Esempio n. 1
0
def setMainGraph(stocks, start_date, end_date):

    ##filtering by date
    # print (type(datetime.strptime(start_date, '%Y-%m-%d').date()), start_date)
    # print (type(datetime.strptime(end_date, '%Y-%m-%d').date()), end_date)
    # print (type(data['timestamp'][0]),data['timestamp'][0])

    filtered_data = data[
        (data['timestamp'] > datetime.strptime(start_date, '%Y-%m-%d').date())
        & (data['timestamp'] < datetime.strptime(end_date, '%Y-%m-%d').date())]

    print('Running setMainGraph, stock input: ', stocks)
    ##stock picker returns an array
    title = "Stock chart for"
    traces = []

    if len(stocks) == 1:
        title = f"Stock chart for {stocks[0]}"
        traces.append(
            go.Ohlc(x=filtered_data[filtered_data['symbol'] ==
                                    stocks[0]]['timestamp'].tolist(),
                    open=filtered_data[filtered_data['symbol'] ==
                                       stocks[0]]['open'].tolist(),
                    high=filtered_data[filtered_data['symbol'] ==
                                       stocks[0]]['high'].tolist(),
                    low=filtered_data[filtered_data['symbol'] ==
                                      stocks[0]]['low'].tolist(),
                    close=filtered_data[filtered_data['symbol'] == stocks[0]]
                    ['close'].tolist(),
                    name=stocks[0]))
    elif len(stocks) > 1:
        for stock in stocks:
            title = title + " " + stock
            print(f'Generating {stock}')
            traces.append(
                go.Ohlc(x=filtered_data[filtered_data['symbol'] ==
                                        stock]['timestamp'].tolist(),
                        open=filtered_data[filtered_data['symbol'] ==
                                           stock]['open'].tolist(),
                        high=filtered_data[filtered_data['symbol'] ==
                                           stock]['high'].tolist(),
                        low=filtered_data[filtered_data['symbol'] ==
                                          stock]['low'].tolist(),
                        close=filtered_data[filtered_data['symbol'] == stock]
                        ['close'].tolist(),
                        name=stock))

    return {
        'data':
        traces,
        'layout':
        go.Layout(paper_bgcolor="#393846",
                  plot_bgcolor="#393846",
                  font={'color': '#a2a1af'},
                  xaxis={'color': '#a2a1af'},
                  yaxis={'color': '#a2a1af'},
                  title=title
                  # colorscale= {'color': '#a2a1af'}
                  )
    }
Esempio n. 2
0
    def getStock(self, stockname, startTime, endTime):
        filename = stockname + "-" + fileBaseName(startTime, endTime)
        filePath = imageFolder +'/'  + filename

        # to be replaced by market data service
        # df = web.DataReader(stockname, 'morningstar', startTime, endTime).reset_index()
        MDS = MarketDataService()
        df = MDS.get_df(stockname, 'morningstar', startTime, endTime)
        trace = go.Ohlc(x=df.Date,
                open=df.Open,
                high=df.High,
                low=df.Low,
                close=df.Close)

        layout = go.Layout(
            xaxis = dict(
                rangeslider = dict(
                    visible = False
                )
            )
        )
        data = [trace]
        fig = go.Figure(data=data, layout=layout)
        
        plt.image.save_as(fig, filename=Path(filePath))

        return(self.showResult(stockTemplate, imageFolder, filename))
Esempio n. 3
0
    def getCrypto(self, symbol, market, startTime, endTime, timeframe=None):
        filename = symbol + "-" + fileBaseName(startTime, endTime)
        filePath = imageFolder +'/'  + filename

        MDS = MarketDataService()
        df = MDS.get_crypto(symbol, market, startTime, endTime, timeframe)
        trace = go.Ohlc(x=df.date,
                open=df.a0,
                high=df.a2,
                low=df.a4,
                close=df.a6)

        layout = go.Layout(
            xaxis = dict(
                rangeslider = dict(
                    visible = False
                )
            )
        )
        data = [trace]
        fig = go.Figure(data=data, layout=layout)
        
        plt.image.save_as(fig, filename=Path(filePath))

        return(self.showResult(stockTemplate, imageFolder, filename))
