Skip to main content

Wind 数据本地转发 API 客户端 - 简单易用的 Wind 金融数据接口

Project description

Wind Linker

Wind 数据本地转发 API 客户端 - 简单易用,无需直接调用 HTTP 接口。

快速开始

1. 安装

cd wind_linker
pip install -e .

如果需要 pandas 支持:

pip install -e .[pandas]

2. 配置 API 地址

python -m wind_linker config http://192.168.10.10:10010

3. 使用

from wind_linker import w

# 获取历史数据
data = w.wsd("000001.SZ", "close", "2025-01-01", "2025-01-10")
print(data.Data)

# 转换为 DataFrame
df = data.to_df()
print(df)

使用示例

历史数据

from wind_linker import w

# 单字段
data = w.wsd("000001.SZ", "close", "2025-01-01", "2025-01-10")
df = data.to_df()

# 多字段
data = w.wsd("000001.SZ", "open,high,low,close,volume", "2025-01-01", "2025-01-10")
df = data.to_df()

# 多品种
data = w.wsd("000001.SZ,600000.SH", "close", "2025-01-01", "2025-01-10")
df = data.to_df()

分钟数据

data = w.wsi("000001.SZ", "close,volume", "2025-01-10 09:30:00", "2025-01-10 15:00:00")
df = data.to_df()

实时行情

data = w.wsq("000001.SZ,600000.SH", "rt_last,rt_vol")
df = data.to_df()

板块成分

data = w.wset("sectorconstituent", "date=2025-01-10;sectorid=a001010100000000")
df = data.to_df()

批量查询

results = w.batch([
    'w.wsd("000001.SZ", "close", "2025-01-01", "2025-01-10")',
    'w.wsd("600000.SH", "close", "2025-01-01", "2025-01-10")'
])

for result in results:
    print(result.to_df())

自定义代码

data = w.execute('w.wsd("000001.SZ", "close", "2025-01-01", "2025-01-10")')
df = data.to_df()

配置方式

方法 1: 命令行配置 (推荐)

python -m wind_linker config http://192.168.10.10:10010

方法 2: 环境变量

# Windows
set WIND_API_URL=http://192.168.10.10:10010

# Linux/Mac
export WIND_API_URL=http://192.168.10.10:10010

方法 3: 代码中指定

from wind_linker import WindAPI

w = WindAPI(base_url="http://192.168.10.10:10010")

API 参考

WindData 对象

返回的数据对象,包含以下属性:

  • ErrorCode: 错误码 (0 表示成功)
  • Codes: 股票代码列表
  • Fields: 字段列表
  • Times: 时间列表
  • Data: 数据列表
  • to_df(): 转换为 pandas DataFrame (需要安装 pandas)

WindAPI 方法

  • wsd(codes, fields, begin_time, end_time, options=""): 历史数据
  • wsi(codes, fields, begin_time, end_time, options=""): 分钟数据
  • wsq(codes, fields="rt_last"): 实时行情
  • wset(tablename, options=""): 板块成分
  • execute(code): 执行自定义代码
  • batch(codes): 批量执行
  • health(): 健康检查

许可证

MIT

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

wind_linker-1.0.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

wind_linker-1.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wind_linker-1.0.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wind_linker-1.0.0.tar.gz
Algorithm Hash digest
SHA256 39e8fc8f57d1cef54bd8a3a723a7351e3bf35610bef627ac7579e62bac0e8c07
MD5 ec7543441199e33fbafd8a9628cef2a3
BLAKE2b-256 18ff4c7493a5c97eb0f1cf874532c9a57c774c6e975f9ec3643f4153639ddb54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wind_linker-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wind_linker-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c082a363ded237e532e85ba64add8d752d452016bf94eb6e1bbcc75ab097a9c4
MD5 213f17b97d4b8513efaf185d44619062
BLAKE2b-256 37489ef7dd409ab7f9c7eae572103e226ed996050beac78294217db42afa6926

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