Skip to content

Instantly share code, notes, and snippets.

@SajidLhessani
Last active January 16, 2021 13:40
Show Gist options
  • Save SajidLhessani/8a07484a21c54c135c56161642af33f6 to your computer and use it in GitHub Desktop.
Save SajidLhessani/8a07484a21c54c135c56161642af33f6 to your computer and use it in GitHub Desktop.
# Raw Package
import numpy as np
import pandas as pd
#Data Source
import yfinance as yf
#Data viz
import plotly.graph_objs as go
# Get Bitcoin data
data = yf.download(tickers='BTC-USD', period = '22h', interval = '15m')
#declare figure
fig = go.Figure()
#Candlestick
fig.add_trace(go.Candlestick(x=data.index,
open=data['Open'],
high=data['High'],
low=data['Low'],
close=data['Close'], name = 'market data'))
# Add titles
fig.update_layout(
title='Bitcoin live share price evolution',
yaxis_title='Bitcoin Price (kUS Dollars)')
# X-Axes
fig.update_xaxes(
rangeslider_visible=True,
rangeselector=dict(
buttons=list([
dict(count=15, label="15m", step="minute", stepmode="backward"),
dict(count=45, label="45m", step="minute", stepmode="backward"),
dict(count=1, label="HTD", step="hour", stepmode="todate"),
dict(count=6, label="6h", step="hour", stepmode="backward"),
dict(step="all")
])
)
)
#Show
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment