Skip to content

Instantly share code, notes, and snippets.

@prystupa
Last active November 26, 2017 03:49
Show Gist options
  • Save prystupa/4415983 to your computer and use it in GitHub Desktop.
Save prystupa/4415983 to your computer and use it in GitHub Desktop.
Matching using a reference price
# Matching using a reference price
Scenario: Matching incoming Buy market order against Sell market order when no best limit price is available
Given the reference price is set to "10"
Given the following orders are submitted in this order:
| Broker | Side | Qty | Price |
| A | Sell | 100 | MO |
| B | Buy | 100 | MO |
Then the following trades are generated:
| Buying broker | Selling broker | Qty | Price |
| B | A | 100 | 10 |
And market order book looks like:
| Broker | Qty | Price | Price | Qty | Broker |
Scenario: Matching incoming Sell market order against Sell market order when no best limit price is available
Given the reference price is set to "10"
Given the following orders are submitted in this order:
| Broker | Side | Qty | Price |
| A | Buy | 100 | MO |
| B | Sell | 100 | MO |
Then the following trades are generated:
| Buying broker | Selling broker | Qty | Price |
| A | B | 100 | 10 |
And market order book looks like:
| Broker | Qty | Price | Price | Qty | Broker |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment