Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add AC code for 0043-MKTL-012, 013 #11216

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Feature: Set up a market, create indiciative price different to actual opening a
| limits.markets.maxPeggedOrders | 2 |

@DebugAuctionMax @Expires
Scenario: Simple test verifying the market is cancelled if it failes to leave opening auction
Scenario: 0043-MKTL-012 Simple test verifying the market is cancelled if it failes to leave opening auction
# setup accounts
Given the parties deposit on asset's general account the following amount:
| party | asset | amount |
Expand All @@ -31,6 +31,10 @@ Feature: Set up a market, create indiciative price different to actual opening a

# Start market with some dead time
And the network moves ahead "5" blocks
Then the parties submit the following liquidity provision:
| id | party | market id | commitment amount | fee | lp type |
| party1 | party1 | ETH/DEC19 | 30000 | 0.1 | submission |

Then the market data for the market "ETH/DEC19" should be:
| trading mode |
| TRADING_MODE_OPENING_AUCTION |
Expand All @@ -54,3 +58,16 @@ Feature: Set up a market, create indiciative price different to actual opening a

# Now the market should be cancelled
Then the last market state should be "STATE_CANCELLED" for the market "ETH/DEC19"

#orders are cancelled
And the orders should have the following status:
| party | reference | status |
| party5 | t5-s-1 | STATUS_CANCELLED |
| party6 | t6-b-1 | STATUS_CANCELLED |

#asset is released for party with orders and LP commitment
Then "party1" should have general account balance of "100000000" for asset "BTC"
Then "party5" should have general account balance of "100000000" for asset "BTC"
Then "party6" should have general account balance of "100000000" for asset "BTC"


41 changes: 31 additions & 10 deletions core/integration/features/spots/opening-auction-expires.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,47 @@ Feature: Set up a spot market, with an opening auction, then uncross the book. M
| id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params |
| BTC/ETH | BTC/ETH | BTC | ETH | my-simple-risk-model | 5 | fees-config-1 | default-none | default-basic |

Scenario: Ensure spot markets get cancelled if they fail to leave opening auction
Scenario: 0043-MKTL-013 Ensure spot markets get cancelled if they fail to leave opening auction
# setup accounts
Given the parties deposit on asset's general account the following amount:
| party | asset | amount |
| party1 | ETH | 1000000000 |
| party2 | ETH | 1000000000 |
| party2 | BTC | 5 |
| party | asset | amount |
| party1 | ETH | 100000 |
| party2 | ETH | 100000 |
| party3 | ETH | 100000 |
| party2 | BTC | 5 |

Then the parties submit the following liquidity provision:
| id | party | market id | commitment amount | fee | lp type |
| lp1 | party3 | BTC/ETH | 3000 | 0.1 | submission |
# place orders and generate trades
When the parties place the following orders:
| party | market id | side | volume | price | resulting trades | type | tif | reference |
| party2 | BTC/ETH | buy | 1 | 950000 | 0 | TYPE_LIMIT | TIF_GTC | t2-b-1 |
| party1 | BTC/ETH | buy | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GFA | t1-b-1 |
| party | market id | side | volume | price | resulting trades | type | tif | reference |
| party2 | BTC/ETH | buy | 1 | 95 | 0 | TYPE_LIMIT | TIF_GTC | t2-b-1 |
| party1 | BTC/ETH | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GFA | t1-b-1 |
| party3 | BTC/ETH | buy | 1 | 110 | 0 | TYPE_LIMIT | TIF_GFA | t3-b-1 |

Then "party1" should have holding account balance of "1000000" for asset "ETH"
Then "party1" should have holding account balance of "100" for asset "ETH"

When the network moves ahead "1" blocks
Then the market data for the market "BTC/ETH" should be:
| trading mode |
| TRADING_MODE_OPENING_AUCTION |

When the network moves ahead "11" blocks
When the network moves ahead "9" blocks
Then the last market state should be "STATE_PENDING" for the market "BTC/ETH"

When the network moves ahead "1" blocks
Then the last market state should be "STATE_CANCELLED" for the market "BTC/ETH"

#orders are cancelled
And the orders should have the following status:
| party | reference | status |
| party2 | t2-b-1 | STATUS_CANCELLED |
| party1 | t1-b-1 | STATUS_CANCELLED |
| party3 | t3-b-1 | STATUS_CANCELLED |

#asset is released for party with orders and LP commitment
Then "party1" should have general account balance of "100000" for asset "ETH"
Then "party2" should have general account balance of "100000" for asset "ETH"
Then "party3" should have general account balance of "100000" for asset "ETH"

Loading