Esempio n. 4
0
def plot_ohlc(df, stock_name):
    trace = go.Ohlc(x=df['<DTYYYYMMDD>'],
                    open=df['<Open>'],
                    high=df['<High>'],
                    low=df['<Low>'],
                    close=df['<Close>'],
                    increasing=dict(line=dict(color='#58FA58')),
                    decreasing=dict(line=dict(color='#FA5858')))

    layout = {
        'title': f'{stock_name} Historical Price',
        'xaxis': {
            'title': 'Date',
            'rangeslider': {
                'visible': False
            }
        },
        'yaxis': {
            'title': f'Price'
        }
    }

    data = [trace]

    fig = go.Figure(data=data, layout=layout)
    fig.show()
    return fig
Esempio n. 5
0
    def graph_OHLC(self):
        #not quite there, but the other one works, which is what i really care about
        OHLC_trace = go.Ohlc(x=self.OHLC_data.Date_Time,
                             open=self.OHLC_data.Open,
                             high=self.OHLC_data.High,
                             low=self.OHLC_data.Low,
                             close=self.OHLC_data.Close,
                             name="OHLC Data",
                             increasing=dict(line=dict(color='#408e4a')),
                             decreasing=dict(line=dict(color='#cc2718')))

        swing_data = pd.read_csv(
            self.swing_file,
            names=['Date_Time', 'Price', 'Direction', 'Row'],
            parse_dates=True)
        swing_trace = go.Scatter(x=swing_data.Date_Time,
                                 y=swing_data.Price,
                                 mode='lines+markers',
                                 name='Swings',
                                 line=dict(color=('rgb(111, 126, 130)'),
                                           width=3))

        data = [OHLC_trace, swing_trace]
        layout = go.Layout(xaxis=dict(rangeslider=dict(visible=False)),
                           title=self.data_file[:-4])

        fig = go.Figure(data=data, layout=layout)
        py.plot(fig, filename=self.data_file + ".html", output_type='file')
Esempio n. 6
0
def get_trace_ohlc(df, x_column='DateTime'):
    trace = go.Ohlc(x=df[x_column],
                    open=df.Open,
                    high=df.High,
                    low=df.Low,
                    close=df.Close)
    return trace
def graph_high_low_open_close(coin_name):
    conn = sqlite3.connect('crypto.sqlite')
    cur = conn.cursor()
    labels_for_graph = []
    high_values_for_graph= []
    low_values_for_graph = []
    open_values_for_graph = []
    close_values_for_graph = []

    statement = '''
            SELECT Date, High, Low , Open, Close FROM "{}" ORDER BY ID DESC
                '''.format(coin_name)
    cur.execute(statement)
    for i, j, k, l, m in cur:
        t = datetime.strptime(i.replace(',', ''), '%b %d %Y')
        labels_for_graph.append(t)
        high_values_for_graph.append(j)
        low_values_for_graph.append(k)
        open_values_for_graph.append(l)
        close_values_for_graph.append(m)
    trace = go.Ohlc(x=labels_for_graph,
                open=open_values_for_graph,
                high=high_values_for_graph,
                low=low_values_for_graph,
                close=close_values_for_graph)



    data = [trace]

    py.plot(data, filename='High-Low-Open-Close For {}'.format(coin_name))
    def change_mode(value):
        refresh_data(crypto_symbol, value)
        global x_data
        global y_data_box_open
        graphs = []

        graphs.append(
            go.Scatter(x=x_data, y=y_data_scatter, name='Manipulate Graph'))

        graphs.append(
            go.Ohlc(x=x_data,
                    open=y_data_box_open,
                    high=y_data_box_high,
                    low=y_data_box_low,
                    close=y_data_box_close))

        layout = go.Layout(
            paper_bgcolor='#27293d',
            plot_bgcolor='rgba(0,0,0,0)',
            xaxis=dict(range=[min(x_data), max(x_data)]),
            yaxis=dict(range=[min(y_data_box_open),
                              max(y_data_box_open)]),
            font=dict(color='white'),
        )
        return {'data': graphs, 'layout': layout}
Esempio n. 9
0
def analyze(context, perf):
    trace0 = go.Ohlc(x=perf.index.to_series(),
                     open=perf.open,
                     high=perf.high,
                     low=perf.low,
                     close=perf.close,
                     showlegend=False)

    pos_values = perf.signal[perf.signal > 0]
    pos_high_values = perf.high[perf.high.index.isin(pos_values.index)]
    neg_values = perf.signal[perf.signal < 0]
    neg_low_values = perf.high[perf.high.index.isin(neg_values.index)]

    trace1 = go.Scatter(x=pos_values.index.to_series(),
                        y=pos_high_values,
                        mode='markers',
                        name='Bull Break')

    trace2 = go.Scatter(x=neg_values.index.to_series(),
                        y=neg_low_values,
                        mode='markers',
                        name='Bear Break')

    data = [trace0, trace1, trace2]
    py.plot(data, filename='simple_ohlc2')
