Skip to content

Instantly share code, notes, and snippets.

@bitfool
bitfool / javascript option stuff.js
Created February 29, 2016 01:42 — forked from aasmith/javascript option stuff.js
black scholes & IV in javascript
/* Returns probability of occuring below and above target price. */
function probability(price, target, days, volatility) {
var p = price;
var q = target;
var t = days / 365;
var v = volatility;
var vt = v*Math.sqrt(t);
var lnpq = Math.log(q/p);
@bitfool
bitfool / arr-stat.js
Created February 17, 2017 17:58 — forked from Daniel-Hug/arr-stat.js
JavaScript statistical functions for arrays: max, min, range, midrange, sum, mean / average, median, modes, variance, standard deviation, mean absolute deviation, z scores
var arr = {
max: function(array) {
return Math.max.apply(null, array);
},
min: function(array) {
return Math.min.apply(null, array);
},
range: function(array) {