示例#1
0
        /// <summary>
        /// Create the Brokerage instance
        /// </summary>
        /// <param name="job"></param>
        /// <param name="algorithm"></param>
        /// <returns></returns>
        public override IBrokerage CreateBrokerage(Packets.LiveNodePacket job, IAlgorithm algorithm)
        {
            var required = new[] { "bitfinex-rest", "bitfinex-url", "bitfinex-api-secret", "bitfinex-api-key" };

            foreach (var item in required)
            {
                if (string.IsNullOrEmpty(job.BrokerageData[item]))
                {
                    throw new Exception($"BitfinexBrokerageFactory.CreateBrokerage: Missing {item} in config.json");
                }
            }

            var priceProvider = new ApiPriceProvider(job.UserId, job.UserToken);

            var brokerage = new BitfinexBrokerage(
                job.BrokerageData["bitfinex-url"],
                job.BrokerageData["bitfinex-rest"],
                job.BrokerageData["bitfinex-api-key"],
                job.BrokerageData["bitfinex-api-secret"],
                algorithm,
                priceProvider,
                Composer.Instance.GetExportedValueByTypeName <IDataAggregator>(Config.Get("data-aggregator", "QuantConnect.Lean.Engine.DataFeeds.AggregationManager")));

            Composer.Instance.AddPart <IDataQueueHandler>(brokerage);

            return(brokerage);
        }
示例#2
0
        /// <summary>
        /// Create the Brokerage instance
        /// </summary>
        /// <param name="job"></param>
        /// <param name="algorithm"></param>
        /// <returns></returns>
        public override IBrokerage CreateBrokerage(Packets.LiveNodePacket job, IAlgorithm algorithm)
        {
            var required = new[] { "bitfinex-rest", "bitfinex-url", "bitfinex-api-secret", "bitfinex-api-key" };

            foreach (var item in required)
            {
                if (string.IsNullOrEmpty(job.BrokerageData[item]))
                {
                    throw new Exception($"BitfinexBrokerageFactory.CreateBrokerage: Missing {item} in config.json");
                }
            }

            var priceProvider = new ApiPriceProvider(job.UserId, job.UserToken);

            var brokerage = new BitfinexBrokerage(
                job.BrokerageData["bitfinex-url"],
                job.BrokerageData["bitfinex-rest"],
                job.BrokerageData["bitfinex-api-key"],
                job.BrokerageData["bitfinex-api-secret"],
                algorithm,
                priceProvider);

            Composer.Instance.AddPart <IDataQueueHandler>(brokerage);

            return(brokerage);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BitfinexSubscriptionManager"/> class.
 /// </summary>
 public BitfinexSubscriptionManager(BitfinexBrokerage brokerage, string wssUrl, ISymbolMapper symbolMapper)
 {
     _brokerage    = brokerage;
     _wssUrl       = wssUrl;
     _symbolMapper = symbolMapper;
 }