如何获取委托的成交状态?

使用OrderTicket发送委托之后,会返回一个Order对象,那么通过Order.State可以获得最新的委托单的状态。Order的状态变化会触发Order Updated Event事件,示例如下所示。当需要处理的Order较多时,可以使用OrdersProvider。

示例1:使用Order获得涨停价或跌停价

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 = 100;
    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;
end;

Method void ord_Updated(elsystem.Object sender,guosen.OrderUpdatedEventArgs args)
Begin
    print(DateTime.Now.ToString()+ "," +args.OrderID.ToString()+","+args.State.ToString());
End;

//打印语句输出栏结果示例:
//2016/12/1 11:23:31,,sending
//2016/12/1 11:23:31,0-_410-0381-2205-9_20-1612-01_1-0397-1351,queued
//2016/12/1 11:23:31,0-_410-0381-2205-9_20-1612-01_1-0397-1351,received
//2016/12/1 11:23:31,0-_410-0381-2205-9_20-1612-01_1-0397-1351,partiallyfilled
//2016/12/1 11:23:31,0-_410-0381-2205-9_20-1612-01_1-0397-1351,filled
Copyright © 1998-2018 国信证券股份有限公司 版权所有发布时间: 2018-05-14 14:58:15

results matching ""

    No results matching ""