public void Update(string instrument, decimal price, char buySell, int amount, long extId, long tradeNo, string tradeDate, string tradeTime, long micosecs, decimal fee) { //CBotPos botPos = new CBotPos { Instrument = instrument, _onlineDetector.Update(); DateTime moment = CASTSConv.ASTSDateAndTimeToDateAndTime(tradeDate, tradeTime); int milisec = Convert.ToInt16((double)micosecs / 1000); moment = moment.AddMilliseconds(milisec); CRawUserDeal rd = new CRawUserDeal { Instrument = instrument, Amount = amount, Dir = (sbyte)(buySell == 'B' ? OrderDirection.Buy : OrderDirection.Sell), Ext_id_buy = buySell == 'B' ? extId : 0, Ext_id_sell = buySell == 'S' ? extId : 0, Price = price, ReplId = tradeNo, Moment = moment, Fee_buy = buySell == 'B' ? fee : 0, Fee_sell = buySell == 'S' ? fee : 0 }; //TODO chek if we already processed deal CalculateBotsPos(rd, isOnlineASTSCalc: true); UserDealsPosBoxClient.UpdateGUIDealCollection(rd); }
public void Update(string instrument, long plannedCovered, decimal debit, decimal credit) { _onlineDetector.Update(); //need only instruments, not money //TODO: maybe something inteli in the future if (instrument == "SUR" || instrument == "RUB") { return; } long lotSize = _instruments.GetLotSize(instrument); if (lotSize == 0) { Error("CPosistionsBoxASTS.Update lotsize==0"); return; } DictPos[instrument].Pos = (int)(plannedCovered / lotSize); DictPos[instrument].PosGUI = DictPos[instrument].Pos; //need for Supervisor, so deprecated /* * CRawPosition rawPos = new CRawPosition(); * * rawPos.Pos = DictPos[instrument].Pos; * rawPos.PosGUI = DictPos[instrument].Pos; * * * _guiBox.ExecuteWindowsUpdate(new Action * ( * () => * _guiBox.UpdatePos(instrument,rawPos) * ) * ); */ UpdateTrdMgrTotalPos(); }
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 }