Ejemplo n.º 1
0
        public TradeEventArgs(BitstampTrade data, string channel) : this()
        {
            TradeId       = data.Id.ToString();
            Quantity      = data.Amount;
            Price         = data.Price;
            TradeType     = data.TradeType;
            BuyerOrderId  = data.BuyerOrderId.ToString();
            SellerOrderId = data.SellerOrderId.ToString();
            Timestamp     = StartTime.AddSeconds(data.Timestamp);
            Exchange      = ExchangeName.Bitstamp;

            string pair = "btcusd";
            int    len  = "live_trades".Length;
            string s1   = channel.Substring(len, channel.Length - len);

            if (s1.StartsWith("_"))
            {
                pair = s1.Substring(1, s1.Length - 1);
            }

            var symbol = OrderBookEventArgs.ParseSymbol(pair);

            Instrument1 = symbol[0];
            Instrument2 = symbol[1];
        }
Ejemplo n.º 2
0
        public ExchangePricesEventArgs(HitBtcOrderBook orderBook) : this()
        {
            var instruments = OrderBookEventArgs.ParseSymbol(orderBook.Params.Symbol);

            Instrument1 = instruments[0];
            Instrument2 = instruments[1];
            Exchange    = ExchangeName.HitBtc;
            OrderBook   = new OrderBookEventArgs(orderBook).OrderBook;
        }
Ejemplo n.º 3
0
        public ExchangePricesEventArgs(OkExOrderBook orderBook, string channel) : this()
        {
            var instruments = OkExTrade.ParseInstruments(channel, "_depth_");

            Instrument1 = instruments[0];
            Instrument2 = instruments[1];
            Exchange    = ExchangeName.OkEx;
            OrderBook   = new OrderBookEventArgs(orderBook).OrderBook;
        }
Ejemplo n.º 4
0
        public ExchangePricesEventArgs(BinanceOrderBook orderBook) : this()
        {
            var pair   = orderBook.Stream.Split('@')[0];
            var symbol = OrderBookEventArgs.ParseSymbol(pair);

            Instrument1 = symbol[0];
            Instrument2 = symbol[1];
            Exchange    = ExchangeName.Binance;
            OrderBook   = new OrderBookEventArgs(orderBook).OrderBook;
        }
Ejemplo n.º 5
0
        public TickerEventArgs(BinanceTicker ticker) : this()
        {
            var data   = ticker.Data;
            var symbol = OrderBookEventArgs.ParseSymbol(data.Symbol);

            BinanceTicker = data;
            Instrument1   = symbol[0];
            Instrument2   = symbol[1];
            OpenTime      = StartTime.AddMilliseconds(data.OpenTimeStatistics);
            CloseTime     = StartTime.AddMilliseconds(data.CloseTimeStatistics);
            Exchange      = ExchangeName.Binance;
        }
Ejemplo n.º 6
0
        public ExchangePricesEventArgs(OrderBookEventArgs e, CurrencyName ins1, ExchangeName ex = ExchangeName.Bitstamp, CurrencyName ins2 = CurrencyName.USD) : this()

        {
            Instrument1    = ins1;
            Instrument2    = ins2;
            OrderBook      = e.OrderBook;
            Exchange       = ex;
            OrderId        = e.OrderId;
            Timestamp      = e.Timestamp;
            IsOrderDeleted = e.IsOrderDeleted;
            MicroTimestamp = e.MicroTimestamp;
        }
Ejemplo n.º 7
0
        public TradeEventArgs(BinanceOrderBook orderBook) : this()
        {
            var data   = orderBook.Data;
            var pair   = orderBook.Stream.Split('@')[0];
            var symbol = OrderBookEventArgs.ParseSymbol(pair);

            Quantity           = data.Amount;
            Price              = data.Price;
            Instrument1        = symbol[0];
            Instrument2        = symbol[1];
            BuyerOrderId       = data.BuyerOrderId;
            SellerOrderId      = data.SellerOrderId;
            CreatedAt          = StartTime.AddMilliseconds(data.EventTime);
            Timestamp          = StartTime.AddMilliseconds(data.TradeTime);
            Exchange           = ExchangeName.Binance;
            TradeId            = data.TradeId;
            IsBuyerMarketMaker = data.IsBuyerMarketMaker;
        }