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

@@ -669,6 +669,7 @@ async def execute_one_position(
669
669
  position.dispatched_slices.append(slice)
670
670
 
671
671
  log(f"Executed slice #{i}", log_level=LogLevel.INFO)
672
+ log(f"{json.dumps(slice.to_dict(), indent=4)}")
672
673
  log(f"{position.ticker}, multiplier: {multiplier}, slice_amount_in_base_ccy: {slice_amount_in_base_ccy}, rounded_slice_amount_in_base_ccy, {rounded_slice_amount_in_base_ccy}", log_level=LogLevel.INFO)
673
674
  if position.order_type=='limit':
674
675
  log(f"{position.ticker}, limit_price: {limit_price}, rounded_limit_price, {rounded_limit_price}", log_level=LogLevel.INFO)
@@ -678,6 +679,7 @@ async def execute_one_position(
678
679
  f"Failed to execute #{i} slice: {slice.to_dict()}. {slice_err} {str(sys.exc_info()[0])} {str(sys.exc_info()[1])} {traceback.format_exc()}",
679
680
  log_level=LogLevel.ERROR
680
681
  )
682
+ raise slice_err
681
683
  finally:
682
684
  i += 1
683
685
 
@@ -698,6 +700,9 @@ async def execute_one_position(
698
700
 
699
701
  position.done = True
700
702
 
703
+ log(f"Executions:")
704
+ log(f"{json.dumps(position.get_executions(), indent=4)}")
705
+
701
706
  except Exception as position_execution_err:
702
707
  position.done = False
703
708
  position.execution_err = f"Execution failed: {position_execution_err} {str(sys.exc_info()[0])} {str(sys.exc_info()[1])} {traceback.format_exc()}"
@@ -12,7 +12,7 @@ from constants import JSON_SERIALIZABLE_TYPES
12
12
 
13
13
  '''
14
14
  set PYTHONPATH=%PYTHONPATH%;D:\dev\siglab\siglab_py
15
- python test_ordergateway.py --gateway_id bybit_03
15
+ python test_ordergateway.py --gateway_id hyperliquid_01
16
16
  '''
17
17
 
18
18
  param : Dict[str, str] = {
@@ -91,27 +91,28 @@ if __name__ == '__main__':
91
91
 
92
92
  positions_3 : List[DivisiblePosition] = [
93
93
  DivisiblePosition(
94
- ticker = 'BTC/USDT:USDT',
94
+ ticker = 'BTC/USDC:USDC',
95
95
  side = 'sell',
96
- amount = 0.01,
96
+ amount = 0.00100,
97
97
  leg_room_bps = 5,
98
- reduce_only=False,
98
+ reduce_only=True,
99
99
  order_type = 'limit',
100
100
  slices=1,
101
- wait_fill_threshold_ms=60000
101
+ wait_fill_threshold_ms=60000,
102
+ fees_ccy='USDC'
102
103
  )
103
104
  ]
104
105
 
105
106
 
106
107
  executed_positions : Union[Dict[JSON_SERIALIZABLE_TYPES, JSON_SERIALIZABLE_TYPES], None] = execute_positions(
107
108
  redis_client=redis_client,
108
- positions=positions_2,
109
+ positions=positions_3,
109
110
  ordergateway_pending_orders_topic=ordergateway_pending_orders_topic,
110
111
  ordergateway_executions_topic=ordergateway_executions_topic
111
112
  )
112
113
  if executed_positions:
113
114
  for position in executed_positions:
114
- print(f"{position['ticker']} {position['side']} amount: {position['amount']} leg_room_bps: {position['leg_room_bps']} slices: {position['slices']}, filled_amount: {position['filled_amount']}, average_cost: {position['average_cost']}, # executions: {len(position['executions'])}") # type: ignore
115
+ print(f"{position['ticker']} {position['side']} amount: {position['amount']} leg_room_bps: {position['leg_room_bps']} slices: {position['slices']}, filled_amount: {position['filled_amount']}, average_cost: {position['average_cost']}, # executions: {len(position['executions'])}, done: {position['done']}, execution_err: {position['execution_err']}") # type: ignore
115
116
 
116
117
 
117
118
 
@@ -88,7 +88,7 @@ class MarketDataUtilTests(unittest.TestCase):
88
88
 
89
89
  def test_fetch_candles_ccxt(self):
90
90
  start_date : datetime = datetime(2024,1,1)
91
- end_date : datetime = datetime(2025,3,28)
91
+ end_date : datetime = datetime(2024,12,31)
92
92
 
93
93
  param = {
94
94
  'apiKey' : None,
@@ -102,7 +102,7 @@ def compute_candles_stats(
102
102
 
103
103
  pd_candles['std_percent'] = pd_candles['std'] / pd_candles['ema_close'] * 100
104
104
  pd_candles['candle_height_percent'] = pd_candles['candle_height'] / pd_candles['ema_close'] * 100
105
- pd_candles['candle_height_percent_rounded'] = pd_candles['candle_height_percent'].round().astype(int)
105
+ pd_candles['candle_height_percent_rounded'] = pd_candles['candle_height_percent'].round().astype('Int64')
106
106
 
107
107
  pd_candles['chop_against_ema'] = (
108
108
  (~pd_candles['is_green'] & (pd_candles['close'] > pd_candles['ema_close'])) | # Case 1: Green candle and close > EMA
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siglab-py
3
- Version: 0.1.57
3
+ Version: 0.2.0
4
4
  Summary: Market data fetches, TA calculations and generic order gateway.
5
5
  Author: r0bbarh00d
6
6
  Author-email: r0bbarh00d <r0bbarh00d@gmail.com>
@@ -15,20 +15,20 @@ siglab_py/market_data_providers/test_provider.py,sha256=wBLCgcWjs7FGZJXWsNyn30lk
15
15
  siglab_py/ordergateway/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  siglab_py/ordergateway/client.py,sha256=EwoVKxEcngIs8-b4MThPBdZfFIWJg1OFAKG9bwC5BYw,14826
17
17
  siglab_py/ordergateway/encrypt_keys_util.py,sha256=-qi87db8To8Yf1WS1Q_Cp2Ya7ZqgWlRqSHfNXCM7wE4,1339
18
- siglab_py/ordergateway/gateway.py,sha256=9D70r6KsgrUo70m_jtt2zG5UUq4w2TTXuEmSfuykDhI,38969
19
- siglab_py/ordergateway/test_ordergateway.py,sha256=_Gz2U_VqljogGWqGyNDYYls1INqUiig9veyPttfGRpg,3901
18
+ siglab_py/ordergateway/gateway.py,sha256=-rDx0tD8vykKbsuS478fedODN0_5ZXe7OAsMYoXtfw8,39165
19
+ siglab_py/ordergateway/test_ordergateway.py,sha256=4PE2flp_soGcD3DrI7zJOzZndjkb6I5XaDrFNNq4Huo,4009
20
20
  siglab_py/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  siglab_py/tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- siglab_py/tests/integration/market_data_util_tests.py,sha256=xzvZeU3QnXmDF4S90uujy11PbdEx0IOAHy0sIlLuByU,7173
22
+ siglab_py/tests/integration/market_data_util_tests.py,sha256=X0CiSMDfsafKcmjVKknA03vUUbMV0fAZweb3D01ikYI,7174
23
23
  siglab_py/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  siglab_py/tests/unit/analytic_util_tests.py,sha256=BzT__hxfqXMRAKvqtYDVYNrcMGGDF3-gFoXhxiJ0Lew,3703
25
25
  siglab_py/tests/unit/market_data_util_tests.py,sha256=A1y83itISmMJdn6wLpfwcr4tGola8wTf1D1xbelMvgw,2026
26
26
  siglab_py/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
- siglab_py/util/analytic_util.py,sha256=xo9gD1ELQt_1v84yu9d4NgxtOIXthePZGipvDrjZAQ8,43834
27
+ siglab_py/util/analytic_util.py,sha256=o9MNuOWUhw-r0id10Wjjd7a6rkL6-g3OmvajMSj1JJ4,43838
28
28
  siglab_py/util/aws_util.py,sha256=KGmjHrr1rpnnxr33nXHNzTul4tvyyxl9p6gpwNv0Ygc,2557
29
29
  siglab_py/util/market_data_util.py,sha256=hBZiFhko0NFf8A74mv9Qia-YYbjK4RuhzC9I6L353is,19033
30
30
  siglab_py/util/retry_util.py,sha256=mxYuRFZRZoaQQjENcwPmxhxixtd1TFvbxIdPx4RwfRc,743
31
- siglab_py-0.1.57.dist-info/METADATA,sha256=SiMQHpopJdPupRvZPoetRePia_2c82SBUiGQX7SEFxI,980
32
- siglab_py-0.1.57.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
33
- siglab_py-0.1.57.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
34
- siglab_py-0.1.57.dist-info/RECORD,,
31
+ siglab_py-0.2.0.dist-info/METADATA,sha256=smtL3wpkrqAmHQC8wdHrA1nVWwejI8QHUdHpXGwOXGM,979
32
+ siglab_py-0.2.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
33
+ siglab_py-0.2.0.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
34
+ siglab_py-0.2.0.dist-info/RECORD,,