代写Python的基础作业,分为三个任务,按照要求完成函数的编写即可。
Requirement
You are creating an order book builder for your trading system. The book
builder will have as an input a list of files with the same format. Each
exchange will have a given file. During this exercise, you will take 3 venues
(3 files) as input: ARCA, EDGX, NYSE. You will need to read the three files at
the same time (to make it deterministic, you will always read ARCA first then
EDGX second).
Task 1
Create the class orderbook. In this Task1, you will create the class orderbook
with the function process_tick and top_of_book. process_tick calling
top_of_book once the new string has been processed. To test your code, we will
generate the output of your code running to check if your book is the same as
the one we will use as reference. Be aware: some dates are missing in the
three files. You should be sure to update with the right timestamp.
For instance: suppose you have:
NYSE-Tick1 at 1.3s
EDGEX-Tick2 at 1.2s
ARCA-Tick3 at 1.1s
You will process ARCA-Tick3 first, then you will need to process EDGEX-Tick2
at 1.2s if the next tick from ARCA is not earlier than 1.2s. An advice for
this part would be to gather these 3 files into 1 and sort by the date (using
python). You still need to read the three files with python (please don’t use
excel to gather the 3 files into 1).
Task 2
You will create the function:getBestBid
retuning the best bid (price, volume, exchange)getBestOffer
retuning the best offer (price, volume, exchange)
In this assignment, you will read the files and get the orders coming from the
different exchanges. You will create a class capable to handle the market data
coming one by one and build a book for each side.
Task 3
You will create the function:getBidVolumeBetween(price1, price2)
returning the total volume between
price1 and price2 for bids.getOfferVolumeBetween(price1, price2)
returning the total volume between
price1 and price2 for offers.