1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-11 06:46:56 +08:00

Merge pull request #92 from bxdd/qlib_register_ops

Support Register of Custom Feature Operators Easily
This commit is contained in:
you-n-g
2021-01-26 18:53:43 +08:00
committed by GitHub
9 changed files with 260 additions and 123 deletions

View File

@@ -15,6 +15,7 @@ import bisect
import shutil
import difflib
import hashlib
import logging
import datetime
import requests
import tempfile
@@ -26,8 +27,9 @@ import pandas as pd
from pathlib import Path
from typing import Union, Tuple
from ..config import C
from ..log import get_module_logger
from ..config import C, REG_CN
from ..log import get_module_logger, set_log_with_config
log = get_module_logger("utils")
@@ -162,7 +164,7 @@ def parse_field(field):
# - $open+$close -> Feature("open")+Feature("close")
if not isinstance(field, str):
field = str(field)
return re.sub(r"\$(\w+)", r'Feature("\1")', field)
return re.sub(r"\$(\w+)", r'Feature("\1")', re.sub(r"(\w+\s*)\(", r"Operators.\1(", field))
def get_module_by_module_path(module_path):