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
; Clojupyter Snippet | |
(require '[clojupyter.misc.helper :as helper]) | |
(helper/add-dependencies '[cnuernber/libpython-clj "1.36"]) | |
(require '[libpython-clj.require :refer [require-python]] | |
'[libpython-clj.python :refer [py. py.. py.- $. $.. $a $c | |
as-python as-jvm | |
->python ->jvm | |
get-attr call-attr call-attr-kw | |
get-item att-type-map | |
call call-kw initialize! |
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
; not fast, just straitfoward | |
def make_heatmap_data(xs, ys, zs, func, cutoff, num_grids, min_samples): | |
xmin = np.nanpercentile(xs, cutoff*100) | |
xmax = np.nanpercentile(xs, (1-cutoff)*100) | |
ymin = np.nanpercentile(ys, cutoff*100) | |
ymax = np.nanpercentile(ys, (1-cutoff)*100) | |
xm = (xmax-xmin)/num_grids | |
ym = (ymax-ymin)/num_grids | |
r = [[list() for _ in range(num_grids)] for _ in range(num_grids)] | |
for x, y, z in zip(xs, ys, zs): |
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
; Clojupyter Snippet | |
(require '[clojupyter.misc.helper :as helper]) | |
(helper/add-dependencies '[cnuernber/libpython-clj "1.36"]) | |
(require '[libpython-clj.require :refer [require-python]] | |
'[libpython-clj.python :refer [py. py.. py.- | |
as-python as-jvm | |
->python ->jvm | |
get-attr call-attr call-attr-kw | |
get-item att-type-map | |
call call-kw initialize! |
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
# coding: utf-8 | |
import os | |
import shutil | |
import pandas as pd | |
import numpy as np | |
import math | |
import quandl | |
from fastai.structured import add_datepart, proc_df | |
from fastai.column_data import ColumnarModelData |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from zipline.data.bundles import register | |
from zipline.data.bundles.yahoo_csv import yahoo_csv_equities # yahoo_csv.py need to be placed in zipline.data.bundles | |
tickers = { | |
"SPY", "VXX", "VXZ" | |
} | |
register( |
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
# supplimental fix to pandas-datareader-'0.4.1' (not yet pulled proposal) | |
# | |
# | |
#$ git clone https://github.com/rgkimball/pandas-datareader | |
#$ cd pandas-datareader | |
#$ git checkout fix-yahoo | |
#$ pip install -e . | |
def fetch_yahoo(ticker): | |
NUM_RETRY = 5 |
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 datetime | |
import pickle | |
import warnings | |
import math | |
from hmmlearn.hmm import GaussianHMM, GMMHMM | |
from matplotlib import cm, pyplot as plt | |
from matplotlib.dates import YearLocator, MonthLocator | |
import numpy as np | |
import pandas as pd | |
import seaborn as sns |
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
%matplotlib inline | |
import os | |
import numpy as np | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import glob | |
from joblib import Memory | |
from pandas_datareader import wb | |
import datetime as dt |
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
# %matplotlib inline | |
import numpy as np | |
import pandas as pd | |
import pandas.io as io | |
import talib as ta | |
import datetime as dt | |
import math | |
from minepy import MINE | |
from pandas.io.data import DataReader | |
import urllib |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
import pandas as pd | |
import datetime as dt | |
from pandas.io.data import DataReader | |
from joblib import Memory | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt |
NewerOlder