Skip to content

Commit

Permalink
Merge pull request #13 from noranhe/main
Browse files Browse the repository at this point in the history
[Mod] replace pytz + 更新版本号到1.0.2.2.6
  • Loading branch information
vnpy committed Jul 31, 2022
2 parents 4a54002 + 6764a58 commit ecaee3a
Show file tree
Hide file tree
Showing 5 changed files with 17 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 @@
# 1.0.2.2.6版本

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

# 1.0.2.2.5版本

1. 修复源码打包中缺少lib文件的问题
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</p>

<p align="center">
<img src ="https://img.shields.io/badge/version-1.0.2.2.5-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/version-1.0.2.2.6-blueviolet.svg"/>
<img src ="https://img.shields.io/badge/platform-windows|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 @@ -17,7 +17,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_esunny
version = 1.0.2.2.5
version = 1.0.2.2.6
url = https://www.vnpy.com
license = MIT
author = Xiaoyou Chen
Expand Down Expand Up @@ -32,6 +32,7 @@ classifiers =
packages = find:
include_package_data = True
zip_safe = False
python_requires = >=3.7
install_requires =
importlib_metadata

Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
def get_ext_modules() -> list:
"""
获取三方模块
Linux和Windows需要编译封装接口
Mac由于缺乏二进制库支持无法使用
"""
Expand All @@ -20,12 +19,16 @@ def get_ext_modules() -> list:
extra_link_args = ["-lstdc++"]
runtime_library_dirs = ["$ORIGIN"]
td_libraries = ["EsTdAPI", "TapTdAPI", "ITapSETdAPI", "ITapTdAPI", "TapDataCollectAPI"]
else:

elif platform.system() == "Windows":
extra_compile_flags = ["-O2"]
extra_link_args = []
runtime_library_dirs = []
td_libraries = ["EsTdAPI", "TapDataCollectAPI"]

else:
return []

vnesunnymd = Extension(
"vnpy_esunny.api.vnesunnymd",
[
Expand Down
7 changes: 3 additions & 4 deletions vnpy_esunny/gateway/esunny_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
from datetime import datetime
from pathlib import Path
from typing import Dict, Tuple, Any, List
import pytz

from vnpy.event import EventEngine
from vnpy.trader.utility import get_folder_path
from vnpy.trader.utility import get_folder_path, ZoneInfo
from vnpy.trader.constant import (
Exchange,
Product,
Expand Down Expand Up @@ -141,7 +140,7 @@
}

# 其他常量
CHINA_TZ = pytz.timezone("Asia/Shanghai") # 中国时区
CHINA_TZ = ZoneInfo("Asia/Shanghai") # 中国时区

# 合约数据全局缓存字典
commodity_infos: Dict[str, "CommodityInfo"] = {}
Expand Down Expand Up @@ -805,7 +804,7 @@ def generate_datetime(timestamp: str) -> datetime:
else:
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)
return dt


Expand Down

0 comments on commit ecaee3a

Please sign in to comment.