コード例 #1
0
        public void ReturnsCorrectLeanSymbol(string brokerageSymbol)
        {
            var symbol = _symbolMapper.GetLeanSymbol(brokerageSymbol, SecurityType.Equity, Market.USA);

            Assert.AreEqual(brokerageSymbol, symbol.Value);
            Assert.AreEqual(SecurityType.Equity, symbol.ID.SecurityType);
            Assert.AreEqual(Market.USA, symbol.ID.Market);
        }
コード例 #2
0
        private void OnSubscribe(BitfinexWebSocketWrapper webSocket, ChannelSubscription data)
        {
            try
            {
                lock (_locker)
                {
                    var channel = new Channel(data.Channel, _symbolMapper.GetLeanSymbol(data.Symbol, SecurityType.Crypto, Market.Bitfinex));

                    BitfinexWebSocketChannels channels;
                    if (!_channelsByWebSocket.TryGetValue(webSocket, out channels))
                    {
                        _onSubscribeEvent.Set();
                        return;
                    }

                    channels.TryAdd(data.ChannelId, channel);

                    Log.Trace($"BitfinexSubscriptionManager.OnSubscribe(): Channel subscribed: Id:{data.ChannelId} {channel.Symbol}/{channel.Name}");

                    _onSubscribeEvent.Set();

                    webSocket.ConnectionHandler.EnableMonitoring(true);
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
                throw;
            }
        }
コード例 #3
0
        /// <summary>
        /// Gets the coin API entry data.
        /// </summary>
        /// <param name="file">The source file.</param>
        /// <param name="processingDate">The processing date.</param>
        /// <param name="market">The market/exchange.</param>
        /// <returns></returns>
        public CoinApiEntryData GetCoinApiEntryData(FileInfo file, DateTime processingDate, string market)
        {
            // crypto/<market>/<date>/<ticktype>-563-BITFINEX_SPOT_BTC_USD.csv.gz
            var tickType = file.FullName.Contains("trade") ? TickType.Trade : TickType.Quote;

            var symbolId = Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(file.Name)).Split('-').Last();

            var symbol = _symbolMapper.GetLeanSymbol(symbolId, SecurityType.Crypto, market);

            return(new CoinApiEntryData
            {
                Name = file.Name,
                Symbol = symbol,
                TickType = tickType,
                Date = processingDate
            });
        }