Skip to content

Instantly share code, notes, and snippets.

@audubon
audubon / analyze.py
Last active December 30, 2017 22:52
import numpy as np
import scipy.stats as ss
import time,calendar
import math
from sklearn.decomposition import PCA
import statsmodels.api as sm
@audubon
audubon / orderBuilder.java
Created September 26, 2015 23:01
ibOrderbuilderjava
package prc.ib;
import com.ib.client.ComboLeg;
import com.ib.client.Order;
import com.ib.client.Execution;
public class OrderBuilder {
@audubon
audubon / ibutils.py
Created September 24, 2015 21:27
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
@audubon
audubon / simexchange.py
Created September 19, 2015 13:55
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
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):
@audubon
audubon / iborderstatus.py
Last active February 26, 2019 16:40
order status and accountUpdates
from sys import argv
from time import sleep, strftime
from ib.ext.Contract import Contract
from ib.ext.Order import Order
from ib.ext.EWrapper import EWrapper
from ib.ext.EClientSocket import EClientSocket
import pandas as pd
from pandas.io.data import DataReader
import matplotlib.pyplot as plt
import numpy as np
from QuantLib import *
import urllib, urllib2,json, re, pylab,dateutil,datetime
class OptionCalculator(object):
def __init__ (self,**kwargs):
import pprint,sys
import blaze
from odo import odo
import pandas as pd
import numpy as np
from BTrees.OOBTree import OOBTree
from tables import *