Avoid using negative indexes
This commit is contained in:
parent
b2a22f1afb
commit
f3e6bcb20c
@ -43,7 +43,7 @@ def trim_tickerlist(tickerlist: List[Dict], timerange: TimeRange) -> List[Dict]:
|
|||||||
start_index += 1
|
start_index += 1
|
||||||
|
|
||||||
if timerange.stoptype == 'line':
|
if timerange.stoptype == 'line':
|
||||||
start_index = len(tickerlist) + timerange.stopts
|
start_index = max(len(tickerlist) + timerange.stopts, 0)
|
||||||
if timerange.stoptype == 'index':
|
if timerange.stoptype == 'index':
|
||||||
stop_index = timerange.stopts
|
stop_index = timerange.stopts
|
||||||
elif timerange.stoptype == 'date':
|
elif timerange.stoptype == 'date':
|
||||||
|
Loading…
Reference in New Issue
Block a user