Last active
November 26, 2017 03:49
-
-
Save prystupa/4415780 to your computer and use it in GitHub Desktop.
Market orders matching with other market orders when "best limit" is defined
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scenario: Matching incoming Buy market order against Sell market order when another - limit - Sell order present | |
Given the following orders are submitted in this order: | |
| Broker | Side | Qty | Price | | |
| A | Sell | 100 | MO | | |
| B | Sell | 100 | 10.5 | | |
Then market order book looks like: | |
| Broker | Qty | Price | Price | Qty | Broker | | |
| | | | MO | 100 | A | | |
| | | | 10.5 | 100 | B | | |
When the following orders are submitted in this order: | |
| Broker | Side | Qty | Price | | |
| C | Buy | 100 | MO | | |
Then the following trades are generated: | |
| Buying broker | Selling broker | Qty | Price | | |
| C | A | 100 | 10.5 | | |
And market order book looks like: | |
| Broker | Qty | Price | Price | Qty | Broker | | |
| | | | 10.5 | 100 | B | | |
Scenario: Matching incoming Sell market order against Buy market order when another - limit - Buy order present | |
Given the following orders are submitted in this order: | |
| Broker | Side | Qty | Price | | |
| A | Buy | 100 | MO | | |
| B | Buy | 100 | 10.5 | | |
Then market order book looks like: | |
| Broker | Qty | Price | Price | Qty | Broker | | |
| A | 100 | MO | | | | | |
| B | 100 | 10.5 | | | | | |
When the following orders are submitted in this order: | |
| Broker | Side | Qty | Price | | |
| C | Sell | 100 | MO | | |
Then the following trades are generated: | |
| Buying broker | Selling broker | Qty | Price | | |
| A | C | 100 | 10.5 | | |
And market order book looks like: | |
| Broker | Qty | Price | Price | Qty | Broker | | |
| B | 100 | 10.5 | | | | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment