Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jdrew1303/7785120fd5083df8c501b25cadbc92e0 to your computer and use it in GitHub Desktop.
Save jdrew1303/7785120fd5083df8c501b25cadbc92e0 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