コード例 #1
0
        // Notes:
        //   - API Info:
        //     https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md

        public BinanceApi(string key, string secret, CancellationToken shutdown, Logger log)
            : base(key, secret, shutdown, 6, "https://api.binance.com/", "wss://stream.binance.com:9443/")
        {
            try
            {
                Log         = new Logger("BinanceApi", log);
                SymbolRules = new SymbolRulesMap();
                TickerData  = new TickerDataCache(this);
                MarketData  = new MarketDataCache(this);
                CandleData  = new CandleDataCache(this);
                UserData    = new UserDataCache(this);
            }
            catch
            {
                Dispose();
                throw;
            }
        }
コード例 #2
0
            public TickerStream(TickerDataCache owner)
            {
                try
                {
                    Cache = owner;

                    // Request a snapshot to initialise the ticker data
                    TickerData = Api.GetTicker().Result;
                    TickerData.Sort(x => x.Pair.Id);

                    // Create the socket
                    Socket = new WebSocket(Api.Shutdown);
                }
                catch
                {
                    Dispose();
                    throw;
                }
            }