Exemplo n.º 1
0
        private IObservable <TickPrice> GetCrossTicks(
            IObservable <TickPrice> lykkeTickPrices,
            OrderbookGenerationSettings settings)
        {
            var direct  = $"{settings.BaseFiat}{settings.ExpectedFiat}";
            var reverse = $"{settings.ExpectedFiat}{settings.BaseFiat}";

            return
                (Observable.Merge(

                     lykkeTickPrices
                     .Where(x => string.Equals(x.Asset, direct, StringComparison.InvariantCultureIgnoreCase)),

                     lykkeTickPrices
                     .Where(x => string.Equals(x.Asset, reverse, StringComparison.InvariantCultureIgnoreCase))
                     .Select(x => Reverse(x, direct))));
        }
Exemplo n.º 2
0
        private IObservable <OrderBook> GetSyntheticOrderBooks(
            IObservable <TickPrice> lykkeTickPrices,
            IObservable <OrderBook> bitstampOrderbooks,
            OrderbookGenerationSettings orderbookGeneration)
        {
            var crossTicks = GetCrossTicks(lykkeTickPrices, orderbookGeneration);

            var sourceBooks = bitstampOrderbooks.Where(x =>
                                                       string.Equals(
                                                           x.Asset,
                                                           $"{orderbookGeneration.Crypto}{orderbookGeneration.BaseFiat}",
                                                           StringComparison.InvariantCultureIgnoreCase));

            return(Observable.CombineLatest(
                       crossTicks,
                       sourceBooks,
                       (t, b) => CreateSyntheticOrderBook(
                           t,
                           b,
                           $"{orderbookGeneration.Crypto}{orderbookGeneration.ExpectedFiat}",
                           GetSyntheticSourceName($"{orderbookGeneration.Crypto}{orderbookGeneration.BaseFiat}"),
                           orderbookGeneration.Decimals)));
        }