private static decimal GetRate(BestPrices bestPrices, bool bid, bool invert) { var needBid = invert ? !bid : bid; var nonInverted = needBid ? bestPrices.BestBid : bestPrices.BestAsk; return(invert ? 1 / nonInverted : nonInverted); }
private static decimal GetCrossRate(BestPrices bba1, BestPrices bba2, CrossRateCalcInfo info, bool bid) { var first = GetRate(bba1, bid, !info.Source1.IsTransitoryAssetQuoting); var second = GetRate(bba2, bid, info.Source2.IsTransitoryAssetQuoting); return(first * second); }
private ExtPriceStatusModel Convert(string assetPairId, string exchangeName, ExchangeQuality exchangeQuality, bool isPrimary, BestPrices bestPrice) { var model = _convertService.Convert <ExchangeQuality, ExtPriceStatusModel>(exchangeQuality, o => o.ConfigureMap(MemberList.Source)); model.AssetPairId = assetPairId; model.ExchangeName = exchangeName; model.IsPrimary = isPrimary; model.ErrorState = model.ErrorState ?? "NoOrderbook"; model.BestPrices = _convertService.Convert <BestPrices, BestPricesModel>(bestPrice); return(model); }