Load a year's worth of data for signal generation but limit chart to 180 days
This commit is contained in:
parent
a5d12cfcf8
commit
d44f5c1ead
13
dashboard.py
13
dashboard.py
@ -28,7 +28,7 @@ signal_functions: List[Dict[str, SignalFunction]] = [
|
|||||||
|
|
||||||
symbol = 'SPY'
|
symbol = 'SPY'
|
||||||
today = datetime.today()
|
today = datetime.today()
|
||||||
data = ohlc(symbol = symbol, start_date = today - timedelta(days = 180), end_date = today)
|
data = ohlc(symbol = symbol, start_date = today - timedelta(days = 365), end_date = today)
|
||||||
|
|
||||||
def calculate_signals(days: int = 12) -> DataFrame:
|
def calculate_signals(days: int = 12) -> DataFrame:
|
||||||
signal_data = []
|
signal_data = []
|
||||||
@ -46,12 +46,13 @@ def calculate_signals(days: int = 12) -> DataFrame:
|
|||||||
return DataFrame(signal_data)
|
return DataFrame(signal_data)
|
||||||
|
|
||||||
def load_chart() -> dict:
|
def load_chart() -> dict:
|
||||||
|
chart_data = data.tail(180)
|
||||||
candlestick_chart = CandlestickChart(
|
candlestick_chart = CandlestickChart(
|
||||||
x = data['Date'],
|
x = chart_data['Date'],
|
||||||
opens = data['Open'],
|
opens = chart_data['Open'],
|
||||||
highs = data['High'],
|
highs = chart_data['High'],
|
||||||
lows = data['Low'],
|
lows = chart_data['Low'],
|
||||||
closes = data['Close']
|
closes = chart_data['Close']
|
||||||
)
|
)
|
||||||
|
|
||||||
return figure_with_subplots([[candlestick_chart]])
|
return figure_with_subplots([[candlestick_chart]])
|
||||||
|
Loading…
Reference in New Issue
Block a user