Esempio n. 10
0
    def plot_raw_data(self, data):
        d = data
        xVar = 'Date'
        if ('Datetime' in d):
            xVar = 'Datetime'
        # fig = 0
        # del fig
        #scatter object class has list of all traces
        # self.figure_bettername = go.Figure(go.Ohlc(x=d['Datetime'], open=d['Open'], high=d['High'], low=d['Low'], close=d['Close']))

        self.figure_bettername = go.Figure(
            go.Ohlc(x=d[xVar],
                    open=d['Open'],
                    high=d['High'],
                    low=d['Low'],
                    close=d['Close']))

        # self.figure_bettername.add_trace()
        # self.figure_bettername.add_trace(go.Scatter(x=d['Date'], y=d['High'], name="stock_high"))
        # self.figure_bettername.add_trace(go.Scatter(x=d['Date'], y=d['Low'], name="stock_low"))
        # self.figure_bettername.update_xaxes(rangeslider_range=d['Date'])
        # fig.del()
        # fig.add_trace(go.Scatter(x=data['Date'], y=data['Volume'], name="Volume"))
        # fig.layout.update(title_text='Time Series data with Rangeslider', xaxis_rangeslider_visible=True)

        self.chartplot.empty()
        self.chartplot = st.plotly_chart(self.figure_bettername)
Esempio n. 11
0
def market_price(stock='GOOGL'):
    start = datetime.datetime(2019, 1, 1)
    end = datetime.datetime(2019, 5, 1)

    STOCK = web.DataReader(stock, 'yahoo', start, end)
    # STOCK = web.DataReader(stock, 'google', start, end)   # deprecated

    data = go.Ohlc(
        x=STOCK.index[:],
        open=STOCK['Open'],
        high=STOCK['High'],
        low=STOCK['Low'],
        close=STOCK['Close'],
        name=stock,
        increasing=dict(line=dict(color='blue')),
        decreasing=dict(line=dict(color='red')),
    )

    layout = {
        'title': stock,
        'xaxis': {
            'title': 'Year to Date 2019'
        },
        'yaxis': {
            'title': 'Price per stock ($)'
        }
    }
    data = dict(data=[data], layout=layout)
    return data
Esempio n. 12
0
def update_figure(selected_stock):
    """Will show different graphs on the figure, depending on what the user selects. Will be called every single time the user changes value on the dropdown list.

    Parameters
    ----------
    selected_stock : string
        The value selected in the dropdown list.

    Returns
    -------
    figure
        Return the figure type information in an array with the new read figure data.

    """
    df = get_history(selected_stock)
    fig = go.Figure(data=go.Ohlc(x=df['Date'],
                        open   = df['Open'],
                        high   = df['High'],
                        low    = df['Low'],
                        close  = df['Close']),
                        layout = go.Layout(
                        title  = go.layout.Title(text="Graph Showing " + selected_stock.upper() + " Stock Price History")
                        )
    )
    print(fig["layout"])
    return fig
Esempio n. 13
0
def update_figure(selected):
    dff = df[(df["year"] >= selected[0]) & (df["year"] <= selected[1])]
    trace = go.Ohlc(x=dff['date'],
                    open=dff['open'],
                    high=dff['high'],
                    low=dff['low'],
                    close=dff['close'],
                    increasing={'line': {'color': '#00CC94'}},
                    decreasing={'line': {'color': '#F50030'}}
                    )

    return {
        'data': [trace],
        'layout': go.Layout(
            title=f"Stock Values for the period:{'-'.join(str(i) for i in selected)}",
            xaxis={
                
                'rangeslider': {'visible': False},
                'autorange': "reversed",
            },
            yaxis={
                "title": f'Stock Price (USD)'
            }

        )}
