Matching engine is the engine support set of limit order commands from input.json
The commands will be triggered in order from first (top) to last(bottom) of the list.
Input Examples:
{
"orders": [
{"command": "sell", "price": 100.003, "amount": 2.4},
{"command": "buy", "price": 90.394, "amount": 3.445}
]
}
Output of the matching engine is Order Book in output.json
. The output has 2 attributes which are buy, sell attributes.
Buy section has Buy price, Buy volume.
- Buy prices are ordered from high to low
- Buy volume is accumulated of buy amount which lies in the same price.
Sell section: Sell section has Sell price, Sell volume
- Sell prices are ordered from low to high
- Sell volume is accumulated of sell amount which lies in the same price.
Output Examples:
{
"sell": [
{
"volume": 2.4,
"price": 100.003
}
],
"buy": [
{
"volume": 3.445,
"price": 90.394
}
]
}
- Elixir, you can look for installation of Elixir in this website.
## Setup ```shell mix deps.get ``` --- ## Testing ```shell mix test test/* ``` --- ## Command
# build output.json file from input.json file
mix run -e "OrderMatchingEngine.build_order_book_from_order_request_file('input.json') |> OrderBookRepository.save"
You can generate docs via this command:
mix docs
TODO: task list
- ✅ Read Json File
- ✅ Build Model
- ✅ Parse Json to Model
- ✅ Build Buy Sell Section
- ✅ Write Section to Json File
- ✅ Matching Engine (Time Priority)
- ✅ Order Book (list of orders, A matching engine uses the book to determine which orders can be fulfilled i.e. what trades can be made.)
- ✅ Refactor Code
- ✅ Finishing Docs
- ✅ Read me