private string GetSixCharTime(CTableRecrd record) { string rowTime = record.values["TIME"].ToString(); if (rowTime.Length == 5) { rowTime = "0" + rowTime; } return(rowTime); }
private string FormatTime(CTableRecrd record) { string rowTime = GetSixCharTime(record); string formatedTime = rowTime.Substring(0, 2) + ":" + rowTime.Substring(2, 2) + ":" + rowTime.Substring(4, 2);; return(formatedTime); }
private string GetKeyValue(CTableRecrd record, string fieldName) { string st = fieldName; object obj = record.values[fieldName]; if (obj != null) { st += "=" + obj.ToString(); } st += "; "; return(st); }
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 }
public void OnUppdateTradeEvent(CTableRecrd record) { string eventType = record.values["TYPE"].ToString(); char status = Convert.ToChar(record.values["STATUS"]); string statusStr = _dictTimeStatus[status]; string stTime = GetSixCharTime(record); string eventDesc = ""; if (_dicTymeTypesDesc.TryGetValue(eventType, out eventDesc)) { string msg = String.Format("{0} {1} {2} {3} {4} {5}", FormatTime(record), GetKeyValue(record, "MARKETID"), GetKeyValue(record, "BOARDID"), GetKeyValue(record, "SECCODE"), "[" + statusStr + "]", eventDesc); Log(msg); var instrumentRec = record.values["SECCODE"]; //process here only COMMON events if (instrumentRec == null) { UpdateSessionEvent(record, eventType, eventDesc, status, statusStr); ProcessCompleteEventsCommon(stTime, eventDesc, statusStr); } //process here instrument specific (mostly for currency else { ProcessEventsForInstrument(instrumentRec.ToString(), eventDesc, statusStr); } } else { Error("Unknown tradeevent " + eventType); } }
private void UpdateSessionEvent(CTableRecrd record, string eventType, string eventDesc, char status, string statusStr) { CSessionEventASTS evnt = new CSessionEventASTS { StTime = GetSixCharTime(record), EventType = eventType, EventDesc = eventDesc, Status = status, StatusStr = statusStr }; if (statusStr == LSessionStatus.Actual) { _eventsFuture.Add(evnt); } else if (statusStr == LSessionStatus.Complete) { _eventsPast.Add(evnt); } }