Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
FN6806: Object Oriented Programming II
Question 3-1
- Use Euler-Maruyama method to generate the paths. returned value is a tuple: 1) the end rates of all paths, 2) the sum of all rates of all paths (except the starting r 0 ).
- You could use either vector or valarray for the result.
Question 3-2
A simulator for event-driven backtesting.
There are two approaches in backtesting trading strategy: vectorized and event-driven.
The vectorized approach is the most common one and consists of simulating the strategy directly on historical data. The price series are loaded as vectors and we use vectorized operations for both the trading strategy and the performance metrics.
For example, we can have a buy signal whenever Close > Open and sell signal whenever Close < Open, and porformance metric is the 1-day lagged signal times the return of the next day (assuming buy at next day Open). It’s fast to implement such backtesting. However, if we want to simulate for adding the number of orders when we have 2nd buy signal, we need to modify the algorithm but it will not be easy. Vectorized method can not simulate the execution of orders realistically. At all, it is a simplified approach towards backtesting.
The event-driven approach is more sophiscated as it simulates the strategy as if it was executed in real-time. The price series are loaded as a stream of ticks and the strategy is executed on each tick, and various modules can be added at both sides: the exeuction side and the strategy side. For example, the exeuction could simulation the price slippage of the execution, the strategy side could simulate for stop loss and dynamic order sizing depends on past performance. The event-driven approach is more flexible and more realistic, but it is more difficult to implement.
In this exercise, you will read the source code of an event-driven simulator and try to understand how it works. You will need to document 5 places that exception could occur, what is the error message, what could be the cause of the error and what could be the exception handling. Create a file exceptions.txt and write down your answers.
This project will also be used in the Final quiz, so you should get familiar with it.
- Forked and modified from Aku https://github.com/flouthoc/aku/. I have made some changes and you can get it by forking on Replit at https://replit.com/@YeKunlun/ akufork?v=1
- The author of this repo only made a start so it’s just a partial implementation. You would find many rough edges: incomplete and incorrect.
- In one-line explaination, it runs over a CSV file with each line as a tick. The trading strategy acts on the tick data and perform buy/sell operations.
- All cpp files are in \src
- All hpp files are in \include
Use Replit tools
• I created a simple chart to show the class organization of Aku’s simulator. You could use it as a reference.