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 yahooquery import Ticker | |
import finvizlite as fl | |
import pandas as pd | |
def download_finviz_tickers(rows): | |
df = fl.scrape_all("https://finviz.com/screener.ashx?v=111&f=geo_usa&o=-marketcap", print_urls=True, rows=rows) | |
df.to_csv("finviz-tickers.csv", index=False) | |
def download_ticker_total_assets(): | |
df = pd.read_csv("finviz-tickers.csv") |
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 math | |
import random | |
def alt_win_probability(p1, p2): | |
diff = p1 - p2 | |
p = 1 - 1 / (1 + math.exp(0.00583 * diff - 0.0505)) | |
return p | |
def win_probability(p1, p2): | |
diff = p1 - p2 |
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 pandas as pd | |
import numpy as np | |
df = pd.read_csv('2005-srs.csv') | |
df_x = df.drop(['avg_mov'], axis=1) | |
df_srs = pd.DataFrame(np.linalg.solve(df_x.values, df['avg_mov'].values * -1.0), index=df_x.columns) | |
print df_srs |
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 nfldb | |
db = nfldb.connect() | |
weeks = range(1,18) | |
years = range(2009,2015) | |
def find_qbs(season_year, season_type, week): | |
q = nfldb.Query(db).game(season_year=season_year, season_type=season_type, week=week) | |
min_passing_yds = 10 |
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
require 'open-uri' | |
require 'json' | |
url = 'http://www.reddit.com/.json' | |
result = JSON.parse(open(url).read) | |
puts result['data']['children'] |