Class TriangularArbitrage
java.lang.Object
com.quantfinlib.pricing.TriangularArbitrage
Triangular arbitrage checks over three related FX pairs, using dealable
bid/ask quotes (not mids), so a positive result is executable edge before
fees.
Conventions: ab is the price of one unit of A in B, bc
of one B in C, ac of one A in C — e.g. A=EUR, B=USD, C=JPY:
ab=EURUSD, bc=USDJPY, ac=EURJPY.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic doublearbitrageBps(TriangularArbitrage.Quote ab, TriangularArbitrage.Quote bc, TriangularArbitrage.Quote ac) Best executable round-trip edge in basis points (positive = arbitrage): Path 1 — buy A synthetically via B (ab.ask * bc.ask) and sell it directly atac.bid. Path 2 — buy A directly atac.askand sell it via B atab.bid * bc.bid.static booleanexists(TriangularArbitrage.Quote ab, TriangularArbitrage.Quote bc, TriangularArbitrage.Quote ac, double thresholdBps) True when the executable edge exceedsthresholdBps(e.g. costs).static doubleThe no-arbitrage cross rate implied by the two leg mids.
-
Method Details
-
arbitrageBps
public static double arbitrageBps(TriangularArbitrage.Quote ab, TriangularArbitrage.Quote bc, TriangularArbitrage.Quote ac) Best executable round-trip edge in basis points (positive = arbitrage):- Path 1 — buy A synthetically via B (
ab.ask * bc.ask) and sell it directly atac.bid. - Path 2 — buy A directly at
ac.askand sell it via B atab.bid * bc.bid.
- Path 1 — buy A synthetically via B (
-
exists
public static boolean exists(TriangularArbitrage.Quote ab, TriangularArbitrage.Quote bc, TriangularArbitrage.Quote ac, double thresholdBps) True when the executable edge exceedsthresholdBps(e.g. costs). -
impliedCrossMid
The no-arbitrage cross rate implied by the two leg mids.
-