Compare commits
10 Commits
b2db4c099c
...
5c2ec0a069
| Author | SHA1 | Date |
|---|---|---|
|
|
5c2ec0a069 | |
|
|
3a49875fc9 | |
|
|
aa73d5a8f0 | |
|
|
4cdf07f35f | |
|
|
e05a531f10 | |
|
|
e7edab7977 | |
|
|
fd6bf64942 | |
|
|
8aab42baac | |
|
|
013df35157 | |
|
|
099f7ac8c3 |
|
|
@ -0,0 +1,4 @@
|
||||||
|
curl 'https://api.openfigi.com/v3/mapping' \
|
||||||
|
--request POST \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '[{"idType":"ID_ISIN","idValue":"US22041X1028","exchCode":"US"}]'
|
||||||
65
GetDaily.py
65
GetDaily.py
|
|
@ -2,40 +2,55 @@
|
||||||
#Get daily quote at end of day
|
#Get daily quote at end of day
|
||||||
#Send email, see Jupyter thing on other laptop for sending email
|
#Send email, see Jupyter thing on other laptop for sending email
|
||||||
|
|
||||||
#Quandl no more data after 2018 for some reason
|
|
||||||
|
|
||||||
import quandl
|
|
||||||
import numpy as np
|
|
||||||
import yfinance as yf
|
import yfinance as yf
|
||||||
import plotly.graph_objects as go
|
import smtplib, ssl, sys, os, configparser
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
from email.mime.application import MIMEApplication
|
||||||
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
from smtplib import SMTP
|
||||||
|
|
||||||
|
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read("c:/Users/Seb/pythonmodule/Module1/testenv.txt")
|
||||||
|
emailp = config.get("config","test")
|
||||||
|
|
||||||
|
|
||||||
#Quandl test
|
|
||||||
#quandl.ApiConfig.api_key = "sEj_5XNt1kyxi27p5nre"
|
|
||||||
#amazon = quandl.get("WIKI/AMZN")
|
|
||||||
#print(amazon.head())
|
|
||||||
#print(amazon.tail(10))
|
|
||||||
|
|
||||||
#Yfinance tests
|
#Yfinance tests
|
||||||
#https://pypi.org/project/yfinance/
|
#https://pypi.org/project/yfinance/
|
||||||
|
|
||||||
df = yf.download("TSLA", start="2018-11-01", end="2020-10-18", interval="1d")
|
|
||||||
fig = go.Figure(
|
data2 = yf.download("CRSR VTI VOO DIS UI TSLA TTWO VFV GME", period="1d")
|
||||||
data=go.Ohlc(
|
#print(data2.tail(1))
|
||||||
x=df.index,
|
#data2.head()
|
||||||
open=df["Open"],
|
Dayclose = data2["Close"].round(decimals=2)
|
||||||
high=df["High"],
|
|
||||||
low=df["Low"],
|
recipients = ["sebastien.trudel@pirolian.com"]
|
||||||
close=df["Close"],
|
emaillist = [elem.strip().split(',') for elem in recipients]
|
||||||
)
|
msg = MIMEMultipart()
|
||||||
)
|
msg["Subject"] = "Daily Stock report"
|
||||||
fig.show()
|
msg["From"] = "strudel@pirolian.com"
|
||||||
|
|
||||||
|
|
||||||
data2 = yf.download("SPY AAPL", start="2017-01-01", end="2017-04-30")
|
html = """\
|
||||||
print(data2.tail())
|
<html>
|
||||||
|
<head></head>
|
||||||
|
<body>
|
||||||
|
{0}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
""".format(Dayclose.to_html())
|
||||||
|
|
||||||
|
part1 = MIMEText(html, "html")
|
||||||
|
msg.attach(part1)
|
||||||
|
|
||||||
|
context = ssl.create_default_context()
|
||||||
|
Email_Port = 465 # If you are not using a gmail account, you will need to look up the port for your specific email host
|
||||||
|
with smtplib.SMTP_SSL("smtppro.zoho.com", Email_Port, context=context) as server:
|
||||||
|
server.login("strudel@pirolian.com", emailp) # This statement is of the form: server.login(<Your email>, "Your email password")
|
||||||
|
# server.sendmail("strudel@pirolian.com", "sebastien.trudel@pirolian.com", Body_of_Email) # This statement is of the form: server.sendmail(<Your email>, <Email receiving message>, Body_of_Email)
|
||||||
|
server.sendmail(msg["From"], emaillist, msg.as_string()) # This statement is of the form: server.sendmail(<Your email>, <Email receiving message>, Body_of_Email)
|
||||||
|
|
||||||
|
|
||||||
msft = yf.Ticker("MSFT")
|
|
||||||
|
|
||||||
# get stock info
|
|
||||||
msft.info
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
#Get stock symbols in a file
|
||||||
|
#Get daily quote at end of day
|
||||||
|
#Send email, see Jupyter thing on other laptop for sending email
|
||||||
|
|
||||||
|
|
||||||
|
import yfinance as yf
|
||||||
|
import smtplib, ssl, sys, os, configparser
|
||||||
|
import sqlite3
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
from email.mime.application import MIMEApplication
|
||||||
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
from smtplib import SMTP
|
||||||
|
|
||||||
|
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
config.read("c:/Users/Seb/pythonmodule/Module1/testenv.txt")
|
||||||
|
emailp = config.get("config","test")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Yfinance tests
|
||||||
|
#https://pypi.org/project/yfinance/
|
||||||
|
|
||||||
|
|
||||||
|
data2 = yf.download("CRSR VTI VOO DIS UI TSLA TTWO VFV GME", period="1d")
|
||||||
|
#print(data2.tail(1))
|
||||||
|
#data2.head()
|
||||||
|
Dayclose = data2["Close"].round(decimals=2)
|
||||||
|
|
||||||
|
recipients = ["sebastien.trudel@pirolian.com"]
|
||||||
|
emaillist = [elem.strip().split(',') for elem in recipients]
|
||||||
|
msg = MIMEMultipart()
|
||||||
|
msg["Subject"] = "Daily Stock report"
|
||||||
|
msg["From"] = "strudel@pirolian.com"
|
||||||
|
|
||||||
|
|
||||||
|
html = """\
|
||||||
|
<html>
|
||||||
|
<head></head>
|
||||||
|
<body>
|
||||||
|
{0}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
""".format(Dayclose.to_html())
|
||||||
|
|
||||||
|
part1 = MIMEText(html, "html")
|
||||||
|
msg.attach(part1)
|
||||||
|
|
||||||
|
context = ssl.create_default_context()
|
||||||
|
Email_Port = 465 # If you are not using a gmail account, you will need to look up the port for your specific email host
|
||||||
|
with smtplib.SMTP_SSL("smtppro.zoho.com", Email_Port, context=context) as server:
|
||||||
|
server.login("strudel@pirolian.com", emailp) # This statement is of the form: server.login(<Your email>, "Your email password")
|
||||||
|
# server.sendmail("strudel@pirolian.com", "sebastien.trudel@pirolian.com", Body_of_Email) # This statement is of the form: server.sendmail(<Your email>, <Email receiving message>, Body_of_Email)
|
||||||
|
server.sendmail(msg["From"], emaillist, msg.as_string()) # This statement is of the form: server.sendmail(<Your email>, <Email receiving message>, Body_of_Email)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
sqliteConnection = sqlite3.connect('dbstocks.sqlite')
|
||||||
|
cursor = sqliteConnection.cursor()
|
||||||
|
print("Successfully Connected to SQLite")
|
||||||
|
|
||||||
|
except sqlite3.Error as error:
|
||||||
|
print("Error while executing sqlite script", error)
|
||||||
|
|
||||||
|
#cursor.execute('SELECT * from dailystocks')
|
||||||
|
|
||||||
|
#rows = cursor.fetchall()
|
||||||
|
|
||||||
|
#for row in rows:
|
||||||
|
# print(row)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
#Quandl no more stock data after 2018 for some reason
|
||||||
|
|
||||||
|
import quandl
|
||||||
|
import numpy as np
|
||||||
|
import yfinance as yf
|
||||||
|
import plotly.graph_objects as go
|
||||||
|
|
||||||
|
#Quandl test
|
||||||
|
quandl.ApiConfig.api_key = "sEj_5XNt1kyxi27p5nre"
|
||||||
|
amazon = quandl.get("WIKI/AMZN")
|
||||||
|
print(amazon.head())
|
||||||
|
print(amazon.tail(10))
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
# Stocks
|
# Stocks
|
||||||
|
|
||||||
|
|
||||||
test
|
Stock data manipulation with Python test.
|
||||||
|
|
||||||
|
# Project 1:
|
||||||
|
# Get data at the end of the day for a list of stocks and send email at end of day with prices, maybe other info.
|
||||||
|
|
||||||
|
* Get data for stocks
|
||||||
|
* Send by email
|
||||||
|
|
|
||||||
1
test.py
1
test.py
|
|
@ -1,4 +1,5 @@
|
||||||
#DataFlair - Make necessary imports
|
#DataFlair - Make necessary imports
|
||||||
|
#Quandl stock data stop in 2018
|
||||||
import quandl
|
import quandl
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from sklearn.linear_model import LinearRegression
|
from sklearn.linear_model import LinearRegression
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
import quandl
|
||||||
|
import numpy as np
|
||||||
|
import yfinance as yf
|
||||||
|
import plotly.graph_objects as go
|
||||||
|
|
||||||
|
|
||||||
|
#Yfinance tests
|
||||||
|
#https://pypi.org/project/yfinance/
|
||||||
|
|
||||||
|
df = yf.download("TSLA", start="2018-11-01", end="2020-10-18", interval="1d")
|
||||||
|
fig = go.Figure(
|
||||||
|
data=go.Ohlc(
|
||||||
|
x=df.index,
|
||||||
|
open=df["Open"],
|
||||||
|
high=df["High"],
|
||||||
|
low=df["Low"],
|
||||||
|
close=df["Close"],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
fig.show()
|
||||||
Loading…
Reference in New Issue