Unified stock data infrastructure for A-share, HK and US markets
Project description
maoxianyong
Unified stock data infrastructure for A-share, HK and US markets.
Install
pip install maoxianyong
Quick Start
from stock import StockReader, get_universe
reader = StockReader()
# Single stock
df = reader.get('NVDA.US', start='2024-01-01')
# Multi-stock wide table (for backtesting / correlation)
close = reader.get_wide(['NVDA.US', 'AMD.US', 'TSLA.US'], 'close', start='2024-01-01')
close.pct_change().corr()
# All US stocks
us = reader.get_market('US', start='2024-01-01')
# Custom SQL
reader.query("""
SELECT symbol, date, close,
close / LAG(close) OVER (PARTITION BY symbol ORDER BY date) - 1 AS ret
FROM {daily}
WHERE market = 'US'
ORDER BY symbol, date
""")
# Index constituents
symbols = get_universe('hs300') # CSI 300
symbols = get_universe('hsi') # Hang Seng Index
symbols = get_universe('us_core') # US tech + sector leaders
Data Sources
| Market | Source | Symbols |
|---|---|---|
| A-share | AKShare (Sina) | 600519.SH, 000001.SZ |
| HK | AKShare (Sina) | 00700.HK, 09988.HK |
| US | yfinance | AAPL.US, NVDA.US |
Cloud Sync (Aliyun OSS)
export DATA_SOURCE=oss
export OSS_KEY_ID=your-key
export OSS_KEY_SECRET=your-secret
export OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com
export OSS_BUCKET=your-bucket
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
maoxianyong-0.1.1.tar.gz
(332.1 kB
view details)
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 maoxianyong-0.1.1.tar.gz.
File metadata
- Download URL: maoxianyong-0.1.1.tar.gz
- Upload date:
- Size: 332.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd074767708237c34d9ebaf29bb85f480001b402a27f1278386e714d8639a087
|
|
| MD5 |
f9a6657a06a53ab3f58ac27771409425
|
|
| BLAKE2b-256 |
cc635d616fb1f6e5f342033e686f8d53bc1c7641f1b82280c63c47ac2b0c84cf
|
File details
Details for the file maoxianyong-0.1.1-py3-none-any.whl.
File metadata
- Download URL: maoxianyong-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ab2fc83f6b523c26e3720afcd783c3a799c7370c9b257d506fa74eb45d7e96e
|
|
| MD5 |
e56d8638cb9afff446c02b49e537675c
|
|
| BLAKE2b-256 |
0cb90509900618f905c9931bb65e76188314e3db573a6e1cb28ccdb4bad9df67
|