Hours are read from config as strings but compared as ints
jasmarc opened this issue · 0 comments
jasmarc commented
Suggested fix:
# times to buy/sell
if startbuytime == 'buyatopen':
- get_stocks_h, get_stocks_m = BAO_GET_STOCKS_TIME.split(':')
- buy_sh, buy_sm = BAO_BUY_START_TIME.split(':')
- buy_eh, buy_em = BAO_BUY_END_TIME.split(':')
- sell_sh, sell_sm = BAO_SELL_START_TIME.split(':')
- sell_eh, sell_em = BAO_SELL_END_TIME.split(':')
+ get_stocks_h, get_stocks_m = list(map(int, BAO_GET_STOCKS_TIME.split(':')))
+ buy_sh, buy_sm = list(map(int, BAO_BUY_START_TIME.split(':')))
+ buy_eh, buy_em = list(map(int, BAO_BUY_END_TIME.split(':')))
+ sell_sh, sell_sm = list(map(int, BAO_SELL_START_TIME.split(':')))
+ sell_eh, sell_em = list(map(int, BAO_SELL_END_TIME.split(':')))
else: # buy at close
- get_stocks_h, get_stocks_m = BAC_GET_STOCKS_TIME.split(':')
- buy_sh, buy_sm = BAC_BUY_START_TIME.split(':')
- buy_eh, buy_em = BAC_BUY_END_TIME.split(':')
- sell_sh, sell_sm = BAC_SELL_START_TIME.split(':')
- sell_eh, sell_em = BAC_SELL_END_TIME.split(':')
+ get_stocks_h, get_stocks_m = list(map(int, BAC_GET_STOCKS_TIME.split(':')))
+ buy_sh, buy_sm = list(map(int, BAC_BUY_START_TIME.split(':')))
+ buy_eh, buy_em = list(map(int, BAC_BUY_END_TIME.split(':')))
+ sell_sh, sell_sm = list(map(int, BAC_SELL_START_TIME.split(':')))
+ sell_eh, sell_em = list(map(int, BAC_SELL_END_TIME.split(':')))