public ProtoOAOrder CreateOrder(long orderId, long accountId, ProtoOAOrderType orderType, ProtoTradeSide tradeSide, string symbolName, long requestedVolume, long executedVolume, bool closingOrder, string channel = null, string comment=null) { var _obj = new ProtoOAOrder(); _obj.orderId = orderId; _obj.accountId = accountId; _obj.orderType = orderType; _obj.tradeSide = tradeSide; _obj.symbolName = symbolName; _obj.requestedVolume = requestedVolume; _obj.executedVolume = executedVolume; _obj.closingOrder = closingOrder; if (channel != null) _obj.channel = channel; if (comment != null) _obj.comment = comment; return _obj; }
public ProtoMessage CreateExecutionEvent(ProtoOAExecutionType executionType, ProtoOAOrder order, ProtoOAPosition position = null, string reasonCode = null, string clientMsgId = null) { var _msg = new ProtoOAExecutionEvent(); _msg.executionType = executionType; _msg.order = order; if (position != null) _msg.position = position; if (reasonCode != null) _msg.reasonCode = reasonCode; return CreateMessage((uint)_msg.payloadType, Utils.Serialize<ProtoOAExecutionEvent>(_msg), clientMsgId); }
static public string OpenApiOrderToString(ProtoOAOrder order) { var _str = "Order{orderId:" + order.orderId.ToString() + ", accountId:" + order.accountId + ", orderType:" + OpenApiOrderTypeToString(order.orderType); _str += ", tradeSide:" + TradeSideToString(order.tradeSide); _str += ", symbolName:" + order.symbolName + ", requestedVolume:" + order.requestedVolume.ToString() + ", executedVolume:" + order.executedVolume.ToString() + ", closingOrder:" + (order.closingOrder ? "TRUE" : "FALSE") + (order.executionPriceSpecified ? ", executionPrice:" + order.executionPrice.ToString() : "") + (order.limitPriceSpecified ? ", limitPrice:" + order.limitPrice.ToString() : "") + (order.stopPriceSpecified ? ", stopPrice:" + order.stopPrice.ToString() : "") + (order.stopLossPriceSpecified ? ", stopLossPrice:" + order.stopLossPrice.ToString() : "") + (order.takeProfitPriceSpecified ? ", takeProfitPrice:" + order.takeProfitPrice.ToString() : "") + (order.baseSlippagePriceSpecified ? ", baseSlippagePrice:" + order.baseSlippagePrice.ToString() : "") + (order.slippageInPipsSpecified ? ", slippageInPips:" + order.slippageInPips.ToString() : "") + (order.relativeStopLossInPipsSpecified ? ", relativeStopLossInPips:" + order.relativeStopLossInPips.ToString() : "") + (order.relativeTakeProfitInPipsSpecified ? ", relativeTakeProfitInPips:" + order.relativeTakeProfitInPips.ToString() : "") + (order.commissionSpecified ? ", commission:" + order.commission.ToString() : "") + (order.openTimestampSpecified ? ", openTimestamp:" + order.openTimestamp.ToString() : "") + (order.closeTimestampSpecified ? ", closeTimestamp:" + order.closeTimestamp.ToString() : "") + (order.expirationTimestampSpecified ? ", expirationTimestamp:" + order.expirationTimestamp.ToString() : "") + (order.channelSpecified ? ", channel:" + order.channel : "") + (order.commentSpecified ? ", comment:" + order.comment : "") + (order.closePositionDetails != null ? ", " + OpenApiClosePositionDetails(order.closePositionDetails) : ""); return _str + "}"; }