MesoSim: �Overview and �Basic operations
Tibor Kiss <tibor@deltaray.io>
2023. 02. 09.
🏗️ Work In Progress version! 👷
1
© DeltaRay. 2022. All Rights Reserved
Agenda
2
© DeltaRay. 2022. All Rights Reserved
MesoSim - Overview
3
© DeltaRay. 2022. All Rights Reserved
4
© DeltaRay. 2022. All Rights Reserved
Prerequisite Crash Course: JSON
"Title": "Dynamic Hedging",
"Author": "Nassim Taleb",
"Publication Year": 1996,
"Categories": � [
"Options",
"Hedging",
"Derivative Securities"
]
}�
Attribute (aka key)
Value
Text (aka string)
Number (aka integer)
Array (or list) of strings
Object�declaration
5
© DeltaRay. 2022. All Rights Reserved
Prerequisite Crash Course: JSON pt2
6
© DeltaRay. 2022. All Rights Reserved
Prerequisite Crash Course: Lua
> 1 + 1
2
> 3 < 5
true
> 100 + (2 * 7) / 4.3
103.25581395349
> max(1, 5)�5
> abs(-4.3)�4.3
Prompt
Statements
Result
Statements with function call
7
© DeltaRay. 2022. All Rights Reserved
Concept: Job Definition
8
© DeltaRay. 2022. All Rights Reserved
Concept: High Level Job Definition
What to trade: Butterfly, Iron Condor, etc
When to enter
How to adjust
When to exit
Environment
9
© DeltaRay. 2022. All Rights Reserved
Concept: Environment & SimSettings
�
10
© DeltaRay. 2022. All Rights Reserved
Concept: Structure [1/2]
11
© DeltaRay. 2022. All Rights Reserved
Concept: Structure [2/2]
Full example with no lower boundary:�
12
© DeltaRay. 2022. All Rights Reserved
Concept: Entry [1/2]
13
© DeltaRay. 2022. All Rights Reserved
Concept: Entry [2/2]
14
© DeltaRay. 2022. All Rights Reserved
Concept: Exit
15
© DeltaRay. 2022. All Rights Reserved
Concept: Adjustment [1/2]
�
16
© DeltaRay. 2022. All Rights Reserved
Concept: Adjustment [2/2]
"abs(pos_delta) > 5": {
"MoveLegAdjustment": {
"LegName": "short_put",
"StrikeSelector": {
"Min": null,
"Max": null,
"Delta": "pos_delta - leg_short_put_delta"
}
}
}
}
Statements
New Strike definition
17
© DeltaRay. 2022. All Rights Reserved
Concept: Indicators
18
© DeltaRay. 2022. All Rights Reserved
Concept: Variables
19
© DeltaRay. 2022. All Rights Reserved
Concept: Functions
��
��
20
© DeltaRay. 2022. All Rights Reserved
MesoSim Workflow
Simple Run
Analyze
Clone
Run
Change
Save as template
Run from template on period of interest
Iterate
Analyze
For�each�period
Once�happy
21
© DeltaRay. 2022. All Rights Reserved
- Strategies -
22
© DeltaRay. 2022. All Rights Reserved
Practice - Strategies - Built-in Templates
Template name | Strategy | Note |
[Strangle] | Short Strangle | Contains adjustments to maintain delta neutrality. |
[Strangle-DownDay] | Short Strangle | Enters on days where open < yesterday’s close.�Demonstrates Entry.Conditions. |
[Strangle-ThetaFilter] | Short Strangle | Enters only if pos_theta > 50. �Demonstrates Entry.AbortCondition. |
[Strangle-Campaign] | Short Strangle | Demonstrates Multiple Positions in Flight (aka Campaign mode).� |
[IC-0DTE] | Iron Condor | 0 Days Till Expiration Iron Condor. �Intraday strategy. |
[ShortPut-EMACross] | Short Put | Demonstrates Indicators. � |
[ShortPut-HighIV] | Short Put | Demonstrates IV Rank.� |
[ThetaEngine] | Short Put | David Sun’s Theta Engine.�Demonstrates Credit Targeted Dynamic Sizing. |
To be added: BoxCar-NG | Condor | Currently not a built-in template, but clonable from here:�https://blog.deltaray.io/boxcar-ng-an-optimized-boxcar |
23
© DeltaRay. 2022. All Rights Reserved
Practice - Strategies - Short Put - Simple Run:
24
© DeltaRay. 2022. All Rights Reserved
Practice - Strategies - Short Put - Job Definition:
25
© DeltaRay. 2022. All Rights Reserved
- Strategy live coding -
26
© DeltaRay. 2022. All Rights Reserved
Backtest Analytics:
�
27
© DeltaRay. 2022. All Rights Reserved
Event Viewer:
�
28
© DeltaRay. 2022. All Rights Reserved
References
29
© DeltaRay. 2022. All Rights Reserved
Thank You!�Any questions?�
30
© DeltaRay 2022.- All Rights Reserved
30
© DeltaRay. 2022. All Rights Reserved
Backup slides
31
© DeltaRay 2022.- All Rights Reserved
31
© DeltaRay. 2022. All Rights Reserved
MesoSim - Timeline
32
© DeltaRay. 2022. All Rights Reserved
MesoSim: Portal
33
© DeltaRay. 2022. All Rights Reserved