test
This commit is contained in:
parent
a4b2638ec2
commit
b2db4c099c
22
GetDaily.py
22
GetDaily.py
|
|
@ -10,12 +10,14 @@ import yfinance as yf
|
||||||
import plotly.graph_objects as go
|
import plotly.graph_objects as go
|
||||||
|
|
||||||
#Quandl test
|
#Quandl test
|
||||||
quandl.ApiConfig.api_key = "sEj_5XNt1kyxi27p5nre"
|
#quandl.ApiConfig.api_key = "sEj_5XNt1kyxi27p5nre"
|
||||||
amazon = quandl.get("WIKI/AMZN")
|
#amazon = quandl.get("WIKI/AMZN")
|
||||||
print(amazon.head())
|
#print(amazon.head())
|
||||||
print(amazon.tail(10))
|
#print(amazon.tail(10))
|
||||||
|
|
||||||
#Yfinance tests
|
#Yfinance tests
|
||||||
|
#https://pypi.org/project/yfinance/
|
||||||
|
|
||||||
df = yf.download("TSLA", start="2018-11-01", end="2020-10-18", interval="1d")
|
df = yf.download("TSLA", start="2018-11-01", end="2020-10-18", interval="1d")
|
||||||
fig = go.Figure(
|
fig = go.Figure(
|
||||||
data=go.Ohlc(
|
data=go.Ohlc(
|
||||||
|
|
@ -26,4 +28,14 @@ fig = go.Figure(
|
||||||
close=df["Close"],
|
close=df["Close"],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
fig.show()
|
fig.show()
|
||||||
|
|
||||||
|
|
||||||
|
data2 = yf.download("SPY AAPL", start="2017-01-01", end="2017-04-30")
|
||||||
|
print(data2.tail())
|
||||||
|
|
||||||
|
|
||||||
|
msft = yf.Ticker("MSFT")
|
||||||
|
|
||||||
|
# get stock info
|
||||||
|
msft.info
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
#Get stock symbols in a file
|
||||||
|
#Get daily quote at end of day
|
||||||
|
#Send email, see Jupyter thing on other laptop for sending email
|
||||||
|
|
||||||
|
#Quandl no more data after 2018 for some reason
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import yfinance as yf
|
||||||
|
import plotly.graph_objects as go
|
||||||
|
|
||||||
|
#Yfinance tests
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
msft = yf.Ticker("MSFT")
|
||||||
|
|
||||||
|
# get stock info
|
||||||
|
msft.info
|
||||||
|
|
||||||
|
# get historical market data
|
||||||
|
hist = msft.history(period="max")
|
||||||
|
|
||||||
|
# show major holders
|
||||||
|
print(msft.major_holders)
|
||||||
|
|
||||||
|
# show institutional holders
|
||||||
|
print(msft.institutional_holders)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# show sustainability
|
||||||
|
print(msft.sustainability)
|
||||||
|
|
||||||
|
# show analysts recommendations
|
||||||
|
print(msft.recommendations)
|
||||||
|
|
||||||
|
# show next event (earnings, etc)
|
||||||
|
print(msft.calendar)
|
||||||
|
|
||||||
|
|
||||||
|
# show ISIN code - *experimental*
|
||||||
|
# ISIN = International Securities Identification Number
|
||||||
|
print(msft.isin)
|
||||||
|
|
||||||
|
|
||||||
|
# show options expirations
|
||||||
|
print(msft.options)
|
||||||
|
|
||||||
|
# get option chain for specific expiration
|
||||||
|
opt = msft.option_chain('2020-12-18')
|
||||||
|
print(opt)
|
||||||
|
# data available via: opt.calls, opt.puts
|
||||||
Loading…
Reference in New Issue