forked from adi0509/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcandlestick_chart.py
More file actions
36 lines (26 loc) · 1.03 KB
/
candlestick_chart.py
File metadata and controls
36 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
"""Candlestick_Chart.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1s5Wq0rCZkzRSdDDKDtq55qq2-tV8kYZa
"""
#Resource:
#Candlestick Charts in Python: https://plot.ly/python/candlestick-charts/#simple-example-with-datetime-objects
#Import the libraries
import plotly.graph_objects as go
import pandas as pd
from datetime import datetime
from pandas_datareader import data as web
# Get the stocks ending date aka todays date and format it in the form YYYY-MM-DD
today = datetime.today().strftime('%Y-%m-%d')
df = web.DataReader('ZOM', data_source='yahoo',
start='2013-01-01' , end=today)
df['Date'] = df.index
fig = go.Figure(data=[go.Candlestick(x=df['Date'],
open=df['Open'],
high=df['High'],
low=df['Low'],
close=df['Close'],
increasing_line_color= 'gold', decreasing_line_color= 'black'
)])
fig.show()