minor upravy
This commit is contained in:
@ -498,10 +498,18 @@ def next(data, state: StrategyState):
|
||||
lookbacktime = state.bars.time[-slope_lookback]
|
||||
else:
|
||||
#kdyz neni dostatek hodnot, pouzivame jako levy bod open hodnotu close[0]
|
||||
#lookbackprice = state.bars.close[0]
|
||||
lookbackprice = state.bars.vwap[0]
|
||||
|
||||
#pokud neni dostatek, bereme vzdy petinu ze stávajících barů
|
||||
# cnt = len(state.bars.close)
|
||||
# if cnt>5:
|
||||
# sliced_to = int(cnt/5)
|
||||
# lookbackprice= Average(state.bars.vwap[:sliced_to])
|
||||
|
||||
# else:
|
||||
# lookbackprice = state.bars.vwap[0]
|
||||
#update -- lookback je pole z toho co mame
|
||||
lookbackprice = Average(state.bars.vwap)
|
||||
#lookbackprice = Average(state.bars.vwap)
|
||||
lookbacktime = state.bars.time[0]
|
||||
state.ilog(e=f"IND {name} slope - not enough data bereme left bod open", slope_lookback=slope_lookback)
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -106,6 +106,8 @@ class Trade_Offline_Streamer(Thread):
|
||||
print(day.close)
|
||||
#make it offset aware
|
||||
day.open = day.open.replace(tzinfo=zoneNY)
|
||||
#add 20 minutes of premarket
|
||||
day.open = day.open - timedelta(minutes=20)
|
||||
day.close = day.close.replace(tzinfo=zoneNY)
|
||||
|
||||
##pokud datum do je mensi day.open, tak tento den neresime
|
||||
@ -155,7 +157,9 @@ class Trade_Offline_Streamer(Thread):
|
||||
|
||||
#protze mi chodi data jen v main sessione, pak jediné, kdy nečekáme na Q, je když time_from je větší než day.open
|
||||
# (např. požadovaná start až od 10:00)
|
||||
if self.time_from > day.open:
|
||||
|
||||
#docasne disablujeme wait for queue, aby nam mohl jit i premarket
|
||||
if self.time_from > day.open or 1==1:
|
||||
wait_for_q = False
|
||||
else:
|
||||
wait_for_q = True
|
||||
@ -177,7 +181,9 @@ class Trade_Offline_Streamer(Thread):
|
||||
#pokud je start_time < trade < end_time
|
||||
#datetime.fromtimestamp(parse_alpaca_timestamp(t['t']))
|
||||
##ic(t['t'])
|
||||
if self.time_from < to_datetime(t['t']) < self.time_to:
|
||||
|
||||
#poustime i 20 minut premarketu pro presnejsi populaci slopu v prvnich minutech
|
||||
if self.time_from - timedelta(minutes=20) < to_datetime(t['t']) < self.time_to:
|
||||
#poustime dal, jinak ne
|
||||
if wait_for_q:
|
||||
#cekame na Q nebo na O (nekterym dnum chybelo Q)
|
||||
|
||||
@ -36,7 +36,8 @@ indConfig = [ {name: "ema", titlevisible: false, embed: true, display: true, pri
|
||||
{name: "slope30MA", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||
{name: "slopeLP", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||
{name: "slopeMA", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||
{name: "slopeLPMA", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||
{name: "slope720", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||
{name: "slope720MA", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||
{name: "slow_slope", titlevisible: true, embed: true, display: false, priceScaleId: "left", lastValueVisible: false},
|
||||
{name: "slow_slopeMA", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||
{name: "emaSlow", titlevisible: true, embed: true, display: true, priceScaleId: "right", lastValueVisible: false},
|
||||
|
||||
Reference in New Issue
Block a user