Beispiel #1
0
        private void M_systemConfigManager_OnSystemSettingChanged1()
        {
            try
            {
                List <AutoTrader> traderList = null;
                lock (m_syncObj)
                {
                    traderList = m_autoTraderDic.Values.ToList();
                }

                if (traderList != null && traderList.Count > 0)
                {
                    TaskOrderSetting taskOrderSetting = m_systemConfigManager.GetTaskOrderSetting();

                    foreach (AutoTrader trader in traderList)
                    {
                        trader.SetTryOrderCondition(taskOrderSetting.TaskMaxTryCount, taskOrderSetting.TryOrderMinInterval);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Assert(false, ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 初始化。
        /// </summary>
        /// <param name="arbitrageOrderList">套利单信息。</param>
        /// <param name="orderDriver">交易驱动。</param>
        /// <param name="quoteDriver">行情驱动。</param>
        /// <param name="alarmManager">预警管理类。</param>
        /// <param name="systemConfigManager">系统配置管理类。</param>
        public void Initialize(List <USeArbitrageOrder> arbitrageOrderList, USeOrderDriver orderDriver, USeQuoteDriver quoteDriver, AlarmManager alarmManager, SystemConfigManager systemConfigManager)
        {
            m_orderDriver         = orderDriver;
            m_quoteDriver         = quoteDriver;
            m_alarmManager        = alarmManager;
            m_systemConfigManager = systemConfigManager;

            m_systemConfigManager.OnSystemSettingChanged += M_systemConfigManager_OnSystemSettingChanged1;

            if (arbitrageOrderList == null || arbitrageOrderList.Count <= 0)
            {
                return;
            }

            lock (m_syncObj)
            {
                int maxAliasNum = 0;  // 当日别名最大号码

                TaskOrderSetting taskOrderSetting = m_systemConfigManager.GetTaskOrderSetting();
                foreach (USeArbitrageOrder arbitrageOrder in arbitrageOrderList)
                {
                    AutoTrader autoTrader = new AutoTrader();
                    autoTrader.SetRecordLogger(USeManager.Instance.CommandLogger);
                    autoTrader.SetTryOrderCondition(taskOrderSetting.TaskMaxTryCount, taskOrderSetting.TryOrderMinInterval);
                    autoTrader.Initialize(arbitrageOrder, m_orderDriver, m_quoteDriver, m_alarmManager);
                    autoTrader.OnNotify                += AutoTrader_OnNotify;
                    autoTrader.OnAlarm                 += AutoTrader_OnAlarm;
                    autoTrader.OnStateChanged          += AutoTrader_OnStateChanged;
                    autoTrader.OnArbitrageOrderChanged += AutoTrader_OnArbitrageOrderChanged;
                    m_autoTraderDic.Add(autoTrader.TraderIdentify, autoTrader);

                    if (arbitrageOrder.CreateTime.Date == DateTime.Today && arbitrageOrder.AliasNum > maxAliasNum)
                    {
                        maxAliasNum = arbitrageOrder.AliasNum;
                    }
                }

                m_aliasIdCrateor.Set(maxAliasNum);
            }
        }