market-price-dynamics
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
The model’s aim is to represent the price dynamics under very simple market conditions, given the values adopted by the user for the model parameters.
HOW IT WORKS
The market of a financial asset contains agents on the hypothesis they have zero-intelligence. In each period, a certain amount of agents are randomly selected to participate to the market. Each of these agents decides, in a equiprobable way, between proposing to make a transaction (talk = 1) or not (talk = 0). Again in an equiprobable way, each participating agent decides to speak on the supply (ask) or the demand side (bid) of the market, and proposes a volume of assets, where this number is drawn randomly from a uniform distribution .
The price of the asset evolves as a function of the excess demand on the market :
p(t) = p(t-1) * exp((total-bids - total-asks)*eta)
total bids = total volume of assets demanded total asks = total volume of assets supplied eta represents the granularity of the market and p0 the initial price .
The granularity depends on various factors, including market conventions, the type of assets or goods being traded, and regulatory requirements. In some markets, high granularity is essential to capture small price movements accurately, while in others, coarser granularity is sufficient due to the nature of the assets or goods being traded
HOW TO USE IT
Basic Usage
- SETUP button resets the model
- GO button allows the model to continuously simulate the market
Parameters
- number-agents slider is used to set the number of people in the market
- number-speakers is used to set the number of participants trading the stock
- max-order-size slide is used to set the highest volume of assets which can be traded for any participant
- initial-price slider is used to set the initial stock price when the market opens
- granularity slider is used to set the granularity of the market in terms of price adjustment level of detail or precision at which prices are quoted or recorded in a particular market.
Plots and monitors
- Asset price monitor checks the final value of price at the end of the simulation
- Level of total bids monitor checks the volume of assets demanded by the participants
- Level of total asks monitor checks the volume of assets supplied by the participants
- Order book balance plot observes the difference between the bid and ask
- Evolution of market price plot observes the price dynamics
- Market return plot checks how distributed the price returns are
THINGS TO NOTICE
Agents are represented with green turtles when they are not participating. If they participate, then they either turn to red (if they want to buy or speak on the demand side) or yellow (if they want to sell or speak on the supply side)
Notice also that the price return is always distributed normally. Why might this happen ?
THINGS TO TRY
Choose one parameter among these ones (granularity , max-order-size , number-speakers with respect to the number-agents) and fix the others to conduct a parametric study : what do you observe in terms of volatility and participants behavior ?
Re-assess your study by running the model several times. Is it possible to converge to an equilibrium at each run ?
Do you think the model can be closed to the financial markets groundtruth ?
EXTENDING THE MODEL
Try to fine-tune the parameters in order to fit the model with real data from different market types . A two-step approach can be used :
- Check your fine tuning with two assets from the same sector to see if there are common values for some parameters
- Check again with two assets from different sectors to understand the values difference
RELATED MODELS
It's not really a related model but I found interesting to mention the Limited Order book by Uri Wilensky available in the Model's library . You should check it if you are passionate about trading !!
CREDITS AND REFERENCES
Economy as a complex adaptive system (CAS), Murat Yıldızoglu, Pre-conference workshop on Agent-based Models in Economics and Finance, CEF 2015 Conference, Taipei
HOW TO CITE
If you mention this model or the NetLogo software in a publication, include the citation below.
- Kouajiep Kouega, E. (2023). NetLogo Market Price Dynamics Model. https://github.com/edgarkp.
This model was developed as part of the Autumn 2022 Agent-based Modeling course offered by Pr. Georgiy Bobashev at DSTI, Paris. For more info, visit https://www.datasciencetech.institute/fr/applied-msc-in-data-science-ai/.
COPYRIGHT AND LICENSE
Copyright 2023 Edgar Kouajiep Kouega.
Market Price Dynamics by Kouajiep Kouega Edgar is licensed under CC BY-NC-SA 4.0
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
Comments and Questions
globals [current-price previous-price return current-number-asks current-number-bids order-balance order-book-balance] ; declare of global variables breed [persons person] ; declare agent persons-own [talk? bid? ask? volume] ; declare individual properties of the agent to setup clear-all setup-variables ; set up the global variables used for computation setup-persons ; set up the agents reset-ticks end to go if (ticks > 15000) [stop] cancel-orders ; reset the decisions make-decision ; create the market speakers and set their decisions execute-orders ; execute the orders of the speakers to compute market features tick end to setup-variables set current-price initial-price set previous-price initial-price set current-number-bids 0 set current-number-asks 0 set return [] ; set order-book-balance [0]; end to setup-persons create-persons number-agents ; create a given number of persons ask persons [ setxy random-xcor random-ycor set color green set shape "person" set talk? False set bid? False set ask? False ] end to make-decision ; only a hand of people can intervene in the market ask n-of number-speakers persons [ ifelse random-float 1 <= 0.5 [set talk? False] [set talk? True] ; some of them can decide to actually interve or not if talk? [ set volume 1 + random (max-order-size - 1) ; only when an agent wants to participate, the agent defines the volume he wants to bid or ask ifelse random-float 1 <= 0.5 [set bid? False set ask? True set color yellow] ; when an agent wants to sell ie speak on the supply side, color him in yellow [set bid? True set ask? False set color red] ; when an agent wants to buy ie speak on the demand side, color him in red ] ] end to execute-orders set current-number-bids sum [volume] of persons with [bid? = True] ; compute the total of bids set current-number-asks sum [volume] of persons with [ask? = True] ; compute the total of asks set order-balance current-number-bids - current-number-asks ; compute the spread set order-book-balance lput order-balance order-book-balance ; monitor all the values of spread set previous-price current-price set current-price previous-price * exp(order-balance * granularity) let current-return ln(current-price) - ln(previous-price) ; get the return of the stock set return lput current-return return ; monitor all its values during the simulation end to cancel-orders ask persons [ set color green set talk? False set bid? False set ask? False ] end
There is only one version of this model, created over 1 year ago by Edgar Kouajiep Kouega.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
market-price-dynamics.png | preview | Preview for 'market-price-dynamics' | over 1 year ago, by Edgar Kouajiep Kouega | Download |
This model does not have any ancestors.
This model does not have any descendants.