forked from robcarver17/pysystemtrade
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdebug_stack_handler.py
81 lines (65 loc) · 2.9 KB
/
debug_stack_handler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from sysexecution.stack_handler.checks import stackHandlerChecks
from sysexecution.stack_handler.spawn_children_from_instrument_orders import (
stackHandlerForSpawning,
)
from sysexecution.stack_handler.roll_orders import stackHandlerForRolls
from sysexecution.stack_handler.create_broker_orders_from_contract_orders import (
stackHandlerCreateBrokerOrders,
)
from sysexecution.stack_handler.additional_sampling import (
stackHandlerAdditionalSampling,
)
from sysexecution.stack_handler.completed_orders import (
stackHandlerForCompletions,
)
from sysexecution.stack_handler.fills import stackHandlerForFills
from sysdata.data_blob import dataBlob
from syslogging.logger import *
def do_check_external_position_break():
stack_handler = stackHandlerChecks()
stack_handler.log.info("No-op", type="stackHandlerChecks")
stack_handler.check_external_position_break()
stack_handler.data.close()
def do_spawn_children_from_new_instrument_orders():
stack_handler = stackHandlerForSpawning()
stack_handler.log.info("No-op", type="stackHandlerForSpawning")
stack_handler.spawn_children_from_new_instrument_orders()
stack_handler.data.close()
def do_force_roll_orders():
stack_handler = stackHandlerForRolls()
stack_handler.log.info("No-op", type="stackHandlerForRolls")
stack_handler.generate_force_roll_orders()
stack_handler.data.close()
def do_create_broker_orders_from_contract_orders():
stack_handler = stackHandlerCreateBrokerOrders()
stack_handler.log.info("No-op", type="stackHandlerCreateBrokerOrders")
stack_handler.create_broker_orders_from_contract_orders(test_mode=False)
stack_handler.data.close()
def do_refresh_additional_sampling_all_instruments():
stack_handler = stackHandlerAdditionalSampling(
# data=dataBlob(log=get_logger("stackHandlerAdditionalSampling"))
data=dataBlob(log=get_logger("refresh_additional_sampling_all_instruments"))
)
# stack_handler.log.label(type="stackHandlerAdditionalSampling")
stack_handler.refresh_additional_sampling_all_instruments()
stack_handler.data.close()
def do_process_fills_stack():
stack_handler = stackHandlerForFills()
stack_handler.log.info("No-op", type="stackHandlerForFills")
stack_handler.process_fills_stack()
stack_handler.data.close()
def do_completed_orders():
stack_handler = stackHandlerForCompletions()
stack_handler.log.info("No-op", type="stackHandlerForCompletions")
stack_handler.handle_completed_orders()
stack_handler.data.close()
if __name__ == "__main__":
# to run for just one instrument, edit
# sysexecution/stack_handler/additional_sampling.py, line ~41
do_refresh_additional_sampling_all_instruments()
# do_process_fills_stack()
# do_create_broker_orders_from_contract_orders()
# do_force_roll_orders()
# do_check_external_position_break()
# do_completed_orders()
# debug_get_all_priced_epics()