Lixinger SDK for Python (Unofficial)
Project description
lixinger
理杏仁 Python SDK (非官方).
包含以下功能:
- 自动将请求结果转换结果为 Dataframe.
- 根据官方文档中的返回结果定义, 验证请求结果, 对缺少的列进行补齐, 对列类型进行相应转换.
- 支持一次性获取时间范围大于 10 年的数据.
- 适当缓存请求结果, 减少请求 API 次数.
- 遇到网络错误时, 自动重试请求.
安装
pip install lixinger
用法
设置 Token
Token 获取地址为 https://www.lixinger.com/open/api/token.
方式 1: 通过环境变量来设置 Token
export LIXINGER_TOKEN="你的 token"
方式 2: 通过配置文件来设置 Token
打开配置文件(路径为 ~/.config/lixinger/settings.toml), 并添加以下内容设置自己的 Token.
[default]
token = "你的 token"
调用 API
使用文档请参考 理杏仁开放平台.
方法导入路径可以根据文档中的请求 URL 得出, 例如下面代码中对应的请求 URL 为 /api/cn/company
则把 /
换成 .
即可.
from lixinger.api.cn.company.base import get_company
# 获取股票详细信息
company = get_company(stock_codes=["600519"])
print(company)
将会看到以下输出内容:
stock_code market ipo_date ... mutual_markets name fs_type
0 600519 a 2001-08-26 16:00:00 ... ha 贵州茅台 non_financial
[1 rows x 7 columns]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
lixinger-0.1.10-py3-none-any.whl
(21.8 kB
view hashes)
Close
Hashes for lixinger-0.1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25c8d2c67fc7011fd6c8bdd23fc236dc475a0eb4c0f59753eb7d41d3b9e8c329 |
|
MD5 | acd21411d1f3de19eb1a1f9e32e55c83 |
|
BLAKE2b-256 | e8e8f591774cc1b3d3d54c8a7f22ae9f648a411c64b6c16ef955c66fc67db351 |