{{ message }}

Instantly share code, notes, and snippets.

Too Many Ideas....

# James Dunkerley jdunkerley

Too Many Ideas....
Created Apr 27, 2021
barrier.numpy.py
View barrier_numpy.py
 from random import random from math import sqrt, log, exp from numba import njit import numpy from numpy.random import normal def path_final_min_max(initial, steps, sdt, volatility, drift): randoms = numpy.exp(normal(size=steps)*volatility*sdt) * drift randoms[0] = 1 factors = numpy.cumprod(randoms) * initial
Last active Apr 27, 2021
barrier_numba.py
View barrier_numba.py
 from random import random from math import sqrt, log, exp from numba import njit, jit, prange @njit(fastmath=True) def box_muller_rand(): while True: x = random() * 2.0 - 1 y = random() * 2.0 - 1 d = x * x + y * y
Created Apr 27, 2021
Barrier Pricing via MonteCarlo in C++
View barrier.cpp
 #include #include #include namespace barrierpricer { static std::random_device rd; static std::mt19937_64 rand_generator(rd()); static std::normal_distribution<> dis; double box_muller_rand() {
Last active Apr 27, 2021
Barrier Pricer
View barrier.py
 from random import random from math import sqrt, log, exp def box_muller_rand(): while True: x = random() * 2.0 - 1 y = random() * 2.0 - 1 d = x * x + y * y if d < 1: return x * sqrt(-2 * log(d) / d)
Created May 14, 2020
Cubic Spline
View spline.py
 from typing import Tuple, List import bisect def compute_changes(x: List[float]) -> List[float]: return [x[i+1] - x[i] for i in range(len(x) - 1)] def create_tridiagonalmatrix(n: int, h: List[float]) -> Tuple[List[float], List[float], List[float]]: A = [h[i] / (h[i] + h[i + 1]) for i in range(n - 2)] + [0] B = [2] * n C = [0] + [h[i + 1] / (h[i] + h[i + 1]) for i in range(n - 2)]
Created Apr 13, 2020
React CI Pipeline for Azure DevOps
View azure-pipelines.xml
 trigger: - master pool: vmImage: 'ubuntu-latest' steps: - task: NodeTool@0 inputs: versionSpec: '10.x'
Created Apr 12, 2020
View .eslintrc.js
 module.exports = { env: { browser: true, es6: true, "jest/globals": true }, extends: [ 'plugin:react/recommended', 'standard' ],
Last active Jan 4, 2019
AlterD3 Geo Projections
View GeoProjection.html

Last active Nov 14, 2018
AlterD3 Stacked Bar Chart
View StackedBarChart.html

Created Nov 13, 2018
AlterD3 Coloured Bar Chart
View Chart.html