Today, give a try to Techtonique web app, a tool designed to help you make informed, data-driven decisions using Mathematics, Statistics, Machine Learning, and Data Visualization. Here is a tutorial with audio, video, code, and slides: https://moudiki2.gumroad.com/l/nrhgb. 100 API requests are now (and forever) offered to every user, no matter the pricing tier.
This blog post demonstrates how to use the (work in progress) stochastic simulation API provided by techtonique.net to generate scenarios using various diffusion models. We’ll explore how to simulate paths using:
- Geometric Brownian Motion (GBM)
- Cox-Ingersoll-Ross (CIR) process
- Ornstein-Uhlenbeck (OU) process
- Gaussian Shocks scenarios
These models are particularly useful for:
- Financial simulation
- Risk assessment
- Portfolio stress testing
- Economic scenario analysis
We’ll walk through examples showing how to:
- Make API calls with proper authentication
- Generate multiple scenarios with different parameters
The API supports (for now) various parameters including (also, read the docs):
- Number of scenarios
- Time horizon
- Frequency (daily, weekly, monthly, quarterly, yearly)
- Initial values
- Model-specific parameters
- Random seed for reproducibility
Let’s get started!
First, get a token from: https://www.techtonique.net/token.
Now, here’s how to use the token in API requests for stochatic simulations. The JSON response contains a key “sims”. Each list is a future scenario, as envisaged by the chosen model, and based on the initial value 100.
Note that you can use https://curlconverter.com/ to translate the following request in your favorite programming language.
# Replace YOUR_TOKEN_HERE with your actual token
curl -X GET "https://www.techtonique.net/scenarios/simulate/?model=GBM&n=6&horizon=5&frequency=quarterly&x0=100&theta1=0.1&theta2=0.2&theta3=0.3&seed=123" \
-H "accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Note that you can use https://curlconverter.com/ to translate the following request in your favorite programming language.
curl -X GET "https://www.techtonique.net/scenarios/simulate/?model=CIR&n=6&horizon=5&frequency=quarterly&x0=100&theta1=0.1&theta2=0.2&theta3=0.3&seed=123" \
-H "accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Note that you can use https://curlconverter.com/ to translate the following request in your favorite programming language.
curl -X GET "https://www.techtonique.net/scenarios/simulate/?model=OU&n=6&horizon=5&frequency=quarterly&x0=100&theta1=0.1&theta2=0.2&theta3=0.3&seed=123" \
-H "accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Note that you can use https://curlconverter.com/ to translate the following request in your favorite programming language.
curl -X GET "https://www.techtonique.net/scenarios/simulate/?model=shocks&n=6&horizon=5&frequency=quarterly&seed=123" \
-H "accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN_HERE"
Comments powered by Talkyard.