Esempio n. 14
0
def create_plotting(symbol, interval):

    py.sign_in(PLOTLY_USER, PLOTLY_PASSWORD)

    df = get_stock(symbol, interval)

    if (df is None):

        return ("Error", None)

    else:

        df = df.astype(float)

        High = max(df['High'])
        Low = min(df['Low'])
        data_mean = np.round(df['Close'].mean(), 2)
        data_std = np.round(df['Close'].std(), 4)

        return_object = {
            'high': High,
            'low': Low,
            'mean': data_mean,
            'std': data_std
        }

        trace_stock = go.Ohlc(x=df.index,
                              open=df.Open,
                              high=df.High,
                              low=df.Low,
                              close=df.Close)

        trace_volume = go.Scatter(x=df.index.values,
                                  y=df['Volume'],
                                  line=dict(color=('rgb(22, 96, 167)'),
                                            width=4))

        stock_label = symbol + ' ' + interval + ' interval graph'

        fig = tools.make_subplots(rows=4,
                                  cols=1,
                                  specs=[[{
                                      'rowspan': 3
                                  }], [None], [None], [{}]],
                                  shared_xaxes=True,
                                  shared_yaxes=True,
                                  vertical_spacing=0.12,
                                  subplot_titles=(stock_label, '', '',
                                                  'Trading volume'))

        fig.append_trace(trace_stock, 1, 1)
        fig.append_trace(trace_volume, 4, 1)

        fig['layout'].update(xaxis=dict(rangeslider=dict(visible=False)),
                             showlegend=False)
        path = 'data/plotting/' + symbol + '_graph.png'
        py.image.save_as(fig, filename=path)
        return (symbol + '_graph.png', return_object)
Esempio n. 15
0
def RenderCoinPage(CurrentCoin):
    RootPage = html.Div([
        html.A(html.H1(CurrentCoin.Name,
                       style={
                           "color": "Black",
                           "fontSize": 72,
                           "textAlign": "center"
                       }),
               href=CurrentCoin.Website,
               target="_blank"),
        dcc.Link("Home Page", href="/", style={
            "color": "Red",
            "fontSize": 28
        }),
        html.Br(),
        html.Div([
            html.Div([
                dcc.Link(Coin.Name,
                         href="/" + Coin.Abbreviation,
                         style={
                             "color": "Blue",
                             "fontSize": 24
                         })
            ],
                     className="two columns")
            for Coin in [item for item in Coins if CurrentCoin != item]
        ],
                 className="row"),
        dcc.Graph(figure={
            "layout":
            go.Layout(title=CurrentCoin.Name + " Market",
                      legend=dict(orientation="h"),
                      xaxis=dict(type="date"),
                      yaxis=dict(title=CurrentCoin.Name + " Prices (USD)",
                                 showticklabels=True)),
            "data": [
                go.Ohlc(x=CurrentCoin.Date,
                        open=CurrentCoin.Open,
                        high=CurrentCoin.High,
                        low=CurrentCoin.Low,
                        close=CurrentCoin.Close)
            ]
        },
                  id=CurrentCoin.Name + "Graph",
                  style={"height": 1000}),
        html.Ul([
            html.Li(
                html.A(Article[0],
                       href=Article[1],
                       style={
                           "color": "Blue",
                           "fontSize": 24
                       },
                       target="_blank")) for Article in CurrentCoin.TopStories
        ],
                style={"padding-left": 70})
    ])
    return RootPage
Esempio n. 16
0
def bar_trace(df, y_col):
    return go.Ohlc(
        x=df.index,
        open=df[y_col],
        increasing=dict(line=dict(color="#888888")),
        decreasing=dict(line=dict(color="#888888")),
        showlegend=False,
        name="bar",
    )
def makeOhlcTrace(label, dates, opens, highs, lows, closes):
    trace = go.Ohlc(name=label,
                    x=dates,
                    open=opens,
                    high=highs,
                    low=lows,
                    close=closes)

    return trace
