Free Essay

# Order Book Simulations Using Monte Carlo Methods

In:

Submitted By atin
Words 1053
Pages 5
Modeling Order Book Fluctuation by Monte Carlo Technique

CONTENTS

Page no. 1) Certificate 2 2) Acknowledgement 3 3) Abstract 5 4) Introduction 6 5) Simulation code 8 ➢ Order Book 8 ➢ Diffusion 9 ➢ Price and Annihilation 11 ➢ One Trade return 14 ➢ Waiting time between consecutive trades 16 ➢ Conditional return 19 ➢ Hurst curve 20

6) Results and Discussion 22 7) Summary 28 8) Future Prospects 29 9) References 30

ABSTRACT

This Project aims to simulate Order Book Fluctuations in a typical Stock Exchange using random variables. We aimed to simulate Bak, Paczuski and Shubik model using ANSI C and compiler Code-Blocks. We Simulated the Order Book using a two dimensional array to get better accessibility and file handling. We used the random function generator to generate random variables .

INTRODUCTION

Order Book : An order book is the list of orders (manually and now electronically) that a trading venue (in particular stock exchanges) uses to record the interest of buyers and sellers in a particular financial instrument.

Trading Engine : A trading engine uses the book to determine which orders can be fulfilled i.e. what trades can be made. Trades are done on the basis of matching between bids and asks.

Order Book Simulation : Order Book Simulation is used to predict the market behavior and estimate price based on various parameters like random variables used etc.

Need of Simulation : If we say that we simulate order book using random variables , then what is the predictability and usage of results in different environment or with different random variables. The question was first addressed by Hurst by inventing a new statistical method called Rescaled Range Analysis in which randomly generated data was analyzed and he got to the conclusion that even randomly generated data can have long range memory effect in some processes and data can be estimated on the basis of same technique. We simulate the order book to see that how predictable is the outcome on the basis of input given and see auto correlation between the two sets.

These simulation techniques steer modern investment portfolios of various investment firms , investment banks and Hedge funds. Now days simulation results are being provided by various consultancy firms to private investors for better investment strategies.

Bak , Paczuski and Shubik Model [31]

On a line representing the price axis, two kinds of particles are placed. The first kind, denoted A (ask), corresponds to sell orders, while the second, B (bid), corresponds to buy orders. The position of the particle is the price at which the order is to be satisfied. A trade can occur only when two particles of opposite type meet. If that happens, the orders are satisfied and the particles are removed from the system. This can be described as annihilation reaction A + B → ∅. It is evident that all B particles must lie on the left with respect to all A particles. The particles diffuse freely and in order to keep their concentration constant on average, new orders are inserted from the left (B type) and from the right (A type). The whole picture of this order-book model is therefore identical to the two-species diffusion-annihilation process. The changes in the price are mapped on the movement of the reaction front.

In this model there are N particles of each type, i.e. total 2N particles placed at the segment of length L. The particles can occupy integer positions from the set {1, 2, . . ., L}. In one update step we choose one particle and change its position as ci’=ci+1 or ci’=ci -1 (there is no bias, so both signs of the change have the same probability), on condition that the new position stays within the allowed interval, 1 ≤ ci’ ≤ L. We use the convention that the time advances by 1/(2N) in one step. If the new site was empty or there was already another particle of the same type at the new position, nothing more happens and the update is completed. We set ci(t + 1/(2N)) = ci’ and ck(t + 1/(2N)) = ck(t), k!=i . On the other hand, if the new site is occupied by a particle of opposite type, say, particle j, so that cj(t) = ci’, then the two particles annihilate. To keep the number of particles constant, we immediately supply two new particles at opposite edges of the allowed segment. E.g. if i was type B and j was type A, the update is ci(t + 1/(2N)) = 1, cj(t + 1/(2N)) = L and ck(t + 1/(2N)) = ck(t), k!= i, j. The annihilation corresponds to an elementary transaction.
The price set in this deal is just the position where the annihilation took place, x(t + 1/(2N)) = ci’. If the transaction did not occur, the price stays unchanged, x(t+1/(2N)) = x(t). This completes the definition of the variant of the BPS model simulated here.

SIMULATION CODE

Programing Language Used : ANSI C

Compiler Environment : Code Blocks

Total Number of particles in the system : 200 A type and 200 B type

Order book : The order is simulated as a two dimensional array of size[2N][L] as this simplifies the problem statement to a large extent. The column number represents the value of the element placed in it.

A sample array is shown below for reference :

