KEMBAR78
SMS Problem Statement | PDF | Stocks | Economies
0% found this document useful (0 votes)
14 views2 pages

SMS Problem Statement

Uploaded by

Rani Garginal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

SMS Problem Statement

Uploaded by

Rani Garginal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

The major components are described below

1. A Stock Exchange:
Which cons tutes
a. A method that indicates the last traded price of any security
b. A method that indicates the current best bid and best o er
c. A method that indicates the top 5 bids and top 5 o ers.
d. A method to accept bids or o ers
e. Order Matching Engine (
i. The Matching engine must always follow price- me priority for all orders Price
me priority: h ps://www.marketswiki.com/wiki/Price- me_priority
ii. When a trade is matched, the exchange should collect money from the person
buying the share and send it to the person selling it. The share should also
change hands immediately.
iii. Assume the exchange does not charge any fees for facilita ng trades.
iv. The Engine should only accept orders sent during the trading hours.
v. Any bid or o er outside of the top 5 bids or top 5 o ers is cancelled and the
trader is no ed. Any pending orders at the end of the day are cancelled and
the trader is no ed.

2. An Order management system for a trader


a. A method to track the trader’s cash in the trading account
b. A method to add and withdraw cash from the trading account.
c. A method that indicates the current value of the trader’s por olio
d. A method to place buy orders.
e. A method to place sell orders.
3. Trader
a. Has access to an Order management system
b. Has a bank account with a xed amount of money in it.
c. An ac on
i. An ac on is de ned as either a buy or a sell decision on a stock
ii. The price at which the buy or sell order is placed should be randomized between
the below three op ons
1. Place order at best bid
2. Place order at best ask
3. Place order at mid price ( mid price = (best bid + best ask) /2 )
4. Assume the size of the order placed (quan ty) is always 1000.
ti
ti
ti
ti
ti
ff
fi
tt
fi
ti
fi
ti
fi
ff
ti
ti
ff
ti
ff
ff
ti
tf
5. If there are no bids or o ers present in the market, the trader places a buy
or sell order arbitrarily 5% above or below the previous closing price.

4. Share
a. All shares are iden cal to each other.

The stock exchange matching engine must take orders as they come and process them as quickly as
possible while maintaining price me priority. Assume there is only one exchange possible. The stock
exchange must support order matching on up to ve securi es.

Any new order that arrives will be queued in the engine.

An order can be placed only via the order management system (OMS). The OMS must send orders to the
exchange and the Exchange will no fy the OMS when an order has been ful lled.

Details surrounding the security and rela onship between objects has been inten onally le vague, feel
free to use your best judgement when the rela onship is unclear.
Simula on:

Create 5 Trader instances with an arbitrary amount of money in their bank accounts and a random
collec on of stocks in their por olio. i.e. they start with a non-zero por olio.

Assume me moves in 1 second steps. At each second, the traders should arbitrarily perform a buy ac on or
sell ac on. The price to buy or sell at should be decided randomly as described in the prior sec on.

If a trader runs out of money during the trading day, they can deposit more money into their trading
account it they want to. If they run out of money or stocks to sell, they stop taking any ac ons.

Simulate this scenario for a day assuming an 6.5 hour trading day and display the pro ts ( or loss ) of
each trader at the end of the day.
ti
ti
ti
ti
ti
ff
tf
ti
ti
ti
ti
fi
ti
tf
fi
ti
fi
ti
ti
ft
ti

You might also like