File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
investing_bot_framework/core/states/templates Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ from typing import List
2+
3+ from investing_bot_framework .core .states import BotState
4+ from investing_bot_framework .core .exceptions import OperationalException
5+ from investing_bot_framework .core .order_executors import OrderExecutor
6+
7+
8+ class OrderingState (BotState ):
9+
10+ from investing_bot_framework .core .states .templates .data_providing_state import DataProvidingState
11+ transition_state_class = DataProvidingState
12+
13+ order_executors : List [OrderExecutor ] = None
14+
15+ def __init__ (self , context ) -> None :
16+ super (OrderingState , self ).__init__ (context )
17+
18+ if self .order_executors is None or len (self .order_executors ) < 1 :
19+ raise OperationalException ("OrderingState state has not any order executors configured" )
20+
21+ def run (self ) -> None :
22+
23+ for order_executor in OrderingState .order_executors :
24+ order_executor .execute_orders ()
25+
26+ @staticmethod
27+ def register_order_executors (order_executors : List [OrderExecutor ]) -> None :
28+ OrderingState .order_executors = order_executors
29+
30+
You can’t perform that action at this time.
0 commit comments