Skip to main content

vnpy使用天勤免费的EDB数据服务下载1分钟K线和日线数据

Project description

VnPy TQSdk EDB Datafeed

VnPy 的天勤 EDB 免费行情数据适配器。

功能特性

  • 支持从天勤 EDB 服务获取历史 K 线数据
  • 免费模式支持:
    • 日线数据:任意历史区间
    • 分钟线数据:最近 1 年
  • 支持多种时间周期:1分钟、日线

安装

安装环境推荐基于3.0.0版本以上的【VeighNa Studio】。

直接使用pip命令:

pip install vnpy_tqsdk_edb

或者下载源代码后,解压后在cmd中运行:

pip install -e .

VNPY桌面应用使用

在VeighNa中使用 vnpy_tqsdk_edb 时,需要在全局配置中填写以下字段信息:

名称 含义 必填
datafeed.name 名称 tqsdk_edb
datafeed.username 用户名
datafeed.password 密码

桌面应用使用截图

image.png

image.png

image.png

image.png

image.png

代码使用

from vnpy.trader.datafeed import get_datafeed
from vnpy.trader.object import HistoryRequest
from vnpy.trader.constant import Exchange, Interval
import datetime
# 获取数据源
datafeed = get_datafeed()

# 构造查询请求
req = HistoryRequest(
    symbol="ag2604",
    exchange=Exchange.SHFE,
    interval=Interval.DAILY,
    start=datetime.datetime(2026, 1, 1),
    end=datetime.datetime(2026, 2, 10)
)

# 查询历史数据
bars = datafeed.query_bar_history(req)
print(bars[0])

#打印结果如下:
BarData(gateway_name='EDB', extra=None, symbol='ag2604', exchange=<Exchange.SHFE: 'SHFE'>, datetime=datetime.datetime(2026, 1, 5, 0, 0, tzinfo=zoneinfo.ZoneInfo(key='Asia/Shanghai')), interval=<Interval.DAILY: 'd'>, volume=np.int64(671811), turnover=0, open_interest=np.int64(222892), open_price=np.int64(18200), high_price=np.int64(18399), low_price=np.int64(17926), close_price=np.int64(18247))

接口限制

免费访问限制(来自天勤 EDB 服务):

  • 日线数据:任意历史区间
  • 分钟线数据:最近 1 年

如需完整历史数据,请前往天勤官网购买专业版访问权限。

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vnpy_tqsdk_edb-1.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vnpy_tqsdk_edb-1.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file vnpy_tqsdk_edb-1.0.1.tar.gz.

File metadata

  • Download URL: vnpy_tqsdk_edb-1.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for vnpy_tqsdk_edb-1.0.1.tar.gz
Algorithm Hash digest
SHA256 95ef317fa0658a36d9da29b436207f4a808f5ca33c4d2001ff1656983ef99765
MD5 619f08933ce61f0e48372e7501fa2900
BLAKE2b-256 5cd321ce0372cc8e384aca38bcdb6b5990ef19f2dc2e5343f997989655ebf641

See more details on using hashes here.

File details

Details for the file vnpy_tqsdk_edb-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: vnpy_tqsdk_edb-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for vnpy_tqsdk_edb-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 526589d0fec0e9e37d0fe6e38f797c2a4021e478570006a73352f18c30db0d12
MD5 a5484c714b27bf34ceb4953903e7c308
BLAKE2b-256 176636832dce6c853bcdbd42b6718ea0e0dc2b9af21521744e455024318c2ff5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page