Skip to content

Instantly share code, notes, and snippets.


John Parkhill jparkhill

View GitHub Profile
View gist:d0a95599ec04c7d8e7006ba649121e5f
// Do a shifted/scaled fourier transform of polarization in each direction.
mat Fourier(const mat& pol, double zoom = 1.0/20.0, int axis=0, bool dering=true) const
cout << "Computing Fourier Transform ..." << endl;
mat tore;
double dt = pol(3,0)-pol(2,0);
int ndata = (pol.n_rows%2==0)? pol.n_rows : pol.n_rows-1; // Keep an even amount of data
for (int r=1; r<ndata; ++r)
jparkhill / gist:b16e3c0055b9dd29146d9c4300f5a7d3
Created Jul 10, 2019
Kelly Sizing Optimizer for Monte Carlo Samples in Pytorch
View gist:b16e3c0055b9dd29146d9c4300f5a7d3
def kelly_loss(c_assets, r_assets, spreads, spread_loss):
Maximizes exponential rate of wealth growth
NOTE: the samples must be in the same order.
the assumption is that the returns are realized
in the same way.
You can’t perform that action at this time.