Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Coursework 2 - Agent Based Modelling

November 8, 2022

Instructions

Academic misconduct

Please remember the good scholarly practice requirements of the University regarding work for credit. You can find guidance at the School page:

https://web.inf.ed.ac.uk/infweb/admin/policies/academic-misconduct This also has links to the relevant University pages.

Submission instructions

All the analysis must be done in Python. You can use an IDE of your choice (including notebooks), but you must submit all your code in a single zip file (even if it is just a single python file, it must be zipped).  You also must submit a pdf in which you report the results and discuss them. Code will not be marked, but it will be checked by the markers to ensure that all the analysis is properly done and the work is yours.  You will have to submit your files on Learn. Name your files with your exam number. For instance, if your exam number is B123456, you must submit a file B123456.zip containing the python source code and a file B123456.pdf containing the report.

General guidance

In this coursework, you will develop an agent-base model of limit order book (LOB) dynamics, also known as limit order flow.  You will work on sample trading data (LOBSTER data 1) gathered on 21st June 2012 for 5 stocks: Amazon, Apple, Google, Intel and Microsoft.  You will analyse this data and use your findings to build an agent- based simulation.  You will be provided with a notebook with some preliminary analysis of the Amazon stock, as well as with a Python environment which to replicate a limit order book. While you do not have to use the provided limit order book environment code, its purpose is to reduce your workload so that you can focus on agent-based modelling and apply the theory you have learned in the course.  The main goal of this coursework is to test your agent-base modelling knowledge and the marking scheme will reflect that.

Agent-based modelling of limit order flow is an open problem and not an easy one, so keep that in mind.  You are not expected to succeed at designing a perfect set of agents.  You are expected to understand the problem, make simplifying assumptions when necessary, design agents, simulate, analyse and discuss your results, discuss the limitations of your agent-based simulation, as well as the problems you have encountered on the way that prevented you from designing better agents (e.g.  computing power, lack of data, not enough time).  Remember to explain your logic and reasoning at all times!

The Python scripts with the preliminary data analysis and the LOB environment are available on Learn → Course Material → Coursework 2 → Coursework Code.

The data you will be analysing for this coursework are available on Learn → Course Material → Coursework 2 → Coursework Data.  In this folder, you will find several zip files corresponding to the different stocks.  The data can also be obtained from the original source at

https://lobsterdata.com/info/DataSamples.php.

Warning: The original source contains many different files. Specifically, there are data files for the five stocks with less than 10 levels and data files with more levels but only for one hour of trading.  You shouldn’t use data with less than 10 levels but you are free to use the one hour data with more levels to extend your analysis.

Tasks

Task 1 [20 marks]

a)  There are two notebooks with the preliminary analysis of Amazon stock data. One handles the messages data and the other one the limit order book state data. Describe very briefly what do the data files contain (max

1 paragraph), and describe the statistics that were computed.  [2 marks]

b)  Compute 3 more statistics that you think might be important, and justify your choice. They can be variations of statistics that are already present in the notebooks.  [5 marks]

c)  Describe how the findings on the Amazon stock might be used to develop an agent-based model.  Describe what the statistics correspond to and why they might be specifically important (if it is not obvious). Include plots.  Try to be as concise as possible (you may want to display some statistics together in a table).   [10 marks]

d)  Repeat the analysis from 1.a and 1.b for the other stocks in the sample data. You will need to change some parameters.  How do the results compare with the analysis on the Amazon data?  Discuss how it can affect agent-based modelling.  (2 paragraphs max) [3 marks]

Task 2 [30 marks]

Design agent based simulation based on the analysis of the data. You can use agent types that you have seen during the course, search for published LOB agent-based models, or design new ones entirely.

a)  Describe the agent-based model. Specifically, describe the model environment and the purpose of the model. [5 marks]

b)  Describe your agents. For each agent type, use the four steps you have seen in the course:

• Choose agents for your agent-based model (this may be a subset of agents listed above).  Reason your choices.

• Describe parameters of the agents.

• Describe actions of the agents.

• Describe interactions of the agents.

[15 marks]

c)  Choose the stylised facts that your agent-based model will aim to recreate and discuss the objective function you would use to validate the model. Justify your choices.  [10 marks]

Task 3 [20 marks]

a) Implement the ABM designed in Task 2 and illustrate the experimental setup.  [10 marks]

b)  Present the results of your agent-based simulations by showing and discussing the stylised facts you chose for your objective function.  [10 marks]

Task 4 [20 marks]

a)  Perform parameter estimation of the implemented model on the Amazon stock data.  Describe the set up of the performed optimisation (you should give enough details to reproduce your study).  Discuss the results. [10 marks]

b)  Perform parameter estimation of the implemented model on Intel stock.  Discuss results and compare the results with those obtained on the Amazon data.  [10 marks]

Task 5 [5 marks]

In the interest of time, you are not required to run a sensitivity analysis.  However, discuss how you would you conduct sensitivity analysis.  [5 marks]

Task 6 [5 marks]

Discuss the results of your agent-based model and its limitations.  [5 marks]