private void CheckForNewSessions(string stTime) { //TODO from global variable, from config //int mscOffset = -2; DateTime dt = CASTSConv.ASTSTimeToDateTime(stTime); DateTime dtBegin = GetSessionStartNormalTime(); DateTime dtEnd = GetSessionEndNormalTime(); int tolMs = 2000; if (CUtilTime.IsEqual(dt, dtBegin, tolMs)) { _currSession = new CDBSession { DtBegin = dtBegin, DtEnd = dtEnd, stock_exchange_id = _client.StockExchId }; _lstSessions.Add(_currSession); } CUtil.TaskStart(InsertUnsavedSessions); }
public void Process(CTableRecrd record) { //TODO normal // if (!_client.IsOnlineUserOrderLog) // _client.IsOnlineUserOrderLog = true; _onlineDetector.Update(); //TODO check partial acception! CRawOrdersLogStruct userOrdLogStruct = new CRawOrdersLogStruct() { Id_ord = Convert.ToInt64(record.values["ORDERNO"]), Ext_id = Convert.ToInt16(record.values["EXTREF"]), Dir = Convert.ToChar(record.values["BUYSELL"]) == 'B' ? (sbyte)EnmOrderDir.Buy : (sbyte)EnmOrderDir.Sell, Price = Convert.ToDecimal(record.values["PRICE"]), Amount = Convert.ToInt16(record.values["QUANTITY"]), Instrument = Convert.ToString(record.values["SECCODE"]), Action = (sbyte)CASTSConv.ASTSActionToEnmOrderAction(Convert.ToChar(record.values["STATUS"])), Moment = CASTSConv.ASTSTimeToDateTime(record.values["ORDERTIME"].ToString()) }; EnmBotEventCode evnt = EnmBotEventCode.OnEmptyEvent; if (userOrdLogStruct.Action == (sbyte)EnmOrderAction.Added) { evnt = EnmBotEventCode.OnOrderAccepted; } else if (userOrdLogStruct.Action == (sbyte)EnmOrderAction.Deleted) { evnt = EnmBotEventCode.OnOrderCancel; } else if (userOrdLogStruct.Action == (sbyte)EnmOrderAction.Deal) { evnt = EnmBotEventCode.OnOrderDeal; } _client.TriggerRecalculateBot(userOrdLogStruct.Ext_id, userOrdLogStruct.Instrument, evnt, userOrdLogStruct); //foreach(CBotBase bb in }
protected override void ProcessRecord() { string time = _currentRecord.values["TIME"].ToString(); DateTime dt = CASTSConv.ASTSTimeToDateTime(time); _client.ServerTime = dt; _guiBox.ServerTime = dt; if (!_guiBox.IsServerTimeAvailable) { _guiBox.IsServerTimeAvailable = true; } _client.SetServerTimeAvailable(); base.ProcessRecord(); }