Esempio n. 1
0
        // **********************************************************************

        public bool Attach(ITrader trader)
        {
            if (this.trader != trader)
            {
                this.trader.Deactivate();

                this.trader.TraderReplyHandler -= TraderReplyHandler;
                this.trader.OrderUpdateHandler -= OrderUpdateHandler;
                this.trader.OwnTradeHandler    -= OwnTradeHandler;

                //MktProvider.Log.Put("Присоединение TradeManager к " + trader.Name);

                this.trader = trader;

                trader.TraderReplyHandler += TraderReplyHandler;
                trader.OrderUpdateHandler += OrderUpdateHandler;
                trader.OwnTradeHandler    += OwnTradeHandler;

                trader.Activate(cfg.u.SecCode, cfg.u.ClassCode);

                return(true);
            }
            else
            {
                return(trader.Activate(cfg.u.SecCode, cfg.u.ClassCode));
            }
        }