Skip to content

Instantly share code, notes, and snippets.

View fanannan's full-sized avatar

SAWADA Takahiro / Gugen Koubou LLC fanannan

  • Gugen Koubou LLC
  • Tokyo, Japan
View GitHub Profile
@fanannan
fanannan / vxx_hmm(ipnb).py
Created February 23, 2017 08:15
simple vxx trade simulation by gaussian hmm
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
@fanannan
fanannan / vxx_intraday(ipnb).py
Created February 23, 2017 01:07
vxx intraday / overnight movement
%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
@fanannan
fanannan / vix_sensitivities.py
Created February 12, 2017 04:22
check front-runners for VIX movement
# %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
@fanannan
fanannan / vix_range_band.py
Last active February 8, 2017 09:28
Draw 'possible range' of VIX movement
#!/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
@fanannan
fanannan / peephole_lstm.py
Created December 16, 2015 02:50 — forked from ShigekiKarita/peephole_lstm.py
Peephole connected LSTM in chainer
import numpy
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
def _extract_gates(x):
r = x.reshape((x.shape[0], x.shape[1] / 3, 3) + x.shape[2:])
@fanannan
fanannan / keras.py
Last active December 16, 2015 02:09 — forked from hnykda/keras.py
Tada's usage (see discussion)
""" From: http://danielhnyk.cz/predicting-sequences-vectors-keras-using-rnn-lstm/
and https://gist.github.com/hnykda/f1eca6cb0061cde701c2#file-keras-py
See comments on the blog at danielhnyk.cz. """
from keras.models import Sequential
from keras.layers.core import TimeDistributedDense, Dense, Activation, Dropout
from keras.layers.recurrent import GRU, LSTM
import numpy as np
import datetime
import matplotlib.pyplot as plt
try:
@fanannan
fanannan / gist:4999952337ea702860ca
Created July 19, 2015 05:33
Chainer MLP sample
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This code is a Chainer example to train a multi-layer perceptron with diabetes dataset,
based on the code by mottodora (https://gist.github.com/mottodora/a9c46754cf555a68edb7)
"""
import argparse
import numpy as np
@fanannan
fanannan / d2v_test.py
Last active August 29, 2015 14:22
doc2vecのテストコード
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import sys
import logging
import codecs
import MeCab
import re
import hashlib
@fanannan
fanannan / sync.py
Last active August 29, 2015 14:18
Python script to synchronize two http servers
#!/usr/bin/python
# this script have two functions:
#
# A: Gatherer
# 1) gets all updated files, excluding the files under symlinks
# 2) makes an archive file with a password, containing all updated files
# 3) places it as a downloadable file on the docroot
#
# B: Updater
# 1) download an archive file with a password, containing all updated file, from another server
@fanannan
fanannan / events.txt
Created January 5, 2015 07:10
MLHackason 準備その1(データ作成)
date,新規失業保険申請件数,ISM非製造業景況指数,消費者物価指数,ミシガン大消費者信頼感指数【速報値】,失業率,消費者物価指数【コア】,NY連銀製造業景気指数,建設許可件数,耐久財受注【除輸送用機器】,鉱工業生産,ミシガン大消費者信頼感指数【確報値】,フィラデルフィア連銀景況指数,生産者物価指数,中古住宅販売保留,小売売上高,中古住宅販売件数,耐久財受注,個人消費,生産者物価指数【コア】,雇用統計,ISM製造業景況指数,小売売上高【除自動車】,FOMC政策金利,貿易収支,四半期GDP,新築住宅販売件数,FOMC議事録,景気先行指数
2008/02/01,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0
2008/02/04,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/05,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/06,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/07,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/08,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
2008/02/13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0