Qubx 0.6.24__cp312-cp312-manylinux_2_39_x86_64.whl → 0.6.25__cp312-cp312-manylinux_2_39_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.

@@ -170,7 +170,7 @@ class CcxtAccountProcessor(BasicAccountProcessor):
170
170
  self._instrument_to_last_price[instrument] = (time, extract_price(update))
171
171
  super().update_position_price(time, instrument, update)
172
172
 
173
- def get_total_capital(self) -> float:
173
+ def get_total_capital(self, exchange: str | None = None) -> float:
174
174
  # sum of balances + market value of all positions on non spot/margin
175
175
  _currency_to_value = {c: self._get_currency_value(b.total, c) for c, b in self._balances.items()}
176
176
  _positions_value = sum([p.market_value_funds for p in self._positions.values() if p.instrument.is_futures()])
qubx/core/interfaces.py CHANGED
@@ -1090,10 +1090,6 @@ class IStrategyContext(
1090
1090
  """Check if the strategy context is running."""
1091
1091
  return False
1092
1092
 
1093
- @property
1094
- def is_warmup(self) -> bool:
1095
- return self._strategy_state.is_warmup_in_progress
1096
-
1097
1093
  @property
1098
1094
  def is_simulation(self) -> bool:
1099
1095
  """Check if the strategy context is running in simulation mode."""
qubx/utils/questdb.py ADDED
@@ -0,0 +1,79 @@
1
+ from typing import Any, Dict, List, Optional, Union
2
+
3
+ import pandas as pd
4
+ import psycopg as pg
5
+ from psycopg.sql import SQL, Composed
6
+
7
+
8
+ class QuestDBClient:
9
+ """
10
+ A helper class for interacting with QuestDB.
11
+ """
12
+
13
+ def __init__(
14
+ self,
15
+ host: str = "nebula",
16
+ port: int = 8812,
17
+ user: str = "admin",
18
+ password: str = "quest",
19
+ dbname: Optional[str] = None,
20
+ ):
21
+ """
22
+ Initialize the QuestDB client.
23
+
24
+ Args:
25
+ host: The hostname of the QuestDB server
26
+ port: The port number for QuestDB PostgreSQL interface
27
+ user: The username for authentication
28
+ password: The password for authentication
29
+ dbname: Optional database name
30
+ """
31
+ conn_str = f"user={user} password={password} host={host} port={port}"
32
+ if dbname:
33
+ conn_str += f" dbname={dbname}"
34
+
35
+ self.conn_str = conn_str
36
+
37
+ def query(self, query: str, params: Optional[Dict[str, Any]] = None) -> pd.DataFrame:
38
+ """
39
+ Execute a SQL query and return the results as a pandas DataFrame.
40
+
41
+ Args:
42
+ query: The SQL query to execute
43
+ params: Optional parameters for the query
44
+
45
+ Returns:
46
+ A pandas DataFrame containing the query results
47
+ """
48
+ with pg.connect(self.conn_str) as conn:
49
+ with conn.cursor() as cursor:
50
+ cursor.execute(query, params)
51
+ if cursor.description: # Check if the query returns data
52
+ column_names = [desc.name for desc in cursor.description]
53
+ records = cursor.fetchall()
54
+ return pd.DataFrame(records, columns=column_names)
55
+ return pd.DataFrame()
56
+
57
+ def execute(self, query: str, params: Optional[Dict[str, Any]] = None) -> int:
58
+ """
59
+ Execute a SQL statement that doesn't return data (INSERT, UPDATE, etc.).
60
+
61
+ Args:
62
+ query: The SQL query to execute
63
+ params: Optional parameters for the query
64
+
65
+ Returns:
66
+ The number of rows affected
67
+ """
68
+ with pg.connect(self.conn_str) as conn:
69
+ with conn.cursor() as cursor:
70
+ cursor.execute(query, params)
71
+ conn.commit()
72
+ return cursor.rowcount
73
+
74
+ def __enter__(self):
75
+ """Context manager entry point."""
76
+ return self
77
+
78
+ def __exit__(self, exc_type, exc_val, exc_tb):
79
+ """Context manager exit point."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: Qubx
3
- Version: 0.6.24
3
+ Version: 0.6.25
4
4
  Summary: Qubx - Quantitative Trading Framework
5
5
  Author: Dmitry Marienko
6
6
  Author-email: dmitry.marienko@xlydian.com
@@ -18,7 +18,7 @@ qubx/cli/deploy.py,sha256=WfrEJ4n_e_xB6e1JstP2Rb4EGIxCftqG_flT03fjPXE,7595
18
18
  qubx/cli/misc.py,sha256=tP28QxLEzuP8R2xnt8g3JTs9Z7aYy4iVWY4g3VzKTsQ,14777
19
19
  qubx/cli/release.py,sha256=JYdNt_ZM9jarmYiRDtKqbRqqllzm2Qwi6VggokB2j8A,28167
20
20
  qubx/connectors/ccxt/__init__.py,sha256=HEQ7lM9HS8sED_zfsAHrhFT7F9E7NFGAecwZwNr-TDE,65
21
- qubx/connectors/ccxt/account.py,sha256=6VMWnpnjd1jocRO8AYGf0YXWZAf0uyYWJAFolUXq2wg,24279
21
+ qubx/connectors/ccxt/account.py,sha256=HILqsSPfor58NrlP0qYwO5lkNZzUBG-SR5Hy1OSa7_M,24308
22
22
  qubx/connectors/ccxt/broker.py,sha256=UMAytmDCwELUv4-R4WmrEQdPnZjjF89XlgJst15WVSs,15305
23
23
  qubx/connectors/ccxt/data.py,sha256=jd6jeygq_3j5D3JkzQu_D-6ft0O5X-hRF6_RBTgl_as,29970
24
24
  qubx/connectors/ccxt/exceptions.py,sha256=OfZc7iMdEG8uLorcZta2NuEuJrSIqi0FG7IICmwF54M,262
@@ -41,7 +41,7 @@ qubx/core/errors.py,sha256=kWCK6o0-mm87VUhhlGKqwTpvdDXAza7YRRjeyz-vwfI,609
41
41
  qubx/core/exceptions.py,sha256=11wQC3nnNLsl80zBqbE6xiKCqm31kctqo6W_gdnZkg8,581
42
42
  qubx/core/helpers.py,sha256=9nl9L_ZzT1HsMC9VthMqXfmuRS_37crB-9bVfIRHeOs,19631
43
43
  qubx/core/initializer.py,sha256=PUiD_cIjvGpuPjYyRpUjpwm3xNQ2Kipa8bAhbtxCQRo,3935
44
- qubx/core/interfaces.py,sha256=7LPM5iviSQ1id_zpaZJ9e1zEBYRMA-WJj-aQvmkA3IM,58061
44
+ qubx/core/interfaces.py,sha256=VKIgEhRaDj9EMf1UUcMlai2BLrw0UNPU1-2akU5q0Ng,57955
45
45
  qubx/core/loggers.py,sha256=eYhJANHYwz1heeFMa5V7jYCL196wkTSvj6c-8lkPj1Y,19567
46
46
  qubx/core/lookups.py,sha256=n5ZjjEhhRvmidCB-Cubr1b0Opm6lf_QVZNEWa_BOQG0,19376
47
47
  qubx/core/metrics.py,sha256=5zdr4uBJJTVf-X2L_7dhfFZOlYNLP1_idETGoZqxdbg,57913
@@ -51,11 +51,11 @@ qubx/core/mixins/processing.py,sha256=dqehukrfqcLy5BeILKnkpHCvva4SbLKj1ZbQdnByu1
51
51
  qubx/core/mixins/subscription.py,sha256=V_g9wCPQ8S5SHkU-qOZ84cV5nReAUrV7DoSNAGG0LPY,10372
52
52
  qubx/core/mixins/trading.py,sha256=6XK712ZHECZnI-lleJfQ8taXfaBagPQBVqNoBxAkEyM,7204
53
53
  qubx/core/mixins/universe.py,sha256=L3s2Jw46_J1iDh4622Gk_LvCjol4W7mflBwEHrLfZEw,9899
54
- qubx/core/series.cpython-312-x86_64-linux-gnu.so,sha256=67Wl9WOJ06hjtML76K-DyJv1X_lzVKlz7setWlILbC4,978280
54
+ qubx/core/series.cpython-312-x86_64-linux-gnu.so,sha256=bqJvlxi68V0rBU2fL_iZo8T36eNLO7oXfJZC2itR0QY,978280
55
55
  qubx/core/series.pxd,sha256=jBdMwgO8J4Zrue0e_xQ5RlqTXqihpzQNu6V3ckZvvpY,3978
56
56
  qubx/core/series.pyi,sha256=RaHm_oHHiWiNUMJqVfx5FXAXniGLsHxUFOUpacn7GC0,4604
57
57
  qubx/core/series.pyx,sha256=7cM3zZThW59waHiYcZmMxvYj-HYD7Ej_l7nKA4emPjE,46477
58
- qubx/core/utils.cpython-312-x86_64-linux-gnu.so,sha256=Qz_FOPzmW2pgNR94cpLS6W1tZwCcWaFerjhTGBHsFVc,86568
58
+ qubx/core/utils.cpython-312-x86_64-linux-gnu.so,sha256=F6rvr0qj0R0CDr3ysek7KdCZz8QNL-0fbuvrkGRQUTw,86568
59
59
  qubx/core/utils.pyi,sha256=a-wS13V2p_dM1CnGq40JVulmiAhixTwVwt0ah5By0Hc,348
60
60
  qubx/core/utils.pyx,sha256=k5QHfEFvqhqWfCob89ANiJDKNG8gGbOh-O4CVoneZ8M,1696
61
61
  qubx/data/__init__.py,sha256=ELZykvpPGWc5rX7QoNyNQwMLgdKMG8MACOByA4pM5hA,549
@@ -116,7 +116,7 @@ qubx/restorers/signal.py,sha256=DBLqA7vDhoMTAzUC4N9UerrO0GbjeHdTeMoCz7U7iI8,6621
116
116
  qubx/restorers/state.py,sha256=duXyEHQhS1zdNdo3VKscMhieZ5sYNlfE4S_pPXQ1Tuw,4109
117
117
  qubx/restorers/utils.py,sha256=We2gfqwQKWziUYhuUnjb-xo-5tSlbuHWpPQn0CEMTn0,1155
118
118
  qubx/ta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
119
- qubx/ta/indicators.cpython-312-x86_64-linux-gnu.so,sha256=sjOXYIOmm3Jv8xFOMno4d6LLfvzHOANN4VBzIHluLbU,654440
119
+ qubx/ta/indicators.cpython-312-x86_64-linux-gnu.so,sha256=lVJu6JxBLhYMT4gPXcRE17VXxBRx1FbOGz-nraw70MQ,654440
120
120
  qubx/ta/indicators.pxd,sha256=Goo0_N0Xnju8XGo3Xs-3pyg2qr_0Nh5C-_26DK8U_IE,4224
121
121
  qubx/ta/indicators.pyi,sha256=19W0uERft49In5bf9jkJHkzJYEyE9gzudN7_DJ5Vdv8,1963
122
122
  qubx/ta/indicators.pyx,sha256=Xgpew46ZxSXsdfSEWYn3A0Q35MLsopB9n7iyCsXTufs,25969
@@ -144,6 +144,7 @@ qubx/utils/plotting/data.py,sha256=ZOg8rHAq4NVmfsyhvzFHtey4HaXywAHufxhv1IExRqg,4
144
144
  qubx/utils/plotting/interfaces.py,sha256=mtRcoWIMt2xkv-Tc2ZgXZQpr5HRiWhPcqkIslzZTeig,493
145
145
  qubx/utils/plotting/renderers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
146
  qubx/utils/plotting/renderers/plotly.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
+ qubx/utils/questdb.py,sha256=TdjmlGPoZXdjidZ_evcBIkFtoL4nGQXPR4IQSUc6IvA,2509
147
148
  qubx/utils/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
148
149
  qubx/utils/runner/_jupyter_runner.pyt,sha256=41dLQeI2EL4wJjBDht2qKbgISgS5DtmJ6XtPWE9NWGs,9243
149
150
  qubx/utils/runner/accounts.py,sha256=mpiv6oxr5z97zWt7STYyARMhWQIpc_XFKungb_pX38U,3270
@@ -152,8 +153,8 @@ qubx/utils/runner/factory.py,sha256=vQ2dBTbrQE9YH__-TvuFzGF-E1li-vt_qQum9GHa11g,
152
153
  qubx/utils/runner/runner.py,sha256=iJsxTU9ne43Seh5rMfZLrXnV-RtA4BwzZYsjHeXajLs,29067
153
154
  qubx/utils/time.py,sha256=J0ZFGjzFL5T6GA8RPAel8hKG0sg2LZXeQ5YfDCfcMHA,10055
154
155
  qubx/utils/version.py,sha256=e52fIHyxzCiIuH7svCF6pkHuDlqL64rklqz-2XjWons,5309
155
- qubx-0.6.24.dist-info/LICENSE,sha256=qwMHOSJ2TD0nx6VUJvFhu1ynJdBfNozRMt6tnSul-Ts,35140
156
- qubx-0.6.24.dist-info/METADATA,sha256=a1xxO3N6ZoCPIFcXEX7jGWX7bpEGVUVLPReKALfLbSw,4444
157
- qubx-0.6.24.dist-info/WHEEL,sha256=XjdW4AGUgFDhpG9b3b2KPhtR_JLZvHyfemLgJJwcqOI,110
158
- qubx-0.6.24.dist-info/entry_points.txt,sha256=VqilDTe8mVuV9SbR-yVlZJBTjbkHIL2JBgXfQw076HY,47
159
- qubx-0.6.24.dist-info/RECORD,,
156
+ qubx-0.6.25.dist-info/LICENSE,sha256=qwMHOSJ2TD0nx6VUJvFhu1ynJdBfNozRMt6tnSul-Ts,35140
157
+ qubx-0.6.25.dist-info/METADATA,sha256=mjOUxG8gi09VJoA6au3UBwdG-yP5I1ZwxUazBZEsNLk,4444
158
+ qubx-0.6.25.dist-info/WHEEL,sha256=XjdW4AGUgFDhpG9b3b2KPhtR_JLZvHyfemLgJJwcqOI,110
159
+ qubx-0.6.25.dist-info/entry_points.txt,sha256=VqilDTe8mVuV9SbR-yVlZJBTjbkHIL2JBgXfQw076HY,47
160
+ qubx-0.6.25.dist-info/RECORD,,
File without changes
File without changes