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'
|
||||
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:
|
||||
signal_data = []
|
||||
@ -46,12 +46,13 @@ def calculate_signals(days: int = 12) -> DataFrame:
|
||||
return DataFrame(signal_data)
|
||||
|
||||
def load_chart() -> dict:
|
||||
chart_data = data.tail(180)
|
||||
candlestick_chart = CandlestickChart(
|
||||
x = data['Date'],
|
||||
opens = data['Open'],
|
||||
highs = data['High'],
|
||||
lows = data['Low'],
|
||||
closes = data['Close']
|
||||
x = chart_data['Date'],
|
||||
opens = chart_data['Open'],
|
||||
highs = chart_data['High'],
|
||||
lows = chart_data['Low'],
|
||||
closes = chart_data['Close']
|
||||
)
|
||||
|
||||
return figure_with_subplots([[candlestick_chart]])
|
||||
|
Loading…
Reference in New Issue
Block a user