OpenBB-finance / OpenBB

Investment Research for Everyone, Everywhere.
https://openbb.co
Other
34.19k stars 3.14k forks source link

[Bug] openbb.stocks.candle external_axes=True parameter does not work #4962

Closed Papalloon closed 1 year ago

Papalloon commented 1 year ago

Describe the bug openbb.stocks.candle external_axes=True parameter does not work, seems to return a figure without any axes

To Reproduce from openbb_terminal.sdk import openbb import matplotlib.pyplot as plt

Ticker = 'AAPL'

VAR = openbb.stocks.load( symbol=Ticker, start_date='2023-01-01', interval='1440')

graph = openbb.stocks.candle( data=VAR, asset_type=Ticker, symbol='', external_axes=True)

save graph to check it

candle_name = f'{Ticker}.png' plt.savefig(candle_name)

Screenshots If applicable, add screenshots to help explain your problem. If you are running the terminal using the conda version please rerun the terminal with python terminal.py --debug, and then recreate your issue. Then include a screenshot of the entire error printout.

Desktop (please complete the following information):

Additional context

This works on 2.5.1:

from openbb_terminal.sdk import openbb import matplotlib.pyplot as plt

Ticker = 'AAPL'

VAR = openbb.stocks.load( symbol=Ticker, start_date='2023-01-01', interval='1440')

graph = openbb.stocks.candle( data=VAR, asset_type=Ticker, symbol='')

save graph to check it

candle_name = f'{Ticker}.png' plt.savefig(candle_name)

deeleeramone commented 1 year ago

Matplotlib is not being used, and it looks like you are applying the wrong syntax.

df = openbb.stocks.load('AAPL')
fig = openbb.stocks.candle(data = df, symbol = 'AAPL', external_axes = True)

Screenshot 2023-05-03 at 3 37 19 PM

fig.data

(Candlestick({
     'close': array([ 68.28730011,  70.53022766,  72.01812744, ..., 169.58999634,
                     168.53999329, 167.44999695]),
     'decreasing': {'line': {'width': 0.8}},
     'high': array([ 70.06446627,  71.00577352,  72.19707239, ..., 170.44999695,
                    170.3500061 , 170.91999817]),
     'increasing': {'line': {'width': 0.8}},
     'low': array([ 68.19415837,  69.5889431 ,  70.68219316, ..., 168.63999939,
                   167.53999329, 167.16000366]),
     'name': ' AAPL OHLC',
     'open': array([ 69.8806215 ,  69.7948484 ,  71.07684304, ..., 169.27999878,
                    170.08999634, 169.5       ]),
     'showlegend': False,
     'x': array([datetime.datetime(2020, 4, 28, 0, 0),
                 datetime.datetime(2020, 4, 29, 0, 0),
                 datetime.datetime(2020, 4, 30, 0, 0), ...,
                 datetime.datetime(2023, 5, 1, 0, 0),
                 datetime.datetime(2023, 5, 2, 0, 0),
                 datetime.datetime(2023, 5, 3, 0, 0)], dtype=object),
     'xaxis': 'x',
     'yaxis': 'y2'
 }),
 Bar({
     'marker': {'color': array(['#e4003a', '#00ACFF', '#00ACFF', ..., '#00ACFF', '#e4003a', '#e4003a'],
                               dtype=object),
                'line': {'width': 0.15}},
     'name': 'Volume',
     'opacity': 0.7,
     'x': array([datetime.datetime(2020, 4, 28, 0, 0),
                 datetime.datetime(2020, 4, 29, 0, 0),
                 datetime.datetime(2020, 4, 30, 0, 0), ...,
                 datetime.datetime(2023, 5, 1, 0, 0),
                 datetime.datetime(2023, 5, 2, 0, 0),
                 datetime.datetime(2023, 5, 3, 0, 0)], dtype=object),
     'xaxis': 'x',
     'xhoverformat': '%Y-%m-%d',
     'y': array([112004800, 137280800, 183064000, ...,  52472900,  48425700,  59322913]),
     'yaxis': 'y'
 }))