Skip to content

Instantly share code, notes, and snippets.

View ryanlake10288's full-sized avatar

Ryan lake ryanlake10288

View GitHub Profile
import numpy as np
import scipy.stats as ss
import time,calendar
import math
from sklearn.decomposition import PCA
import statsmodels.api as sm
@ryanlake10288
ryanlake10288 / fncache.py
Created November 23, 2015 05:43 — forked from kwarrick/fncache.py
Redis-backed LRU cache decorator in Python.
#!/usr/bin/env python
__author__ = 'Kevin Warrick'
__email__ = '[email protected]'
import cPickle
from functools import wraps
def redis_lru(capacity=5000, slice=slice(None)):
"""
Simple Redis-based LRU cache decorator *.
import pykka
import pykka.gevent
class Worker(pykka.gevent.GeventActor):
def __init__(self, **kwargs):
super(Worker, self).__init__()
self.inputs = kwargs.get('inputs')
def on_receive(self, message):
@ryanlake10288
ryanlake10288 / ibutils.py
Created November 2, 2015 06:48 — forked from audubon/ibutils.py
IB utli to create orders
class Utils(object):
months=['','F','G','H','J','K','M','N','Q','U','V','X','Z']
@staticmethod
def localsymbol (expiry,right,strike):
exp = Utils.months[1+ int(expiry)/100%100 ]
s= strike*1000
sym="ON%s2 %s%s" %(exp,right,str(s)[:-2])
return sym
@ryanlake10288
ryanlake10288 / simexchange.py
Created November 2, 2015 06:48 — forked from audubon/simexchange.py
simexchange
import pykka
import pykka.gevent
import gevent
import numpy as np
import copy,sys, pprint , blist
from collections import defaultdict
import logging
import signal
@ryanlake10288
ryanlake10288 / 0_reuse_code.js
Created October 29, 2015 20:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ryanlake10288
ryanlake10288 / big_tstables.py
Created October 26, 2015 07:41 — forked from yhilpisch/big_tstables.py
Python file to test TsTables Performance
#
# TsTables -- High Frequency Times Series Data with PyTables
#
# to install -- pip install tstables
# Github repo -- https://github.com/afiedler/tstables
#
# Dr. Yves J. Hilpisch
#
# The Python Quants GmbH
# http://quant-platform.com
@ryanlake10288
ryanlake10288 / mech_plot2.py
Last active September 13, 2015 18:25 — forked from raddy/mech_plot2.py
mechanical markets style plots updated with better line widths
import seaborn
import pandas as pd
import numpy as np
import matplotlib.patches as mpatches
#create random trade pnls
n = 5000
sigma = .1
pnl1 = pd.DataFrame(np.random.randn(n,15)) * sigma
@ryanlake10288
ryanlake10288 / mech_plot.py
Last active September 13, 2015 18:25 — forked from raddy/mech_plot.py
mechanical markets style python plots
import seaborn
import pandas as pd
import numpy as np
import matplotlib.patches as mpatches
#create random trade pnls
n = 5000
sigma = .1
pnl1 = pd.DataFrame(np.random.randn(n,15)) * sigma
{
"metadata": {
"name": "",
"signature": "sha256:3338a1daefbcc568033180ef3e8f67027da32f0fd4d4ffbfeffdfc2149397bc1"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [