walrasquant-lib 0.4.23__tar.gz → 0.4.25__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.
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/PKG-INFO +4 -4
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/pyproject.toml +4 -4
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/aggregation.py +5 -2
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/backends/db_postgresql.py +9 -8
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/backends/db_sqlite.py +9 -8
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/api_client.py +10 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/connector.py +18 -8
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/ems.py +57 -329
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/oms.py +26 -17
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/retry.py +11 -5
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/sms.py +5 -5
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/ws_client.py +19 -12
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/config.py +8 -4
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/core/cache.py +17 -12
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/core/entity.py +12 -8
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/core/registry.py +5 -5
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/engine.py +62 -25
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/base_factory.py +1 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/connector.py +123 -68
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/ems.py +2 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/exchange.py +8 -5
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/factory.py +1 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/oms.py +44 -29
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/rest_api.py +4 -4
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/schema.py +25 -10
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/websockets.py +3 -3
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/connector.py +4 -4
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/ems.py +2 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/exchange.py +1 -1
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/factory.py +1 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/oms.py +65 -38
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/rest_api.py +8 -4
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/websockets.py +2 -2
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/connector.py +23 -14
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/ems.py +2 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/exchange.py +1 -1
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/factory.py +1 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/oms.py +41 -25
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/rest_api.py +4 -4
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/schema.py +12 -11
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/websockets.py +10 -8
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/connector.py +1 -1
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/ems.py +2 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/exchange.py +5 -2
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/factory.py +1 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/oms.py +42 -22
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/rest_api.py +7 -57
- walrasquant_lib-0.4.25/src/walrasquant/exchange/hyperliquid/signing.py +72 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/websockets.py +5 -55
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/connector.py +31 -22
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/ems.py +2 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/exchange.py +1 -1
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/factory.py +1 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/oms.py +43 -24
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/rest_api.py +8 -4
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/schema.py +0 -2
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/websockets.py +2 -2
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/registry.py +5 -2
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/execution/algorithm.py +43 -21
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/execution/algorithms/twap.py +48 -23
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/push.py +1 -1
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/schema.py +1 -1
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/strategy.py +56 -16
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/tools/pm2_wrapper.py +1 -1
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/README.md +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/backends/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/backends/db.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/backends/db_memory.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/base/exchange.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/constants.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/core/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/core/clock.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/core/connection.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/core/nautilius_core.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/error.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/constants.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/binance/error.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/constants.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/error.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bitget/schema.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/constants.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/bybit/error.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/constants.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/error.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/hyperliquid/schema.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/constants.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/exchange/okx/error.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/execution/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/execution/algorithms/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/execution/config.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/execution/constants.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/execution/schema.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/indicator.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/tools/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/web/__init__.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/web/app.py +0 -0
- {walrasquant_lib-0.4.23 → walrasquant_lib-0.4.25}/src/walrasquant/web/server.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: walrasquant-lib
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.25
|
|
4
4
|
Summary: fastest python trading bot
|
|
5
5
|
Author: River-Shi
|
|
6
6
|
Author-email: River-Shi <nachuan.shi.quant@gmail.com>
|
|
@@ -23,13 +23,13 @@ Requires-Dist: dynaconf[redis]>=3.2.12
|
|
|
23
23
|
Requires-Dist: aiohttp>=3.13.3
|
|
24
24
|
Requires-Dist: rich>=14.0.0
|
|
25
25
|
Requires-Dist: picows>=2.1.1
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist: nexuscore-lib>=0.2.0
|
|
26
|
+
Requires-Dist: nexuscore-lib>=0.2.1
|
|
28
27
|
Requires-Dist: flashduty-lib>=0.2.0
|
|
29
|
-
Requires-Dist: nexuslog-lib>=0.
|
|
28
|
+
Requires-Dist: nexuslog-lib>=0.7.0
|
|
30
29
|
Requires-Dist: msgspec>=0.21.1
|
|
31
30
|
Requires-Dist: pandas<3.0.0
|
|
32
31
|
Requires-Dist: numpy>=2.2.0
|
|
32
|
+
Requires-Dist: ccxt>=4.5.64
|
|
33
33
|
Requires-Python: >=3.11, <3.15
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "walrasquant-lib"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.25"
|
|
4
4
|
description = "fastest python trading bot"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "River-Shi",email = "nachuan.shi.quant@gmail.com"}
|
|
@@ -27,13 +27,13 @@ dependencies = [
|
|
|
27
27
|
"aiohttp>=3.13.3",
|
|
28
28
|
"rich>=14.0.0",
|
|
29
29
|
"picows>=2.1.1",
|
|
30
|
-
"
|
|
31
|
-
"nexuscore-lib>=0.2.0",
|
|
30
|
+
"nexuscore-lib>=0.2.1",
|
|
32
31
|
"flashduty-lib>=0.2.0",
|
|
33
|
-
"nexuslog-lib>=0.
|
|
32
|
+
"nexuslog-lib>=0.7.0",
|
|
34
33
|
"msgspec>=0.21.1",
|
|
35
34
|
"pandas<3.0.0",
|
|
36
35
|
"numpy>=2.2.0",
|
|
36
|
+
"ccxt>=4.5.64",
|
|
37
37
|
]
|
|
38
38
|
|
|
39
39
|
[project.scripts]
|
|
@@ -396,7 +396,10 @@ class TimeKlineAggregator(KlineAggregator):
|
|
|
396
396
|
callback=self._build_bar,
|
|
397
397
|
)
|
|
398
398
|
self._log.debug(
|
|
399
|
-
|
|
399
|
+
"Timer set: %s, start=%s, interval=%s",
|
|
400
|
+
self._timer_name,
|
|
401
|
+
start_time,
|
|
402
|
+
interval_td,
|
|
400
403
|
)
|
|
401
404
|
|
|
402
405
|
def _get_start_time(self):
|
|
@@ -446,4 +449,4 @@ class TimeKlineAggregator(KlineAggregator):
|
|
|
446
449
|
|
|
447
450
|
# # Build and send kline (only if trades were received)
|
|
448
451
|
self._build_and_send(ts_event, ts_init)
|
|
449
|
-
self._log.debug(
|
|
452
|
+
self._log.debug("Kline built: ts_event=%s, ts_init=%s", ts_event, ts_init)
|
|
@@ -139,7 +139,8 @@ class PostgreSQLBackend(StorageBackend):
|
|
|
139
139
|
str(symbol),
|
|
140
140
|
)
|
|
141
141
|
self._log.debug(
|
|
142
|
-
|
|
142
|
+
"Deleted %s stale positions from database",
|
|
143
|
+
len(positions_to_delete),
|
|
143
144
|
)
|
|
144
145
|
|
|
145
146
|
for symbol, position in mem_positions.copy().items():
|
|
@@ -219,7 +220,7 @@ class PostgreSQLBackend(StorageBackend):
|
|
|
219
220
|
return order
|
|
220
221
|
return None
|
|
221
222
|
except psycopg2.DatabaseError as error:
|
|
222
|
-
self._log.error(
|
|
223
|
+
self._log.error("Error getting order from PostgreSQL: %s", error)
|
|
223
224
|
return None
|
|
224
225
|
|
|
225
226
|
def get_symbol_orders(self, symbol: str) -> Set[str]:
|
|
@@ -277,9 +278,9 @@ class PostgreSQLBackend(StorageBackend):
|
|
|
277
278
|
serialized_value,
|
|
278
279
|
)
|
|
279
280
|
except msgspec.EncodeError as e:
|
|
280
|
-
self._log.error(
|
|
281
|
+
self._log.error("Error serializing parameter %s: %s", key, e)
|
|
281
282
|
except Exception as e:
|
|
282
|
-
self._log.error(
|
|
283
|
+
self._log.error("Error storing parameter %s: %s", key, e)
|
|
283
284
|
|
|
284
285
|
def get_param(self, key: str, default: Any = None) -> Any:
|
|
285
286
|
import msgspec
|
|
@@ -296,11 +297,11 @@ class PostgreSQLBackend(StorageBackend):
|
|
|
296
297
|
try:
|
|
297
298
|
return self._decode_param(row[0])
|
|
298
299
|
except msgspec.DecodeError as e:
|
|
299
|
-
self._log.error(
|
|
300
|
+
self._log.error("Error deserializing parameter %s: %s", key, e)
|
|
300
301
|
return default
|
|
301
302
|
return default
|
|
302
303
|
except Exception as e:
|
|
303
|
-
self._log.error(
|
|
304
|
+
self._log.error("Error getting parameter %s: %s", key, e)
|
|
304
305
|
return default
|
|
305
306
|
|
|
306
307
|
def get_all_params(self) -> Dict[str, Any]:
|
|
@@ -314,8 +315,8 @@ class PostgreSQLBackend(StorageBackend):
|
|
|
314
315
|
try:
|
|
315
316
|
params[row[0]] = self._decode_param(row[1])
|
|
316
317
|
except msgspec.DecodeError as e:
|
|
317
|
-
self._log.error(
|
|
318
|
+
self._log.error("Error deserializing parameter %s: %s", row[0], e)
|
|
318
319
|
cursor.close()
|
|
319
320
|
except Exception as e:
|
|
320
|
-
self._log.error(
|
|
321
|
+
self._log.error("Error getting all parameters: %s", e)
|
|
321
322
|
return params
|
|
@@ -142,7 +142,8 @@ class SQLiteBackend(StorageBackend):
|
|
|
142
142
|
[(symbol,) for symbol in positions_to_delete],
|
|
143
143
|
)
|
|
144
144
|
self._log.debug(
|
|
145
|
-
|
|
145
|
+
"Deleted %s stale positions from database",
|
|
146
|
+
len(positions_to_delete),
|
|
146
147
|
)
|
|
147
148
|
|
|
148
149
|
for symbol, position in mem_positions.copy().items():
|
|
@@ -217,7 +218,7 @@ class SQLiteBackend(StorageBackend):
|
|
|
217
218
|
return None
|
|
218
219
|
|
|
219
220
|
except sqlite3.Error as e:
|
|
220
|
-
self._log.error(
|
|
221
|
+
self._log.error("Error getting order from SQLite: %s", e)
|
|
221
222
|
return None
|
|
222
223
|
|
|
223
224
|
def get_symbol_orders(self, symbol: str) -> Set[str]:
|
|
@@ -269,9 +270,9 @@ class SQLiteBackend(StorageBackend):
|
|
|
269
270
|
(key, serialized_value),
|
|
270
271
|
)
|
|
271
272
|
except msgspec.EncodeError as e:
|
|
272
|
-
self._log.error(
|
|
273
|
+
self._log.error("Error serializing parameter %s: %s", key, e)
|
|
273
274
|
except sqlite3.Error as e:
|
|
274
|
-
self._log.error(
|
|
275
|
+
self._log.error("Error storing parameter %s: %s", key, e)
|
|
275
276
|
await self._async_conn.commit()
|
|
276
277
|
|
|
277
278
|
def get_param(self, key: str, default: Any = None) -> Any:
|
|
@@ -286,11 +287,11 @@ class SQLiteBackend(StorageBackend):
|
|
|
286
287
|
try:
|
|
287
288
|
return self._decode_param(row[0])
|
|
288
289
|
except msgspec.DecodeError as e:
|
|
289
|
-
self._log.error(
|
|
290
|
+
self._log.error("Error deserializing parameter %s: %s", key, e)
|
|
290
291
|
return default
|
|
291
292
|
return default
|
|
292
293
|
except sqlite3.Error as e:
|
|
293
|
-
self._log.error(
|
|
294
|
+
self._log.error("Error getting parameter %s: %s", key, e)
|
|
294
295
|
return default
|
|
295
296
|
|
|
296
297
|
def get_all_params(self) -> Dict[str, Any]:
|
|
@@ -304,7 +305,7 @@ class SQLiteBackend(StorageBackend):
|
|
|
304
305
|
try:
|
|
305
306
|
params[row[0]] = self._decode_param(row[1])
|
|
306
307
|
except msgspec.DecodeError as e:
|
|
307
|
-
self._log.error(
|
|
308
|
+
self._log.error("Error deserializing parameter %s: %s", row[0], e)
|
|
308
309
|
except sqlite3.Error as e:
|
|
309
|
-
self._log.error(
|
|
310
|
+
self._log.error("Error getting all parameters: %s", e)
|
|
310
311
|
return params
|
|
@@ -29,8 +29,18 @@ class ApiClient(ABC):
|
|
|
29
29
|
|
|
30
30
|
async def _init_session(self, base_url: str | None = None):
|
|
31
31
|
if self._session is None:
|
|
32
|
+
# The default TCPConnector drops idle connections after 15s and
|
|
33
|
+
# resolves DNS on a thread pool, so intermittent traders pay a
|
|
34
|
+
# fresh DNS + TCP + TLS handshake on the order path.
|
|
35
|
+
connector = aiohttp.TCPConnector(
|
|
36
|
+
limit=64,
|
|
37
|
+
ttl_dns_cache=300,
|
|
38
|
+
keepalive_timeout=60,
|
|
39
|
+
resolver=aiohttp.AsyncResolver(),
|
|
40
|
+
)
|
|
32
41
|
kwargs: Dict[str, Any] = {
|
|
33
42
|
"timeout": aiohttp.ClientTimeout(total=self._timeout),
|
|
43
|
+
"connector": connector,
|
|
34
44
|
}
|
|
35
45
|
if base_url:
|
|
36
46
|
kwargs["base_url"] = base_url
|
|
@@ -223,7 +223,7 @@ class PublicConnector(ABC):
|
|
|
223
223
|
self._add_aggregator(symbol, aggregator)
|
|
224
224
|
|
|
225
225
|
self._log.info(
|
|
226
|
-
|
|
226
|
+
"Time kline aggregator created for %s with interval %s", symbol, interval
|
|
227
227
|
)
|
|
228
228
|
|
|
229
229
|
def unsubscribe_kline_aggregator(
|
|
@@ -247,7 +247,9 @@ class PublicConnector(ABC):
|
|
|
247
247
|
aggregator.stop()
|
|
248
248
|
aggregators.remove(aggregator)
|
|
249
249
|
self._log.info(
|
|
250
|
-
|
|
250
|
+
"Time kline aggregator stopped for %s with interval %s",
|
|
251
|
+
symbol,
|
|
252
|
+
interval,
|
|
251
253
|
)
|
|
252
254
|
if not aggregators:
|
|
253
255
|
self._aggregators.pop(symbol, None)
|
|
@@ -275,7 +277,10 @@ class PublicConnector(ABC):
|
|
|
275
277
|
self._add_aggregator(symbol, aggregator)
|
|
276
278
|
|
|
277
279
|
self._log.info(
|
|
278
|
-
|
|
280
|
+
"Volume kline aggregator created for %s with threshold %s and type %s",
|
|
281
|
+
symbol,
|
|
282
|
+
volume_threshold,
|
|
283
|
+
volume_type,
|
|
279
284
|
)
|
|
280
285
|
|
|
281
286
|
def unsubscribe_volume_kline_aggregator(
|
|
@@ -296,7 +301,10 @@ class PublicConnector(ABC):
|
|
|
296
301
|
):
|
|
297
302
|
aggregators.remove(aggregator)
|
|
298
303
|
self._log.info(
|
|
299
|
-
|
|
304
|
+
"Volume kline aggregator stopped for %s with threshold %s and type %s",
|
|
305
|
+
symbol,
|
|
306
|
+
volume_threshold,
|
|
307
|
+
volume_type,
|
|
300
308
|
)
|
|
301
309
|
if not aggregators:
|
|
302
310
|
self._aggregators.pop(symbol, None)
|
|
@@ -690,7 +698,7 @@ class MockLinearConnector:
|
|
|
690
698
|
)
|
|
691
699
|
return order
|
|
692
700
|
except OrderError as e:
|
|
693
|
-
self._log.error(
|
|
701
|
+
self._log.error("Error creating order: %s", e)
|
|
694
702
|
return Order(
|
|
695
703
|
exchange=self._exchange_id,
|
|
696
704
|
timestamp=self._clock.timestamp_ms(),
|
|
@@ -726,7 +734,8 @@ class MockLinearConnector:
|
|
|
726
734
|
book = self._cache.bookl1(symbol)
|
|
727
735
|
if not book:
|
|
728
736
|
self._log.warning(
|
|
729
|
-
|
|
737
|
+
"Please subscribe to the `bookl1` data for %s or data not ready",
|
|
738
|
+
symbol,
|
|
730
739
|
)
|
|
731
740
|
continue
|
|
732
741
|
notional += float(position.amount) * book.mid
|
|
@@ -739,7 +748,8 @@ class MockLinearConnector:
|
|
|
739
748
|
book = self._cache.bookl1(symbol)
|
|
740
749
|
if not book:
|
|
741
750
|
self._log.warning(
|
|
742
|
-
|
|
751
|
+
"Please subscribe to the `bookl1` data for %s or data not ready",
|
|
752
|
+
symbol,
|
|
743
753
|
)
|
|
744
754
|
return
|
|
745
755
|
|
|
@@ -851,7 +861,7 @@ class MockLinearConnector:
|
|
|
851
861
|
self._apply_fee(order)
|
|
852
862
|
|
|
853
863
|
async def connect(self):
|
|
854
|
-
self._log.debug(
|
|
864
|
+
self._log.debug("Starting mock connector for %s", self._account_type)
|
|
855
865
|
await self._init_position()
|
|
856
866
|
await self._init_balance()
|
|
857
867
|
|