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

@@ -439,7 +439,7 @@ async def send_heartbeat(exchange):
439
439
  except Exception as hb_error:
440
440
  log(f'Failed to send heartbeat: {hb_error}')
441
441
  finally:
442
- await asyncio.sleep(30)
442
+ await asyncio.sleep(20)
443
443
 
444
444
  async def execute_one_position(
445
445
  exchange : AnyExchange,
@@ -18,9 +18,20 @@ import yfinance as yf
18
18
  from siglab_py.exchanges.futubull import Futubull
19
19
 
20
20
  def timestamp_to_datetime_cols(pd_candles : pd.DataFrame):
21
- pd_candles['timestamp_ms'] = pd_candles['timestamp_ms'].apply(
22
- lambda x: int(x.timestamp()) if isinstance(x, pd.Timestamp) else (int(x) if len(str(int(x)))==13 else int(x*1000))
23
- )
21
+ def _fix_timestamp_ms(x):
22
+ if isinstance(x, pd.Timestamp):
23
+ return int(x.value // 10**6)
24
+ elif isinstance(x, np.datetime64):
25
+ return int(x.astype('int64') // 10**6)
26
+ elif isinstance(x, (int, float)):
27
+ x = int(x)
28
+ if len(str(abs(x))) == 13:
29
+ return x
30
+ else:
31
+ return int(x * 1000)
32
+ else:
33
+ raise ValueError(f"Unsupported type {type(x)} for timestamp conversion")
34
+ pd_candles['timestamp_ms'] = pd_candles['timestamp_ms'].apply(_fix_timestamp_ms)
24
35
  pd_candles['datetime'] = pd_candles['timestamp_ms'].apply(lambda x: datetime.fromtimestamp(int(x/1000)))
25
36
  pd_candles['datetime'] = pd.to_datetime(pd_candles['datetime'])
26
37
  pd_candles['datetime'] = pd_candles['datetime'].dt.tz_localize(None)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: siglab-py
3
- Version: 0.2.0
3
+ Version: 0.2.1
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=-rDx0tD8vykKbsuS478fedODN0_5ZXe7OAsMYoXtfw8,39165
18
+ siglab_py/ordergateway/gateway.py,sha256=cT51JvnUxZ7a9-DqJpTXQtI8GLXb3tLnQyNzlaOa9-8,39165
19
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
@@ -26,9 +26,9 @@ siglab_py/tests/unit/market_data_util_tests.py,sha256=A1y83itISmMJdn6wLpfwcr4tGo
26
26
  siglab_py/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  siglab_py/util/analytic_util.py,sha256=o9MNuOWUhw-r0id10Wjjd7a6rkL6-g3OmvajMSj1JJ4,43838
28
28
  siglab_py/util/aws_util.py,sha256=KGmjHrr1rpnnxr33nXHNzTul4tvyyxl9p6gpwNv0Ygc,2557
29
- siglab_py/util/market_data_util.py,sha256=hBZiFhko0NFf8A74mv9Qia-YYbjK4RuhzC9I6L353is,19033
29
+ siglab_py/util/market_data_util.py,sha256=9Uze8DE5z90H4Qm15R55ZllAi5trUkwCAW-BWYbfaW8,19420
30
30
  siglab_py/util/retry_util.py,sha256=mxYuRFZRZoaQQjENcwPmxhxixtd1TFvbxIdPx4RwfRc,743
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,,
31
+ siglab_py-0.2.1.dist-info/METADATA,sha256=8J6E7JpP-057PWlaIcta09vhMIIR-kINbHcWP21L7eM,979
32
+ siglab_py-0.2.1.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
33
+ siglab_py-0.2.1.dist-info/top_level.txt,sha256=AbD4VR9OqmMOGlMJLkAVPGQMtUPIQv0t1BF5xmcLJSk,10
34
+ siglab_py-0.2.1.dist-info/RECORD,,