本文整理汇总了C#中SingleOrder类的典型用法代码示例。如果您正苦于以下问题:C# SingleOrder类的具体用法?C# SingleOrder怎么用?C# SingleOrder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SingleOrder类属于命名空间,在下文中一共展示了SingleOrder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OrderRecord
// Methods
public OrderRecord(SingleOrder order)
{
this.order = order;
this.avgPx = 0.0;
this.leavesQty = (int)order.OrderQty;
this.cumQty = 0;
}
示例2: Cancel
private void Cancel(SingleOrder order)
{
if (!_bTdConnected)
{
EmitError(-1, -1, "交易服务器没有连接,无法撤单");
tdlog.Error("交易服务器没有连接,无法撤单");
return;
}
Dictionary<string, CZQThostFtdcOrderField> _Ref2Action;
if (_Orders4Cancel.TryGetValue(order, out _Ref2Action))
{
// 标记下正在撤单
_PendingCancelFlags[order] = order.OrdStatus;
lock (_Ref2Action)
{
CZQThostFtdcOrderField __Order;
foreach (CZQThostFtdcOrderField _Order in _Ref2Action.Values)
{
__Order = _Order;
//这地方要是过滤下就好了
TraderApi.TD_CancelOrder(m_pTdApi, ref __Order);
}
}
}
}
示例3: Cancel
private void Cancel(SingleOrder order)
{
if (order == null)
return;
if (!_bTdConnected)
{
EmitError(-1, -1, "交易服务器没有连接,无法撤单");
tdlog.Error("交易服务器没有连接,无法撤单");
return;
}
DFITCOrderRspDataRtnField pOrderRtn;
if (_Orders4Cancel.TryGetValue(order, out pOrderRtn))
{
Instrument inst = InstrumentManager.Instruments[order.Symbol];
string altSymbol = inst.GetSymbol(Name);
int localOrderID = pOrderRtn.localOrderID;
int spdOrderID = pOrderRtn.spdOrderID;
if (spdOrderID >= 0)
{
localOrderID = -1;
}
else
{
spdOrderID = -1;
}
TraderApi.TD_CancelOrder(m_pTdApi, altSymbol, localOrderID, spdOrderID);
}
}
示例4: Cancel
private void Cancel(SingleOrder order)
{
if (null == order)
return;
if (!_bTdConnected)
{
EmitError(-1, -1, "交易服务器没有连接,无法撤单");
tdlog.Error("交易服务器没有连接,无法撤单");
return;
}
GenericOrderItem item;
if(orderMap.TryGetValue(order,out item))
{
CThostFtdcOrderField _order;
if (orderMap.TryGetValue(item, out _order))
{
// 标记下正在撤单
orderMap.Order_OrdStatus[order] = order.OrdStatus;
EmitExecutionReport(order, OrdStatus.PendingCancel);
TraderApi.TD_CancelOrder(m_pTdApi, ref _order);
}
}
}
示例5: Add
public override void Add(SingleOrder order, TextCommon t)
{
if (Index >= GetLegNum())
return;
Leg[Index] = new MultiOrderLeg { Order = order, OpenClose = t.OpenClose };
++Index;
}
示例6: Add
public override void Add(SingleOrder order, TextCommon t)
{
if (order.Side == Side.Buy)
{
Buy = new MultiOrderLeg() { Order = order, OpenClose = t.OpenClose };
}
else
{
Sell = new MultiOrderLeg() { Order = order, OpenClose = t.OpenClose };
}
}
示例7: Add
public SPOrderItem Add(SingleOrder order, TextSP t)
{
if (item == null || item.IsDone())
{
item = new SPOrderItem(t);
}
item.Add(order, t);
if (item.IsDone())
{
return item;
}
return null;
}
示例8: Add
public CommonOrderItem Add(SingleOrder order, TextRequest t)
{
if(item == null || item.IsDone())
{
item = new CommonOrderItem();
}
item.Add(order, t);
if (item.IsDone())
{
return item;
}
return null;
}
示例9: OnTrade
public bool OnTrade(ref SingleOrder order, ref CThostFtdcTradeField pTrade, ref double Price, ref int Volume)
{
#if CTP
//先保存到两个队例,排序是为了配对
if (TThostFtdcDirectionType.Buy == pTrade.Direction)
{
qBuy.Add(pTrade);
qBuy.Sort(SortCThostFtdcTradeField);
}
else
{
qSell.Add(pTrade);
qSell.Sort(SortCThostFtdcTradeField);
}
//取已经配对好的
if (qBuy.Count > 0 && qSell.Count > 0)
{
// 有网友说可能成交时不成对,这地方是否改动一下
if (qBuy[0].Volume == qSell[0].Volume)//如果不等就有问题了
{
Volume = qBuy[0].Volume;
if (order.Side == Side.Buy)
{
Price = qBuy[0].Price - qSell[0].Price;
}
else
{
Price = qSell[0].Price - qBuy[0].Price;
}
//用完就清除
qBuy.RemoveAt(0);
qSell.RemoveAt(0);
return true;
}
}
#endif
return false;
}
示例10: OnTrade
public bool OnTrade(ref SingleOrder order, ref CZQThostFtdcTradeField pTrade, ref double Price, ref int Volume)
{
//先保存到两个队例,排序是为了配对
//if (TZQThostFtdcDirectionType.Buy == pTrade.Direction)
//{
// qBuy.Add(pTrade);
// qBuy.Sort(SortCZQThostFtdcTradeField);
//}
//else
//{
// qSell.Add(pTrade);
// qSell.Sort(SortCZQThostFtdcTradeField);
//}
////取已经配对好的
//if (qBuy.Count > 0 && qSell.Count > 0)
//{
// if (qBuy[0].Volume == qSell[0].Volume)//如果不等就有问题了
// {
// Volume = qBuy[0].Volume;
// if (order.Side == Side.Buy)
// {
// Price = qBuy[0].Price - qSell[0].Price;
// }
// else
// {
// Price = qSell[0].Price - qBuy[0].Price;
// }
// //用完就清除
// qBuy.RemoveAt(0);
// qSell.RemoveAt(0);
// return true;
// }
//}
return false;
}
示例11: EmitCancelled
protected void EmitCancelled(SingleOrder order)
{
EmitExecutionReport(order, OrdStatus.Cancelled);
}
示例12: EmitAccepted
protected void EmitAccepted(SingleOrder order)
{
EmitExecutionReport(order, OrdStatus.New);
}
示例13: Cancel
private void Cancel(SingleOrder order)
{
if (!_bTdConnected)
{
EmitError(-1,-1,"交易服务器没有连接,无法撤单");
return;
}
Dictionary<string, CThostFtdcOrderField> _Ref2Action;
if (_Orders4Cancel.TryGetValue(order, out _Ref2Action))
{
lock (_Ref2Action)
{
CThostFtdcOrderField __Order;
foreach (CThostFtdcOrderField _Order in _Ref2Action.Values)
{
__Order = _Order;
//这地方要是过滤下就好了
TraderApi.TD_CancelOrder(m_pTdApi, ref __Order);
}
}
}
}
示例14: EmitFilled
protected void EmitFilled(SingleOrder order, double price, int quantity, CommType commType, double commission)
{
EmitExecutionReport(order, price, quantity, commType, commission);
}
示例15: EmitCancelReject
protected void EmitCancelReject(SingleOrder order, OrdStatus status, string message)
{
OrderCancelReject reject = new OrderCancelReject
{
TransactTime = Clock.Now,
ClOrdID = order.ClOrdID,
OrigClOrdID = order.ClOrdID,
OrderID = order.OrderID,
CxlRejReason = CxlRejReason.BrokerOption,
CxlRejResponseTo = CxlRejResponseTo.CancelRequest,
OrdStatus = status
};
EmitOrderCancelReject(reject);
}