Esempio n. 18
0
def get_currency_graph_update(exchange_name, symbol, time_frame, cryptocurrency_name):
    symbol_evaluator_list = get_bot().get_symbol_evaluator_list()
    exchange_list = get_bot().get_exchanges_list()

    if time_frame is not None:
        if len(symbol_evaluator_list) > 0:
            evaluator_thread_managers = symbol_evaluator_list[symbol].get_evaluator_thread_managers(
                exchange_list[exchange_name])

            if time_frame in evaluator_thread_managers:
                evaluator_thread_manager = evaluator_thread_managers[time_frame]
                data = evaluator_thread_manager.get_evaluator().get_data()

                if data is not None:
                    _, pair_tag = split_symbol(symbol)
                    add_to_symbol_data_history(symbol, data, time_frame)
                    data = get_symbol_data_history(symbol, time_frame)

                    # data.loc[:, PriceStrings.STR_PRICE_TIME.value] /= 1000

                    data_x = data[PriceIndexes.IND_PRICE_TIME.value]
                    data_y = data[PriceIndexes.IND_PRICE_CLOSE.value]

                    # Candlestick
                    ohlc_graph = go.Ohlc(x=data[PriceIndexes.IND_PRICE_TIME.value],
                                         open=data[PriceIndexes.IND_PRICE_OPEN.value],
                                         high=data[PriceIndexes.IND_PRICE_HIGH.value],
                                         low=data[PriceIndexes.IND_PRICE_LOW.value],
                                         close=data[PriceIndexes.IND_PRICE_CLOSE.value])

                    real_trades_prices, real_trades_times, simulated_trades_prices, simulated_trades_times = \
                        get_trades_by_times_and_prices()

                    real_trades_points = go.Scatter(
                        x=real_trades_prices,
                        y=real_trades_times,
                        mode='markers',
                        name='markers'
                    )

                    simulated_trades_points = go.Scatter(
                        x=simulated_trades_times,
                        y=simulated_trades_prices,
                        mode='markers',
                        name='markers'
                    )

                    return {'data': [ohlc_graph, real_trades_points, simulated_trades_points],
                            'layout': go.Layout(
                                title="{} real time data (per time frame)".format(cryptocurrency_name),
                                xaxis=dict(range=[min(data_x), max(data_x)],
                                           title=TIME_AXIS_TITLE),
                                yaxis=dict(range=[min(data_y) * 0.98, max(data_y) * 1.02],
                                           title=pair_tag)
                            )}
    return None
Esempio n. 19
0
def colored_bar_trace(df):
    return go.Ohlc(
        x=df.index,
        open=df["open"],
        high=df["high"],
        low=df["low"],
        close=df["close"],
        showlegend=False,
        name="colored bar",
    )
Esempio n. 20
0
 def to_ohlc(self,id=str,dataframe=None):
     ohlc = go.Ohlc(
         x=dataframe["Date"],
         open=dataframe["Open"],
         close=dataframe["Close"],
         high=dataframe["High"],
         low=dataframe["Low"]
     )
     final = dcc.Graph(id=id,figure=dict(data=[ohlc]))
     return final
Esempio n. 21
0
def refresh_tkrTrend(tkr):
    start = dtm.utcnow()
    tFrame = pdr.DataReader(tkr, 'iex', start - timedelta(188), start)
    trace = go.Ohlc(x=list(tFrame.index),
                    open=tFrame['open'],
                    high=tFrame['high'],
                    low=tFrame['low'],
                    close=tFrame['close'])
    figure = {'data': [trace], 'layout': {'title': 'Stock Trends'}}
    return figure
Esempio n. 22
0
def build_ohlcv(df, title='Intraday OHLCV Plot'):
    """
    Builds an OHLCV candlestick plot and returns a Plotly figure
    """

    cols = ["Open", "High", "Low", "Close", "Volume"]

    if not [col in df.columns for col in cols]:
        raise ValueError("'df' does not contain all required OHLCV columns: {}".format(cols))

    # Build the OHLC candlestick trace
    trace1 = go.Ohlc(
        x=df.index,
        open=df["Open"],
        high=df["High"],
        low=df["Low"],
        close=df["Close"],
        name="OHLC"
    )

    # Build the Volume barchart
    trace2 = go.Bar(
        x=df.index,
        y=df["Volume"],
        yaxis='y2',         # Plot on a separate axis
        name="Volume",
        opacity=0.6,        # Slightly opaque
        marker=dict(
            color='rgb(66, 134, 244)'   # Blue color
        )
    )

    # Define the layout
    layout = go.Layout(
        showlegend=False,
        title=title,
        yaxis=dict(
            title='OHLC',
            side="left"
        ),
        yaxis2=dict(
            title='Volume',
            side="right",     
            overlaying="y"  # Volume plot overlays the candlestick
        ),
        template="plotly_white"
    )

    # Aggregate the traces and build the figure
    data = [trace1, trace2]
    fig = go.Figure(data=data, layout=layout)

    # Return the plotly figure
    return fig
