@app.callback([dash.dependencies.Output('ivv-hist', 'children'), dash.dependencies.Output('date-range-output', 'children'), dash.dependencies.Output('candlestick', 'figure'), dash.dependencies.Output('candlestick', 'style')], dash.dependencies.Input('run-backtest', 'n_clicks'), [dash.dependencies.State('bbg-identifier-1', 'value'), dash.dependencies.State('big-N', 'value'), dash.dependencies.State('lil-n', 'value'), dash.dependencies.State('hist-data-range', 'start_date'), dash.dependencies.State('hist-data-range', 'end_date')], prevent_initial_call=True)
def update_bbg_data(nclicks, bbg_id_1, N, n, start_date, end_date):
    start_date = (pd.to_datetime(start_date).date() - timedelta(days=ceil(((N + n) * (365 / 252)))))
    start_date = start_date.strftime('%Y-%m-%d')
    historical_data = req_historical_data(bbg_id_1, start_date, end_date)
    date_output_msg = 'Backtesting from '
    if (start_date is not None):
        start_date_object = date.fromisoformat(start_date)
        start_date_string = start_date_object.strftime('%B %d, %Y')
        date_output_msg = (((date_output_msg + 'Start Date: ') + start_date_string) + ' to ')
    if (end_date is not None):
        end_date_object = date.fromisoformat(end_date)
        end_date_string = end_date_object.strftime('%B %d, %Y')
        date_output_msg = ((date_output_msg + 'End Date: ') + end_date_string)
    if (len(date_output_msg) == len('You have selected: ')):
        date_output_msg = 'Select a date to see it displayed here'
    fig = go.Figure(data=[go.Candlestick(x=historical_data['Date'], open=historical_data['Open'], high=historical_data['High'], low=historical_data['Low'], close=historical_data['Close'])])
    return (historical_data.to_json(), date_output_msg, fig, {'display': 'block'})
@app.callback([dash.dependencies.Output('ivv-hist', 'children'), dash.dependencies.Output('date-range-output', 'children'), dash.dependencies.Output('candlestick', 'figure'), dash.dependencies.Output('candlestick', 'style')], dash.dependencies.Input('run-backtest', 'n_clicks'), [dash.dependencies.State('bbg-identifier-1', 'value'), dash.dependencies.State('big-N', 'value'), dash.dependencies.State('lil-n', 'value'), dash.dependencies.State('hist-data-range', 'start_date'), dash.dependencies.State('hist-data-range', 'end_date')], prevent_initial_call=True)
def update_bbg_data(nclicks, bbg_id_1, N, n, start_date, end_date):
    start_date = (pd.to_datetime(start_date).date() - timedelta(days=ceil(((N + n) * (365 / 252)))))
    start_date = start_date.strftime('%Y-%m-%d')
    historical_data = req_historical_data(bbg_id_1, start_date, end_date)
    date_output_msg = 'Backtesting from '
    if (start_date is not None):
        start_date_object = date.fromisoformat(start_date)
        start_date_string = start_date_object.strftime('%B %d, %Y')
        date_output_msg = (((date_output_msg + 'Start Date: ') + start_date_string) + ' to ')
    if (end_date is not None):
        end_date_object = date.fromisoformat(end_date)
        end_date_string = end_date_object.strftime('%B %d, %Y')
        date_output_msg = ((date_output_msg + 'End Date: ') + end_date_string)
    if (len(date_output_msg) == len('You have selected: ')):
        date_output_msg = 'Select a date to see it displayed here'
    fig = go.Figure(data=[go.Candlestick(x=historical_data['Date'], open=historical_data['Open'], high=historical_data['High'], low=historical_data['Low'], close=historical_data['Close'])])
    return (historical_data.to_json(), date_output_msg, fig, {'display': 'block'})