File tree Expand file tree Collapse file tree
investing_algorithm_framework/services/trade_order_evaluator Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import polars as pl
44
55from investing_algorithm_framework .domain import OrderSide , OrderStatus , \
6- Trade , Order
6+ Trade , Order , TradeStatus
77from .trade_order_evaluator import TradeOrderEvaluator
88
99
@@ -36,6 +36,12 @@ def evaluate(
3636
3737 self ._check_has_executed (open_order , data )
3838
39+ # Re-query open trades to include newly created trades
40+ # from filled orders above (#384)
41+ open_trades = self .trade_service .get_all (
42+ {"status" : TradeStatus .OPEN .value }
43+ )
44+
3945 if len (open_trades ) > 0 :
4046 for open_trade in open_trades :
4147 data = ohlcv_data .get (open_trade .symbol )
@@ -54,9 +60,6 @@ def evaluate(
5460
5561 self .trade_service .save_all (open_trades )
5662
57- # Re-query open trades so newly created trades (from filled
58- # orders above) also have updated prices before stop-loss
59- # and take-profit evaluation. Fixes #384.
6063 self ._check_take_profits ()
6164 self ._check_stop_losses ()
6265
You can’t perform that action at this time.
0 commit comments