THUgewu's picture
Add TsFile (converted from AdityaaXD/Multi-Model-Trading-Data)
34cad67 verified
|
Raw History Blame Contribute Delete
2.49 kB
metadata
license: mit
task_categories:
  - time-series-forecasting
tags:
  - tsfile
  - timeseries
  - time-series
  - finance
  - trading
  - bitcoin
  - cryptocurrency
  - technical-analysis
  - format:tsfile
pretty_name: Multi-Model Trading Data
configs:
  - config_name: default
    data_files:
      - split: historical
        path: multi_model_trading_data_historical.tsfile
      - split: features
        path: multi_model_trading_data_features.tsfile

Multi-Model Trading Data (TsFile)

Apache TsFile version of AdityaaXD/Multi-Model-Trading-Data.

Overview

Bitcoin (BTC-USD) historical daily prices with technical indicators for ML/DL trading models, 2015-2024. The repo ships two CSVs with different column sets; both are converted to their own TsFile:

  • btc_usd_historical.csv (3,653 daily rows, 2015-01-01..2024-12-31): raw OHLCV (open, high, low, close, volume).
  • btc_usd_features.csv (3,603 daily rows, 2015-02-19..2024-12-30 — the indicator warm-up period is absent): raw OHLCV plus rsi, macd, macd_signal, bb_width, atr, dist_sma50, obv_pct, adx, stoch_rsi_k, stoch_rsi_d, return and the binary target label (next-day direction).

Schema (TsFile structure)

Both files: Time (INT64, ms, daily date naive), no TAG (dates unique), all remaining columns FIELD with their source types (volume, indicator columns DOUBLE, target INT64 in the features file).

Usage

Install the Apache TsFile Python SDK (pip install tsfile) and read a converted file:

from pathlib import Path
from tsfile import TsFileReader

path = Path("multi_model_trading_data_features.tsfile")
with TsFileReader(str(path)) as reader:
    schemas = reader.get_all_table_schemas()
    print("tables:", list(schemas))
    table_name = next(iter(schemas))
    table = schemas[table_name]
    columns = [column.get_column_name() for column in table.get_columns()]
    print("columns:", columns)
    field_names = [
        column.get_column_name()
        for column in table.get_columns()
        if column.get_column_name() not in {"Time", "time"}
    ]
    if field_names:
        with reader.query_table(table_name, field_names[:3], batch_size=1024) as result:
            batch = result.read_arrow_batch()
            if batch is not None:
                print(batch.to_pandas().head())

Source & license