This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fbm import FBM | |
from fbm import fbm, fgn, times | |
from fbm import MBM | |
from fbm import mbm, mgn, times | |
import math | |
def MMAR(K, simulated_H, simulated_lambda, simulated_sigma, original_price_history, magnitude_parameter, GRAPHS): | |
# --- VARIABLES --- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fbm import FBM | |
new_fbm_class = FBM(n = 10*2**K+1, hurst = simulated_H, length = magnitude_parameter, method='daviesharte') | |
new_fbm_simulation = new_fbm_class.fbm() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new_cascade = list(np.array(lognormal_cascade(k=K, v=1, ln_lambda = simulated_lambda, ln_theta = simulated_sigma)).flat) | |
tradingtime = 2**K*np.cumsum(new_cascade)/sum(new_cascade) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lognormal_cascade(k, v,ln_lambda, ln_theta): | |
k = k - 1 | |
m0 = np.random.lognormal(ln_lambda,ln_theta) | |
m1 = np.random.lognormal(ln_lambda,ln_theta) | |
M = [m0, m1] | |
if (k >= 0): | |
d=[0 for x in range(0,2)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def estimate_multifractal_spectrum(TAU_Q, Q, MIN_Q, MAX_Q): | |
TAU_Q_ESTIMATED = np.polyfit(Q[MIN_Q:MAX_Q], TAU_Q[MIN_Q:MAX_Q], 2) | |
F_A = [0 for x in range(len(q)-10)] | |
p = [0 for x in range(len(q)-10)] | |
a = TAU_Q_ESTIMATED[0][0] | |
b = TAU_Q_ESTIMATED[1][0] | |
c = TAU_Q_ESTIMATED[2][0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def partition_function(SIGMA, DELTA, XT, Q): | |
print("Calculating the partition function...\nThis step will take quite a while... so strap yourself in...\n") | |
SIGMA=[[0 for x in range(len(DELTA))] for y in range(len(Q))] | |
for k in range (0, len(Q)): | |
if k%30==0: | |
print("calculating i=" + str(k) + ' out of ' + str(len(Q)-1)) | |
for j in range (0,len(DELTA)): | |
for i in range (0,len(XT)-1): | |
if i < int(len(XT)/DELTA[j]): | |
SIGMA[k][j]=SIGMA[k][j] + abs(XT[i*DELTA[j]+DELTA[j]]-XT[i*DELTA[j]])**Q[k] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
symbol,date,open,high,low,pe | |
1130,20180531,43.40,44.71,42.97,7.84 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
symbol,year,quarter,assets,liabilities,earnings | |
11100,2018,1,8614953000,3480139000,3052336000 | |
3030,2018,1,416657000,220331000,-1972000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// turing.go | |
// by Todd Moses | |
package main | |
import ( | |
"fmt" | |
) | |
type Tape struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The Greeks Calculator for European vanilla options | |
//by Todd Moses | |
#include <iostream> | |
#include <cmath> | |
//standard normal probability density function | |
double PDF(const double d) { | |
return (1.0/(pow(2*M_PI,0.5)))*exp(-0.5*d*d); | |
} |