Skip to content

Commit

Permalink
[Mod] 版本号 + replace pytz + [Add] 增加Python版本限制
Browse files Browse the repository at this point in the history
  • Loading branch information
noranhe committed Jul 15, 2022
1 parent d8baf3b commit d4f57a5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 4.8.4版本

1. 使用zoneinfo替换pytz库
2. 调整安装脚本setup.cfg,添加Python版本限制

# 4.8.3版本

1. 调整接口初始化时,接口名称的赋值方式
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</p>

<p align="center">
<img src ="https://img.shields.io/badge/version-4.8.3-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/version-4.8.4-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/platform-linux-yellow.svg"/>
<img src ="https://img.shields.io/badge/python-3.7|3.8|3.9|3.10-blue.svg" />
<img src ="https://img.shields.io/github/license/vnpy/vnpy.svg?color=orange"/>
Expand All @@ -16,7 +16,7 @@

## 安装

安装环境推荐基于3.0.0版本以上的【[**VeighNa Studio**](https://www.vnpy.com)】。
安装环境推荐基于3.3.0版本以上的【[**VeighNa Studio**](https://www.vnpy.com)】。

直接使用pip命令:

Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = vnpy_sgit
version = 4.8.3
version = 4.8.4
url = https://www.vnpy.com
license = MIT
author = Xiaoyou Chen
Expand Down Expand Up @@ -31,6 +31,7 @@ classifiers =
packages = find:
include_package_data = True
zip_safe = False
python_requires = >=3.7
install_requires =
importlib_metadata

Expand Down
11 changes: 5 additions & 6 deletions vnpy_sgit/gateway/sgit_gateway.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
import pytz
from datetime import datetime
from typing import Dict, List
from pathlib import Path
Expand All @@ -26,7 +25,7 @@
CancelRequest,
SubscribeRequest,
)
from vnpy.trader.utility import get_folder_path
from vnpy.trader.utility import get_folder_path, ZoneInfo
from vnpy.trader.event import EVENT_TIMER

from ..api import (
Expand Down Expand Up @@ -135,7 +134,7 @@

# 其他常量
MAX_FLOAT: float = sys.float_info.max # 浮点数极限值
CHINA_TZ = pytz.timezone("Asia/Shanghai") # 中国时区
CHINA_TZ = ZoneInfo("Asia/Shanghai") # 中国时区

# 全局缓存字典
symbol_exchange_map: Dict[str, Exchange] = {}
Expand Down Expand Up @@ -299,7 +298,7 @@ def onRtnDepthMarketData(self, data: dict) -> None:

timestamp: str = f"{data['TradingDay']} {data['UpdateTime']}.{int(data['UpdateMillisec']/100)}"
dt: datetime = datetime.strptime(timestamp, "%Y%m%d %H:%M:%S.%f")
dt: datetime = CHINA_TZ.localize(dt)
dt: datetime = dt.replace(tzinfo=CHINA_TZ)

tick: TickData = TickData(
symbol=symbol,
Expand Down Expand Up @@ -622,7 +621,7 @@ def onRtnOrder(self, data: dict) -> None:
else:
timestamp: str = f"{data['InsertTime']}"
dt: datetime = datetime.strptime(timestamp, "%H:%M:%S")
dt: datetime = CHINA_TZ.localize(dt)
dt: datetime = dt.replace(tzinfo=CHINA_TZ)

order: OrderData = OrderData(
symbol=symbol,
Expand Down Expand Up @@ -658,7 +657,7 @@ def onRtnTrade(self, data: dict) -> None:
else:
timestamp: str = f"{data['TradeTime']}"
dt: datetime = datetime.strptime(timestamp, "%H:%M:%S")
dt: datetime = CHINA_TZ.localize(dt)
dt: datetime = dt.replace(tzinfo=CHINA_TZ)

trade: TradeData = TradeData(
symbol=symbol,
Expand Down

0 comments on commit d4f57a5

Please sign in to comment.