Metadata-Version: 2.4
Name: maoxianyong
Version: 0.1.3
Summary: Unified stock data infrastructure for A-share, HK and US markets
Project-URL: Repository, https://github.com/jackmaoxianyong/data-lab
License: MIT
Keywords: akshare,finance,quant,stock,yfinance
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.11
Requires-Dist: duckdb>=1.5.3
Requires-Dist: pandas>=3.0.2
Requires-Dist: pyarrow>=24.0.0
Requires-Dist: python-dotenv>=1.2.2
Provides-Extra: research
Requires-Dist: backtrader>=1.9.78.123; extra == 'research'
Requires-Dist: ipykernel>=7.2.0; extra == 'research'
Requires-Dist: ipywidgets>=8.1.8; extra == 'research'
Requires-Dist: matplotlib>=3.10.9; extra == 'research'
Requires-Dist: mplfinance>=0.12.10b0; extra == 'research'
Requires-Dist: numpy>=2.4.4; extra == 'research'
Description-Content-Type: text/markdown

# maoxianyong

Unified stock data infrastructure for A-share, HK and US markets.

## Install

```bash
pip install maoxianyong
```

## Quick Start

```python
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)

```bash
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
```
