siglab-py 0.1.55__tar.gz → 0.1.57__tar.gz
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-0.1.55 → siglab_py-0.1.57}/PKG-INFO +1 -1
- {siglab_py-0.1.55 → siglab_py-0.1.57}/pyproject.toml +1 -1
- {siglab_py-0.1.55 → siglab_py-0.1.57}/setup.cfg +1 -1
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/util/market_data_util.py +20 -40
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py.egg-info/PKG-INFO +1 -1
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/__init__.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/constants.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/exchanges/__init__.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/exchanges/any_exchange.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/exchanges/futubull.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/__init__.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/aggregated_orderbook_provider.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/candles_provider.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/candles_ta_provider.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/ccxt_candles_ta_to_csv.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/deribit_options_expiry_provider.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/futu_candles_ta_to_csv.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/orderbooks_provider.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/test_provider.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/ordergateway/__init__.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/ordergateway/client.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/ordergateway/encrypt_keys_util.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/ordergateway/gateway.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/ordergateway/test_ordergateway.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/tests/__init__.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/tests/integration/__init__.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/tests/integration/market_data_util_tests.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/tests/unit/__init__.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/tests/unit/analytic_util_tests.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/tests/unit/market_data_util_tests.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/util/__init__.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/util/analytic_util.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/util/aws_util.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/util/retry_util.py +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py.egg-info/SOURCES.txt +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py.egg-info/dependency_links.txt +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py.egg-info/requires.txt +0 -0
- {siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "siglab_py"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.57"
|
|
8
8
|
description = "Market data fetches, TA calculations and generic order gateway."
|
|
9
9
|
authors = [{name = "r0bbarh00d", email = "r0bbarh00d@gmail.com"}]
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -298,6 +298,10 @@ def fetch_candles(
|
|
|
298
298
|
validation_max_gaps : int = 10,
|
|
299
299
|
validation_max_end_date_intervals : int = 1
|
|
300
300
|
) -> Dict[str, Union[pd.DataFrame, None]]:
|
|
301
|
+
|
|
302
|
+
if end_ts>datetime.now().timestamp():
|
|
303
|
+
end_ts = int(datetime.now().timestamp())
|
|
304
|
+
|
|
301
305
|
if type(exchange) is YahooExchange:
|
|
302
306
|
return exchange.fetch_candles(
|
|
303
307
|
start_ts=start_ts,
|
|
@@ -331,10 +335,7 @@ def fetch_candles(
|
|
|
331
335
|
exchange=exchange,
|
|
332
336
|
normalized_symbols=normalized_symbols,
|
|
333
337
|
candle_size=candle_size,
|
|
334
|
-
|
|
335
|
-
num_candles_limit=num_candles_limit,
|
|
336
|
-
cache_dir=cache_dir,
|
|
337
|
-
list_ts_field=list_ts_field
|
|
338
|
+
num_candles_limit=num_candles_limit
|
|
338
339
|
)
|
|
339
340
|
return { '' : None }
|
|
340
341
|
|
|
@@ -344,47 +345,23 @@ def _fetch_candles_ccxt(
|
|
|
344
345
|
exchange,
|
|
345
346
|
normalized_symbols : List[str],
|
|
346
347
|
candle_size : str,
|
|
347
|
-
num_candles_limit : int = 100,
|
|
348
|
-
logger = None,
|
|
349
|
-
cache_dir : Union[str, None] = None,
|
|
350
|
-
list_ts_field : Union[str, None] = None
|
|
351
|
-
) -> Dict[str, Union[pd.DataFrame, None]]:
|
|
352
|
-
ticker = normalized_symbols[0]
|
|
353
|
-
pd_candles = _fetch_candles(
|
|
354
|
-
symbol = ticker,
|
|
355
|
-
exchange = exchange,
|
|
356
|
-
start_ts = start_ts,
|
|
357
|
-
end_ts = end_ts,
|
|
358
|
-
candle_size = candle_size,
|
|
359
|
-
)
|
|
360
|
-
return {
|
|
361
|
-
ticker : pd_candles
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
def _fetch_candles(
|
|
365
|
-
symbol : str,
|
|
366
|
-
exchange : CcxtExchange,
|
|
367
|
-
start_ts : int,
|
|
368
|
-
end_ts : int,
|
|
369
|
-
candle_size : str = '1d',
|
|
370
348
|
num_candles_limit : int = 100
|
|
371
|
-
):
|
|
372
|
-
|
|
373
|
-
one_timeframe = f"1{timeframe[-1]}"
|
|
374
|
-
candles = exchange.fetch_ohlcv(symbol=symbol, timeframe=one_timeframe, since=since, limit=limit, params=params)
|
|
375
|
-
if candles and len(candles)>0:
|
|
376
|
-
candles.sort(key=lambda x : x[0], reverse=False)
|
|
377
|
-
|
|
378
|
-
return candles
|
|
349
|
+
) -> Dict[str, Union[pd.DataFrame, None]]:
|
|
350
|
+
ticker = normalized_symbols[0]
|
|
379
351
|
|
|
380
|
-
|
|
381
|
-
|
|
352
|
+
def _fetch_ohlcv(exchange, symbol, timeframe, since, limit, params) -> Union[List, NoReturn]:
|
|
353
|
+
one_timeframe = f"1{timeframe[-1]}"
|
|
354
|
+
candles = exchange.fetch_ohlcv(symbol=symbol, timeframe=one_timeframe, since=since, limit=limit, params=params)
|
|
355
|
+
if candles and len(candles)>0:
|
|
356
|
+
candles.sort(key=lambda x : x[0], reverse=False)
|
|
382
357
|
|
|
358
|
+
return candles
|
|
359
|
+
|
|
383
360
|
all_candles = []
|
|
384
361
|
params = {}
|
|
385
362
|
this_cutoff = start_ts
|
|
386
363
|
while this_cutoff<end_ts:
|
|
387
|
-
candles = _fetch_ohlcv(exchange=exchange, symbol=
|
|
364
|
+
candles = _fetch_ohlcv(exchange=exchange, symbol=ticker, timeframe=candle_size, since=int(this_cutoff * 1000), limit=num_candles_limit, params=params)
|
|
388
365
|
if candles and len(candles)>0:
|
|
389
366
|
all_candles = all_candles + [[ int(x[0]), float(x[1]), float(x[2]), float(x[3]), float(x[4]), float(x[5]) ] for x in candles if x[1] and x[2] and x[3] and x[4] and x[5] ]
|
|
390
367
|
|
|
@@ -398,10 +375,13 @@ def _fetch_candles(
|
|
|
398
375
|
this_cutoff += 1
|
|
399
376
|
|
|
400
377
|
columns = ['exchange', 'symbol', 'timestamp_ms', 'open', 'high', 'low', 'close', 'volume']
|
|
401
|
-
pd_all_candles = pd.DataFrame([ [ exchange.name,
|
|
378
|
+
pd_all_candles = pd.DataFrame([ [ exchange.name, ticker, x[0], x[1], x[2], x[3], x[4], x[5] ] for x in all_candles], columns=columns)
|
|
402
379
|
fix_column_types(pd_all_candles)
|
|
403
380
|
pd_all_candles['pct_chg_on_close'] = pd_all_candles['close'].pct_change()
|
|
404
|
-
|
|
381
|
+
|
|
382
|
+
return {
|
|
383
|
+
ticker : pd_all_candles
|
|
384
|
+
}
|
|
405
385
|
|
|
406
386
|
def fetch_deribit_btc_option_expiries(
|
|
407
387
|
market: str = 'BTC'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/candles_ta_provider.py
RENAMED
|
File without changes
|
{siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/ccxt_candles_ta_to_csv.py
RENAMED
|
File without changes
|
|
File without changes
|
{siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/futu_candles_ta_to_csv.py
RENAMED
|
File without changes
|
{siglab_py-0.1.55 → siglab_py-0.1.57}/siglab_py/market_data_providers/orderbooks_provider.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|