vnpy-xtdata 2.0.0__tar.gz → 2.0.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vnpy_xtdata
3
- Version: 2.0.0
3
+ Version: 2.0.3
4
4
  Summary: Xtquant datafeed/pub interface.
5
5
  Author-email: YQ Tsui <qianyun210603@hotmail.com>
6
6
  License-Expression: MIT
@@ -28,15 +28,15 @@ Requires-Dist: setuptools>=64; extra == "dev"
28
28
  Requires-Dist: wheel; extra == "dev"
29
29
  Dynamic: license-file
30
30
 
31
- <h1 align="center">VeighNa框架的迅投数据服务接口</h1>
31
+ <h1 style="text-align: center;">VeighNa框架的迅投数据服务接口</h1>
32
32
 
33
33
  ***
34
34
 
35
- <p align="center">
36
- <img src ="https://img.shields.io/badge/version-2.0.0-blueviolet.svg"/>
37
- <img src ="https://img.shields.io/badge/platform-windows-yellow.svg"/>
38
- <img src ="https://img.shields.io/badge/python-3.11|3.12|3.13-blue.svg" />
39
- <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
35
+ <p style="text-align: center;">
36
+ <img src ="https://img.shields.io/badge/version-2.0.3-blueviolet.svg" alt="version"/>
37
+ <img src ="https://img.shields.io/badge/platform-windows-yellow.svg" alt="platform"/>
38
+ <img src ="https://img.shields.io/badge/python-3.11|3.12|3.13-blue.svg" alt="python"/>
39
+ <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange" alt="license"/>
40
40
  </p>
41
41
 
42
42
  ## 说明
@@ -1,12 +1,12 @@
1
- <h1 align="center">VeighNa框架的迅投数据服务接口</h1>
1
+ <h1 style="text-align: center;">VeighNa框架的迅投数据服务接口</h1>
2
2
 
3
3
  ***
4
4
 
5
- <p align="center">
6
- <img src ="https://img.shields.io/badge/version-2.0.0-blueviolet.svg"/>
7
- <img src ="https://img.shields.io/badge/platform-windows-yellow.svg"/>
8
- <img src ="https://img.shields.io/badge/python-3.11|3.12|3.13-blue.svg" />
9
- <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
5
+ <p style="text-align: center;">
6
+ <img src ="https://img.shields.io/badge/version-2.0.3-blueviolet.svg" alt="version"/>
7
+ <img src ="https://img.shields.io/badge/platform-windows-yellow.svg" alt="platform"/>
8
+ <img src ="https://img.shields.io/badge/python-3.11|3.12|3.13-blue.svg" alt="python"/>
9
+ <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange" alt="license"/>
10
10
  </p>
11
11
 
12
12
  ## 说明
@@ -67,7 +67,7 @@ CHINA_TZ = ZoneInfo("Asia/Shanghai") # 中国时区
67
67
 
68
68
 
69
69
  # 全局缓存字典
70
- symbol_contract_map: dict[(str, Exchange), ContractData] = {} # 合约数据
70
+ symbol_contract_map: dict[tuple[str, Exchange], ContractData] = {} # 合约数据
71
71
  symbol_limit_map: dict[str, tuple[float, float]] = {} # 涨跌停价
72
72
  account_type_symbol_map: dict[str, set[tuple[str, Exchange]]] = {} # 账号类型对应的合约代码
73
73
 
@@ -167,6 +167,11 @@ class XtMdApi:
167
167
 
168
168
  def remove_gateway(self, gateway: XtGatewayBase) -> None:
169
169
  """移除网关"""
170
+ for key in list(self.gateway_subscriptions.keys()):
171
+ if gateway.gateway_name in self.gateway_subscriptions[key]:
172
+ self.gateway_subscriptions[key].discard(gateway.gateway_name)
173
+ if not self.gateway_subscriptions[key]:
174
+ self.gateway_subscriptions.pop(key)
170
175
  self.gateways.pop(gateway.gateway_name, None)
