C++代写:ECS60 Stock Market

代写一个股票买卖仿真程序,需要一定的性能优化工作,搞明白逻辑的话还是比较好实现。

Requirement

A stock market attempts to match buyers to sellers for each stock. Each buyer specifies the number of shares of a stock, and the highest price per share she is willing to pay. Each seller specifies the number of shares, and the lowest price per share he is willing to accept. Here are the specifications:

  1. The stock market gives preference to buyers that are willing to spend more for shares.
  2. Buyers bidding the same amount are ordered by time of order with earlier given preference.
  3. Each sale will involve a buyer that is currently offering the highest price for a given stock.
  4. The seller will be that person whose price is closest to, but not more than, the buyer’s bid.
    • Sellers asking the same amount are ordered by time of order with earlier given preference.
  5. A single sale may not completely satisfy the shares of a buyer’s bid or a seller’s offering. In that case, the remaining portion may be satisfied in later sale(s).
  6. According Mr. Felsman’s rule, the price per share for a transaction will be that of the second highest bidder of that stock. If the second highest bidder’s price is less than the seller’s asking price or there is no other bidder, then the price will be the asking price. Note that after the highest bidder has bought, the original third highest bidder will be setting the price for the original second highest bidder.
  7. All transactions must occur as soon as possible, and are considered instantaneous.
  8. Format of txt file: buy/sell userID, price, shares, stock.
  9. Format of solution file: time, buyer, seller, price, number of shares, stock.
  10. Grading
    • Performance will be tested with three data files. At least one will have the full 3792 stocks with 1,000,000 offers, and 100,000 IDs.
    • testhw will copy MarketDriver.h and MarketDriver.cpp into your directory, and then call make, so please make sure you handin all necessary files. Students often forget to handin dsexceptions.h, as well as other secondary
      Weiss files. “handin cs60 p4 .cpp .h Makefile authors.csv” would probably be wise after a successful clean remake.
    • Correctly conducts all transactions. This is indicated by having no error messages. If it does not correctly process the transactions then it will receive zero for the entire assignment.
    • CPU time: min (30, 25 * Sean’s CPU Time / Your CPU Time).
    • CPU time may not exceed 60.
    • Programs must be compiled without any optimization options. You may not use any precompiled code, including the STL and assembly.
    • You may not have any static, or global variables since they would be created before the CPU timer begins. Note that you may have constants.
  11. Suggestions
    • Keep things simple, and get things running first, and only then use gprof to learn where things are going slowly.
    • Start with simple ADTs, and use Weiss code where possible.
    • Hint: All of the transactions at a given time will only deal with the offer passed in newOffer() at that time.
    • Remember to turn in dsexceptions.h if your program needs it!