siglab-py 0.1.30__py3-none-any.whl → 0.1.31__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.

@@ -138,7 +138,7 @@ class DivisiblePosition(Order):
138
138
 
139
139
  def get_filled_amount(self) -> float:
140
140
  # filled_amount is in base ccy
141
- filled_amount = sum([ self.executions[order_id]['filled'] * self.multiplier for order_id in self.executions ])
141
+ filled_amount = sum([ self.executions[order_id]['filled'] if 'filled' in self.executions[order_id] else 0 * self.multiplier for order_id in self.executions ])
142
142
  if self.side=='sell':
143
143
  filled_amount = -1 * filled_amount
144
144
  return filled_amount
@@ -189,14 +189,14 @@ class DivisiblePosition(Order):
189
189
  }
190
190
  '''
191
191
  total_amount : float = sum([ self.executions[order_id]['amount'] for order_id in self.executions ])
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 ])
192
+ average_cost = sum([ (self.executions[order_id]['average'] if 'average' in self.executions[order_id] else 0 if self.executions[order_id]['average'] else self.executions[order_id]['price']) * self.executions[order_id]['amount'] for order_id in self.executions ])
193
193
  average_cost = average_cost / total_amount if total_amount!=0 else 0
194
194
  return average_cost
195
195
 
196
196
  def get_fees(self) -> float:
197
197
  fees : float = 0
198
198
  if self.fees_ccy:
199
- fees = sum([ float(self.executions[order_id]['fee']['cost']) for order_id in self.executions if self.executions[order_id]['fee'] and self.executions[order_id]['fee']['currency'].strip().upper()==self.fees_ccy.strip().upper() ])
199
+ fees = sum([ float(self.executions[order_id]['fee']['cost'] if self.executions[order_id]['fee'] else 0) for order_id in self.executions if self.executions[order_id]['fee'] and self.executions[order_id]['fee']['currency'].strip().upper()==self.fees_ccy.strip().upper() ])
200
200
  return fees
201
201
 
202
202
  def to_dict(self) -> Dict[JSON_SERIALIZABLE_TYPES, JSON_SERIALIZABLE_TYPES]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siglab-py
3
- Version: 0.1.30
3
+ Version: 0.1.31
4
4
  Summary: Market data fetches, TA calculations and generic order gateway.
5
5
  Author: r0bbarh00d
6
6
  Author-email: r0bbarh00d <r0bbarh00d@gmail.com>
@@ -13,7 +13,7 @@ siglab_py/market_data_providers/futu_candles_ta_to_csv.py,sha256=S4GXaJ7AveEh-Cm
13
13
  siglab_py/market_data_providers/orderbooks_provider.py,sha256=olt-3LIkoyzQWfNNQRhJtKibLbkTutt_q_rCCTM7i1g,16216
14
14
  siglab_py/market_data_providers/test_provider.py,sha256=wBLCgcWjs7FGZJXWsNyn30lkOLa_cgpuvqRakMC0wbA,2221
15
15
  siglab_py/ordergateway/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- siglab_py/ordergateway/client.py,sha256=qh4vrCJm8iITKAl07lisZxJ3V4JkbsYlmIBMYihfUaU,9575
16
+ siglab_py/ordergateway/client.py,sha256=vpvBacWFRYUDIAtpxkMjylE2zuP9PYpo8_9QdvnC1zg,9715
17
17
  siglab_py/ordergateway/encrypt_keys_util.py,sha256=-qi87db8To8Yf1WS1Q_Cp2Ya7ZqgWlRqSHfNXCM7wE4,1339
18
18
  siglab_py/ordergateway/gateway.py,sha256=FoE-OUBrHJ2fdKAfvGue1yQ2P67falWoyoEGCV8ScfA,37219
19
19
  siglab_py/ordergateway/test_ordergateway.py,sha256=_Gz2U_VqljogGWqGyNDYYls1INqUiig9veyPttfGRpg,3901
@@ -28,7 +28,7 @@ siglab_py/util/analytic_util.py,sha256=w3-ee13q7d6O-w45zafQdWeuKtYO2ycNW9Ek4MJTO
28
28
  siglab_py/util/aws_util.py,sha256=KGmjHrr1rpnnxr33nXHNzTul4tvyyxl9p6gpwNv0Ygc,2557
29
29
  siglab_py/util/market_data_util.py,sha256=qRKsFKZMYsaC18ImSWug6dRAOo2_GS1NZM-j0EYMViE,19319
30
30
  siglab_py/util/retry_util.py,sha256=mxYuRFZRZoaQQjENcwPmxhxixtd1TFvbxIdPx4RwfRc,743
31
- siglab_py-0.1.30.dist-info/METADATA,sha256=qaTrOuk27oztMUHRGSahl7OwYFme9R7J-xbK6v0KjiE,980
32
- siglab_py-0.1.30.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
33
- siglab_py-0.1.30.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
34
- siglab_py-0.1.30.dist-info/RECORD,,
31
+ siglab_py-0.1.31.dist-info/METADATA,sha256=vLf-54Ssp9XJXmEQ7x3Er_kxax2aMYE2ttf30DESUF4,980
32
+ siglab_py-0.1.31.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
33
+ siglab_py-0.1.31.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
34
+ siglab_py-0.1.31.dist-info/RECORD,,