From 166db7ed19f40d184d3926361b80cb825adeae70 Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Fri, 26 Apr 2024 10:50:58 +0100 Subject: [PATCH 1/6] feat: add ACs to cover market order collateral check for spot market --- protocol/0080-SPOT-product_builtin_spot.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/protocol/0080-SPOT-product_builtin_spot.md b/protocol/0080-SPOT-product_builtin_spot.md index b872f6892..755ec98f2 100644 --- a/protocol/0080-SPOT-product_builtin_spot.md +++ b/protocol/0080-SPOT-product_builtin_spot.md @@ -121,6 +121,8 @@ Price-monitoring auctions are still required and should be implemented following 1. If a "sell" order does not trade immediately (or only trades in part), an amount of the base_asset should be transferred to a holding_account to cover the remaining size of the order for the base_asset.(0080-SPOT-009) 1. If a "sell" order incurs fees through trading, the required amount of the quote_asset to cover the fees will be deducted from the total quote_asset resulting from the sale of the base_asset.(0080-SPOT-010) 1. For a "buy" order to be considered valid during continuous trading, the party must have a sufficient amount of the `quote_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-012) +1. For a "buy" market order to be considered valid during continuous trading, the party must have a sufficient amount of the `quote_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-024) +1. For a "sell" market order to be considered valid during continuous trading, the party must have a sufficient amount of the `base_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-025) 1. If a "buy" order does not trade immediately (or only trades in part), only the necessary amount of the quote_asset to cover the remaining size of the order should be transferred to a holding_account for the quote_asset.(0080-SPOT-013). 1. If the order is cancelled, funds should be released from the `holding_account` and returned to the `general_account`.(0080-SPOT-007) 1. If the order's size is reduced through an order amendment, funds should be released from the `holding_account` and returned to the `general_account`.(0080-SPOT-015) From 61e518d5f51ddb0c76e60b4cd1d0e02613cb19e4 Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Fri, 26 Apr 2024 12:09:08 +0100 Subject: [PATCH 2/6] feat: add AC 026027028 --- protocol/0080-SPOT-product_builtin_spot.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protocol/0080-SPOT-product_builtin_spot.md b/protocol/0080-SPOT-product_builtin_spot.md index 755ec98f2..616167b3c 100644 --- a/protocol/0080-SPOT-product_builtin_spot.md +++ b/protocol/0080-SPOT-product_builtin_spot.md @@ -123,6 +123,9 @@ Price-monitoring auctions are still required and should be implemented following 1. For a "buy" order to be considered valid during continuous trading, the party must have a sufficient amount of the `quote_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-012) 1. For a "buy" market order to be considered valid during continuous trading, the party must have a sufficient amount of the `quote_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-024) 1. For a "sell" market order to be considered valid during continuous trading, the party must have a sufficient amount of the `base_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-025) +1. amending order should be rejected when an order is amended such that would trade immediately and the party can't afford none/some of the trades(0080-SPOT-026) +1. order should be rejected when submit a limit order, partly matched, party can't afford the trades.(0080-SPOT-027) +1. order should be rejected when submit a limit order, no match, added to the book, party can't cover the amount that needs to be transfered to the holding account.(0080-SPOT-028) 1. If a "buy" order does not trade immediately (or only trades in part), only the necessary amount of the quote_asset to cover the remaining size of the order should be transferred to a holding_account for the quote_asset.(0080-SPOT-013). 1. If the order is cancelled, funds should be released from the `holding_account` and returned to the `general_account`.(0080-SPOT-007) 1. If the order's size is reduced through an order amendment, funds should be released from the `holding_account` and returned to the `general_account`.(0080-SPOT-015) From 6e9f42b4a86f2f0a90686bd5d2e79cd051ed5e8c Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Fri, 26 Apr 2024 13:57:36 +0100 Subject: [PATCH 3/6] feat: add ACs to json file --- protocol/features.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/protocol/features.json b/protocol/features.json index dc0260712..b261e6d84 100644 --- a/protocol/features.json +++ b/protocol/features.json @@ -405,7 +405,12 @@ "0079-TGAP-006", "0079-TGAP-007", "0028-GOVE-186", - "0028-GOVE-187" + "0028-GOVE-187", + "0080-SPOT-024", + "0080-SPOT-025", + "0080-SPOT-026", + "0080-SPOT-027", + "0080-SPOT-028" ] }, "Spot stop orders": { From 321541722b137a3071d1aa2ba8556c1d2efc1568 Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Fri, 26 Apr 2024 15:26:05 +0100 Subject: [PATCH 4/6] chore: typo --- protocol/0080-SPOT-product_builtin_spot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/0080-SPOT-product_builtin_spot.md b/protocol/0080-SPOT-product_builtin_spot.md index 616167b3c..fd3614e64 100644 --- a/protocol/0080-SPOT-product_builtin_spot.md +++ b/protocol/0080-SPOT-product_builtin_spot.md @@ -125,7 +125,7 @@ Price-monitoring auctions are still required and should be implemented following 1. For a "sell" market order to be considered valid during continuous trading, the party must have a sufficient amount of the `base_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-025) 1. amending order should be rejected when an order is amended such that would trade immediately and the party can't afford none/some of the trades(0080-SPOT-026) 1. order should be rejected when submit a limit order, partly matched, party can't afford the trades.(0080-SPOT-027) -1. order should be rejected when submit a limit order, no match, added to the book, party can't cover the amount that needs to be transfered to the holding account.(0080-SPOT-028) +1. order should be rejected when submit a limit order, no match, added to the book, party can't cover the amount that needs to be transferred to the holding account.(0080-SPOT-028) 1. If a "buy" order does not trade immediately (or only trades in part), only the necessary amount of the quote_asset to cover the remaining size of the order should be transferred to a holding_account for the quote_asset.(0080-SPOT-013). 1. If the order is cancelled, funds should be released from the `holding_account` and returned to the `general_account`.(0080-SPOT-007) 1. If the order's size is reduced through an order amendment, funds should be released from the `holding_account` and returned to the `general_account`.(0080-SPOT-015) From 6b9523ae1dd6c57751196e647032d9dc65c244df Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Fri, 26 Apr 2024 16:54:12 +0100 Subject: [PATCH 5/6] feat: address comment from Charlie --- protocol/0080-SPOT-product_builtin_spot.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol/0080-SPOT-product_builtin_spot.md b/protocol/0080-SPOT-product_builtin_spot.md index fd3614e64..6906f3764 100644 --- a/protocol/0080-SPOT-product_builtin_spot.md +++ b/protocol/0080-SPOT-product_builtin_spot.md @@ -122,10 +122,11 @@ Price-monitoring auctions are still required and should be implemented following 1. If a "sell" order incurs fees through trading, the required amount of the quote_asset to cover the fees will be deducted from the total quote_asset resulting from the sale of the base_asset.(0080-SPOT-010) 1. For a "buy" order to be considered valid during continuous trading, the party must have a sufficient amount of the `quote_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-012) 1. For a "buy" market order to be considered valid during continuous trading, the party must have a sufficient amount of the `quote_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-024) -1. For a "sell" market order to be considered valid during continuous trading, the party must have a sufficient amount of the `base_asset` in the `general_account` to cover the value of the trade as well as any possible fees incurred as a result of the order trading immediately (the aggressor).(0080-SPOT-025) +1. For a "sell" market order to be considered valid during continuous trading, the party must have a sufficient amount of the `base_asset` in the `general_account` to cover the value of the trade. (0080-SPOT-025) 1. amending order should be rejected when an order is amended such that would trade immediately and the party can't afford none/some of the trades(0080-SPOT-026) 1. order should be rejected when submit a limit order, partly matched, party can't afford the trades.(0080-SPOT-027) 1. order should be rejected when submit a limit order, no match, added to the book, party can't cover the amount that needs to be transferred to the holding account.(0080-SPOT-028) +1. order should be rejected when submit a limit order, partly matched, party can afford partial trade but not what needs to be transferred to the holding account after to cover the remaining size.(0080-SPOT-029) 1. If a "buy" order does not trade immediately (or only trades in part), only the necessary amount of the quote_asset to cover the remaining size of the order should be transferred to a holding_account for the quote_asset.(0080-SPOT-013). 1. If the order is cancelled, funds should be released from the `holding_account` and returned to the `general_account`.(0080-SPOT-007) 1. If the order's size is reduced through an order amendment, funds should be released from the `holding_account` and returned to the `general_account`.(0080-SPOT-015) From 3251629ba5ed3a95de96ae3cbb12def4eff8aef9 Mon Sep 17 00:00:00 2001 From: Jiajia-Cui Date: Mon, 29 Apr 2024 10:08:48 +0100 Subject: [PATCH 6/6] feat: update AC code --- protocol/features.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocol/features.json b/protocol/features.json index b261e6d84..46ae72e3c 100644 --- a/protocol/features.json +++ b/protocol/features.json @@ -410,7 +410,8 @@ "0080-SPOT-025", "0080-SPOT-026", "0080-SPOT-027", - "0080-SPOT-028" + "0080-SPOT-028", + "0080-SPOT-029" ] }, "Spot stop orders": {