wangdx25's picture
Add TsFile (converted from AdityaaXD/Multi-Agent_Reinforcement_Learning_Trading_System_Data)
9abaf35 verified
|
Raw History Blame Contribute Delete
3.98 kB
metadata
license:
  - mit
task_categories:
  - time-series-forecasting
  - reinforcement-learning
language:
  - en
tags:
  - tsfile
  - timeseries
  - time-series
  - finance
  - stock-market
  - technical-analysis
  - yfinance
  - format:tsfile
pretty_name: multi_agent_reinforcement_learning_trading_system_ (TsFile)
size_categories:
  - 10K<n<100K
configs:
  - config_name: default
    data_files:
      - split: train
        path: multi_agent_reinforcement_learning_trading_system.tsfile

multi_agent_reinforcement_learning_trading_system_ (TsFile)

Apache TsFile version of AdityaaXD/Multi-Agent_Reinforcement_Learning_Trading_System_Data.

Overview

This dataset contains historical OHLCV (Open, High, Low, Close, Volume) data for AAPL, MSFT, and GOOGL, pre-processed for Reinforcement Learning based trading systems.

  • Tables: 1 TsFile table(s), 5,280 rows in total.
    • multi_agent_reinforcement_learning_trading_system: 5,280 rows, 2018-01-02 00:00:00 鈫?2024-12-30 00:00:00.002000 (UTC)

Schema (TsFile structure)

multi_agent_reinforcement_learning_trading_system.tsfile

  • Time (INT64, milliseconds) 鈥?round(timestamp 脳 1000); the source timestamp column is folded into Time.
  • TAG: none 鈥?the table is stored as a single device.
  • FIELD (5): Close (double), High (double), Low (double), Open (double), Volume (int64)

Conversion notes

  • One TsFile per source table (1 tables). Tables whose source carries several entities per file are stored as one device per entity.
  • Time = the table's own clock column as INT64 milliseconds. The clock columns used here are Date.
  • No column is dropped. Rows that share a timestamp inside one device are ordered by a 1 ms step in stable source order, so calendar columns keep their exact 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):

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 = "multi_agent_reinforcement_learning_trading_system.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