An experiment in modeling a monte carlo simulation in erlang
monterl_carlo will simulate market prices on a stock exchange.
You can start it and it will execute a function on every tick or you can have it graph a series of prices for you.
###initialize
monterl_carlo:start_link("MSFT",28.61,5,0.1,0.2,1000).
where the parameters are:
- symbol
- initial price
- precision of the price (how many decimals)
- annual volatility (%)
- annual expected return (%)
- update interval (ms)
###Start pumping out data:
monterl_carlo:subscribe("MSFT",fun(X) -> io:format("~p~n",[X]) end).
This will start pumping out the state of the simulation at the interval you specified.
You can stop it by calling:
monterl_carlo:unsubscribe("MSFT").
###Generate graph data
monterl_carlo:graph("MSFT",50, bid).
Where the parameters are:
- symbol
- points
- type of data
currently the types of data are:
- bid
- ask
- both
- statistics