Michael Siley's Sample Code


Example 1: Simple Retirement Planner in Python
This is a simple retirement planner that allows you to enter your personal and investment information and will run a retirement projection resulting in an analysis of your situation.

Application Resides Here

Application Classes:
account.py
asset.py
cash_flow.py
portfolio.py
retirement_projection.py

Example 2: Genetic Algorithms
This is from a class Prof. Daniel Solow of Case Western Reserve Unviversity and I developed for an independent study class. The result of the class is the following paper and code.

GA Paper

Code:
binarychromofactory.cpp
binarychromofactory.h
binarychromosome.cpp
binarychromosome.h
chromosome.cpp
chromosome.h
chromosomefactory.h
ga2.cpp
geneticalgorithm.cpp
geneticalgorithm.h
modga.cpp
modga.h
modtsp.cpp
random.cpp
random.h
randombits.cpp
randombits.h
tsp.cpp
tspchromofactory.cpp
tspchromofactory.h
tspchromosome.cpp
tspchromosome.h
tspfilereader.cpp
tspfilereader.h
utility.cpp
utility.h
makefile

Example 3: FX Arbitrage Example Perl/OCaml/Python
Foreign Exchange Arbitrage Application
This is an example of a financial application that can be used to calculate foriegn exchange (fx) arbitrage opportunities.

Design Decision
Perl is used for the web front end, OCaml for the back end fx computations and a little Python for downloading data from Yahoo! Finance. OCaml was used because the computations needed are expensive and OCaml is a compiled language and has the performance characteristics of C++. The Perl version of the fx computations took at least 8 seconds in the worst case on my P4 2.4Ghz desktop. Whereas, the OCaml program does them in 100ths of of a second. Python was used because my ISP does not have the Perl LWP library installed.

The application is here → Application
The code can be viewed here → Source Code

Application Caveats:
Transaction costs are not taken into consideration.
Bid/Ask spreeds are not considered.

Code Caveats:
I usually have better error handling with production level code.



Example 4: Two PHP Examples From Same Project
Here are two examples of a project that is in mid-development right now. The strength of these examples is that they are your typical average not too exciting object oriented PHP code. The Event module is the Model in the MVC pattern. The Date module is what would be deemed a Value Type in OO terminology.
An 'Event' Module sd_event.php
A Date Module sd_date.php

Example 5: Python Dictionary to C++ Data Structure
I wanted to read in a 'serialized' Python dictionary data structure into a representative C++ datastructure. With the intent of creating a Python to C++ data bridge.
Parser pytextserializer.cpp pytextserializer.h
Data Structure dictobject.cpp dictobject.h

Example 6: C String Library
I'm spoiled with the wonderful string libraries of PHP, Python, and Perl and I also like to write system level programming in C. So, I developed my own C String library that makes manipulating strings in C nearly as easy as more dynamic languages.
Library dstring.c dstring.h

Example 7: Python Spider Library
This is a library from from a search engine that I am developing. It's used to crawl and index websites. It's still a work in progress but the code is still rather interesting and useable.
crawler.py
htmlextractor.py
matrix.py
querywords.py
searchresults.py
textfilters.py
uniqitemserver.py
urlresolver.py
weburl.py