本次澳洲代写是一个使用Java实现股票交易系统的project
Task Description
In this assignment you will develop a Stock Exchange application in the Java programming language. Use the
examples below and the Javadoc found under resources on EdStem to write the program to specification.
You are encouraged to ask questions on Ed using the assignments category. As with any assignment, make
sure that your work is your own, and you do not share your code or solutions with other students.
Working on your assignment
You can work on this assignment on your own computer or the lab machines. It is important that you
continually back up your assignment files onto your own machine, external drives, and in the cloud.
You are encouraged to submit your assignment on Ed while you are in the process of completing it. By
submitting you will obtain some feedback of your progress on the sample test cases provided.
Implementation details
Write a program in Java that implements the Stack Exchange application as documented in the Javadoc on
EdStem. You can assume that our test cases will contain only valid input commands and not cause any integer
overflows. Commands are case insensitive.
The Exchange stores details on all the registered traders, as well as a reference to the matching engine
(market) used to process orders and trades. Traders are identified by their ID, and store both their balance
(in dollars) as well as their inventory, which tracks the products and quantities that the trader possesses.
The Market stores collections of orders (within sell and buy books, for sell and buy orders respectively) and
trades. An order can be made by a trader to buy or sell an amount of a product for a given price per unit.
Each order has a unique ID hexadecimal String of 4 characters. Order IDs begin at 0000 and increment up
(such that the second order will have ID 0001). Note that as the IDs use hexadecimal values, after 0009 is
000A, and after 000F is 0010.
A trade is for a single product for a set amount at a given price per unit and occurs between a sell order and
a buy order. Each trade represents a completed transaction in which funds and product have been
transferred between traders.
The Market utilises the Price-Time Priority Algorithm (explained below) when a new order is made to the
engine. When an order is created, it is initially open. The Price-Time Priority Algorithm then determines the
best order from the corresponding book (sell book for a new buy order, buy book for a new sell order), if any,
with which a trade can be made. If a trade can be made, the price from the existing order is used, and the
minimum amount of the two orders is transferred. Note that as the price is per unit, the money transferred
is equal to price ∗ amount. After the money and product is transferred, if one or both of the orders no
longer require any more amount, the order(s) is closed and is removed from the order book. If an order
cannot be matched, or remains open after going through one or more trades, it is added to the market’s
order book. Examples of this process are provided below.
Your program should only be comprised of Exchange.java, Market.java, Trader.java, Trade.java and
Order.java. Do not modify any of the existing method signatures found in the documentation. You are
encouraged to write your own additional methods to improve style and reduce repetitive code. Your program
must produce no errors when built and run. Your program will read from standard input and write to standard
output.
Your program output must match the exact output format shown in the examples below. You are encouraged
to submit your assignment while you are working on it, so you can obtain some feedback.
In order to obtain full marks, your program will be checked against automatic test cases, manually inspected
by your tutors and you must submit a set of test cases that ensure you have implemented functionality
correctly.
Price-Time Priority Algorithm
The Price-Time Priority Algorithm first prioritises by price, and then uses time to differentiate between orders
at the same price. If a sell order is made, the algorithm will find a corresponding buy order for the same
product with the highest price greater or equal to the price specified by the sell order. If there are multiple
such buy orders, the earliest one is used.
If a buy order is made, the algorithm will find a corresponding sell order for the same price with the lowest
price less than or equal to the price specified by the buy order. If there are multiple such sell orders, the
earliest one is used.
Algorithm Example
Initially both the buy book and the sell book are empty. Let there be 5 traders in the market, with ID’s trader1,
trader2, trader3, trader4 and trader5, each with $100 dollars balance, and assume that trader1 has imported
100 units of product ABC.
trader2 wants to buy ABC and decides to make a buy order for it. They want to purchase 10 units, and the
most they are willing to pay per unit is $7.50. They hence make a buy order for 10 units of ABC at $7.50 per
unit. As the sell book is currently empty, no trades can be made, so the order is added unchanged to the buy
book.
trader3 also wishes to buy some ABC and hence also makes a buy order for it. They want to purchase 5 units,
and the most they are willing to pay per unit is $10.00. They hence make a buy order for 5 units of ABC at
$10.00 per unit. As the sell book is still empty, no trades can be made, so the order is added unchanged to
the buy book, which now has trader2’s order (with ID 0000) and trader3’s order (with ID 0001).
trader4 realises that ABC must be a popular product and will probably rise in value soon, so hence decides to
make a buy order for it. They want to purchase 15 units, but for a maximum price per unit of $5.00. They
hence make a buy order for 15 units of ABC at $5.00 per unit.
trader5 comes to the same conclusion as trader4 and makes a buy order for 20 units of ABC with a maximum
price per unit of $7.50.
trader1 notices the interest in the market for ABC and decides to sell all of their stock. They decide to make
a sell order for 100 units of ABC, with the lowest price they will accept be $6.50. The buy book is currently
not empty, so the Price-Time Priority Algorithm gets to work to determine whether any trades can be made.
程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB

本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易!
E-mail: itcsdx@outlook.com 微信:itcsdx
如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。
