hyperquant 0.59__tar.gz → 0.61__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.
- {hyperquant-0.59 → hyperquant-0.61}/PKG-INFO +1 -1
- hyperquant-0.61/data/records_swap.csv +38 -0
- hyperquant-0.61/data/records_swapc.csv +50 -0
- {hyperquant-0.59 → hyperquant-0.61}/pyproject.toml +1 -1
- hyperquant-0.61/src/hyperquant/broker/edgex.py +183 -0
- hyperquant-0.61/src/hyperquant/broker/models/edgex.py +518 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/broker/models/ourbit.py +0 -1
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/broker/ws.py +10 -0
- hyperquant-0.61/tests/test_edgex.py +26 -0
- {hyperquant-0.59 → hyperquant-0.61}/tests/test_ourbit.py +4 -5
- {hyperquant-0.59 → hyperquant-0.61}/uv.lock +1 -1
- hyperquant-0.59/pnl_chart.html +0 -1268
- {hyperquant-0.59 → hyperquant-0.61}/.gitignore +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/.python-version +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/README.md +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/apis.json +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/backtest_tmp.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/data/alpine_smoke.log +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/data/logs/notikit.log +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/data/logs/test_order_sync.log +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/deals.json +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/pub.sh +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/requirements-dev.lock +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/requirements.lock +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/__init__.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/broker/auth.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/broker/hyperliquid.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/broker/lib/hpstore.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/broker/lib/hyper_types.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/broker/models/hyperliquid.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/broker/ourbit.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/core.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/datavison/_util.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/datavison/binance.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/datavison/coinglass.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/datavison/okx.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/db.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/draw.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/logkit.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/src/hyperquant/notikit.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/tests/test_draw.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/tests/test_lbank.py +0 -0
- {hyperquant-0.59 → hyperquant-0.61}/tests/tmp.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: hyperquant
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.61
|
4
4
|
Summary: A minimal yet hyper-efficient backtesting framework for quantitative trading
|
5
5
|
Project-URL: Homepage, https://github.com/yourusername/hyperquant
|
6
6
|
Project-URL: Issues, https://github.com/yourusername/hyperquant/issues
|
@@ -0,0 +1,38 @@
|
|
1
|
+
timestamp,symbol,direction,entry_price,entry_contracts,contract_sz,exit_price,exit_contracts,reason
|
2
|
+
1758131354316,DOLO_USDT,long,0.1592,75.0,1.0,0.15975,75.0,TIME HIT
|
3
|
+
1758131800371,RESOLV_USDT,short,0.1479,81.0,1.0,0.1476,81.0,TP HIT
|
4
|
+
1758132024899,COOKIE_USDT,short,0.1273,94.0,1.0,0.1286,94.0,TP HIT
|
5
|
+
1758132051084,HUMA_USDT,short,0.02573,46.0,10.0,0.02571,46.0,TP HIT
|
6
|
+
1758132059956,VET_USDT,long,0.02427,49.0,10.0,0.02427,49.0,TP HIT
|
7
|
+
1758132085989,DOLO_USDT,long,0.15892,75.0,1.0,0.1589,75.0,TP HIT
|
8
|
+
1758132091568,PROVE_USDT,long,0.8824,13.0,1.0,0.8826,13.0,TP HIT
|
9
|
+
1758132094699,INIT_USDT,long,0.3576,33.0,1.0,0.3585,33.0,TP HIT
|
10
|
+
1758132103982,ACX_USDT,long,0.1328,90.0,1.0,0.1331,90.0,TP HIT
|
11
|
+
1758132793877,LA_USDT,long,0.3609,33.0,1.0,0.3611,33.0,TP HIT
|
12
|
+
1758136338252,KERNEL_USDT,long,0.1921,62.0,1.0,0.1915,62.0,TIME HIT
|
13
|
+
1758136553105,KERNEL_USDT,long,0.1919,62.0,1.0,0.1929,62.0,TIME HIT
|
14
|
+
1758136741317,KERNEL_USDT,long,0.1932,62.0,1.0,0.1927,62.0,TIME HIT
|
15
|
+
1758136924406,KERNEL_USDT,long,0.1928,62.0,1.0,0.1926,62.0,TIME HIT
|
16
|
+
1758137111075,KERNEL_USDT,long,0.1928,62.0,1.0,0.1927,62.0,TIME HIT
|
17
|
+
1758137300837,KERNEL_USDT,long,0.193,62.0,1.0,0.194,62.0,TIME HIT
|
18
|
+
1758137529786,KERNEL_USDT,long,0.1943,61.0,1.0,0.1941,61.0,TIME HIT
|
19
|
+
1758138156477,KERNEL_USDT,long,0.1947,61.0,1.0,0.1947,61.0,TIME HIT
|
20
|
+
1758138395870,KERNEL_USDT,long,0.1949,61.0,1.0,0.1952,61.0,TIME HIT
|
21
|
+
1758138421445,KERNEL_USDT,long,0.1955,61.0,1.0,0.1961,61.0,SL HIT
|
22
|
+
1758138603263,KERNEL_USDT,long,0.1961,61.0,1.0,0.1969,61.0,TIME HIT
|
23
|
+
1758138789727,KERNEL_USDT,long,0.1966,61.0,1.0,0.1972,61.0,TIME HIT
|
24
|
+
1758138830481,KERNEL_USDT,long,0.1972,60.0,1.0,0.1977,60.0,SL HIT
|
25
|
+
1758138856972,KERNEL_USDT,long,0.1981,60.0,1.0,0.1982,60.0,SL HIT
|
26
|
+
1758139103876,KERNEL_USDT,long,0.198,60.0,1.0,0.1972,60.0,TIME HIT
|
27
|
+
1758139288089,KERNEL_USDT,long,0.1973,60.0,1.0,0.1987,60.0,TIME HIT
|
28
|
+
1758139478785,KERNEL_USDT,long,0.1987,60.0,1.0,0.1981,60.0,TIME HIT
|
29
|
+
1758139666469,KERNEL_USDT,long,0.1982,60.0,1.0,0.1992,60.0,TIME HIT
|
30
|
+
1758139889864,KERNEL_USDT,long,0.1994,60.0,1.0,0.2021,60.0,TIME HIT
|
31
|
+
1758140079535,KERNEL_USDT,long,0.2015,59.0,1.0,0.2025,59.0,TIME HIT
|
32
|
+
1758140272352,KERNEL_USDT,long,0.2025,59.0,1.0,0.2026,59.0,TIME HIT
|
33
|
+
1758140456287,KERNEL_USDT,long,0.2026,59.0,1.0,0.2025,59.0,TIME HIT
|
34
|
+
1758140640717,KERNEL_USDT,long,0.2025,59.0,1.0,0.2033,59.0,TIME HIT
|
35
|
+
1758140816822,KERNEL_USDT,long,0.2037,58.0,1.0,0.2059,58.0,SL HIT
|
36
|
+
1758140994381,KERNEL_USDT,long,0.206,58.0,1.0,0.2075,58.0,SL HIT
|
37
|
+
1758141770128,KERNEL_USDT,long,0.2022,59.0,1.0,0.2027,59.0,TP HIT
|
38
|
+
1758152737076,VET_USDT,short,0.02517,47.0,10.0,0.02515,47.0,TP HIT
|
@@ -0,0 +1,50 @@
|
|
1
|
+
timestamp,symbol,direction,entry_price,entry_contracts,contract_sz,exit_price,exit_contracts,reason
|
2
|
+
1758127742300,F_USDT,long,0.01867,64.0,10.0,0.01864,64.0,TP HIT
|
3
|
+
1758128281143,F_USDT,long,0.01842,65.0,10.0,0.01843,65.0,TP HIT
|
4
|
+
1758130842628,RESOLV_USDT,long,0.1474,81.0,1.0,0.1475,81.0,TP HIT
|
5
|
+
1758131030061,DOOD_USDT,short,0.004297,27.0,100.0,0.004291,27.0,TP HIT
|
6
|
+
1758132065200,AGT_USDT,short,0.006175,195.0,10.0,0.006189,195.0,TP HIT
|
7
|
+
1758132082858,BIO_USDT,short,0.15953,75.0,1.0,0.15876,75.0,TP HIT
|
8
|
+
1758132091939,XLM_USDT,long,0.38544,3.0,10.0,0.38631,3.0,TP HIT
|
9
|
+
1758132105929,YALA_USDT,short,0.148,81.0,1.0,0.1478,81.0,TP HIT
|
10
|
+
1758132112073,PLUME_USDT,long,0.11831,101.0,1.0,0.11904,101.0,TP HIT
|
11
|
+
1758132135460,IN_USDT,short,0.06489,18.0,10.0,0.0649,18.0,TP HIT
|
12
|
+
1758132140351,GUN_USDT,short,0.02599,46.0,10.0,0.02601,46.0,TP HIT
|
13
|
+
1758132165560,AI16Z_USDT,short,0.1123,106.0,1.0,0.1125,106.0,TP HIT
|
14
|
+
1758132174202,INIT_USDT,short,0.3592,33.0,1.0,0.3605,33.0,TP HIT
|
15
|
+
1758132177220,MOVE_USDT,long,0.1252,95.0,1.0,0.1258,95.0,TP HIT
|
16
|
+
1758132179041,ARC_USDT,short,0.02076,57.0,10.0,0.02076,57.0,SL HIT
|
17
|
+
1758132199046,USELESS_USDT,short,0.2187,54.0,1.0,0.2194,54.0,TP HIT
|
18
|
+
1758132240915,TA_USDT,long,0.11113,107.0,1.0,0.11095,107.0,TP HIT
|
19
|
+
1758132957868,USELESS_USDT,short,0.216,55.0,1.0,0.2161,55.0,TP HIT
|
20
|
+
1758133517302,LAUNCHCOIN_USDT,short,0.08501,14.0,10.0,0.08483,14.0,TP HIT
|
21
|
+
1758134779244,LAUNCHCOIN_USDT,long,0.08271,14.0,10.0,0.083,14.0,TP HIT
|
22
|
+
1758134949732,LAUNCHCOIN_USDT,short,0.08468,14.0,10.0,0.08447,14.0,TP HIT
|
23
|
+
1758135085694,USELESS_USDT,short,0.2173,55.0,1.0,0.217,55.0,TP HIT
|
24
|
+
1758135912414,KERNEL_USDT,short,0.1908,63.0,1.0,0.1906,63.0,TP HIT
|
25
|
+
1758137511945,DOOD_USDT,short,0.004411,27.0,100.0,0.004398,27.0,TP HIT
|
26
|
+
1758137855380,DOOD_USDT,long,0.004334,27.0,100.0,0.00435,27.0,TP HIT
|
27
|
+
1758140785015,DOOD_USDT,short,0.004376,27.0,100.0,0.004374,27.0,TP HIT
|
28
|
+
1758140871891,KERNEL_USDT,long,0.2083,57.0,1.0,0.2082,57.0,TP HIT
|
29
|
+
1758141156431,DOOD_USDT,short,0.004349,27.0,100.0,0.004338,27.0,TP HIT
|
30
|
+
1758141205990,DOOD_USDT,short,0.004329,27.0,100.0,0.004328,27.0,TP HIT
|
31
|
+
1758143858528,USELESS_USDT,long,0.2244,53.0,1.0,0.2251,53.0,TP HIT
|
32
|
+
1758145026924,LAUNCHCOIN_USDT,long,0.08684,13.0,10.0,0.08734,13.0,TP HIT
|
33
|
+
1758145705087,LAUNCHCOIN_USDT,short,0.08849,13.0,10.0,0.08817,13.0,TP HIT
|
34
|
+
1758145766769,DOOD_USDT,short,0.004341,27.0,100.0,0.004332,27.0,TP HIT
|
35
|
+
1758146013089,DOOD_USDT,long,0.004299,27.0,100.0,0.004313,27.0,TP HIT
|
36
|
+
1758147347733,DOOD_USDT,short,0.004336,27.0,100.0,0.004329,27.0,TP HIT
|
37
|
+
1758147802824,LAUNCHCOIN_USDT,long,0.09033,13.0,10.0,0.09067,13.0,TP HIT
|
38
|
+
1758148938162,DOOD_USDT,short,0.004359,27.0,100.0,0.004346,27.0,TP HIT
|
39
|
+
1758149565888,LAUNCHCOIN_USDT,short,0.09038,13.0,10.0,0.09043,13.0,TP HIT
|
40
|
+
1758149685658,DOOD_USDT,long,0.004368,27.0,100.0,0.004366,27.0,TP HIT
|
41
|
+
1758150463215,LAUNCHCOIN_USDT,short,0.09008,13.0,10.0,0.08968,13.0,TP HIT
|
42
|
+
1758150552216,LAUNCHCOIN_USDT,long,0.08895,13.0,10.0,0.08953,13.0,TP HIT
|
43
|
+
1758153615507,USELESS_USDT,long,0.232,51.0,1.0,0.2319,51.0,TP HIT
|
44
|
+
1758153790450,VINE_USDT,short,0.08327,14.0,10.0,0.08306,14.0,TP HIT
|
45
|
+
1758153891658,USELESS_USDT,long,0.2309,51.0,1.0,0.2309,51.0,TP HIT
|
46
|
+
1758153973913,NAORIS_USDT,short,0.05876,20.0,10.0,0.05878,20.0,TP HIT
|
47
|
+
1758154206740,VINE_USDT,long,0.0846,14.0,10.0,0.08456,14.0,TP HIT
|
48
|
+
1758154703995,VINE_USDT,short,0.08754,13.0,10.0,0.08665,13.0,TP HIT
|
49
|
+
1758156424415,VINE_USDT,long,0.08401,14.0,10.0,0.08404,14.0,TP HIT
|
50
|
+
1758157213849,VINE_USDT,long,0.08408,14.0,10.0,0.08405,14.0,TP HIT
|
@@ -0,0 +1,183 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import time
|
4
|
+
from typing import Any, Iterable, Literal
|
5
|
+
|
6
|
+
import pybotters
|
7
|
+
|
8
|
+
from .models.edgex import EdgexDataStore
|
9
|
+
|
10
|
+
|
11
|
+
class Edgex:
|
12
|
+
"""
|
13
|
+
Edgex 公共 API (HTTP/WS) 封装。
|
14
|
+
|
15
|
+
说明
|
16
|
+
- 当前仅包含公共行情数据(不包含私有接口)。
|
17
|
+
- 订单簿频道命名规则:``depth.{contractId}.{level}``。
|
18
|
+
成功订阅后,服务器会先推送一次完整快照(depthType=SNAPSHOT),之后持续推送增量(depthType=CHANGED)。
|
19
|
+
解析后的结果存入 ``EdgexDataStore.book``。
|
20
|
+
|
21
|
+
参数
|
22
|
+
- client: ``pybotters.Client`` 实例
|
23
|
+
- api_url: REST 基地址;默认使用 Edgex 官方 testnet 站点
|
24
|
+
- ws_url: WebSocket 基地址;如不提供,则默认使用官方文档地址。
|
25
|
+
"""
|
26
|
+
|
27
|
+
def __init__(
|
28
|
+
self,
|
29
|
+
client: pybotters.Client,
|
30
|
+
*,
|
31
|
+
api_url: str | None = None,
|
32
|
+
) -> None:
|
33
|
+
self.client = client
|
34
|
+
self.store = EdgexDataStore()
|
35
|
+
# 公共端点可能因环境/地区不同而变化,允许外部覆盖。
|
36
|
+
self.api_url = api_url or "https://pro.edgex.exchange"
|
37
|
+
self.ws_url = "wss://quote.edgex.exchange"
|
38
|
+
|
39
|
+
async def __aenter__(self) -> "Edgex":
|
40
|
+
# 初始化基础合约元数据,便于后续使用 tickSize 等字段。
|
41
|
+
await self.update_detail()
|
42
|
+
return self
|
43
|
+
|
44
|
+
async def __aexit__(
|
45
|
+
self,
|
46
|
+
exc_type: type[BaseException] | None,
|
47
|
+
exc: BaseException | None,
|
48
|
+
tb: BaseException | None,
|
49
|
+
) -> None:
|
50
|
+
# Edgex 当前没有需要关闭的资源;保持接口与 Ourbit 等类一致。
|
51
|
+
return None
|
52
|
+
|
53
|
+
async def update_detail(self) -> dict[str, Any]:
|
54
|
+
"""Fetch and cache contract metadata via the public REST endpoint."""
|
55
|
+
|
56
|
+
url = self._resolve_api_path("/api/v1/public/meta/getMetaData")
|
57
|
+
res = await self.client.get(url)
|
58
|
+
res.raise_for_status()
|
59
|
+
data = await res.json()
|
60
|
+
|
61
|
+
if data.get("code") != "SUCCESS": # pragma: no cover - defensive guard
|
62
|
+
raise RuntimeError(f"Failed to fetch Edgex metadata: {data}")
|
63
|
+
|
64
|
+
self.store._apply_metadata(data)
|
65
|
+
return data
|
66
|
+
|
67
|
+
def _resolve_api_path(self, path: str) -> str:
|
68
|
+
base = (self.api_url or "").rstrip("/")
|
69
|
+
return f"{base}{path}"
|
70
|
+
|
71
|
+
async def sub_orderbook(
|
72
|
+
self,
|
73
|
+
contract_ids: str | Iterable[str] | None = None,
|
74
|
+
*,
|
75
|
+
symbols: str | Iterable[str] | None = None,
|
76
|
+
level: int = 15,
|
77
|
+
ws_url: str | None = None,
|
78
|
+
) -> None:
|
79
|
+
"""订阅指定合约 ID 或交易对名的订单簿(遵循 Edgex 协议)。
|
80
|
+
|
81
|
+
规范
|
82
|
+
- 默认 WS 端点:wss://quote.edgex.exchange(可通过参数/实例覆盖)
|
83
|
+
- 每个频道的订阅报文:
|
84
|
+
{"type": "subscribe", "channel": "depth.{contractId}.{level}"}
|
85
|
+
- 服务端在订阅成功后,会先推送一次快照,再持续推送增量。
|
86
|
+
"""
|
87
|
+
|
88
|
+
ids: list[str] = []
|
89
|
+
if contract_ids is not None:
|
90
|
+
if isinstance(contract_ids, str):
|
91
|
+
ids.extend([contract_ids])
|
92
|
+
else:
|
93
|
+
ids.extend(contract_ids)
|
94
|
+
|
95
|
+
if symbols is not None:
|
96
|
+
if isinstance(symbols, str):
|
97
|
+
lookup_symbols = [symbols]
|
98
|
+
else:
|
99
|
+
lookup_symbols = list(symbols)
|
100
|
+
|
101
|
+
for symbol in lookup_symbols:
|
102
|
+
matches = self.store.detail.find({"contractName": symbol})
|
103
|
+
if not matches:
|
104
|
+
raise ValueError(f"Unknown Edgex symbol: {symbol}")
|
105
|
+
ids.append(str(matches[0]["contractId"]))
|
106
|
+
|
107
|
+
if not ids:
|
108
|
+
raise ValueError("contract_ids or symbols must be provided")
|
109
|
+
|
110
|
+
channels = [f"depth.{cid}.{level}" for cid in ids]
|
111
|
+
|
112
|
+
# 优先使用参数 ws_url,其次使用实例的 ws_url,最后使用默认地址。
|
113
|
+
url = f"{self.ws_url}/api/v1/public/ws?timestamp=" + str(int(time.time() * 1000))
|
114
|
+
|
115
|
+
# 根据文档:每个频道一条订阅指令,允许一次发送多个订阅对象。
|
116
|
+
payload = [{"type": "subscribe", "channel": ch} for ch in channels]
|
117
|
+
|
118
|
+
wsapp = self.client.ws_connect(url, send_json=payload, hdlr_json=self.store.onmessage)
|
119
|
+
# 等待 WS 完成握手再返回,确保订阅报文成功发送。
|
120
|
+
await wsapp._event.wait()
|
121
|
+
|
122
|
+
async def sub_ticker(
|
123
|
+
self,
|
124
|
+
contract_ids: str | Iterable[str] | None = None,
|
125
|
+
*,
|
126
|
+
symbols: str | Iterable[str] | None = None,
|
127
|
+
all_contracts: bool = False,
|
128
|
+
periodic: bool = False,
|
129
|
+
ws_url: str | None = None,
|
130
|
+
) -> None:
|
131
|
+
"""订阅 24 小时行情推送。
|
132
|
+
|
133
|
+
参数
|
134
|
+
- contract_ids / symbols: 指定单个或多个合约;二者至少提供一个。
|
135
|
+
- all_contracts: 订阅 ``ticker.all``(或 ``ticker.all.1s``)。
|
136
|
+
- periodic: 与 ``all_contracts`` 配合,true 则订阅 ``ticker.all.1s``。
|
137
|
+
"""
|
138
|
+
|
139
|
+
channels: list[str] = []
|
140
|
+
|
141
|
+
if all_contracts:
|
142
|
+
channel = "ticker.all.1s" if periodic else "ticker.all"
|
143
|
+
channels.append(channel)
|
144
|
+
else:
|
145
|
+
ids: list[str] = []
|
146
|
+
if contract_ids is not None:
|
147
|
+
if isinstance(contract_ids, str):
|
148
|
+
ids.append(contract_ids)
|
149
|
+
else:
|
150
|
+
ids.extend(contract_ids)
|
151
|
+
|
152
|
+
if symbols is not None:
|
153
|
+
if isinstance(symbols, str):
|
154
|
+
lookup_symbols = [symbols]
|
155
|
+
else:
|
156
|
+
lookup_symbols = list(symbols)
|
157
|
+
|
158
|
+
for symbol in lookup_symbols:
|
159
|
+
matches = self.store.detail.find({"contractName": symbol})
|
160
|
+
if not matches:
|
161
|
+
raise ValueError(f"Unknown Edgex symbol: {symbol}")
|
162
|
+
ids.append(str(matches[0]["contractId"]))
|
163
|
+
|
164
|
+
if not ids:
|
165
|
+
raise ValueError("Provide contract_ids/symbols or set all_contracts=True")
|
166
|
+
|
167
|
+
channels.extend(f"ticker.{cid}" for cid in ids)
|
168
|
+
|
169
|
+
url = ws_url or f"{self.ws_url}/api/v1/public/ws?timestamp=" + str(int(time.time() * 1000))
|
170
|
+
payload = [{"type": "subscribe", "channel": ch} for ch in channels]
|
171
|
+
|
172
|
+
wsapp = self.client.ws_connect(url, send_json=payload, hdlr_json=self.store.onmessage)
|
173
|
+
await wsapp._event.wait()
|
174
|
+
|
175
|
+
|
176
|
+
async def __aexit__(
|
177
|
+
self,
|
178
|
+
exc_type: type[BaseException] | None,
|
179
|
+
exc: BaseException | None,
|
180
|
+
tb: BaseException | None,
|
181
|
+
) -> None:
|
182
|
+
# Edgex 当前没有需要关闭的资源;保持接口与 Ourbit 等类一致。
|
183
|
+
return None
|