oil032_sample / README.md
wangdx25's picture
Add TsFile (converted from xpertsystems/oil032-sample)
e39ac82 verified
|
Raw History Blame Contribute Delete
11.1 kB
---
license: cc-by-nc-4.0
task_categories:
- tabular-classification
- tabular-regression
- time-series-forecasting
language:
- en
tags:
- tsfile
- timeseries
- time-series
- synthetic
- oil-and-gas
- commodities
- energy-derivatives
- futures
- options
- black-scholes
- greeks
- vol-surface
- cftc-cot
- crack-spread
- xpertsystems
- format:tsfile
pretty_name: OIL-032 — Synthetic Energy Derivatives Dataset (Sample) (TsFile)
size_categories:
- 100K<n<1M
configs:
- config_name: default
data_files:
- split: calendar_spreads
path: calendar_spreads.tsfile
- split: crack_spreads
path: crack_spreads.tsfile
- split: derivatives_labels
path: derivatives_labels.tsfile
- split: futures_contracts
path: futures_contracts.tsfile
- split: hedging_positions
path: hedging_positions.tsfile
- split: market_liquidity
path: market_liquidity.tsfile
- split: open_interest
path: open_interest.tsfile
- split: options_chain
path: options_chain.tsfile
- split: rare_market_events
path: rare_market_events.tsfile
- split: trader_behavior
path: trader_behavior.tsfile
- split: volatility_surfaces
path: volatility_surfaces.tsfile
---
# OIL-032 — Synthetic Energy Derivatives Dataset (Sample) (TsFile)
Apache TsFile version of [`xpertsystems/oil032-sample`](https://huggingface.co/datasets/xpertsystems/oil032-sample).
## Overview
A free, schema-identical preview of XpertSystems.ai's enterprise energy derivatives dataset for **options pricing ML, vol surface modeling, futures curve analytics, hedging strategy optimization, Greeks-based risk modeling, CFTC positioning analysis, crack spread arbitrage, rare event impact modeling, and trader behavior classification**. The sample covers **1,100 futures contracts** across **6 energy underlyings** (WTI, Brent, Henry Hub NG, Heating Oil, RBOB, LNG) over **180 days** with **28,548 option chains**, complete **Black-Scholes pricing + full Greeks**, and **106,959 rows** across **11 tables**.
- **Tables:** 11 TsFile table(s), 106,959 rows in total.
- `calendar_spreads`: 546 rows, 2022-01-03 00:00:00 → 2022-04-03 00:00:00.005000 (UTC)
- `crack_spreads`: 92 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00 (UTC)
- `derivatives_labels`: 1,098 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00.005000 (UTC)
- `futures_contracts`: 1,098 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00.005000 (UTC)
- `hedging_positions`: 1,000 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00.003000 (UTC)
- `market_liquidity`: 29,646 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00.161000 (UTC)
- `open_interest`: 29,646 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00.161000 (UTC)
- `options_chain`: 28,548 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00.155000 (UTC)
- `rare_market_events`: 11 rows, 2022-01-03 00:00:00 → 2022-03-31 00:00:00 (UTC)
- `trader_behavior`: 1,000 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00.003000 (UTC)
- `volatility_surfaces`: 14,274 rows, 2022-01-03 00:00:00 → 2022-04-04 00:00:00.077000 (UTC)
## Schema (TsFile structure)
### `calendar_spreads.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (12): `spread_id` (string), `underlying` (string), `front_contract_id` (string), `back_contract_id` (string), `front_month` (string), `back_month` (string), `front_price` (double), `back_price` (double), `spread_value` (double), `spread_zscore` (double), `regime` (string), `arbitrage_flag` (int64)
### `crack_spreads.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (9): `crack_spread_id` (string), `crude_contract` (string), `gasoline_contract` (string), `distillate_contract` (string), `wti_price_per_bbl` (double), `rbob_price_per_gal` (double), `heating_oil_price_per_gal` (double), `three_two_one_crack_spread` (double), `refinery_margin_regime` (string)
### `derivatives_labels.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (10): `label_id` (string), `contract_id` (string), `underlying` (string), `volatility_regime` (string), `hedging_priority` (string), `liquidity_risk_label` (string), `arbitrage_watch_label` (string), `severity_score` (double), `implied_volatility_mean` (double), `avg_abs_delta` (double)
### `futures_contracts.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (15): `contract_id` (string), `underlying` (string), `contract_month` (string), `expiry_date` (string), `tenor_months` (int64), `spot_price` (double), `futures_price` (double), `carry_rate` (double), `convenience_yield` (double), `volume` (int64), `open_interest` (int64), `bid_ask_spread` (double), `curve_state` (string), `inventory_index` (double), `macro_risk_index` (double)
### `hedging_positions.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (17): `hedge_id` (string), `underlying` (string), `option_id` (string), `trader_type` (string), `position_qty` (int64), `target_delta` (double), `delta_exposure` (double), `gamma_exposure` (double), `vega_exposure` (double), `theta_exposure` (double), `hedge_ratio` (double), `hedge_efficiency` (double), `basis_risk_score` (double), `notional_usd` (double), `initial_margin_usd` (double), `margin_utilization_rate` (double), `rebalance_signal` (string)
### `market_liquidity.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (11): `liquidity_id` (string), `underlying` (string), `volume` (int64), `open_interest` (int64), `bid_ask_spread` (double), `instrument_type` (string), `instrument_id` (string), `mid_price` (double), `market_depth` (double), `liquidity_stress_score` (double), `slippage_bps` (double)
### `open_interest.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (9): `open_interest_id` (string), `instrument_id` (string), `instrument_type` (string), `underlying` (string), `open_interest` (int64), `volume` (int64), `commercial_share_pct` (double), `speculative_share_pct` (double), `participant_concentration_index` (double)
### `options_chain.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (18): `option_id` (string), `contract_id` (string), `underlying` (string), `option_type` (string), `expiry_date` (string), `tenor_days` (int64), `strike_price` (double), `moneyness` (double), `underlying_futures_price` (double), `implied_volatility` (double), `option_price` (double), `delta` (double), `gamma` (double), `vega` (double), `theta` (double), `bid_ask_spread` (double), `open_interest` (int64), `volume` (int64)
### `rare_market_events.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (10): `event_id` (string), `underlying` (string), `event_type` (string), `severity_score` (double), `price_shock_pct` (double), `volatility_multiplier` (double), `liquidity_depth_reduction_pct` (double), `bid_ask_widening_multiplier` (double), `margin_call_probability` (double), `recovery_days` (int64)
### `trader_behavior.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (9): `behavior_id` (string), `underlying` (string), `trader_type` (string), `observed_action` (string), `reaction_latency_sec` (int64), `risk_limit_utilization_pct` (double), `panic_liquidation_probability` (double), `dealer_gamma_pressure` (double), `speculative_flow_intensity` (double)
### `volatility_surfaces.tsfile`
- **Time** (INT64, milliseconds) — the source `trade_date` column.
- **TAG**: none — the table is stored as a single device.
- **FIELD** (8): `surface_node_id` (string), `underlying` (string), `tenor_days` (int64), `moneyness` (double), `implied_volatility` (double), `option_price_mean` (double), `vega_mean` (double), `open_interest_total` (int64)
## Conversion notes
- One TsFile per source CSV (11 tables); each table is stored as a single device, so the rig / well / tank / equipment / sensor identifiers stay ordinary FIELDs.
- Time = the table's own clock column as INT64 milliseconds (event timestamps, sample or inspection dates, and daily record dates). The clock columns used here are `trade_date`.
- No column is dropped. Rows that share a timestamp are ordered by a 1 ms step in stable source order, so daily tables keep their exact calendar day.
## Usage
> **Read this dataset with the Java SDK.** It is written with the `zstd` compressor. The Apache TsFile Java SDK reads every compressor, but the Python SDK (`pip install tsfile`) implements only `UNCOMPRESSED`, `SNAPPY`, `GZIP` and `LZ4`; opening this file with it yields no rows.
Read a converted file with the Apache TsFile Java SDK (`org.apache.tsfile:tsfile`):
```java
import org.apache.tsfile.file.metadata.IDeviceID;
import org.apache.tsfile.read.TsFileReader;
import org.apache.tsfile.read.TsFileSequenceReader;
import org.apache.tsfile.read.common.Path;
import org.apache.tsfile.read.expression.QueryExpression;
import org.apache.tsfile.read.query.dataset.QueryDataSet;
import org.apache.tsfile.write.schema.MeasurementSchema;
import java.util.ArrayList;
import java.util.List;
String path = "calendar_spreads.tsfile";
try (TsFileSequenceReader sequenceReader = new TsFileSequenceReader(path);
TsFileReader reader = new TsFileReader(sequenceReader)) {
// Devices are enumerated as IDeviceID objects. Tables with TAG columns
// have multi-segment device ids that cannot be rebuilt from their string
// form, so always use getAllDevices() rather than getAllDeviceIds().
for (IDeviceID device : sequenceReader.getAllDevices()) {
List<Path> paths = new ArrayList<>();
for (MeasurementSchema schema : reader.getMeasurement(device)) {
String name = schema.getMeasurementName();
if (name != null && !name.isEmpty() && !name.equalsIgnoreCase("Time")) {
paths.add(new Path(device, name, true));
}
}
QueryDataSet dataSet = reader.query(QueryExpression.create(paths, null));
while (dataSet.hasNext()) {
System.out.println(dataSet.next());
}
}
}
```
## Source & license
- Original dataset: [`xpertsystems/oil032-sample`](https://huggingface.co/datasets/xpertsystems/oil032-sample)
- Source card title: OIL-032 — Synthetic Energy Derivatives Dataset (Sample)
- License: cc-by-nc-4.0 (as declared by the original dataset).