quantinvbench / README.md
anonymous-quantinv's picture
Publish QuantInvBench dataset
bcc98e7 verified
|
Raw History Blame Contribute Delete
8.68 kB
---
license: other
task_categories:
- time-series-forecasting
language:
- en
tags:
- finance
- cryptocurrency
- portfolio-allocation
- multi-agent
configs:
- config_name: default
data_files:
- split: train
path: data/train.jsonl
- split: validation
path: data/validation.jsonl
- split: test
path: data/test.jsonl
---
# QuantInvBench
QuantInvBench is the companion benchmark for evaluating multi-agent portfolio
aggregation on five assets in the fixed order `BTC`, `ETH`, `USDT`, `XRP`,
`BNB`. At each seven-day execution event, a method receives ten long-only,
fully invested strategy proposals and must return one portfolio weight vector.
The ten strategy identities, in canonical order, are `Momentum`, `MaxSharpe`,
`TSMom14`, `TSMom60`, `RiskParity`, `MinVar`, `NewsSentiment`, `Size`,
`ValueNVT`, and `Liquidity`. Equal-weight buy-and-hold (EWBH) is a passive
evaluation baseline, not an eleventh agent.
## Record Schema
Every JSONL record has exactly these fields:
| Field | Type | Meaning |
| --- | --- | --- |
| `id` | string | Stable `quantinv_<split>_<index>_<YYYYMMDD>` identifier. |
| `split` | string | `train`, `validation`, or `test`. |
| `as_of` | UTC timestamp | Latest instant visible when proposals are formed; strictly earlier than execution. |
| `execution_at` | UTC timestamp | Execution-day open and start of the holding period. |
| `label_end_at` | UTC timestamp | Open exactly seven days after `execution_at`; end of the label interval. |
| `assets` | list of 5 strings | Always `["BTC", "ETH", "USDT", "XRP", "BNB"]`. |
| `strategy_proposals` | list of 10 objects | Ordered objects with exactly `strategy` and `weights`; each weight vector is non-negative and sums to one. |
| `next_7d_daily_returns` | 7 x 5 numbers | Seven consecutive open-to-next-open daily asset returns in asset order. |
| `next_7d_returns` | list of 5 numbers | Execution-open to label-end-open asset returns, compounded from the seven daily rows. |
For asset `j`, the endpoint label satisfies
`next_7d_returns[j] = product(1 + next_7d_daily_returns[d][j], d=0..6) - 1`.
## Splits and Label Isolation
Splits are chronological and include only records whose complete forward label
is contained on their side of the next split boundary.
| Split | Records | First execution | Last execution | Final `label_end_at` |
| --- | ---: | --- | --- | --- |
| train | 297 | 2018-07-04 | 2024-03-06 | 2024-03-13 |
| validation | 52 | 2024-03-16 | 2025-03-08 | 2025-03-15 |
| test | 52 | 2025-03-16 | 2026-03-08 | 2026-03-15 |
Strategy generation reads only observations strictly earlier than
`execution_at`. No training label reaches validation, and no validation label
reaches test.
The two return fields are public scoring labels, not method inputs. When
producing validation or test predictions, pass only record metadata and
`strategy_proposals` to the method; do not expose `next_7d_daily_returns` or
`next_7d_returns`. Byzantine identity/role labels are likewise evaluator-only
and are written to a separate audit file, never into attacked method records.
## Evaluation Protocol
The included evaluator follows the paper protocol:
- Capital starts in an already established equal-weight portfolio: 20% in
each asset at the first execution open.
- EWBH holds those initial asset units for the full evaluation window and
never rebalances, so its weights drift with returns and its turnover is zero.
- `simple_avg` and submitted methods target a new portfolio every seven days.
The first trade starts from equal weights; later trades start from the
return-drifted holdings left by the preceding period.
- Turnover is `0.5 * sum(abs(target - pre_trade_drifted_weights))`. A one-way
cost of `0.001 * turnover` (0.1%) is deducted at each rebalance.
- Cumulative return includes transaction costs. Maximum drawdown is computed
from daily NAV, including rebalance costs. Annualized Sharpe uses weekly net
returns, zero risk-free rate, population standard deviation, and `sqrt(52)`
scaling. Average turnover includes the first rebalance.
Run the clean baselines from the repository root:
```bash
conda run -n quantinv-hf python QuantInv/hf_release/scripts/evaluate.py \
--baseline equal_weight
conda run -n quantinv-hf python QuantInv/hf_release/scripts/evaluate.py \
--baseline simple_avg
```
Use `--data PATH` to score another compatible split or an attacked view, and
`--transaction-cost RATE` to override the default only for an explicitly
declared protocol variant.
## Submission Format
A submission is JSONL with exactly one object for every evaluated record:
```json
{"id": "quantinv_test_0000_20250316", "weights": [0.2, 0.2, 0.2, 0.2, 0.2]}
```
Each object must contain exactly `id` and `weights`. IDs must be unique and
match the evaluation data exactly. `weights` must be five finite JSON numbers
in canonical asset order, all non-negative, and already sum to one within
`1e-6`. Booleans, strings, missing or extra IDs, extra fields, and invalid
simplex vectors are rejected; the evaluator never clips or normalizes a
submission.
```bash
conda run -n quantinv-hf python QuantInv/hf_release/scripts/evaluate.py \
--predictions predictions.jsonl
```
## Byzantine Views
The checked-in splits are the clean benchmark. `attacks.py` deterministically
creates a replace-mode Byzantine view: the population remains `n=10`, while a
static set of `f` identities is replaced for the entire ordered run. The
constraint is `0 <= f < 5`. A seed selects the identities and the fixed Drift
targets; identities can instead be fixed explicitly by repeating
`--malicious-id` exactly `f` times.
Let `h_t` be the mean proposal of the honest identities, `d=5`, and `e_BTC` the
BTC one-hot vector. The frozen `quantinv-byzantine-v1` attacks are:
- Reverse: `(1 - h_t) / (d - 1)`.
- Bias: `0.9 * h_t + 0.1 * e_BTC`.
- Drift: use that identity's clean proposal for rounds 1-20, then use
`(1 - alpha_t) * clean_t + alpha_t * target`, where
`alpha_t = min(1, 0.02 * (t - 20))` and `target` is a seeded,
identity-specific `Dirichlet(1)` portfolio.
- Mixed: assign Reverse, Bias, and Drift cyclically to the ordered static
malicious identities.
Generate a view and its evaluator-only audit metadata separately:
```bash
conda run -n quantinv-hf python QuantInv/hf_release/scripts/attacks.py \
--data QuantInv/hf_release/data/test.jsonl \
--output attacked-test.jsonl \
--audit-output attacked-test.audit.json \
--attack mixed --f 3 --seed 42
```
Do not provide the audit file or either return-label field to the method. Score
predictions against the attacked view with:
```bash
conda run -n quantinv-hf python QuantInv/hf_release/scripts/evaluate.py \
--data attacked-test.jsonl --predictions predictions.jsonl
```
## Loading
Local repository checkout:
```python
from datasets import load_dataset
dataset = load_dataset("QuantInv/hf_release")
```
After publication to the Hub:
```python
from datasets import load_dataset
dataset = load_dataset("YOUR_ORG/quantinvbench")
```
## Reproduction and Validation
Run from the Crypto-MAD repository root. Creating the pinned environment is a
one-time step:
```bash
conda env create -f QuantInv/hf_release/environment.yml
```
The clean generator expects the five hourly market files under `data/` and the
derived sentiment cache at its default release path; both can be overridden
with `--data-dir` and `--sentiment-file`.
```bash
conda run -n quantinv-hf python QuantInv/hf_release/scripts/generate.py
conda run -n quantinv-hf python QuantInv/hf_release/scripts/validate.py \
QuantInv/hf_release/data --source-data-dir data
conda run -n quantinv-hf python -m unittest discover \
-s QuantInv/hf_release/tests -v
conda run -n quantinv-hf python QuantInv/hf_release/scripts/attacks.py --self-test
```
Without the original hourly sources, omit `--source-data-dir`; schema, split,
hash, compounding, and manifest checks still run. `data/manifest.json` records
the benchmark version, counts, protocol constants, and SHA-256 hashes needed
to audit a generation.
## Limitations and License
This is a public-label offline benchmark, not a hidden leaderboard. It covers
five surviving assets and one fixed test window, so it has survivorship and
regime-selection limitations. The USDT series is synthetic and cash-like.
The fixed transaction model omits slippage, market impact, liquidity limits,
and order-book execution. It is not investment advice.
Release code is covered by the [MIT license](LICENSE). Dataset records and
source-derived artifacts remain subject to provider terms; see
[DATA_LICENSE.md](DATA_LICENSE.md). The Dataset Card therefore uses
`license: other`.