private EFILLED_STATE register2Vt(string sSymbol, ETRADER_OP nCmd, ref double dLots, ref double dPrice, EORDER_TYPE nOrderType, string sLogicID, string sComment = "", double dLots_exc = 0, double dPrice_exc = 0, DateTime dtTime_exc = default(DateTime)) { if (dLots_exc == 0) { dLots_exc = dLots; } if (dPrice_exc == 0) { dPrice_exc = dPrice; } if (dtTime_exc == default(DateTime)) { dtTime_exc = m_rates[sSymbol].m_dtTime; } if (nCmd == ETRADER_OP.BUY || nCmd == ETRADER_OP.SELL) {//For new order TPosItem posItem = new TPosItem(); posItem.m_dtOpenTime_req = m_rates[sSymbol].m_dtTime; posItem.m_dtOpenTime_exc = dtTime_exc; posItem.m_dOpenPrice_req = dPrice; posItem.m_dOpenPrice_exc = dPrice_exc; posItem.m_dLots_req = dLots; posItem.m_dLots_exc = dLots_exc; posItem.m_nCmd = nCmd; posItem.m_sSymbol = sSymbol; posItem.m_dProfit_vt = 0; posItem.m_sLogicID = sLogicID; posItem.m_sComment = sComment; posItem.m_dContractSize = getContractSize(sSymbol); posItem.m_dCommission_percent = getCommissionPercent(sSymbol); if (sLogicID != "REQ_MERGE") { m_lstPos_vt.Add(posItem); } } if (nCmd == ETRADER_OP.BUY_CLOSE || nCmd == ETRADER_OP.SELL_CLOSE) {//For close order closeOrder(sSymbol, nCmd, dLots, dPrice, nOrderType, sLogicID, sComment, dLots_exc, dPrice_exc, dtTime_exc); } EFILLED_STATE nRet = EFILLED_STATE.PARTIAL; if (Math.Abs(dLots - dLots_exc) < CFATCommon.ESP) { nRet = EFILLED_STATE.FULL; } if (Math.Abs(dLots_exc) < CFATCommon.ESP) { nRet = EFILLED_STATE.FAIL; } return(nRet);// updateRealPositions(); }
public void setVal(ETRADER_OP nCmd, double dLots_req, double dPrice_req, EORDER_TYPE nOrderType, int nPriority, string sLogicID, string sComment) { m_nCmd = nCmd; m_dLots_req = dLots_req; m_dPrice_req = dPrice_req; m_nOrderType = nOrderType; m_nPriority = nPriority; m_sLogicID = sLogicID; m_sComment = sComment; m_dLots_exc = 0; m_nOrderResult = EFILLED_STATE.FAIL; m_dPrice_exc = 0; }
private void setFilledState_subReqOrders(EFILLED_STATE nResult) { foreach (TReqOrder reqOrderItem in m_lstSubReqOrders) { if (nResult == EFILLED_STATE.FULL) { reqOrderItem.m_dLots_exc = reqOrderItem.m_dLots_req; } if (nResult == EFILLED_STATE.FAIL) { reqOrderItem.m_dLots_exc = 0; } reqOrderItem.m_nOrderResult = nResult; reqOrderItem.m_bProcessed = true; } }
public void reqOrder(bool bMustExc) { if (Math.Abs(m_dLots_req) < CFATCommon.ESP) { m_nOrderResult = EFILLED_STATE.FULL; m_dLots_exc = 0; m_bProcessed = true; return; } m_dLots_exc = m_dLots_req; m_dPrice_exc = m_dPrice_req; EFILLED_STATE nRet = m_product.reqOrder(m_nCmd, ref m_dLots_exc, ref m_dPrice_exc, m_nOrderType, m_sComment); m_nOrderResult = nRet; m_bProcessed = true; }
public override EFILLED_STATE reqOrder(string sSymbol, ETRADER_OP nCmd, ref double dLots, ref double dPrice, EORDER_TYPE nOrderType, string sLogicID, string sComment = "", double dLots_exc = 0, double dPrice_exc = 0, DateTime dtTime_exc = default(DateTime)) { EFILLED_STATE nRet = EFILLED_STATE.FULL; ETRADER_OP nCmd_req = nCmd; double dLots_req = dLots; available_lots_cmd(sSymbol, ref nCmd_req, ref dLots_req); if (Math.Abs(dLots_req - dLots) > CFATCommon.ESP) { nRet = EFILLED_STATE.PARTIAL; dLots = dLots_req; } base.reqOrder(sSymbol, nCmd_req, ref dLots_req, ref dPrice, nOrderType, sLogicID, sComment, dLots_req, dPrice, CFATCommon.m_dtCurTime); return(nRet); }