Skip to content

Qlib Highfreq Support & Highfreq DataHanlder/Operator/Processor Examples#222

Merged
you-n-g merged 18 commits intomicrosoft:mainfrom
bxdd:rl-highfreq-include-examples
Jan 28, 2021
Merged

Qlib Highfreq Support & Highfreq DataHanlder/Operator/Processor Examples#222
you-n-g merged 18 commits intomicrosoft:mainfrom
bxdd:rl-highfreq-include-examples

Conversation

@bxdd
Copy link
Collaborator

@bxdd bxdd commented Jan 27, 2021

Description

Qlib Highfreq Support & Highfreq DataHanlder/Operator/Processor Examples

Motivation and Context

How Has This Been Tested?

  • Pass the test by running: pytest qlib/tests/test_all_pipeline.py under upper directory of qlib.
  • If you are adding a new feature, test on your own test scripts.

Screenshots of Test Results (if appropriate):

  1. Pipeline test:
  2. Your own tests:

Types of changes

  • Fix bugs
  • Add new feature
  • Update documentation

H["c"][flag] = _calendar, _calendar_index
return _calendar, _calendar_index

def get_calendar_day(self, freq="day", future=False):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_calendar_day just for high-freq, if there are other ways to implement it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to put this in qlib/data/data.py

@bxdd bxdd requested a review from you-n-g January 27, 2021 05:25
H["c"][flag] = _calendar, _calendar_index
return _calendar, _calendar_index

def get_calendar_day(self, freq="day", future=False):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to put this in qlib/data/data.py

# use default data
provider_uri = "/nfs_data/qlib_data/yahoo_high_qlib" # target_dir
qlib.init(
provider_uri=provider_uri,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

**HIGH_FREQ_CONFIG

qlib.init(
provider_uri=provider_uri,
custom_ops=[DayFirst, DayLast, FFillNan, Date, Select, IsNull],
redis_port=-1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default in most case

  • Enable expression cache , disable dataset cache.

qlib.init(
provider_uri=provider_uri,
custom_ops=[DayFirst, DayLast, FFillNan, Date, Select, IsNull],
redis_port=-1,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

disable expression cache in this case

# use default data
provider_uri = "/nfs_data/qlib_data/yahoo_high_qlib" # target_dir
qlib.init(
provider_uri=provider_uri,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPEC_CONF
HIGH_FREQ_CONFIG

``qlib.init(**HIGH_FREQ_CONFIG, **SPEC_CONF)`

# use default data
provider_uri = "/nfs_data/qlib_data/yahoo_high_qlib" # target_dir
qlib.init(
provider_uri=provider_uri,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provider_uri in HIGH_FREQ_CONFIG

if DROP_LOAD_DATASET:

##=============dump dataset=============
dataset.to_pickle(path="dataset.pkl")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import fire
class HFWorkflow:
     def XXXX
     def case1:
     def case2:

fields += [
"{0}/Ref(DayLast({1}), 240)".format(

def get_04_price_feature(price_field):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_04_price_feature & get_59_price_feature are really weird names.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_normalized_price_fea

class FFillNan(ElemOperator):
def __init__(self, feature):
super(FFillNan, self).__init__(feature, "fill_nan")
super(FFillNan, self).__init__(feature)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These init function are no longer required.

provider_uri = QLIB_INIT_CONFIG.get("provider_uri")
if not exists_qlib_data(provider_uri):
print(f"Qlib data is not found in {provider_uri}")
sys.path.append(str(Path(__file__).resolve().parent.parent.parent.joinpath("scripts")))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from qlib.tests.data import GetData

GetData().qlib_data(target_dir=provider_uri, region=REG_CN)

qlib.init(provider_uri=provider_uri, region=REG_CN)
qlib.init(provider_uri=provider_uri, region=REG_CN, redis_port=-1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello

@you-n-g you-n-g merged commit 828993b into microsoft:main Jan 28, 2021
gaogen123 pushed a commit to gaogen123/qlib that referenced this pull request Sep 13, 2025
Qlib Highfreq Support & Highfreq DataHanlder/Operator/Processor Examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants