Metadata-Version: 2.1
Name: jing
Version: 0.6.3
Summary: Download stock data and perform data analisys
Author-email: sai <dawangfei@gmail.com>
License: MIT
Keywords: jing,sai,stock
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Provides-Extra: cos
Provides-Extra: s3
Provides-Extra: dev

# jing

`jing` downloads and organizes stock market data. The examples below use China A-share stocks with BaoStock.

## Install

```bash
pip install jing
```

## Download CN data

BaoStock is the default data source for CN. Stock codes must include an exchange prefix, such as `sh.` or `sz.`.

```python
import jing

d = jing.D("cn")
d.download("sz.000807")  # Download one stock
d.download()             # Download the stocks in the default list
```

Batch downloads use `~/data/jing/list/cn_baostock.txt` by default. On first use, `jing` copies the bundled list there; edit this copy to maintain your stock list.

## Download US data

US stocks use Yahoo Finance. Yahoo blocks many datacenter and mainland-China
IPs with 403/429, so on such hosts route the requests through a proxy:

```bash
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
```

```python
import jing

d = jing.D("us")
d.download("AAPL")   # one stock
d.download()         # batch from ~/data/jing/list/us.txt
```

Batch runs resume per stock: each CSV is the ledger, so a re-run after an
interruption only fetches what is still missing.

## File locations

The default data directory is `~/data/jing`:

```text
~/data/jing/
├── list/cn_baostock.txt
└── raw/baostock/cn/sz.000807.csv
```

Set `JING_DATA` to use another directory:

```bash
export JING_DATA=/data/stocks
```

Or set the data directory from Python:

```python
from jing.data_paths import set_data_root

set_data_root("/data/stocks")
```

The stock list and CSV files will then be stored under `/data/stocks/list/` and `/data/stocks/raw/baostock/cn/`.

## Documentation

See https://github.com/dawangfei/jing for the full documentation, including
COS upload and server deployment.
