Exemple #1
0
        public void Init()
        {
            if (_telegram != null)
            {
                _telegram.CancellationPending = true;
            }

            if (TgBotToken != null && TgChatId > long.MinValue)
            {
                _telegram = new TelegramManager(TgBotToken, TgChatId)
                {
                    IsEnabled = _tradingVM.IsTelegramEnabled
                }
            }
            ;

            if (TiApiToken == null)
            {
                return;
            }

            PrepareConnection();

            //TradeBot = new SandboxBot(this, _telegram);

            //_broker2 = ConnectionFactory.GetConnection("[token]");
            //_account2 = _broker2.Context;

            //_broker2.StreamingEventReceived += Broker_StreamingEventReceived;

            if (_brokerQueueThread == null)
            {
                _brokerQueueThread = new Thread(BrokerQueueLoop)
                {
                    IsBackground = true,
                    Name         = "BrokerActionQueueLoopThread"
                };
                _brokerQueueThread.Start();
            }
        }
Exemple #2
0
 public SandboxBot(StocksManager broker, TelegramManager telegram)
 {
     _broker   = broker;
     _telegram = telegram;
 }