Esempio n. 23
0
def plot_candlestick(stockData):
    ohlc = stockData.getOhlc()
    trace_cs = go.Ohlc(x=ohlc['Date'],
                       open=ohlc['Open'],
                       high=ohlc['High'],
                       low=ohlc['Low'],
                       close=ohlc['Close'],
                       name='Candlestick Pattern')

    data = [trace_cs]
    fig = go.Figure(data=data)
    plot(fig)
Esempio n. 24
0
def plot_olhc(value):
    global data
    dates, open_data, high_data, low_data, close_data, _ \
        = data.get_ohlcv(value)
    return {
        'data': [go.Ohlc(x=dates,
                         open=open_data,
                         high=high_data,
                         low=low_data,
                         close=close_data)],
        'layout': dict(title="OHLC")
    }
Esempio n. 25
0
def bar_trace(df):
    return go.Ohlc(
        x=df.index,
        open=df["open"],
        high=df["high"],
        low=df["low"],
        close=df["close"],
        increasing=dict(line=dict(color="#888888")),
        decreasing=dict(line=dict(color="#888888")),
        showlegend=False,
        name="bar",
    )
Esempio n. 26
0
def plot():
    plotly.tools.set_credentials_file(username='******', api_key=apiKey_pl)

    df = pd.read_csv('historical.csv')
    
    trace = go.Ohlc(x=df['date'],
                    open=df['open'],
                    high=df['high'],
                    low=df['low'],
                    close=df['close'])
    data = [trace]
    py.iplot(data, filename='simple_ohlc')
Esempio n. 27
0
def plot_ohlc(df, title_str):

    trace = go.Ohlc(x=df.index,
                    open=df.Open,
                    high=df.High,
                    low=df.Low,
                    close=df.Close,
                    increasing=dict(line=dict(color='red')),
                    decreasing=dict(line=dict(color='green')))

    data = [trace]

    iplot(data, filename=title_str)
Esempio n. 28
0
    def __genOhlcData(self, dataframe, startDate=None, endDate=None):
        df = dataframe.loc[startDate:endDate]

        trace = go.Ohlc(x=df.index,
                        name="K Line",
                        open=df.OpenPrice,
                        high=df.MaxPrice,
                        low=df.MinPrice,
                        close=df.ClosePrice,
                        increasing=dict(line=dict(color='#FF0000')),
                        decreasing=dict(line=dict(color='#008000')))

        return trace
Esempio n. 29
0
    def export_graphs(self, output_path):
        for key,value in self.wave_data.items():
            my_swing_data = value[0]
            print("My Swing Data:", my_swing_data)

            lables = []
            if key == "WaveC":
                lables = ["","","","","","","A", "B", "C"]
            else:
                lables = [str(x) for x in range(len(my_swing_data.index))]

            OHLC_trace = go.Ohlc(x=self.OHLC_data.index,
                    open=self.OHLC_data.Open,
                    high=self.OHLC_data.High,
                    low=self.OHLC_data.Low,
                    close=self.OHLC_data.Close,
                    name="OHLC Data",
                    increasing=dict(line=dict(color= '#408e4a')),
                    decreasing=dict(line=dict(color= '#cc2718')))

            print([str(x) for x in range(1, len(my_swing_data.index))])
            swing_trace = go.Scatter(
                x = my_swing_data.Date_Time,
                y = my_swing_data.Price,
                mode = 'lines+markers+text',
                name = 'Swings',
                line = dict(
                    color = ('rgb(111, 126, 130)'),
                    width = 3),
                text=lables,
                textposition='top center',
                textfont=dict(
                    family='sans serif',
                    size=35,
                    color='#2c3035'
                )
            )

            data = [OHLC_trace, swing_trace]

            time_frame = output_path.split("_")[-1]

            layout = dict(
                            title=self.currency_name + " " + key + " " + time_frame + ": " + value[1],
                            xaxis = dict(
                            type="category"))

            fig = go.Figure(data=data, layout=layout)
            # offline.plot(fig, output_type='file',filename=self.currency_name + ".html", image='png', image_filename=self.currency_name)
            offline.plot(fig, output_type='file',filename=output_path + "_" + key + ".html", auto_open=False)
Esempio n. 30
0
def plot_olhc(value):
    global data
    df = data.get_window_ohlcv(value)
    return {
        'data': [
            go.Ohlc(x=df.time,
                    open=df.open,
                    high=df.high,
                    low=df.low,
                    close=df.close)
        ],
        'layout':
        dict(title="OHLC")
    }