lmari’s blog

Data analytics, machine learning & front end development

Python

Stock market forecasting with prophet

fb Open Anaconda Prompt and install fbprophet conda install -c conda-forge fbprophet If kernel error occured in jupyter notebook, open Anaconda prompt and view location. Open kernal.json, see if python editor have the same path jupyter ker…

Heatmap in Seaborn

Using Python to find currency correlation. The correlation coefficient represents a statistical relationship between 2 variables. Near +1 or -1 means the currency pairs are highly correlated Useful in hedging and diversifying risk Official…

Scraping Financial Data with Selenium

Selenium with Python — Selenium Python Bindings 2 documentation Install Beautiful Soup 4 Followup: Unable to run in sublime text. Program ran in PyCharm Read xpath Getting FB stock data from yahoo finance from bs4 import BeautifulSoupimpor…

Creating candlestick chart with TA-Lib

Install python extension package (check version) TA-lib-0.4.17-cp37-cp37m-win32.whl cp37 = python 3.7, win32 = x32, amd64 = x64 mpl_finance Tutorial: https://ithelp.ithome.com.tw/articles/10206894 Go to Anaconda installed location pip inst…

Sphinx and Rinohtype

Followup: Generate epub, pdf file, display at lower left corner Find out why touch command doesn't work Sphinx Documentation medium.com www.xncoding.com Go to the root directory of the project. virtualenv -p python3 <name of virtualenv>source <name of virtualenv>/bin/activate pi</name></name>…

Moving Averages and Statistics for Stock Prices

1. Finding Historical Prices import requests In site url, period1 is starting time, period 2 is ending time site="https://query1.finance.yahoo.com/v7/finance/download/2330.TW?period1=0&period2=1549258857&interval=1d&events=history&crumb=hP…

Pandas Time Series

Download csv from finance.yahoo.com/quote/AAPL/history HK Stocks csv https://hk.finance.yahoo.com/quote/0012.HK/history?p=0012.HK Financial info https://finance.yahoo.com/quote/AAPL/financials?p=AAPL Lesson 1, Lesson 2, Lesson 3, Lesson 4,…

Panda Data Analytics

Jupyter Notebook: Lesson 6, Lesson 7, Lesson 8, Lesson 9, Lesson 10, Lesson 11, Lesson 12, Lesson 13, Lesson 14 Library https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.join.html Open documentation: Shift+Tab sho…

Pandas Data Frame

Data frame - main object in pandas, used to represent tabular data (rows and columns) Shortcut: B - insert new cell below / A - insert cell above Run cell - Ctrl + Enter Library: https://pandas.pydata.org/pandas-docs/stable/ Notes: Lesson …

Build an eCommerce Website

Install sublime text Run python commands from cmd Download get-pip.py to folder C:\User\Z\ python get-pip.py cd desktop pip install virtualenv virtualenv tryten cd tryten scripts\activate In the screen, you'll see <tryten> .\Scripts\activate pip i</tryten>…

Numpy, Matplotlib, Sklearn

Install numpy RUN pip install numpy scipy RUN pip install pandas sklearn (Restart program if it cannot find installed software) RUN jupyter notebook https://www.youtube.com/embed/HW29067qVWk Export as html File> Download as .html Download …

Creating Charts with MatPlotLib

First try at MatPlotLib. Created piechart and bar chart. Need to familarize the basics of MatPlotLib before moving forward. Tip: Can skip the part on specifying colors. Piechart.py import matplotlib.pyplot as plt plt.figure(figsize=(5,5)) …

Budget Automation Using Chrome

Selenium is browser automation. The default browser is firefox. Need to change the settings in amazon_bot.py to to run selenium webdriver in Chrome browser from selenium import webdriver chromedriver = "C:\\Users\\Z\\chromedriver"driver = …

Building Website with Django

http://127.0.0.1:8000/ http://127.0.0.1:8000/admin/ http://127.0.0.1:8000/products/ Followup: Angular, Firebase and Bootstrap 4 I was hoping it could morph into something like this later: Changing display of Product object Add ProductAdmin…