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.0.tar.gz (4.6 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.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vnpy_tqsdk_edb-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d04a9cd10c4d315c9000e5510f6bc556b2672d984764d1b67b3bc0bfa86b4e8a
MD5 d90a7eefebda2ed22b9594f98d8f66cb
BLAKE2b-256 f56248eba73a51d0e705385f4b4701cc8fa22af3dc1f4d5da57b600c672660c4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vnpy_tqsdk_edb-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c9e3fba2c36270c9d21e835887387ed787cbf0a911f2086437932b1aebee76d
MD5 69d0e8865bdbded8b845acab6ca48f5e
BLAKE2b-256 5a55a9ab41c9c7b7eb7b0286981cdc626b69e9256ebe0f0176a1deb0c17babb8

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