Skip to content

Instantly share code, notes, and snippets.

@axs
axs / percentile_to_probability.py
Created March 28, 2018 10:41
percentile_to_probability
def percentile_to_probability (hits, percentile):
""" hits 190
percentile .99
desc: given a 99 percentile what is the probability of seeing it in 190 attempts
"""
return (1-(percentile**hits)) * 100
group 'chronlogger'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'application'
sourceCompatibility = 1.8
version = '1.0' + new Date().format("MMddHHmm")
//remove javaagent when not monitoring with kamon
@axs
axs / fix.py
Created March 2, 2016 20:49
quickfixapp
"""
[DEFAULT]
ConnectionType=initiator
ReconnectInterval=60
FileStorePath=store
FileLogPath=log
StartTime=00:00:00
EndTime=00:00:00
UseDataDictionary=Y
@axs
axs / ratelimit.py
Created December 18, 2015 00:21
tokenbucket algorithm
from time import time, sleep
_128k = 128 * 1024
_256k = 256 * 1024
_512k = 512 * 1024
_1024k = 1024 * 1024
@axs
axs / quickfixparser.py
Last active August 3, 2023 19:13
quickfix parse
w='8=FIX.4.29=48135=E34=3649=OCO252=20140115-07:51:41.08856=DFIX20266=INTERNALISEDOCO21234567.5348578368=2394=29382=273=211=QLR6546-2014012467=1109=ABC76=CBXX:2301=OCO221=155=AA167=OPT200=201312205=21201=1202=154=138=50040=159=047=C77=C440=OCO29465=CBXX:OCO2386=1336=SESS11=QLR6556-2014012467=2109=ABC76=CBOE:2301=OCO221=155=AA167=OPT200=201312205=21201=1202=154=238=50040=444=1.299=1.3559=047=M77=C440=OCO29465=CBXX:OCO2386=1336=SESS10=112'
import quickfix
import quickfix42
import quickfix50sp2
dd=quickfix.DataDictionary('c:/tmp/fix42.xml')
m=quickfix.Message()
m=quickfix.Message(w,dd,False)
@axs
axs / odds.py
Last active May 17, 2018 22:30
import numpy as np
from fractions import Fraction
import pandas as pd
from odo import odo
def dec2percent (dec):
"""dec2percent(2)
"""
"""
microsoft TrueSkill algorithm for rankings
"""
from __future__ import print_function
import math
import sys
from scipy.stats.distributions import norm as scipy_norm
import pandas as pd
import numpy as np
option_data_frame = pd.read_csv('C:/code/python/pyql/examples/data/df_SPX_24jan2011.csv',parse_dates=[0,2])
grouped = option_data_frame.groupby('dtExpiry')
for spec, group in grouped:
print('processing group %s' % spec)
indx = group.index
"""
This was written using Python 2.7.2
This requires the attached gziped blist library and the numpy library
or you can install blist and numpy from commandline with
easy_install blist or pip install blist
easy_install numpy or pip install numpy
@axs
axs / index
Created June 9, 2014 16:07 — forked from vollerts/index
************************************************************************************************************
*** Installation on Ubuntu 12.04 ***************************************************************************
************************************************************************************************************
# Dependencies
sudo apt-get install build-essential
sudo apt-get install libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
# Download Python
cd ~/Downloads/
wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz