Ai代做 | 代写Assignment | 机器学习代写 – ORDER BOOK

Ai代做|代写Assignment | 机器学习代写 – 这是一个典型的ai方面的题目代写任务

assignment 4 ORDER BOOK

Design and Implement a stock trading (order matching) system utilizing an Order Book as shown in the following screenshot: (Visit http://www.level2stockquotes.com/, then click the top left button, LII Book, above the graph.)

The simulated orders stream will be given in a file (shortorder.dat) and there are 4 kinds of orders. Each order has the format:

Order type, action, price, shares, account ID, separated by a space. The code for order type is 0: market order, 1: limited order. The code for action is 1: buy (bid), -1: sell (ask). For market order, the price is 0, otherwise, price is a number with 2 decimal places. Shares is a long integer, and Account ID is also a long integer. For example,

  1. Market buy (bid) order: 0 1 0 100 999887777
  2. Market sell (ask) order: 0 -1 0 200 888776666
  3. Limited buy (bid) order: 1 1 114.53 100 777665555
  4. Limited sell (ask) order: 1 -1 114.54 200 666554444

When you retrieve these orders, you need to attach a time stamp from system time to each order. You also need to use simulated time delay to separate these orders as they arrive in sequence.

Here is timeDelay(int t) function: (the delay time is measured in t seconds)

#include

void timeDelay(double t) { time_t initial, final; time_t ltime; initial = time(&ltime); final=initial+t;

while(time(&ltime) < final) { }

return; }

Your program should use priority queues to store limited orders of bids (buys) and asks (sells) while process the transactions (matches) and record them in an audit (transaction) file as follows:

Buyer ID, Seller ID, Price, Shares, Time Stamp

So, a transaction record would be as follows:

999887777 666554444 114.54 100 1415959388

You also need to produce 2 more files, one is bidbook and the other one is askbook to store the unmatched limited orders of bid and ask at the end of the process.

When you use the shortorder.dat to test your program, at the end of the process your bidbook should be empty, but your askbook should contain the following orders:

1 -1 114.33 360 765761334

1 -1 114.89 980 905660804

1 -1 114.89 320 724999496

1 -1 114.92 650 488201672

1 -1 114.97 340 557153505

During the process, youll also produce a screen trace of all the transactions (matched orders) with price changes from the prior day (yesterday) closing similar to this one here (Visit https://finance.yahoo.com/quote/FB?p=FB&.tsrc=fin-srch-v1)

So, your screen during the run time should look like the following:

Note: Each team needs to complete the assignment and demonstrate the program and result in classes on 11/21. The order of demonstration will be determined by lottery on Monday (11/19). When you demonstrate your program, you will use a new order file that I prepare for your demo. So, be sure that your program covers every possible scenario. This assignment will count for 10% of your grade.

If you feel comfortable or have knowledge in programming in graphical interface, you may implement it with graphical interface for extra bonus.

The following is your team assignment. Please contact your team member and start to work on the assignment.

Leave a Reply

Your email address will not be published. Required fields are marked *