View metrics.py
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
from blankly import Alpaca, CoinbasePro # supports stocks, crypto, and forex | |
import numpy as np | |
from math import sqrt | |
def cagr(start_value: float, end_value: float, years: int): | |
return (end_value / start_value) ** (1.0 / years) - 1 | |
def sharpe(account_values: np.array, risk_free_rate, annualize_coefficient): | |
diff = np.diff(account_values, 1) / account_values[1:] # this gets our pct_return in the array |
View housingScrape.py
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
import sys | |
reload(sys) | |
sys.setdefaultencoding("utf-8") | |
import requests | |
import bs4 | |
import zipcode | |
import threading | |
import re | |
import json | |
import time |
View denominator-snippet.rb
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
denominator = @xs.reduce(0) do |sum, x| | |
sum + ((x - x_mean) ** 2) | |
end |