Under the Hood

Under the Hood

The brilliance of Object Oriented Programming makes life convenient for us - it gives us abstraction. Abstraction is like - hiding the overwhelmingly complex code and logic - and enabling us to simply “use the libraries” and “apply the methods”. An interesting analogy could be - “not worrying about the mechanics and intricacies of the Engine and only focusing on Driving the Car”.


Our attempt then is to bring out the gory detail of simulating Stochastic models - out in the open - essentially breaking the abstraction barrier that libraries and methods provide us. Simulation in this barebones manner involves --  explicitly coding out the mathematical formulae, combining nested loops and nested conditional statements and declaring the appropriate variables and functions. The only difference in this approach to that of the “packages” is that it enables us to actually witness the algorithm and the mathematical underpinnings of stochastic models. 


We have compiled an assortment of simulation programs, written in Python, that deal with various financial models and topics in statistics. 

  • The Garman Model: Simulating the stochastic inventory management of a Market Maker. This model factors in “the uncertainties in arrivals buy and sell orders” - and revolves around the Gambler’s Ruin problem. 

https://github.com/nullspacemse/Finance101/blob/master/Garman's%20Model.pdf

  • Bayesian Methods in Finance: A stochastic program that first “demonstrates the Bayes rule using coins” as a toy program and then models a “bayesian Market Maker” - essentially a Dealer who sets quotes by applying the Bayes Rule. 

https://github.com/nullspacemse/Finance101/blob/master/BayesianFMM%20(1).ipynb

  • Options Payoff Calculator: A program that takes as an input - a construction of a portfolio of put/call options - and then computes a graph of the “combined payoff” over time. 

https://github.com/nullspacemse/Finance101/blob/master/DOP_Options%20Payoff%20Calculator%20(3).ipynb

  • Limit Theorems and Convergence: This program lets us see in “black and white” as to what goes on behind key statistical theorems - CLT, WLLN, SLLN. 

https://github.com/nullspacemse/Finance101/blob/master/Statistics_simulations.ipynb

  • The Wiener Process: Simulates the Generalized Wiener process to simulate and predict stock prices. 

https://github.com/nullspacemse/Finance101/blob/master/Stochastic_simulations.ipynb


To view or add a comment, sign in

More articles by Null Space

  • The Year Gone By

    “The year that changed everything” - finally comes to an end. We now look forward to new beginnings and hopefully, more…

Others also viewed

Explore content categories