171
176
  self.account_types_required[gateway.account_type].discard(gateway.gateway_name)
172
177
  if not self.account_types_required[gateway.account_type]:
@@ -252,10 +257,11 @@ class XtMdApi:
252
257
  def distribute_ticks(tick: TickData) -> None:
253
258
  """分发Tick数据到关联网关"""
254
259
  for gateway_name in self.gateway_subscriptions.get((tick.symbol, tick.exchange), set()):
255
- gateway = self.gateways[gateway_name]
256
- gw_tick = deepcopy(tick)
257
- gw_tick.gateway_name = gateway_name
258
- gateway.on_tick(gw_tick)
260
+ gateway = self.gateways.get(gateway_name, None)
261
+ if gateway is not None:
262
+ gw_tick = deepcopy(tick)
263
+ gw_tick.gateway_name = gateway_name
264
+ gateway.on_tick(gw_tick)
259
265
 
260
266
  for xt_symbol, buf in data.items():
261
267
  if isinstance(buf, dict):
@@ -390,7 +396,10 @@ class XtMdApi:
390
396
  ):
391
397
  gateway.write_log(f"{gateway.account_type}合约信息已经查询,复用历史数据")
392
398
  for key in account_type_symbol_map[gateway.account_type]:
393
- contract = symbol_contract_map[key]
399
+ contract = deepcopy(symbol_contract_map[key])
400
+ contract.gateway_name = gateway.gateway_name
401
+ if gateway.gateway_name not in contract.gateway_names:
402
+ contract.gateway_names.append(gateway.gateway_name)
394
403
  gateway.on_contract(contract)
395
404
  gateway.write_log("合约信息查询成功")
396
405
  gateway.on_contract_ready()
@@ -616,7 +625,7 @@ class XtMdApi:
616
625
 
617
626
  # 筛选期权合约合约(ETF期权代码为8位)
618
627
  if len(symbol) != 8:
619
- return None
628
+ return
620
629
 
621
630
  # 查询转换数据
622
631
  data: dict = xtdata.get_instrument_detail(xt_symbol, True)
@@ -627,7 +636,7 @@ class XtMdApi:
627
636
  elif "沽" in name:
628
637
  option_type = OptionType.PUT
629
638
  else:
630
- return None
639
+ return
631
640
 
632
641
  if "A" in name:
633
642
  option_index = str(data["OptExercisePrice"]) + "-A"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vnpy_xtdata
3
- Version: 2.0.0
3
+ Version: 2.0.3
4
4
  Summary: Xtquant datafeed/pub interface.
5
5
  Author-email: YQ Tsui <qianyun210603@hotmail.com>
6
6
  License-Expression: MIT
@@ -28,15 +28,15 @@ Requires-Dist: setuptools>=64; extra == "dev"
28
28
  Requires-Dist: wheel; extra == "dev"
29
29
  Dynamic: license-file
30
30
 
31
- <h1 align="center">VeighNa框架的迅投数据服务接口</h1>
31
+ <h1 style="text-align: center;">VeighNa框架的迅投数据服务接口</h1>
32
32
 
33
33
  ***
34
34
 
35
- <p align="center">
36
- <img src ="https://img.shields.io/badge/version-2.0.0-blueviolet.svg"/>
37
- <img src ="https://img.shields.io/badge/platform-windows-yellow.svg"/>
38
- <img src ="https://img.shields.io/badge/python-3.11|3.12|3.13-blue.svg" />
39
- <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
35
+ <p style="text-align: center;">
36
+ <img src ="https://img.shields.io/badge/version-2.0.3-blueviolet.svg" alt="version"/>
37
+ <img src ="https://img.shields.io/badge/platform-windows-yellow.svg" alt="platform"/>
38
+ <img src ="https://img.shields.io/badge/python-3.11|3.12|3.13-blue.svg" alt="python"/>
39
+ <img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange" alt="license"/>
40
40
  </p>
41
41
 
42
42
  ## 说明
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes