Skip to content

Commit

Permalink
feat: address comments from Witold
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiajia-Cui committed Aug 12, 2024
1 parent 38a037c commit 06fa8ce
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
24 changes: 14 additions & 10 deletions core/integration/features/verified/0029-FEES-040.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ Feature: Fees calculations
| trader6 | USD | 5000 |

When the parties submit the following liquidity provision:
| id | party | market id | commitment amount | fee | lp type |
| lp1 | aux1 | ETH/DEC21 | 10000 | 0.002 | submission |
| lp1 | aux1 | ETH/DEC21 | 10000 | 0.002 | submission |
| id | party | market id | commitment amount | fee | lp type |
| lp1 | aux1 | ETH/DEC21 | 10000 | 0.002 | submission |
| lp1 | aux1 | ETH/DEC21 | 10000 | 0.002 | submission |
| trader2 | trader2 | ETH/DEC21 | 100 | 0.002 | submission |
When the network moves ahead "2" blocks

And the parties place the following orders:
Expand All @@ -58,8 +59,8 @@ Feature: Fees calculations
| buyer | price | size | seller |
| aux1 | 1000 | 1 | aux2 |
Then the parties should have the following account balances:
| party | asset | market id | margin | general |
| aux1 | USD | ETH/DEC21 | 540 | 89460 |
| party | asset | market id | margin | general | bond |
| aux1 | USD | ETH/DEC21 | 540 | 89460 | |

#0029-FEES-040:In continuous trading mode, if the price taker has insufficient asset to cover the total fee in their general + margin account, then the trade should be discarded, the orders on the book that would have been hit should remain in place with previous remaining size intact and the incoming order should be rejected (not enough fees error).

Expand All @@ -68,6 +69,11 @@ Feature: Fees calculations
| trader1 | ETH/DEC21 | buy | 2 | 1002 | 0 | TYPE_LIMIT | TIF_GTC | t1-b2-01 | |
| trader2 | ETH/DEC21 | sell | 2 | 1002 | 0 | TYPE_LIMIT | TIF_GTC | t2-s4-01 | party has insufficient funds to cover fees |

Then the parties should have the following account balances:
| party | asset | market id | margin | general | bond |
| trader1 | USD | ETH/DEC21 | 480 | 8520 | |
| trader2 | USD | ETH/DEC21 | 0 | 240 | 60 |

And the orders should have the following status:
| party | reference | status |
| trader2 | t2-s4-01 | STATUS_REJECTED |
Expand Down Expand Up @@ -127,10 +133,8 @@ Feature: Fees calculations

#trader2 is closed out, after paying infra fee, trader2 does not have enough left to cover margin
Then the parties should have the following account balances:
| party | asset | market id | margin | general |
| trader1 | USD | ETH/DEC21 | 1082 | 7308 |
| trader2 | USD | ETH/DEC21 | 0 | 0 |


| party | asset | market id | margin | general | bond |
| trader1 | USD | ETH/DEC21 | 1082 | 7308 | |
| trader2 | USD | ETH/DEC21 | 0 | 0 | 0 |


9 changes: 9 additions & 0 deletions core/integration/features/verified/0029-FEES-fees.feature
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ Feature: Fees calculations
| trader3 | USD | ETH/DEC21 | 480 | 19 |
| trader4 | USD | ETH/DEC21 | 221 | 0 |

And the following transfers should happen:
| from | to | from account | to account | market id | amount | asset |
| market | trader3 | ACCOUNT_TYPE_FEES_MAKER | ACCOUNT_TYPE_GENERAL | ETH/DEC21 | 9 | USD |
| trader4 | market | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_FEES_MAKER | ETH/DEC21 | 9 | USD |
| trader4 | | ACCOUNT_TYPE_GENERAL | ACCOUNT_TYPE_BUY_BACK_FEES | | 1 | USD |
| trader4 | | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_FEES_INFRASTRUCTURE | ETH/DEC21 | 7 | USD |
| trader4 | | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_FEES_LIQUIDITY | ETH/DEC21 | 5 | USD |
| trader4 | | ACCOUNT_TYPE_MARGIN | ACCOUNT_TYPE_NETWORK_TREASURY | ETH/DEC21 | 5 | USD |

And the market data for the market "ETH/DEC21" should be:
| mark price | trading mode | horizon | min bound | max bound |
| 1000 | TRADING_MODE_CONTINUOUS | 60 | 900 | 1100 |
Expand Down

0 comments on commit 06fa8ce

Please sign in to comment.