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

@@ -38,6 +38,9 @@ Usage:
38
38
  --slack_info_url, --slack_critical_url and --slack_alert_url are if you want gateway to dispatch Slack notification on events.
39
39
  How to get Slack webhook urls? https://medium.com/@natalia_assad/how-send-a-table-to-slack-using-python-d1a20b08abe0
40
40
 
41
+ Another example:
42
+ python gateway.py --gateway_id hyperliquid_01 --default_type linear --rate_limit_ms 100 --slack_info_url=https://hooks.slack.com/services/xxx --slack_critial_url=https://hooks.slack.com/services/yyy --slack_alert_url=https://hooks.slack.com/services/zzz
43
+
41
44
  This script is pypy compatible:
42
45
  pypy gateway.py --gateway_id bybit_01 --default_type linear --rate_limit_ms 100
43
46
 
@@ -321,9 +324,9 @@ def parse_args():
321
324
  param['secret'] = args.secret
322
325
  param['passphrase'] = args.passphrase
323
326
 
324
- param['notification']['slack']['info'] = args.slack_info_url
325
- param['notification']['slack']['critical'] = args.slack_critial_url
326
- param['notification']['slack']['alert'] = args.slack_alert_url
327
+ param['notification']['slack']['info']['webhook_url'] = args.slack_info_url
328
+ param['notification']['slack']['critical']['webhook_url'] = args.slack_critial_url
329
+ param['notification']['slack']['alert']['webhook_url'] = args.slack_alert_url
327
330
  param['notification']['footer'] = f"From gateway {param['gateway_id']}"
328
331
 
329
332
  def init_redis_client() -> StrictRedis:
@@ -733,6 +736,8 @@ async def execute_one_position(
733
736
  log(f"Executions:")
734
737
  log(f"{json.dumps(position.get_executions(), indent=4)}")
735
738
 
739
+ notification_util.dispatch_notification(title=f"{param['gateway_id']} execute_one_position {position.ticker} {position.side} {position.amount}", message=position.get_executions(), footer=param['notification']['footer'], params=notification_params, log_level=LogLevel.CRITICAL)
740
+
736
741
  except Exception as position_execution_err:
737
742
  position.done = False
738
743
  position.execution_err = f"Execution failed: {position_execution_err} {str(sys.exc_info()[0])} {str(sys.exc_info()[1])} {traceback.format_exc()}"
@@ -875,8 +880,8 @@ async def main():
875
880
  # Once exchange instantiated, try fetch_balance to confirm connectivity and test credentials.
876
881
  balances = await exchange.fetch_balance() # type: ignore
877
882
  log(f"{param['gateway_id']}: account balances {balances}")
878
- notification_util.dispatch_notification(title=f"{param['gateway_id']} started", message=balances, footer=param['notification']['footer'], params=notification_params)
883
+ notification_util.dispatch_notification(title=f"{param['gateway_id']} started", message=balances, footer=param['notification']['footer'], params=notification_params, log_level=LogLevel.CRITICAL)
879
884
 
880
- await work(param=param, exchange=exchange, redis_client=redis_client, notification_params=notification_params, params=notification_params, log_level=LogLevel.INFO)
885
+ await work(param=param, exchange=exchange, redis_client=redis_client, notification_params=notification_params)
881
886
 
882
887
  asyncio.run(main())
@@ -19,13 +19,16 @@ def slack_dispatch_notification(
19
19
 
20
20
  if log_level==LogLevel.INFO or log_level==LogLevel.DEBUG:
21
21
  webhook_url = slack_params['info']['webhook_url']
22
- elif log_level==LogLevel.ERROR or log_level==LogLevel.CRITICAL:
22
+ elif log_level==LogLevel.CRITICAL:
23
23
  webhook_url = slack_params['critical']['webhook_url']
24
- elif log_level==LogLevel.ERROR or log_level==LogLevel.CRITICAL:
24
+ elif log_level==LogLevel.ERROR:
25
25
  webhook_url = slack_params['alert']['webhook_url']
26
26
  else:
27
27
  webhook_url = slack_params['info']['webhook_url']
28
28
 
29
+ if not webhook_url:
30
+ return
31
+
29
32
  slack_data = {
30
33
  "username": "NotificationBot",
31
34
  "type": "section",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siglab-py
3
- Version: 0.2.5
3
+ Version: 0.2.7
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,7 +15,7 @@ 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=WnuwBl8_-MAumxSOLMivNfuOYMG8CBzpYc2ahNPViFM,41095
18
+ siglab_py/ordergateway/gateway.py,sha256=k1VM02F94gRORj6l0GFTrtPnUMXvFkEDxmEZqXZSI-E,41691
19
19
  siglab_py/ordergateway/test_ordergateway.py,sha256=KajC0oidfDIgboRazkteAXzx47FffVRligThzKKqgRk,4035
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
@@ -29,8 +29,8 @@ siglab_py/util/aws_util.py,sha256=KGmjHrr1rpnnxr33nXHNzTul4tvyyxl9p6gpwNv0Ygc,25
29
29
  siglab_py/util/market_data_util.py,sha256=9Uze8DE5z90H4Qm15R55ZllAi5trUkwCAW-BWYbfaW8,19420
30
30
  siglab_py/util/notification_util.py,sha256=6TPyStp-F6g_NTN-sVG18_o35agV6tjayNtJ0A4axyk,2311
31
31
  siglab_py/util/retry_util.py,sha256=mxYuRFZRZoaQQjENcwPmxhxixtd1TFvbxIdPx4RwfRc,743
32
- siglab_py/util/slack_notification_util.py,sha256=WShr3gxktOkW0-bHN5pxXk1sF3N720WlnAZovJv5HpY,1926
33
- siglab_py-0.2.5.dist-info/METADATA,sha256=3T8_3T52pPABfn7JtsOrq7uWjE_eKpI8tv88skVYIyQ,979
34
- siglab_py-0.2.5.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
35
- siglab_py-0.2.5.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
36
- siglab_py-0.2.5.dist-info/RECORD,,
32
+ siglab_py/util/slack_notification_util.py,sha256=Rs2hRnXZq1aglBAGFCuhmNex_w9M2z0ciUVIOvInBjc,1906
33
+ siglab_py-0.2.7.dist-info/METADATA,sha256=ZQNZuD3RPM9WdE2t4KBGtq9HG1o4Xyc_z3db6ijRJn8,979
34
+ siglab_py-0.2.7.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
35
+ siglab_py-0.2.7.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
36
+ siglab_py-0.2.7.dist-info/RECORD,,