MATM / README.md
Changahou's picture
Screened A-share panel for the MambaATM rework
ab51070 verified
|
Raw History Blame Contribute Delete
5.14 kB
---
license: mit
configs:
- config_name: adj
data_files: data/adj/*.csv
- config_name: adj_unscreened
data_files: data/adj_unscreened/*.csv
---
# A-share daily quotes, screened panel for the MambaATM rework
Daily quotes for Chinese A-share stocks, retrieved through the public `baostock` interface and
screened for price-series integrity. The panel was built for a study of whether a hybrid of causal
attention and a selective state-space model can predict the daily direction of a stock, and it is
published so that the study's negative result can be checked and reused.
**This dataset replaces an earlier upload of the same name.** The earlier version held four unnamed
stocks with 2,435 rows each, of which 248 of 258 feature columns were constant, and its quoted return
column was uncorrelated with its own price columns. It is withdrawn and must not be used.
`CORRECTION.md` records what was wrong with it and how each defect was measured.
## Contents
| config | stocks | rows | what it is |
|---|---|---|---|
| `adj` | 232 | 610,988 | the screened panel the study uses |
| `adj_unscreened` | 240 | 628,554 | the same panel before screening, so the screen can be re-run |
One file per stock, named by exchange code, for example `000001.SZ.csv`. Both directories carry the
same ten columns, in this order, and the files are UTF-8 with a byte-order mark.
| column | meaning |
|---|---|
| `日期` | trading date |
| `当日开盘` | open |
| `收盘价` | close, forward adjusted for splits and distributions |
| `最高价` | high |
| `最低价` | low |
| `成交量` | volume, in shares |
| `成交额` | turnover value, in yuan |
| `涨跌幅` | quoted close-to-close return |
| `换手率` | turnover rate |
| `昨收` | previous close |
Prices are forward adjusted, so a return computed from two consecutive rows is the return an investor
would have received. The eight columns used as features are open, close, high, low, volume, turnover
value, turnover rate and previous close. The label in the study is the sign of the next trading day's
close-to-close return.
## How the panel was screened
The adjusted series of some stocks contains daily moves that A-shares cannot produce, either where a
stock was suspended and resumed into the delisting process so that the price limit does not span the
suspension, or where the adjustment factor breaks mid-series. Without a corporate-action database the
two cannot be told apart, and both leave a meaningless label, so the rule is the simple one in
`screen_panel.py`: a stock whose adjusted series contains any daily move beyond 25 per cent is
excluded in full.
Excluding the whole stock rather than the offending row is deliberate. Dropping an interior row
leaves the next return spanning a two-day gap, which manufactures a large spurious return, and that
is exactly the defect that made the earlier upload unusable. A whole-stock screen keeps every
remaining series continuous. Eight stocks were dropped for this reason, which is why `adj` has 232
files and `adj_unscreened` has 240.
Screening also drops the first row of each file, which has no previous close, and recomputes the
previous close and the quoted return from the adjusted close column so that every column agrees with
the price column.
## Caveats
Three things to know before reusing this data.
**Suspension days are still present.** A suspension day is a row with zero volume. There are 22,798
of them, 3.7 per cent of the rows, and they are removed inside the modelling pipeline rather than in
the files, so that the files remain exactly what was retrieved and screened. Their quoted return is
zero by construction, so leaving them in would both add untradable observations and push the label
distribution toward "down".
**The screen is survivorship-biased.** Stocks whose adjusted series contain an impossible move are
removed, and stocks that delisted during the sample are absent. That flatters every long-only
strategy including buy and hold, and the study says so in its conclusion.
**The rows do not all carry a usable label.** Of the 610,988 rows, 232 are the last row of a stock and
have no next-day return, 232 are the first row and have no quoted return, and 25 rows are both a
first row and a suspension day. 23,237 distinct rows are therefore removed before modelling and
587,751 usable stock-days remain.
## Usage
```python
import pandas as pd
d = pd.read_csv("000001.SZ.csv", encoding="utf-8-sig")
```
```python
from datasets import load_dataset
ds = load_dataset("Changahou/MATM", "adj")
```
## Code and the study
The code that builds the panel, screens it, trains the models and produces every table and figure is
at <https://github.com/ChenJiahaoJNU/Mamba_ATM>, together with the manuscript and a verification
record in which every check names the command that produced it. `screen_panel.py` is in
`code/panel/`. Running it on `adj_unscreened` reproduces `adj`.
## Licence
MIT for the files and the code in this repository. The quotes themselves come from the public
`baostock` interface and carry whatever terms that source imposes. Nothing here is investment advice.