Skip to content

Instantly share code, notes, and snippets.

View erwinvaneyk's full-sized avatar

Erwin van Eyk erwinvaneyk

View GitHub Profile
@erwinvaneyk
erwinvaneyk / BNPM.py
Last active December 23, 2015 04:39
Simple "Binomial Non-Arbitrage Pricing model (BNPM)" simulator, based upon the first 2 paragraphs of the book of Steven Shreve.
# A simple "Binomial Non-Arbitrage Pricing model (BNPM)" simulator. Requires python 2.x
import sys;
steps = ("--steps" in sys.argv); # if --steps is included, BNPM.py will show all V-values.
PUT = "p"; CALL = "c";
class Stock:
tail = head = None;
val = -1.0;
period = 0;
@erwinvaneyk
erwinvaneyk / ega.py
Created October 22, 2013 13:05
A prototype/doodle for a equation generation algorithm.
# Equation Generation Algorithm - prototype script.
import random;
class EquationType:
def __init__(self,pycode,argcount):
self.pycode = pycode;
self.argcount = argcount;
arith = lambda: None
arith.ADD = EquationType("+",2);
@erwinvaneyk
erwinvaneyk / fixDatafile.py
Created November 10, 2013 21:48
Script to fix some inconsistencies in self-generated historical stockdata-files. The first argument specifies the relative file-path, next argument(s) trigger the timestamp to datetime-conversion
# Fixes some inconsistencies in self-generated historical stockdata-files.
import sys, datetime;
# Retrieve file arg
try:
path = sys.argv[1]
except:
exit("No file argument provided!");
# Fix data
@erwinvaneyk
erwinvaneyk / namecoind.py
Last active August 29, 2015 13:57
A wrapper for the namecoind.exe -server with integrated query opportunities, which provides more than the usual (none) info about the status of the namecoin (NMC) server.
import subprocess, logging, time, threading, json, os
######################################################
# Setup; change this.
CLIENT = 'namecoin\\namecoind.exe';
LOGGER = logging.getLogger('namecoind');
FORMAT = '%(asctime)-15s %(levelname)-5s: %(message)s'
logging.basicConfig(format=FORMAT, level=logging.INFO);
#######################################################
@erwinvaneyk
erwinvaneyk / importStackOverflow.sql
Last active August 29, 2015 14:10
A SQL-file for creating the table structure and importing the datadump from the StackOverflow-datadump
-- Creates database structure for StackOverflow-dump
-- required:
-- - http://stackoverflow.com/questions/10762239/mysql-enable-load-data-local-infile
DROP DATABASE stackoverflow;
CREATE DATABASE stackoverflow;
USE stackoverflow;