1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-06-30 01:21:18 +08:00
Files
qlib/examples/orderbook_data
luocy16 2bb8a4ce0e Supporting Arctic Backend Provider & Orderbook, Tick Data Example (#744)
* change weight_decay & batchsize

* del weight_decay

* big weight_decay

* mid weight_decay

* small layer

* 2 layer

* full layer

* no weight decay

* divide into two data source

* change parse field

* delete some debug

* add Toperator

* new format of arctic

* fix cache bug to arctic read

* fix connection problem

* add some operator

* final version for arcitc

* clear HZ cache

* remove not used function

* add topswrappers

* successfully import data and run first test

* A simpler version to support arctic

* Successfully run all high-freq expressions

* Black format and fix add docs

* Add docs for download and test data

* update scripts and docs

* Add docs

* fix bug

* Refine docs

* fix test bug

* fix CI error

* clean code

Co-authored-by: bxdd <bxddream@gmail.com>
Co-authored-by: wangwenxi.handsome <wangwenxi.handsome@gmail.com>
Co-authored-by: Young <afe.young@gmail.com>
2022-01-18 09:13:11 +08:00
..

Introduction

This example tries to demonstrate how Qlib supports data without fixed shared frequency.

For example,

  • Daily prices volume data are fixed-frequency data. The data comes in a fixed frequency (i.e. daily)
  • Orders are not fixed data and they may come at any time point

To support such non-fixed-frequency, Qlib implements an Arctic-based backend. Here is an example to import and query data based on this backend.

Installation

Please refer to the installation docs of mongodb. Current version of script with default value tries to connect localhost via default port without authentication.

Run following command to install necessary libraries

pip install pytest

Importing example data

  1. (Optional) Please follow the first part of this section to get 1min data of Qlib.
  2. Please follow following steps to download example data
cd examples/orderbook_data/
wget http://fintech.msra.cn/stock_data/downloads/highfreq_orderboook_example_data.tar.bz2
tar xf highfreq_orderboook_example_data.tar.bz2
  1. Please import the example data to your mongo db
cd examples/orderbook_data/
python create_dataset.py initialize_library  # Initialization Libraries
python create_dataset.py import_data  # Initialization Libraries

Query Examples

After importing these data, you run example.py to create some high-frequency features.

cd examples/orderbook_data/
pytest -s --disable-warnings example.py   # If you want run all examples
pytest -s --disable-warnings example.py::TestClass::test_exp_10  # If you want to run specific example

Known limitations

Expression computing between different frequencies are not supported yet