如何获得撤单被拒绝的信息?
使用保留字(Reserve Word)不能获得撤单被拒绝的信息提示。 国信OrderTicket发送委托后获得该Order对象,可以通过Order.Cancel()方法撤单,如果撤单被拒绝,那么会触发orderUpdated事件,但是Order的State不会变化,可以通过查看order.StateDetail 查看是否撤单失败。
示例1:使用OrderUpdatedEventArgs 获得撤单被拒绝的提示
using guosen;
using elsystem;
using tsdata.common;
using tsdata.marketdata;
vars:
guosen.OrderTicket otk1(null),
guosen.Order ord(null),
string accID("410038122059");
method void AnalysisTechnique_Initialized( elsystem.Object sender, elsystem.InitializedEventArgs args )
begin
otk1 = new guosen.OrderTicket;
otk1.Symbol = "000002.SZ";
otk1.Quantity = 12100;
otk1.Account = accID;
otk1.Action = OrderAction.Buy;
otk1.SymbolType = tsdata.common.SecurityType.Stock;
otk1.Type = tsdata.trading.OrderType.Limit;
otk1.Duration="GFD";
otk1.LimitPrice = 26.28;
ord = otk1.Send();//发单
ord.Updated += ord_Updated;
ord.Cancel();//撤单
end;
Method void ord_Updated(elsystem.Object sender,guosen.OrderUpdatedEventArgs args)
Begin
print(DateTime.Now.ToString()+ "," +
args.OrderID.ToString()+","+
args.State.ToString()+","+
args.Order.StateDetail.ToString()+","+
args.Message);
End;