Tim55667757 / TKSBrokerAPI

TKSBrokerAPI is the trading platform for automation and simplifying the implementation of trading scenarios, as well as working with Tinkoff Invest API server via the REST protocol. The TKSBrokerAPI platform may be used in two ways: from the console, it has a rich keys and commands, or you can use it as Python module.
https://tim55667757.github.io/TKSBrokerAPI/
Apache License 2.0
26 stars 9 forks source link

Bug in `Trade()` method: if not "oK" status received then TP/SL orders still opens #66

Closed Tim55667757 closed 1 year ago

Tim55667757 commented 2 years ago

Just run `python scenario1.py' and see logs:

...
scenario1.py        L:108  INFO    [2022-10-28 16:17:40,331] --- Ticker [GOOGL], data analysis...
scenario1.py        L:115  INFO    [2022-10-28 16:17:40,768] Total portfolio cost: 4791.26 rub; blocked: 0.00 rub; changes: +88.88 rub (+1.89%)
scenario1.py        L:125  INFO    [2022-10-28 16:17:40,769] Available funds free for trading: 0.29 eur; 1.42 cny; 1.00 chf; 10.00 try; 0.68 usd; 2.41 hkd; 3346.28 rub
scenario1.py        L:151  INFO    [2022-10-28 16:17:40,861] Ticker [GOOGL]: no current open positions with that instrument, checking opens rules...
scenario1.py        L:174  INFO    [2022-10-28 16:17:40,862] Opening BUY position... (Buyers volumes [1281] >= 1.1 * sellers volumes [687] and current price to buy: [92.56 usd])
TKSBrokerAPI.py     L:2842 WARNING [2022-10-28 16:17:41,329] Not `oK` status received! Market order not created. See full debug log or try again and open order later.
TKSBrokerAPI.py     L:3113 INFO    [2022-10-28 16:17:47,926] Stop-order [********-****-****-****-************] was created: ticker [GOOGL], FIGI [BBG009S39JX6], action [Sell], lots [1], target price [95.34 usd], limit price [95.34 usd], stop-order type [Take profit] and expiration date in UTC [2022-10-28 14:17:40]
...
Tim55667757 commented 1 year ago

fixed since v1.5.*