Qubx 0.4.2__cp311-cp311-manylinux_2_35_x86_64.whl → 0.4.3__cp311-cp311-manylinux_2_35_x86_64.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 Qubx might be problematic. Click here for more details.

qubx/pandaz/utils.py CHANGED
@@ -90,7 +90,7 @@ def rolling_forward_test_split(
90
90
  yield (np.array(range(i - training_period, i)), np.array(range(i, i + test_period)))
91
91
 
92
92
 
93
- def generate_equal_date_ranges(start: str, end: str, freq, units):
93
+ def generate_equal_date_ranges(start: str | pd.Timestamp, end: str | pd.Timestamp, freq, units):
94
94
  """
95
95
  Generator for date ranges:
96
96
 
@@ -103,7 +103,12 @@ def generate_equal_date_ranges(start: str, end: str, freq, units):
103
103
  2022-01-01 2022-05-17
104
104
  """
105
105
  _as_f = lambda x: pd.Timestamp(x).strftime("%Y-%m-%d")
106
- if pd.Timestamp(end) - pd.Timestamp(start) < freq * pd.Timedelta(f"1{units}"):
106
+ if units in ["M", "Y"]:
107
+ offset = pd.DateOffset(years=freq) if units == "Y" else pd.DateOffset(months=freq)
108
+ else:
109
+ offset = pd.Timedelta(f"{freq}{units}")
110
+
111
+ if pd.Timestamp(end) - offset < pd.Timestamp(start):
107
112
  b = [start, end]
108
113
 
109
114
  for a, b in rolling_forward_test_split(pd.Series(0, pd.date_range(start, end)), freq, freq, units=units):
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from typing import Any, Callable, Dict, List, Tuple
2
3
  from os import unlink
3
4
  import numpy as np
@@ -57,13 +58,18 @@ def fetch_file(url, local_file_storage, chunk_size=1024*1024, progress_bar=True)
57
58
  # if dest location not exists create it
58
59
  if not exists(local_file_storage):
59
60
  makedirs(local_file_storage)
60
-
61
+
61
62
  response = requests.get(url, stream=True)
63
+ if response.status_code != 200:
64
+ logger.warning(f"Error while fetching {url}: {response.status_code}")
65
+ return None
62
66
  fpath = join(local_file_storage, file)
63
- with open(fpath, "wb") as handle:
67
+ fpath_temp = join(local_file_storage, f"{file}_tmp")
68
+ with open(fpath_temp, "wb") as handle:
64
69
  iters = response.iter_content(chunk_size=chunk_size)
65
70
  for data in tqdm(iters) if progress_bar else iters:
66
71
  handle.write(data)
72
+ os.rename(fpath_temp, fpath)
67
73
  return fpath
68
74
 
69
75
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Qubx
3
- Version: 0.4.2
3
+ Version: 0.4.3
4
4
  Summary: Qubx - quantitative trading framework
5
5
  Home-page: https://github.com/dmarienko/Qubx
6
6
  Author: Dmitry Marienko
@@ -27,11 +27,11 @@ qubx/core/mixins/processing.py,sha256=T6dcYGdN6HuuRGEglbdtl7wVC1zoo6rMly3tNTSB-k
27
27
  qubx/core/mixins/subscription.py,sha256=7Dsux4hpUfOuJ8K9OvD3CMqWH3sT0tPZIHjYKBiKE5M,3703
28
28
  qubx/core/mixins/trading.py,sha256=-agX-D2-4YFFEP5KHWrGKaMdTqVW_XX3YkoyFKpNd78,2625
29
29
  qubx/core/mixins/universe.py,sha256=BsfxRp2qZdgHO9uI7OUg5260yV5kceACRh4nG42diHo,5199
30
- qubx/core/series.cpython-311-x86_64-linux-gnu.so,sha256=JVOUOyF3DAJxMNSEyNxvwAUWnoT6GE_Kqc84gusn4_Y,804616
30
+ qubx/core/series.cpython-311-x86_64-linux-gnu.so,sha256=Vu7JtSEeGsU1TXvUZ_qBzMBo9fam0l24GbO_xjONnVk,804616
31
31
  qubx/core/series.pxd,sha256=EqgYT41FrpVB274mDG3jpLCSqK_ykkL-d-1IH8DE1ik,3301
32
32
  qubx/core/series.pyi,sha256=T47k885QQ5E0UlxEgFn9Bvi_dnC_x8L0cG1Nf61iQ60,3173
33
33
  qubx/core/series.pyx,sha256=YbpZD28CgsRrqMXiVdBSGgzVXN4UxjkvUeCgvOa7Czo,33283
34
- qubx/core/utils.cpython-311-x86_64-linux-gnu.so,sha256=C6HgAct7HwoXmWeoE06p9DWGqX5tx-kchAekQY6HXFQ,82504
34
+ qubx/core/utils.cpython-311-x86_64-linux-gnu.so,sha256=yjhrrGn0Cl66-zZiYdwJq0d_tnh3CCoNFDVbwnfVDH8,82504
35
35
  qubx/core/utils.pyi,sha256=DAjyRVPJSxK4Em-9wui2F0yYHfP5tI5DjKavXNOnHa8,276
36
36
  qubx/core/utils.pyx,sha256=-8ek58CrbqWZq0-OY7WSREsCXBoBeWrD_wEYbIBS9rI,1696
37
37
  qubx/data/__init__.py,sha256=ZBIOlciDTD44xyCYAJOngxwqxrKSgwJYDpMQdecPUIQ,245
@@ -42,9 +42,9 @@ qubx/math/__init__.py,sha256=QRat0pqEqmbJF7CIHBuqnB1xUek4CsDDhv7SpgssnFw,57
42
42
  qubx/math/stats.py,sha256=OAovG31EDJjkTOV5aRC9W4MoquiW8U0BrahlysXP2EQ,3085
43
43
  qubx/pandaz/__init__.py,sha256=xlZvm48eBur0U7N4F4xTKqh7-n5fN0wghj1Tb8lCCNk,332
44
44
  qubx/pandaz/ta.py,sha256=NthiiueUoqWGRcjovcKKThcCcdImZn3JRdWDA2vL28k,85075
45
- qubx/pandaz/utils.py,sha256=21EXrSjAYaNEn-tbGPh3Vetu6iQNxqzW0hsiPNs9zag,22287
45
+ qubx/pandaz/utils.py,sha256=BkguW16JskO-Dqt5D4Xsye62Mbxo_XsfK_sXST3SlrI,22469
46
46
  qubx/ta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
- qubx/ta/indicators.cpython-311-x86_64-linux-gnu.so,sha256=aTUtwsQNjJ6uhylGHkURhGDW03MGkus8VI7fK4a6CmM,609640
47
+ qubx/ta/indicators.cpython-311-x86_64-linux-gnu.so,sha256=8qmd_Sy9d2-3Z5r50ybVtoiUcpC7o5cZGBV4p6STPPU,609640
48
48
  qubx/ta/indicators.pxd,sha256=eCJ9paOxtxbDFx4U5CUhcgB1jjCQAfVqMF2FnbJ03Lo,4222
49
49
  qubx/ta/indicators.pyi,sha256=NJlvN_774UV1U3_lvaYYbCEikLR8sOUo0TdcUGR5GBM,1940
50
50
  qubx/ta/indicators.pyx,sha256=FVkv5ld04TpZMT3a_kR1MU3IUuWfijzjJnh_lG78JxM,26029
@@ -58,14 +58,14 @@ qubx/utils/_pyxreloader.py,sha256=FyqGzfSpZGYziB8JYS5AP3cLRAvJSIPAKgwQn0E4YQ0,12
58
58
  qubx/utils/charting/lookinglass.py,sha256=VNSFVfEyAH6NbsvJYcbMvPyGRIRKtLTK1WQ-adH4qkA,39580
59
59
  qubx/utils/charting/mpl_helpers.py,sha256=z6vL0IllTZeD-Oe-alVW-kYOP_deHyyoFcukvOVwSz8,35354
60
60
  qubx/utils/collections.py,sha256=JWU3q3owLK0xEHXVyFCmNmvR8jKhYgcM2flOc0Iut2I,1935
61
- qubx/utils/marketdata/binance.py,sha256=36dl4rxOAGTeY3uoONmiPanj8BkP0oBdDiH-URJJo9A,10993
61
+ qubx/utils/marketdata/binance.py,sha256=_Hm2KtMFrUOguHlT3ZhRZFmoszG8ivRh72vCUZWhssU,11224
62
62
  qubx/utils/misc.py,sha256=QAHiyPRoHFYraHYfTNUJGQw1B-XgGHnpO81EsDUPYeE,11844
63
63
  qubx/utils/ntp.py,sha256=yNurgbdiqKhq_dVrJ5PRnho9SzT3ijQG-Bi2sDnFSLs,1904
64
64
  qubx/utils/orderbook.py,sha256=zkz3xKz_T8DF_qMk0449A31wRObl7kTBTnmU4BjnoEw,18449
65
65
  qubx/utils/runner.py,sha256=H0q7tI0Jtbo7wDeSe5henfqHUH2Z_10ExVefTLbJFPI,12555
66
66
  qubx/utils/threading.py,sha256=lXRAkTktV6W-awMcLzBjXQ9UMqJr_m3j6STAs0CqW9E,326
67
67
  qubx/utils/time.py,sha256=fIVWYRmqRT1zkLIWy9jo_Fpfpc03S0sYyOcrHZcfF74,5198
68
- qubx-0.4.2.dist-info/METADATA,sha256=7kRisovyyO7_g73Bk219eEdbg3eer2Yp8JwgWRoCqr4,2613
69
- qubx-0.4.2.dist-info/WHEEL,sha256=MLOa6LysROdjgj4FVxsHitAnIh8Be2D_c9ZSBHKrz2M,110
70
- qubx-0.4.2.dist-info/entry_points.txt,sha256=l9LSVnPyu0KY99qVMpw7agrPiuEU0qrSwcTFNUpxuoA,46
71
- qubx-0.4.2.dist-info/RECORD,,
68
+ qubx-0.4.3.dist-info/METADATA,sha256=CaXTJfIzONKpvraipjuFATqbfQ1iCVgi_uHgtU1b4HM,2613
69
+ qubx-0.4.3.dist-info/WHEEL,sha256=MLOa6LysROdjgj4FVxsHitAnIh8Be2D_c9ZSBHKrz2M,110
70
+ qubx-0.4.3.dist-info/entry_points.txt,sha256=l9LSVnPyu0KY99qVMpw7agrPiuEU0qrSwcTFNUpxuoA,46
71
+ qubx-0.4.3.dist-info/RECORD,,
File without changes