Skip to content

Instantly share code, notes, and snippets.

Fully caffeinated for your safety

brian piercy bjpcjp

Fully caffeinated for your safety
View GitHub Profile
bjpcjp /
Created January 15, 2022 18:06 — forked from bfan1256/
5 Performance Metrics for Trading Algorithms and Investment Portfolios
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
bjpcjp /
Created February 8, 2018 22:57 — forked from theriley106/
Scraping Valid Addresses from all US ZipCodes
import sys
import requests
import bs4
import zipcode
import threading
import re
import json
import time
bjpcjp / denominator-snippet.rb
Created September 12, 2012 01:24 — forked from rweald/denominator-snippet.rb
Code Snippets for Simple Linear Regression Using Ruby Blog Post
View denominator-snippet.rb
denominator = @xs.reduce(0) do |sum, x|
sum + ((x - x_mean) ** 2)