Day10 - 如何查询委托单状态

又到了每天把玩Python API的时间了,还记得Day8的文章吗? 我们对於下单的状态讯息做了示范与说明。今天来谈查询委托单,查询动作对交易很重要,不过其实程序很简易。

登入状态下,可以用下列指令查询:

api.update_status()
api.list_trades()

例如下列有跑出两笔结果,显示交易状态是删单:

[
    Trade(
        contract=Contract(security_type=<SecurityType.Future: 'FUT'>, exchange=<Exchange.TAIFEX: 'TAIFEX'>, code='TXFA1'), 
        order=Order(action=<Action.Buy: 'Buy'>, price=13770.0, quantity=1, id='63f8f2c9', seqno='896206', ordno='ky007', account=Account(account_type=<AccountType.Future: 'F'>, person_id='PAPIUSER06', broker_id='F002000', account_id='9102620', signed=True), price_type=<StockPriceType.LMT: 'LMT'>, order_type=<FuturesOrderType.ROD: 'ROD'>, octype=<FuturesOCType.New: 'New'>), 
        status=OrderStatus(id='63f8f2c9', ==status=<Status.Cancelled: 'Cancelled'>==, status_code='0000', order_datetime=datetime.datetime(2020, 12, 2, 11, 1, 48), modified_price=13770.0, cancel_quantity=1, deals=[])
    ), 
    Trade(
        contract=Contract(security_type=<SecurityType.Future: 'FUT'>, exchange=<Exchange.TAIFEX: 'TAIFEX'>, code='TXFA1'), 
        order=Order(action=<Action.Buy: 'Buy'>, price=13770.0, quantity=1, id='7808d809', seqno='896208', ordno='ky008', account=Account(account_type=<AccountType.Future: 'F'>, person_id='PAPIUSER06', broker_id='F002000', account_id='9102620', signed=True), price_type=<StockPriceType.LMT: 'LMT'>, order_type=<FuturesOrderType.ROD: 'ROD'>, octype=<FuturesOCType.New: 'New'>), 
        status=OrderStatus(id='7808d809', ==status=<Status.Cancelled: 'Cancelled'>==, status_code='0000', order_datetime=datetime.datetime(2020, 12, 2, 11, 2, 17), modified_price=13770.0, cancel_quantity=1, deals=[])
    )
]

以上就是今天的查询指令分享,我们明天见!


<<:  npm

>>:  用React刻自己的投资Dashboard Day10 - 用useCallback hook帮你记住函式

【在 iOS 开发路上的大小事-Day04】透过 Segue 来传值

前情提要 一般我们在做传值动作的时候,会有好几种方式可以做,像是用 Segue、Closure、De...

[Day23] Infrastructure as code

昨天介绍的 Deployment Manager 可以透过 GUI 与 Command Line 的...

Day28 黯然消魂饭-自制蜜汁叉烧

经典的粤式烧腊的主角之一-叉烧,是许多人喜爱的烧腊之一 这次自制叉烧酱腌了2-3天的叉烧肉,搭配烤...

【Day 28】设置开发环境 & 开发

tags: 铁人赛 蚵仔面线 萝卜丝饼 开发环境 env virtualenv 美食与废言 前阵子常...

Day 9 Self-attention(三) input相关联性计算

Self-attention 首先先把a1乘上Wq,就会得到q1,q的意思是query,也就是查询的...