Python SDK for Lixinger Financial Data API
Project description
This is the python SDK of lixinger API. Lixinger is a website of financial data.
Installation
From PyPI (Recommended)
# Using pip
pip install lixinger-python
# Using uv (faster)
uv add lixinger-python
From Source (Development)
# Clone the repository
git clone https://github.com/your-username/lixinger-python.git
cd lixinger-python
# Install dependencies
uv sync
Configuration
REQUIRED: The SDK requires the API key to be set in a .env file. The API key cannot be passed as a parameter.
# Copy the example file
cp .env.example .env
# Edit .env and add your API key
# LIXINGER_API_KEY=your_actual_api_key_here
Get your API key from: https://www.lixinger.com/open/api
Usage
from lixinger import LixingerClient
# The API key is ALWAYS loaded from .env file
# You cannot pass it as a parameter - this is intentional for security
client = LixingerClient()
try:
# Fetch company information
df = client.company.get_company(stock_codes=["600036"])
print(df)
# Fetch company profile
df_profile = client.company.get_profile(stock_codes=["600036"])
print(df_profile)
finally:
client.close()
# Or use context manager (recommended)
with LixingerClient() as client:
df = client.company.get_company(stock_codes=["000001"])
print(df)
# You can override other settings (but NOT the API key)
with LixingerClient(timeout=60.0, proxy="socks5://localhost:1080") as client:
df = client.company.get_company(stock_codes=["000001"])
print(df)
For more examples, see the examples/ directory.
Project Structure
The project follows an endpoint-based file organization:
lixinger/
├── api/cn/
│ ├── company/ # /cn/company endpoints
│ └── index/ # /cn/index endpoints
└── models/cn/ # Models mirror API structure
├── company/
└── index/
Import Examples:
# Functional API (recommended for quick usage)
from lixinger import get_company, get_index
# Client API
from lixinger import LixingerClient
# Models (if needed)
from lixinger.models.cn.company import Company
from lixinger.models.cn.index import Index
See AGENTS.md for detailed file organization rules.
Documentation
- 📚 完整文档: 运行
uv run mkdocs serve启动本地文档站点 - 📖 API 参考: 查看
docs/api/目录或 API_SUMMARY.md - 🚀 快速开始: 查看 docs/getting-started/quickstart.md
文档特性
本项目使用 MkDocs + Material 主题 自动生成文档,特性包括:
- ✨ 从 Python docstrings 自动生成 API 文档
- 🎨 美观的 Material Design 界面
- 🔍 全文搜索功能(支持中英文)
- 🌓 深色/浅色主题切换
- 📱 响应式设计,支持移动端
生成和预览文档
# 安装文档依赖
uv sync --dev
# 启动本地文档服务器(支持热重载)
uv run mkdocs serve
# 访问 http://127.0.0.1:8000
# 构建静态站点
uv run mkdocs build
# 部署到 GitHub Pages
uv run mkdocs gh-deploy
详细说明请查看 DOCS.md。
API Notes
Notes when using the API:
- Set Content-Type to application/json in the request headers.
- The accept-encoding in request headers must include gzip, other options can be deflate, br, *.
- The maximum number of requests per minute is 1000. If it exceeds 1000, the request will fail and return status code 429 (Too Many Requests).
- Crawlers generally need to have a retry mechanism to avoid the crawler crashing when network issues or other unknown problems occur.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lixinger_python-0.1.2.tar.gz.
File metadata
- Download URL: lixinger_python-0.1.2.tar.gz
- Upload date:
- Size: 783.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c7a92cd3a8b32aaba2c75ad53f820a7b62ea083296b959e2600e67ca0e1108f
|
|
| MD5 |
f382bd263e4475a61b63ebbd3c35fe26
|
|
| BLAKE2b-256 |
64aaade83e391b988cfa8a5a06c8832e1ad564af2f81b9fa5aa2a41d2e2ea43f
|
File details
Details for the file lixinger_python-0.1.2-py3-none-any.whl.
File metadata
- Download URL: lixinger_python-0.1.2-py3-none-any.whl
- Upload date:
- Size: 48.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49ce32d63eb04bd76f3731e83f0d2874e761d814f95292de52f86b591927755e
|
|
| MD5 |
4195de0fd7c98ba37edf66fba8709078
|
|
| BLAKE2b-256 |
3319bc79ba94bba5869aaa0c7ce855748f152931efa62324dfcd979471c54ed4
|