jtbandes / Arbitrage / 0.1.0

Detects arbitrage opportunities in a directed, complete graph of currency conversions.

Currency conversions are specified in a square matrix of edge weights. All conversion rates must be strictly positive; numbers on the diagonal are expected to be exactly 1.

The output is a list of arbitrage opportunities, represented as lists of indices into the input matrix.

The returned cycles will not overlap, but some cycles may be missed; currently, there is no guarantee that the opportunities returned are the best possible. For details, see also jtbandes/NegativeWeightCycles.