siglab-py 0.1.15__py3-none-any.whl → 0.1.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of siglab-py might be problematic. Click here for more details.
- siglab_py/ordergateway/client.py +10 -1
- {siglab_py-0.1.15.dist-info → siglab_py-0.1.17.dist-info}/METADATA +1 -1
- {siglab_py-0.1.15.dist-info → siglab_py-0.1.17.dist-info}/RECORD +5 -5
- {siglab_py-0.1.15.dist-info → siglab_py-0.1.17.dist-info}/WHEEL +0 -0
- {siglab_py-0.1.15.dist-info → siglab_py-0.1.17.dist-info}/top_level.txt +0 -0
siglab_py/ordergateway/client.py
CHANGED
|
@@ -35,6 +35,9 @@ class Order:
|
|
|
35
35
|
reduce_only : bool = False,
|
|
36
36
|
fees_ccy : Union[str, None] = None
|
|
37
37
|
) -> None:
|
|
38
|
+
if amount<=0:
|
|
39
|
+
raise ValueError(f"amount must be >0!")
|
|
40
|
+
|
|
38
41
|
self.ticker = ticker
|
|
39
42
|
self.side = side.strip().lower()
|
|
40
43
|
self.amount = amount
|
|
@@ -71,6 +74,9 @@ class DivisiblePosition(Order):
|
|
|
71
74
|
slices : int = 1,
|
|
72
75
|
wait_fill_threshold_ms : float = -1
|
|
73
76
|
) -> None:
|
|
77
|
+
if amount<=0:
|
|
78
|
+
raise ValueError(f"amount must be >0!")
|
|
79
|
+
|
|
74
80
|
super().__init__(ticker, side, amount, order_type, leg_room_bps, reduce_only, fees_ccy)
|
|
75
81
|
self.slices = slices
|
|
76
82
|
self.wait_fill_threshold_ms = wait_fill_threshold_ms
|
|
@@ -133,6 +139,8 @@ class DivisiblePosition(Order):
|
|
|
133
139
|
def get_filled_amount(self) -> float:
|
|
134
140
|
# filled_amount is in base ccy
|
|
135
141
|
filled_amount = sum([ self.executions[order_id]['filled'] * self.multiplier for order_id in self.executions ])
|
|
142
|
+
if self.side=='sell':
|
|
143
|
+
filled_amount = -1 * filled_amount
|
|
136
144
|
return filled_amount
|
|
137
145
|
|
|
138
146
|
def get_average_cost(self) -> float:
|
|
@@ -180,8 +188,9 @@ class DivisiblePosition(Order):
|
|
|
180
188
|
'stopLossPrice': None
|
|
181
189
|
}
|
|
182
190
|
'''
|
|
191
|
+
total_amount : float = sum([ self.executions[order_id]['amount'] for order_id in self.executions ])
|
|
183
192
|
average_cost = sum([ (self.executions[order_id]['average'] if self.executions[order_id]['average'] else self.executions[order_id]['price']) * self.executions[order_id]['amount'] for order_id in self.executions ])
|
|
184
|
-
average_cost = average_cost /
|
|
193
|
+
average_cost = average_cost / total_amount if total_amount!=0 else 0
|
|
185
194
|
return average_cost
|
|
186
195
|
|
|
187
196
|
def get_fees(self) -> float:
|
|
@@ -10,7 +10,7 @@ siglab_py/market_data_providers/deribit_options_expiry_provider.py,sha256=e9Ee8T
|
|
|
10
10
|
siglab_py/market_data_providers/orderbooks_provider.py,sha256=olt-3LIkoyzQWfNNQRhJtKibLbkTutt_q_rCCTM7i1g,16216
|
|
11
11
|
siglab_py/market_data_providers/test_provider.py,sha256=wBLCgcWjs7FGZJXWsNyn30lkOLa_cgpuvqRakMC0wbA,2221
|
|
12
12
|
siglab_py/ordergateway/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
siglab_py/ordergateway/client.py,sha256=
|
|
13
|
+
siglab_py/ordergateway/client.py,sha256=qh4vrCJm8iITKAl07lisZxJ3V4JkbsYlmIBMYihfUaU,9575
|
|
14
14
|
siglab_py/ordergateway/encrypt_keys_util.py,sha256=-qi87db8To8Yf1WS1Q_Cp2Ya7ZqgWlRqSHfNXCM7wE4,1339
|
|
15
15
|
siglab_py/ordergateway/gateway.py,sha256=CugCtEI-ShxjRr_DkLbasOmZ1O1iUmSTu1FzPVN8evs,36937
|
|
16
16
|
siglab_py/ordergateway/test_ordergateway.py,sha256=_Gz2U_VqljogGWqGyNDYYls1INqUiig9veyPttfGRpg,3901
|
|
@@ -24,7 +24,7 @@ siglab_py/util/analytic_util.py,sha256=QLabbEMqM4rKKH2PE_LqxIyo-BUdCRhkLybLATBIm
|
|
|
24
24
|
siglab_py/util/aws_util.py,sha256=KGmjHrr1rpnnxr33nXHNzTul4tvyyxl9p6gpwNv0Ygc,2557
|
|
25
25
|
siglab_py/util/market_data_util.py,sha256=3qTq71xGvQXj0ORKJV50IN5FP_mCBF_gvdmlPyhdyco,16439
|
|
26
26
|
siglab_py/util/retry_util.py,sha256=mxYuRFZRZoaQQjENcwPmxhxixtd1TFvbxIdPx4RwfRc,743
|
|
27
|
-
siglab_py-0.1.
|
|
28
|
-
siglab_py-0.1.
|
|
29
|
-
siglab_py-0.1.
|
|
30
|
-
siglab_py-0.1.
|
|
27
|
+
siglab_py-0.1.17.dist-info/METADATA,sha256=mNbhmFy0h_bPYr4oyTFW8PZ0b_vpBnlO-n9hpt5q__U,1097
|
|
28
|
+
siglab_py-0.1.17.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
29
|
+
siglab_py-0.1.17.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
|
|
30
|
+
siglab_py-0.1.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|