Skip to content

Commit

Permalink
change safe_sorted beyond range raise error to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
BurdenBear committed Mar 16, 2018
1 parent fd35bfa commit d3cc253
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion rqalpha_mod_fxdayu_source/data_source/quantos.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def safe_searchsorted(a, v, side='left', sorter=None):
raise RuntimeError("Can't search in a empty array!")
pos = np.searchsorted(a, v, side=side, sorter=sorter)
if pos >= len(a):
raise RuntimeError("Value to search [%s] beyond array range [ %s - %s ]" % (v, a[0], a[-1]))
system_log.warning(RuntimeWarning(
"Value to search [%s] beyond array range [ %s - %s ], there may be some data missing."
% (v, a[0], a[-1])
))
return len(a)
return pos


Expand Down
1 change: 0 additions & 1 deletion tests/quantos/test_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def handle_bar(context, bar_dict):
"accounts": {"stock": 100000},
"frequency": "1m",
"benchmark": None,
"data_bundle_path": r"E:\Users\BurdenBear\.rqalpha\bundle",
"strategy_file": __file__,
"run_type": "p"
},
Expand Down

0 comments on commit d3cc253

Please sign in to comment.