Last active
August 20, 2024 09:31
-
-
Save SajidLhessani/69515feb77849ce1456867a924dc74e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Raw Package | |
import numpy as np | |
import pandas as pd | |
#Data Source | |
import yfinance as yf | |
#Data viz | |
import plotly.graph_objs as go | |
#Interval required 1 minute | |
data = yf.download(tickers='UBER', period='1d', interval='1m') | |
#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='Uber live share price evolution', | |
yaxis_title='Stock Price (USD per Shares)') | |
# 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=3, label="3h", 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