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.3.tar.gz
(334.6 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.3.tar.gz.
File metadata
- Download URL: maoxianyong-0.1.3.tar.gz
- Upload date:
- Size: 334.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6d822979763cfd3769cedad2e11f1970f5595bbcffd4c38865f7a8c2e47e90a
|
|
| MD5 |
816b535ea93a5c87a871bf0115f340d5
|
|
| BLAKE2b-256 |
97364d3594ddbea530ea20ab1f34590dee0fddcb829de74c073a49b8984b5b50
|
File details
Details for the file maoxianyong-0.1.3-py3-none-any.whl.
File metadata
- Download URL: maoxianyong-0.1.3-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06d2c72d69696abab0e6a2f2951417bb04dd65489ae809bc5d0bdac5fe246fad
|
|
| MD5 |
8611c40fae55ab62f0fbaaacb0df3256
|
|
| BLAKE2b-256 |
87a6327d760f9078a9d0561760e10c9bdb1ad2dc4aceb58b529bb2a10d27a6e9
|