tdaapi尾部停止在放置时失败

2024-05-29 10:43:24 发布

您现在位置:Python中文网/ 问答频道 /正文

总结: 当我从TDAAPI在python中放置一个拖尾停止顺序时,它给出了错误

"error": "trailingStopMethod is required when orderType is Trailing Stop."

当我创建一个保存的订单(通过将place\u order更改为create\u saved\u order)并手动放置它时,没有任何问题。从下面的调用中,我相信我通过执行set_stop_price_link_type(StopPriceLinkType.VALUE)来指定trailingstop方法,以指定我正在执行值偏移。以下是订购规格

from tda.orders.common import OrderType, StopPriceLinkType
from tda.orders.common import Duration, Session

trailStopResponse = client.place_order(config.account_id,
                            equity_sell_market(symbol,qty)
                            .set_duration(Duration.DAY)
                            .set_session(Session.NORMAL)
                            .set_order_type(OrderType.TRAILING_STOP)
                            .set_stop_price_offset(atrValFifteen/3) #trailing the market with our ATR val
                            .set_stop_price_link_type(StopPriceLinkType.VALUE) #-> means we're supplying a price as a stop value
                            .build()
                )

让我知道我错过了什么,使这个电话工作时,由自己放置


Tags: fromimportisvaluetypelinkorderplace

热门问题