Skip to content

Commit 6f918a8

Browse files
author
rob
committed
1 parent 2f70f87 commit 6f918a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+125
-121
lines changed

sysbrokers/IB/client/ib_orders_client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
)
77

88
from syscore.exceptions import missingContract
9-
from syscore.objects import arg_not_supplied, missing_order
9+
from syscore.objects import arg_not_supplied
10+
from sysexecution.orders.named_order_objects import missing_order
1011
from sysbrokers.IB.client.ib_contracts_client import ibContractsClient
1112
from sysbrokers.IB.ib_translate_broker_order_objects import (
1213
tradeWithContract,

sysbrokers/IB/ib_orders.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
from sysbrokers.IB.client.ib_orders_client import ibOrdersClient
1919
from sysbrokers.broker_execution_stack import brokerExecutionStackData
2020

21-
from syscore.objects import missing_order, failure, success, arg_not_supplied
21+
from syscore.objects import failure, success, arg_not_supplied
22+
from sysexecution.orders.named_order_objects import missing_order
2223

2324
from sysexecution.order_stacks.broker_order_stack import orderWithControls
2425
from sysexecution.orders.list_of_orders import listOfOrders

sysbrokers/IB/ib_translate_broker_order_objects.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from sysbrokers.IB.ib_contracts import ibcontractWithLegs
99
from sysbrokers.broker_trade import brokerTrade
1010
from syscore.exceptions import missingData
11-
from syscore.objects import missing_order, arg_not_supplied
11+
from syscore.objects import arg_not_supplied
12+
from sysexecution.orders.named_order_objects import missing_order
1213
from sysexecution.orders.base_orders import resolve_multi_leg_price_to_single_price
1314

1415
from sysobjects.spot_fx_prices import currencyValue

syscore/fileutils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def rename_files_with_extension_in_pathname_as_archive_files(
9292
"""
9393

9494
resolved_pathname = get_resolved_pathname(pathname)
95-
list_of_files = files_with_extension_in_resolved_pathname(resolved_pathname)
95+
list_of_files = files_with_extension_in_resolved_pathname(
96+
resolved_pathname, extension=extension
97+
)
9698

9799
for filename in list_of_files:
98100
full_filename = os.path.join(resolved_pathname, filename)

syscore/objects.py

+6-36
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
22
Do fun things with objects and classes
33
"""
4-
from collections import namedtuple
54
import importlib
65

76
none_type = type(None)
@@ -16,31 +15,13 @@ def __repr__(self):
1615

1716

1817
missing_instrument = named_object("missing instrument")
19-
20-
missing_order = named_object("missing order")
21-
locked_order = named_object("locked order")
22-
duplicate_order = named_object("duplicate order")
23-
zero_order = named_object("zero order")
24-
18+
missing_file = named_object("missing file")
19+
missing_data = named_object("missing data")
2520
market_closed = named_object("market closed")
26-
2721
fill_exceeds_trade = named_object("fill too big for trade")
2822

29-
order_is_in_status_finished = named_object("order status is modification close")
30-
order_is_in_status_modified = named_object("order status is being modified")
31-
order_is_in_status_not_modified = named_object("order status is not currently modified")
32-
order_is_in_status_reject_modification = named_object(
33-
"order status is modification rejected"
34-
)
35-
36-
no_order_id = named_object("no order ID")
37-
no_children = named_object("no_children")
38-
no_parent = named_object("no parent")
39-
40-
rolling_cant_trade = named_object("rolling can't trade")
41-
ROLL_PSEUDO_STRATEGY = "_ROLL_PSEUDO_STRATEGY"
42-
43-
not_updated = named_object("not updated")
23+
arg_not_supplied = named_object("arg not supplied")
24+
user_exit = named_object("exit")
4425

4526

4627
class status(named_object):
@@ -50,13 +31,7 @@ class status(named_object):
5031
success = status("success")
5132
failure = status("failure")
5233

53-
arg_not_supplied = named_object("arg not supplied")
54-
user_exit = named_object("exit")
55-
56-
table = namedtuple("table", "Heading Body")
57-
header = namedtuple("header", "Heading")
58-
body_text = namedtuple("bodytext", "Text")
59-
figure = namedtuple("figure", "pdf_filename")
34+
## FIXME HERE
6035

6136

6237
def get_methods(a_stage_object) -> list:
@@ -67,7 +42,7 @@ def get_methods(a_stage_object) -> list:
6742
dir_list = [method_name for method_name in dir_list if method_name[0] != "_"]
6843

6944
# remove special
70-
special_list = ["log", "name", "parent", "description"]
45+
special_list = ["log", "name", "parent", "description", "data"]
7146
dir_list = [
7247
method_name for method_name in dir_list if method_name not in special_list
7348
]
@@ -219,8 +194,3 @@ def hasallattr(some_object, attrlist=[]):
219194

220195
def get_class_name(class_object):
221196
return class_object.__name__
222-
223-
224-
missing_file = named_object("missing file")
225-
missing_data = named_object("missing data")
226-
ALL_ROLL_INSTRUMENTS = "ALL"

sysdata/mongodb/mongo_historic_orders.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import datetime
22

33
from syscore.exceptions import missingData
4-
from syscore.objects import success, missing_order, arg_not_supplied
4+
from syscore.objects import success, arg_not_supplied
5+
from sysexecution.orders.named_order_objects import missing_order
56
from sysdata.mongodb.mongo_generic import mongoDataWithSingleKey
67

78
from sysexecution.orders.base_orders import Order

sysdata/mongodb/mongo_order_stack.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from sysdata.mongodb.mongo_generic import mongoDataWithSingleKey
33
from syslogdiag.log_to_screen import logtoscreen
44

5-
from sysexecution.order_stacks.order_stack import orderStackData, missing_order
5+
from sysexecution.order_stacks.order_stack import orderStackData
6+
from sysexecution.orders.named_order_objects import missing_order
67
from sysexecution.orders.base_orders import Order
78
from sysexecution.orders.instrument_orders import instrumentOrder
89
from sysexecution.order_stacks.instrument_order_stack import instrumentOrderStackData

sysdata/production/historic_orders.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"""
1616
import datetime
1717

18-
from syscore.objects import arg_not_supplied, missing_order
18+
from syscore.objects import arg_not_supplied
19+
from sysexecution.orders.named_order_objects import missing_order
1920

2021
from sysdata.base_data import baseData
2122
from sysobjects.fills import listOfFills, fill_from_order

sysexecution/algos/algo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from syscore.exceptions import missingContract
55
from syscore.objects import (
66
arg_not_supplied,
7-
missing_order,
87
missing_data,
98
)
9+
from sysexecution.orders.named_order_objects import missing_order
1010

1111
from sysdata.data_blob import dataBlob
1212

sysexecution/algos/algo_limit_orders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Simplest possible execution method, one market order
33
"""
44
from copy import copy
5-
from syscore.objects import missing_order
5+
from sysexecution.orders.named_order_objects import missing_order
66
from sysproduction.data.broker import dataBroker
77

88
from sysexecution.algos.algo import Algo, limit_price_from_input, limit_order_type

sysexecution/algos/algo_market.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Simplest possible execution method, one market order
33
"""
44
from copy import copy
5-
from syscore.objects import missing_order
5+
from sysexecution.orders.named_order_objects import missing_order
66
from sysproduction.data.broker import dataBroker
77

88
from sysexecution.algos.algo import Algo

sysexecution/algos/algo_original_best.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"""
44
from typing import Union
55

6-
from syscore.objects import missing_order, market_closed, missing_data
6+
from syscore.objects import market_closed, missing_data
7+
from sysexecution.orders.named_order_objects import missing_order
78

89
from sysdata.data_blob import dataBlob
910
from sysexecution.algos.algo import Algo, limit_price_from_offside_price

sysexecution/algos/allocate_algo_to_order.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"""
77
from sysproduction.data.orders import dataOrders
88
from sysproduction.data.broker import dataBroker
9-
from syscore.objects import missing_order, arg_not_supplied
9+
from syscore.objects import arg_not_supplied
10+
from sysexecution.orders.named_order_objects import missing_order
1011
from sysdata.data_blob import dataBlob
1112
from sysexecution.orders.instrument_orders import (
1213
instrumentOrder,

sysexecution/order_stacks/broker_order_stack.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import datetime
22

3-
from syscore.objects import missing_order, fill_exceeds_trade
3+
from syscore.objects import fill_exceeds_trade
4+
from sysexecution.orders.named_order_objects import missing_order
45
from sysexecution.order_stacks.order_stack import orderStackData
56
from sysexecution.orders.broker_orders import brokerOrder
67

sysexecution/order_stacks/contract_order_stack.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22
from copy import copy
33

4-
from syscore.objects import missing_order
4+
from sysexecution.orders.named_order_objects import missing_order
55
from sysexecution.order_stacks.order_stack import orderStackData, missingOrder
66
from sysexecution.trade_qty import tradeQuantity
77

sysexecution/order_stacks/instrument_order_stack.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from syscore.objects import missing_order, zero_order
1+
from sysexecution.orders.named_order_objects import missing_order, zero_order
22
from sysexecution.order_stacks.order_stack import orderStackData
33
from sysexecution.orders.instrument_orders import instrumentOrder
44
from sysexecution.orders.list_of_orders import listOfOrders

sysexecution/order_stacks/order_stack.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import datetime
22
from copy import copy
33
from syscore.objects import (
4-
missing_order,
54
success,
65
failure,
6+
)
7+
from sysexecution.orders.named_order_objects import (
8+
missing_order,
79
no_order_id,
810
no_children,
911
)

sysexecution/orders/base_orders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
if_object_matches_return_empty_string,
88
list_of_ints_with_highest_common_factor_positive_first,
99
)
10-
from syscore.objects import no_order_id, no_children, no_parent
10+
from sysexecution.orders.named_order_objects import no_order_id, no_children, no_parent
1111

1212
from sysexecution.trade_qty import tradeQuantity
1313

sysexecution/orders/broker_orders.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import datetime
22

3-
from syscore.objects import missing_order
4-
5-
from sysexecution.orders.base_orders import (
3+
from sysexecution.orders.named_order_objects import (
4+
missing_order,
65
no_order_id,
76
no_children,
87
no_parent,
8+
)
9+
10+
from sysexecution.orders.base_orders import (
911
orderType,
1012
)
1113
from sysexecution.orders.base_orders import Order

sysexecution/orders/contract_orders.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33

44
from sysexecution.orders.base_orders import (
55
Order,
6-
no_order_id,
7-
no_children,
8-
no_parent,
96
resolve_inputs_to_order,
107
orderType,
118
)
9+
from sysexecution.orders.named_order_objects import no_order_id, no_children, no_parent
1210

1311
from sysexecution.trade_qty import tradeQuantity
1412

sysexecution/orders/instrument_orders.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88

99
from sysexecution.orders.base_orders import (
1010
Order,
11-
no_order_id,
12-
no_children,
13-
no_parent,
1411
tradeQuantity,
1512
orderType,
1613
)
14+
from sysexecution.orders.named_order_objects import no_order_id, no_children, no_parent
1715

1816
from sysobjects.production.tradeable_object import instrumentStrategy
1917

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from syscore.objects import named_object
2+
3+
missing_order = named_object("missing order")
4+
locked_order = named_object("locked order")
5+
duplicate_order = named_object("duplicate order")
6+
zero_order = named_object("zero order")
7+
order_is_in_status_finished = named_object("order status is modification close")
8+
order_is_in_status_modified = named_object("order status is being modified")
9+
order_is_in_status_not_modified = named_object("order status is not currently modified")
10+
order_is_in_status_reject_modification = named_object(
11+
"order status is modification rejected"
12+
)
13+
no_order_id = named_object("no order ID")
14+
no_children = named_object("no_children")
15+
no_parent = named_object("no parent")

sysexecution/stack_handler/balance_trades.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from syscore.objects import failure, success, missing_order
1+
from syscore.objects import failure, success
2+
from sysexecution.orders.named_order_objects import missing_order
23
from sysexecution.stack_handler.fills import stackHandlerForFills
34
from sysexecution.orders.instrument_orders import instrumentOrder
45
from sysexecution.orders.contract_orders import contractOrder

sysexecution/stack_handler/cancel_and_modify.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from copy import copy
22

3-
from syscore.objects import (
4-
missing_order,
5-
)
3+
from sysexecution.orders.named_order_objects import missing_order
64
from syscore.genutils import quickTimer
75
from sysexecution.stack_handler.stackHandlerCore import stackHandlerCore
86
from sysexecution.orders.list_of_orders import listOfOrders

sysexecution/stack_handler/checks.py

-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
11
from syscore.objects import (
2-
missing_order,
3-
success,
4-
failure,
5-
locked_order,
6-
duplicate_order,
7-
no_order_id,
8-
no_children,
9-
no_parent,
10-
rolling_cant_trade,
11-
ROLL_PSEUDO_STRATEGY,
12-
missing_order,
13-
order_is_in_status_reject_modification,
14-
order_is_in_status_finished,
15-
locked_order,
16-
order_is_in_status_modified,
17-
resolve_function,
182
arg_not_supplied,
19-
missing_data,
203
)
214

225
from sysexecution.stack_handler.stackHandlerCore import stackHandlerCore

sysexecution/stack_handler/completed_orders.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
from syscore.objects import (
2-
no_children,
3-
missing_order,
4-
)
1+
from sysexecution.orders.named_order_objects import missing_order, no_children
52

63
from sysexecution.stack_handler.stackHandlerCore import stackHandlerCore, orderFamily
74
from sysproduction.data.orders import dataOrders

sysexecution/stack_handler/create_broker_orders_from_contract_orders.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from copy import copy
22
from syscore.objects import (
3-
missing_order,
43
resolve_function,
54
)
5+
from sysexecution.orders.named_order_objects import missing_order
66
from sysproduction.data.controls import dataTradeLimits
77

88
from sysexecution.algos.allocate_algo_to_order import (

sysexecution/stack_handler/fills.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
import numpy as np
33
from syscore.objects import (
44
fill_exceeds_trade,
5-
no_children,
6-
no_parent,
7-
missing_order,
8-
no_order_id,
95
)
6+
from sysexecution.orders.named_order_objects import missing_order, no_order_id, no_children, no_parent
107

118
from sysexecution.stack_handler.completed_orders import stackHandlerForCompletions
129

sysexecution/stack_handler/roll_orders.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datetime
22
from dataclasses import dataclass
3-
from syscore.objects import missing_order, ROLL_PSEUDO_STRATEGY
3+
from sysexecution.orders.named_order_objects import missing_order
44

55
from sysdata.data_blob import dataBlob
66

@@ -28,6 +28,8 @@
2828

2929
CONTRACT_ORDER_TYPE_FOR_ROLL_ORDERS = best_order_type
3030

31+
ROLL_PSEUDO_STRATEGY = "_ROLL_PSEUDO_STRATEGY"
32+
3133

3234
class stackHandlerForRolls(stackHandlerCore):
3335
def generate_force_roll_orders(self):

0 commit comments

Comments
 (0)