Let say my algorithm tells me to get the following positions through opening fx positions:


GBP 236.96379

USD -310.58000

CHF 0.02000

There are 2 ways to achieve this:

  1. Long 1000 GBP/USD, Long 1000 USD/CHF and Long 1000 CHF/GBP given the rates are 1.310580(GBPUSD),0.999980(USDCHF) and 0.763036(CHFGBP)
  2. Long 236.96379 GBP/USD and Short 0.02 USDCHF. same rates.

So I replicated the same pl but the first option uses more capital and positions meanwhile the second one is optimal.

I want to develop an optimization that tries to satisfy my required currency positions by using as little forex pairs as possible and minimize the absolute value of exposure as well. I read that Bellman-Ford equations can be helpful in finding the shortest possible way but most of the examples try to find a triangular arbitrage instead of the optimization I am after. Are there any examples out there that I can use or any resource, an idea will be helpful.


1 Answer 1


if you form a transform matrix from the input to the output currency position. This will be a problem to solve linear equations。the matrix condition number is very big. actually one eigen value is almost zero. so you solution has one degree of freedom. you can add additonal constrain to solve it like minimal trading position


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.