Skip to content

Instantly share code, notes, and snippets.

% Create a mesh plot
h = figure;
x = seed;
y = season_win_pct;
z = tourney_wins;
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
xi = dt.Points(:,1) ;
yi = dt.Points(:,2) ;
F = scatteredInterpolant(x,y,z);
stats = csvread('training_data.csv',1,0);
tourney_wins = stats(:, 1);
season_games = stats(:, 3);
season_win_pct = stats(:, 4);
season_ppg = stats(:, 5);
const = ones(size(tourney_wins));
facs = horzcat(season_win_pct,season_games,season_ppg,const);
beta = mvregress(facs,tourney_wins,'algorithm','cwls');
beta
import config as config
import robin_stocks as r
def login():
username = config.username
password = config.password
r.login(username,password)
username = 'ROBINHOD_USERNAME'
password = 'ROBINHOOD_PASSWORD'
import robin_stocks as r
def getTradeableCryptoList():
data = r.crypto.get_crypto_currency_pairs()
return [crypto for crypto in data if not crypto['display_only']]
def getCryptoPositions():
positions = r.get_crypto_positions()
return positions
def getHistoricals(symbol, span='year'):
symbol_dict = {
'BTC': '3d961844-d360-45fc-989b-f6fca761d511',
'ETH': '76637d50-c702-4ed1-bcb5-5b0732a81f48',
'LTC': '383280b1-ff53-43fc-9c84-f01afd0989cd',
'BCH': '2f2b77c4-e426-4271-ae49-18d5cb296d3a',
'DOGE': '1ef78e1b-049b-4f12-90e5-555dcf2fe204',
'ETC': '7b577ce3-489d-4269-9408-796a0d1abb3a',
'BSV': '086a8f9f-6c39-43fa-ac9f-57952f4a1ba6'
}
import robin_stocks as r
username = ''
password = ''
r.login(username, password)
def getYearHistoricals(symbol):
symbol_dict = {
'BTC': '3d961844-d360-45fc-989b-f6fca761d511',
'ETH': '76637d50-c702-4ed1-bcb5-5b0732a81f48',
'LTC': '383280b1-ff53-43fc-9c84-f01afd0989cd',
'BCH': '2f2b77c4-e426-4271-ae49-18d5cb296d3a',
'DOGE': '1ef78e1b-049b-4f12-90e5-555dcf2fe204',
'ETC': '7b577ce3-489d-4269-9408-796a0d1abb3a',
'BSV': '086a8f9f-6c39-43fa-ac9f-57952f4a1ba6'
}
# Fetch a dict of a year of BTC prices
btc_data = getYearHistoricals('BTC')['data_points']
# Tranform price dict to list of low prices
btc_data = [float(point['low_price']) for point in btc_data]
import matplotlib.pyplot as plt
plt.plot(btc_data)
plt.title('Daily Low Bitcoin Prices - 1 Year')
plt.ylabel('Daily Low - USD')
plt.show()