放置时 tda-api 追踪止损失败

时间:2021-04-09 17:57:39

标签: python algorithmic-trading

总结: 当我从 tda-api 在 python 中放置追踪止损订单时,它给出了错误

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

当我创建一个已保存订单(通过将 place_order 更改为 create_saved_order)并手动放置时,没有任何问题。从下面的调用中,我相信我通过执行 set_stop_price_link_type(StopPriceLinkType.VALUE) 指定了 trailingStopMethod 来指定我正在执行值偏移。以下是订单规格

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()
                )

让我知道我缺少什么才能让这个电话在单独发出时起作用。

0 个答案:

没有答案