Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix $volume normalization issue
Fix: #765
  • Loading branch information
2young-2simple-sometimes-naive authored Jan 1, 2022
commit 525dd170482724555da047004d571ddfb81a528f
6 changes: 3 additions & 3 deletions qlib/contrib/data/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def get_feature_config(self):
fields += ["$vwap/$close"]
names += ["VWAP0"]
for i in range(59, 0, -1):
fields += ["Ref($volume, %d)/$volume" % (i)]
fields += ["Ref($volume, %d)/($volume+1e-12)" % (i)]
names += ["VOLUME%d" % (i)]
fields += ["$volume/$volume"]
fields += ["($volume+1e-12)/($volume+1e-12)"]
names += ["VOLUME0"]

return fields, names
Expand Down Expand Up @@ -249,7 +249,7 @@ def parse_config_to_fields(config):
names += [field.upper() + str(d) for d in windows]
if "volume" in config:
windows = config["volume"].get("windows", range(5))
fields += ["Ref($volume, %d)/$volume" % d if d != 0 else "$volume/$volume" for d in windows]
fields += ["Ref($volume, %d)/($volume+1e-12)" % d if d != 0 else "($volume+1e-12)/($volume+1e-12)" for d in windows]
names += ["VOLUME" + str(d) for d in windows]
if "rolling" in config:
windows = config["rolling"].get("windows", [5, 10, 20, 30, 60])
Expand Down