1 |5 |5 |5 |5 |5 |5 |5 | |5 |1 |5 |5 |5 |5 |5 |5 | |5 |5 |1 |5 |5 |5 |5 |5 | |5 |5 |5 |1 |5 |5 |5 |5 | |5 |5 |5 |5 |9 |5 |5 |5 | |5 |5 |5 |5 |5 |9 |5 |5 | |5 |5 |5 |5 |5 |5 |9 |5 | |5 |5 |5 |5 |5 |5 |5 |9 | |

5 = Background element , 1 = B Type , 9 = A Type

All the background elements are taken as 5 to avoid ambiguities using conditional statements in C . All B type elements are taken as 1’s and all A type elements are taken as 9’s. Since all the elements occupy a unique row, horizontal diffusion will not change the number of particles in each row.

Initiating Array : The first step in the program is to initiate the 2N*L array and put all the elements at places as described above. Function written to initiate the array is given below

void set1(){

if(n

### Similar Documents

#### Failure of Risk Management

...failure of risk management: a book review with 7 comments Introduction Any future-directed activity has a degree of uncertainty, and uncertainty implies risk. Bad stuff happens – anticipated events don’t unfold as planned and unanticipated events occur. The main function of risk management is to deal with this negative aspect of uncertainty. The events of the last few years suggest that risk management as practiced in many organisations isn’t working. A book by Douglas Hubbard entitled, The Failure of Risk Management – Why it’s Broken and How to Fix It, discusses why many commonly used risk management practices are flawed and what needs to be done to fix them. This post is a summary and review of the book. Interestingly, Hubbard began writing the book well before the financial crisis of 2008 began to unfold. So although he discusses matters pertaining to risk management in finance, the book has a much broader scope. For instance, it will be of interest to project and program/portfolio management professionals because many of the flawed risk management practices that Hubbard mentions are often used in project risk management. The book is divided into three parts: the first part introduces the crisis in risk management; the second deals with why some popular risk management practices are flawed; the third discusses what needs to be done to fix these. My review covers the main points of each section in roughly the same order as they appear in the book. The crisis in risk management...

Words: 3167 - Pages: 13

Free Essay

#### Interpretation of Modeling and Simulation

Words: 1781 - Pages: 8

#### Pricing and Hedging Asian Options

...Jon M. Huntsman School of Business Master of Science in Financial Economics August 2013           Pricing and Hedging Asian Options By Vineet B. Lakhlani   Pricing  and  Hedging  Asian  Options     Table of Contents   Table of Contents 1. Introduction to Derivatives 2. Exotic Options 2.1.  Introduction  to  Asian  Options   3.1. Binomial Option Pricing Model 3.2. Black-Scholes Model 3.2.1. Black-Scholes PDE Derivation 3.2.2. Black-Scholes Formula 1 2 3 4 4 5 6 7 3   3. Option Pricing Methodologies 4. Asian Option Pricing 4.1. 4.2. 4.3. 4.4. Closed Form Solution (Black-Scholes Formula) QuantLib/Boost Monte Carlo Simulations Price Characteristics 8 8 10 11 14 5. Hedging 5.1. Option Greeks 5.2. Characteristics of Option Delta (Δ) 5.3. Delta Hedging 5.3.1. Delta-Hedging for 1 Day 5.4. Hedging Asian Option 5.5. Other Strategies 6. Conclusion 16 17 17 19 20 22 25 26 27 32 34 Appendix i. ii. iii. Tables References Code: Black-Scholes Formula For European & Asian (Geometric) Option   1   Pricing  and  Hedging  Asian  Options     1. Introduction to Derivatives: Financial derivatives have been in existence as long as the invention of writing. The first derivative contracts—forward contracts—were written in cuneiform script on clay tablets. The evidence of the first written contract was dates back to in nineteenth century BC in Mesopotamia...

Words: 10175 - Pages: 41

#### Ms Summart

...Management Science Summary Definitions by Subject Game theory * Nash equilibrium * In game theory, the Nash equilibrium is a solution concept of a non-cooperative game involving two or more players, in which each player is assumed to know the equilibrium strategies of the other players, and no player has anything to gain by changing only their own strategy. If each player has chosen a strategy and no player can benefit by changing strategies while the other players keep theirs unchanged, then the current set of strategy choices and the corresponding payoffs constitute a Nash equilibrium. * Stated simply, Amy and Wili are in Nash equilibrium if Amy is making the best decision she can, taking into account Wili's decision, and Wili is making the best decision he can, taking into account Amy's decision. Likewise, a group of players are in Nash equilibrium if each one is making the best decision that he or she can, taking into account the decisions of the others. * Pareto efficiency * Pareto efficiency, or Pareto optimality, is a state of allocation of resources in which it is impossible to make any one individual better off without making at least one individual worse off. The term is named after Vilfredo Pareto (1848–1923), an Italian economist who used the concept in his studies of economic efficiency and income distribution.The concept has applications in academic fields such as economics and engineering. * Given an initial allocation of goods among...

Words: 3775 - Pages: 16

Free Essay

#### Stochastic Volatility

...kij1 Master Thesis Supervisor: PETER LØCHTE JØRGENSEN Author: QIAN Zhang (402847) Pricing of principle protected notes embedded with Asian options in Denmark ---- Using a Monte Carlo Method with stochastic volatility (the Heston Model) Aarhus School of Business and Social Science 2011 2 Acknowledgements My gratitude and appreciation goes to my supervisor Peter Lø chte Jø rgensen, for his kind and insightful discussion and guide through my process of writing. I was always impressed by his wisdom, openness and patience whenever I wrote an email or came by to his office with some confusion and difficulty. Especially on access to the information on certain Danish structured products, I have gained great help and support from him. 3 Abstract My interest came after the reading of the thesis proposal on strucured products written by Henrik, as is pointed out and suggested at the last part of this proposal, one of the main limitations of this thesis may be the choice of model. This intrigues my curiosity on pricing Asian options under assumption of stochstic volatility. At first, after the general introduction of strucutred products, the Black Scholes Model and risk neutral pricing has been explained. The following comes the disadvanges of BS model and then moves to the stochastic volatility model, among which the Heston model is highlighted and elaborated. The next part of this thesis is an emricical studying of two structured products embbeded with Asian...

Words: 17332 - Pages: 70

#### Mangaement of Project

Words: 3914 - Pages: 16

Free Essay

#### Real Options Valuation

...V O LU M E 2 0 | N U M B E R 2 | s p RiN g 2 0 0 8 Journal of APPLIED CORPORATE FINANCE A MO RG A N S TA N L E Y P U B L I C AT I O N In This Issue: Valuation and Corporate portfolio Management Corporate portfolio Management Roundtable Presented by Ernst & Young 8 Panelists: Robert Bruner, University of Virginia; Robert Pozen, MFS Investment Management; Anne Madden, Honeywell International; Aileen Stockburger, Johnson & Johnson; Forbes Alexander, Jabil Circuit; Steve Munger and Don Chew, Morgan Stanley. Moderated by Jeff Greene, Ernst & Young Liquidity, the Value of the Firm, and Corporate Finance 32 Yakov Amihud, New York University, and Haim Mendelson, Stanford University Real Asset Valuation: A Back-to-Basics Approach 46 David Laughton, University of Alberta; Raul Guerrero, Asymmetric Strategy LLC; and Donald Lessard, MIT Sloan School of Management Expected Inflation and the Constant-Growth Valuation Model 66 Michael Bradley, Duke University, and Gregg Jarrell, University of Rochester Single vs. Multiple Discount Rates: How to Limit “Influence Costs” in the Capital Allocation process 79 The Era of Cross-Border M&A: How Current Market Dynamics are Changing the M&A Landscape 84 Transfer pricing for Corporate Treasury in the Multinational Enterprise 97 The Equity Market Risk premium and Valuation of Overseas investments John Martin, Baylor University, and Sheridan Titman, University of Texas at Austin ...

Words: 9906 - Pages: 40

#### Financial Modelling

Words: 57326 - Pages: 230

#### An Evolution of Computer Science Research

...Abbreviated version of this report is published as "Trends in Computer Science Research" Apirak Hoonlor, Boleslaw K. Szymanski and M. Zaki, Communications of the ACM, 56(10), Oct. 2013, pp.74-83 An Evolution of Computer Science Research∗ Apirak Hoonlor, Boleslaw K. Szymanski, Mohammed J. Zaki, and James Thompson Abstract Over the past two decades, Computer Science (CS) has continued to grow as a research ﬁeld. There are several studies that examine trends and emerging topics in CS research or the impact of papers on the ﬁeld. In contrast, in this article, we take a closer look at the entire CS research in the past two decades by analyzing the data on publications in the ACM Digital Library and IEEE Xplore, and the grants awarded by the National Science Foundation (NSF). We identify trends, bursty topics, and interesting inter-relationships between NSF awards and CS publications, ﬁnding, for example, that if an uncommonly high frequency of a speciﬁc topic is observed in publications, the funding for this topic is usually increased. We also analyze CS researchers and communities, ﬁnding that only a small fraction of authors attribute their work to the same research area for a long period of time, reﬂecting for instance the emphasis on novelty (use of new keywords) and typical academic research teams (with core faculty and more rapid turnover of students and postdocs). Finally, our work highlights the dynamic research landscape in CS, with its focus constantly ...

Words: 15250 - Pages: 61

Free Essay

#### A Stochastic Model for Order Book Dynamics

...INFORMS A Stochastic Model for Order Book Dynamics Rama Cont Department of Industrial Engineering and Operations Research, Columbia University, New York, New York 10027, rama.cont@columbia.edu Sasha Stoikov Cornell Financial Engineering Manhattan, New York, New York 10004, sashastoikov@gmail.com Rishi Talreja Department of Industrial Engineering and Operations Research, Columbia University, New York, New York 10027, rt2146@columbia.edu We propose a continuous-time stochastic model for the dynamics of a limit order book. The model strikes a balance between three desirable features: it can be estimated easily from data, it captures key empirical properties of order book dynamics, and its analytical tractability allows for fast computation of various quantities of interest without resorting to simulation. We describe a simple parameter estimation procedure based on high-frequency observations of the order book and illustrate the results on data from the Tokyo Stock Exchange. Using simple matrix computations and Laplace transform methods, we are able to efﬁciently compute probabilities of various events, conditional on the state of the order book: an increase in the midprice, execution of an order at the bid before the ask quote moves, and execution of both a buy and a sell order at the best quotes before the price moves. Using high-frequency data, we show that our model can effectively capture the short-term dynamics of a limit order book. We also evaluate the performance...

Words: 11360 - Pages: 46

Free Essay

#### Econometrics

...of Illinois at Urbana–Champaign, Illinois, USA SUMMARY I investigate using the method of ordinary least squares (OLS) on auction data. I ﬁnd that for parameterizations of the valuation distribution that are common in empirical practice, an adaptation of OLS provides unbiased estimators of structural parameters. Under symmetric independent private values, adapted OLS is a specialization of the method of moments strategy of Laffont, Ossard and Vuong (1995). In contrast to their estimator, here simulation is not required, leading to a computationally simpler procedure. The paper also discusses using estimation results for inference on the shape of the valuation distribution, and applicability outside the symmetric independent private values framework. Copyright  2008 John Wiley & Sons, Ltd. Received 15 September 2006; Revised 1 July 2008 1. INTRODUCTION The ﬁeld of econometrics of auctions has been successful in providing methods for the investigation of auction data that are well grounded in economic theory and allow for inference on the structure of an auction environment. Today, a researcher has a number of alternative structural methods, especially within the independent private-values paradigm (IPVP); an excellent reference to this literature is the book by Paarsch and Hong (2006). To name a few alternatives, it is possible to use maximum likelihood (Donald and Paarsch, 1996), nonparametric methods (Guerre et al., 2000), simulated nonlinear least squares (Laffont et al...

Words: 12659 - Pages: 51

#### Interest Rates

...INTEREST RATE RISK MANAGEMENT: DEVELOPMENTS IN INTEREST RATE TERM STRUCTURE MODELING FOR RISK MANAGEMENT AND VALUATION OF INTEREST-RATE-DEPENDENT CASH FLOWS Andrew Ang* and Michael Sherris† ABSTRACT This paper surveys the main concepts and techniques of recent developments in the modeling of the term structure of interest rates that are used in the risk management and valuation of interest-rate-dependent cash ﬂows. These developments extend the concepts of immunization and matching to a stochastic interest rate environment. Such cash ﬂows include the cash ﬂows on assets such as bonds and mortgage-backed securities as well as those for annuity products, life insurance products with interest-rate-sensitive withdrawals, accrued liabilities for deﬁnedbeneﬁt pension funds, and property and casualty liability cash ﬂows. 1. INTRODUCTION The aim of this paper is to discuss recent developments in interest rate term structure modeling and the application of these models to the interest rate risk management and valuation of cash ﬂows that are dependent on future interest rates. Traditional approaches to risk management and valuation are based on the concepts of immunization and matching of cash ﬂows. These ideas were pioneered in the actuarial profession by the British actuary Frank Redington (1952). Interest rates have long been recognized as important to the risk management of insurance liabilities. Recent developments have incorporated a stochastic approach to modeling interest...

Words: 18994 - Pages: 76

Free Essay

#### Liquidity Risk and Specialness

Words: 21572 - Pages: 87