Currency Arbitrage

Back to General discussions forum

CSFPython     2023-03-21 23:40:56

I spotted the e-mail and took a quick look at the problem before going to bed. I foolishly decided to code it and submit the solution.

There may be a problem but it could just be me being too tired to spot something obvious.

Just in case there is a problem, this is what happened. My program found a very short loop WNE JYC WNE rather than the significantly longer loop that I was expecting. I checked the data and found the following two lines:

WNE JYC 0.34233321073854 JYC WNE 3.3205509429651

Multiplying the exchange rates gives 1.13673486573 which appears to be a significant profit. The problem setter informs me that I am left with only 87% of what I invested.

Please excuse me if I have made a mistake. I'm clearly too tired to spot it and am going to bed!

gardengnome     2023-03-22 02:19:09
User avatar

Thanks, interesting problem. But I agree, somewhere seems to be a little bug.

  • My proposed solution: XEN XYP OQX OWG XEN
  • Verdict: No exchange from OQX to OWG
  • Yet there it is in the input data: OQX OWG 5.8099378802659
Rodion (admin)     2023-03-22 05:18:05
User avatar

Good Morning, Friends! Sorry for confusion, there seem to be two issues - by now hopefully improved:

  • the rate in the data provided by generator was inverse from what statement meant (or vice versa - for now the code was updated, not the statement)
  • names of currencies may have clashes

Thanks a lot for provided examples. Please kindly retry.

gardengnome     2023-03-22 06:21:56
User avatar

Worked in my two attempts, thank you very much!

gardengnome     2023-03-22 16:00:39
User avatar

Also: You've got mail.

CSFPython     2023-03-22 16:23:43

Thanks for correcting the problem. If I hadn't been so tired last night I would have realised that the exchange rates given were the inverse of the ones in the problem description. It was a really nice problem. Thanks!

Please login and solve 5 problems to be able to post at forum