minor upravy
This commit is contained in:
@ -498,10 +498,18 @@ def next(data, state: StrategyState):
|
|||||||
lookbacktime = state.bars.time[-slope_lookback]
|
lookbacktime = state.bars.time[-slope_lookback]
|
||||||
else:
|
else:
|
||||||
#kdyz neni dostatek hodnot, pouzivame jako levy bod open hodnotu close[0]
|
#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
|
#update -- lookback je pole z toho co mame
|
||||||
lookbackprice = Average(state.bars.vwap)
|
#lookbackprice = Average(state.bars.vwap)
|
||||||
lookbacktime = state.bars.time[0]
|
lookbacktime = state.bars.time[0]
|
||||||
state.ilog(e=f"IND {name} slope - not enough data bereme left bod open", slope_lookback=slope_lookback)
|
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)
|
print(day.close)
|
||||||
#make it offset aware
|
#make it offset aware
|
||||||
day.open = day.open.replace(tzinfo=zoneNY)
|
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)
|
day.close = day.close.replace(tzinfo=zoneNY)
|
||||||
|
|
||||||
##pokud datum do je mensi day.open, tak tento den neresime
|
##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
|
#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)
|
# (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
|
wait_for_q = False
|
||||||
else:
|
else:
|
||||||
wait_for_q = True
|
wait_for_q = True
|
||||||
@ -177,7 +181,9 @@ class Trade_Offline_Streamer(Thread):
|
|||||||
#pokud je start_time < trade < end_time
|
#pokud je start_time < trade < end_time
|
||||||
#datetime.fromtimestamp(parse_alpaca_timestamp(t['t']))
|
#datetime.fromtimestamp(parse_alpaca_timestamp(t['t']))
|
||||||
##ic(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
|
#poustime dal, jinak ne
|
||||||
if wait_for_q:
|
if wait_for_q:
|
||||||
#cekame na Q nebo na O (nekterym dnum chybelo Q)
|
#cekame na Q nebo na O (nekterym dnum chybelo Q)
|
||||||
|
|||||||
@ -93,7 +93,7 @@ async def get(username: Annotated[str, Depends(get_current_username)]):
|
|||||||
|
|
||||||
@app.websocket("/runners/{runner_id}/ws")
|
@app.websocket("/runners/{runner_id}/ws")
|
||||||
async def websocket_endpoint(
|
async def websocket_endpoint(
|
||||||
*,
|
*,
|
||||||
websocket: WebSocket,
|
websocket: WebSocket,
|
||||||
runner_id: str,
|
runner_id: str,
|
||||||
api_key: Annotated[str, Depends(get_api_key)],
|
api_key: Annotated[str, Depends(get_api_key)],
|
||||||
|
|||||||
@ -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: "slope30MA", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||||
{name: "slopeLP", 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: "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_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: "slow_slopeMA", titlevisible: true, embed: true, display: true, priceScaleId: "left", lastValueVisible: false},
|
||||||
{name: "emaSlow", titlevisible: true, embed: true, display: true, priceScaleId: "right", lastValueVisible: false},
|
{name: "emaSlow", titlevisible: true, embed: true, display: true, priceScaleId: "right", lastValueVisible: false},
|
||||||
|
|||||||
Reference in New Issue
Block a user