public static SynthOrderBook FromOrderBook(OrderBook orderBook, AssetPair target) { Debug.Assert(orderBook != null); Debug.Assert(target != null); Debug.Assert(target.IsEqualOrInverted(orderBook.AssetPair)); var result = new SynthOrderBook(target, new List <OrderBook> { orderBook }); return(result); }
public static SynthOrderBook FromOrderBooks(OrderBook first, OrderBook second, AssetPair target) { Debug.Assert(first != null); Debug.Assert(first.AssetPair != null); Debug.Assert(second != null); Debug.Assert(second.AssetPair != null); Debug.Assert(target != null); var result = new SynthOrderBook(target, GetOrdered(new List <OrderBook> { first, second }, target)); return(result); }
public Arbitrage(AssetPair assetPair, SynthOrderBook bidSynth, VolumePrice bid, SynthOrderBook askSynth, VolumePrice ask) { Debug.Assert(bidSynth != null); Debug.Assert(askSynth != null); AssetPair = assetPair; BidSynth = bidSynth; AskSynth = askSynth; Bid = bid; Ask = ask; Spread = GetSpread(Bid.Price, Ask.Price); Volume = Ask.Volume < Bid.Volume ? Ask.Volume : Bid.Volume; PnL = GetPnL(Bid.Price, Ask.Price, Volume); ConversionPath = FormatConversionPath(BidSynth.ConversionPath, AskSynth.ConversionPath); StartedAt = DateTime.UtcNow; }