You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: protocol/0001-MKTF-market_framework.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@ Data:
32
32
-**Position Decimal Places**: number of decimal places for orders and positions, i.e. if this is 2 then the smallest increment that can be traded is 0.01, for example 0.01 BTC in a `BTSUSD` market.
33
33
- If this is negative e.g. -3 this means that the smallest order and position is of size 1000.
34
34
- Accepted values are `-6,...,-1,0,1,2,...,6`.
35
+
-**Liquidation strategy**: A field specifying the liquidation strategy for the market. Please refer to [0012-POSR-position_resolution](./0012-POSR-position_resolution.md#managing-networks-position) for supported strategies.
35
36
36
37
Note: it is agreed that initially the integer representation of the full precision of both order and positions can be required to fit into an int64, so this means that the largest position/order size possible reduces by a factor of ten for every extra decimal place used. This also means that, for instance, it would not be possible to create a `BTCUSD` market that allows order/position sizes equivalent to 1 sat.
Copy file name to clipboardExpand all lines: protocol/0004-AMND-amends.md
+29-6Lines changed: 29 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,13 @@
4
4
5
5
- Only LIMIT or PEGGED orders can be amended. Any attempt to amend a MARKET order is rejected (<aname="0004-AMND-001"href="#0004-AMND-001">0004-AMND-001</a>). For product spot: (<aname="0004-AMND-030"href="#0004-AMND-030">0004-AMND-030</a>)
6
6
- Price change amends remove the order from the book and insert the order at the back of the queue at the new price level (<aname="0004-AMND-002"href="#0004-AMND-002">0004-AMND-002</a>). For product spot: (<aname="0004-AMND-031"href="#0004-AMND-031">0004-AMND-031</a>)
7
-
- Reducing the quantity leaves the order in its current spot but reduces the remaining amount accordingly (<aname="0004-AMND-003"href="#0004-AMND-003">0004-AMND-003</a>). For product spot: (<aname="0004-AMND-032"href="#0004-AMND-032">0004-AMND-032</a>)
8
-
- Quantity after amendment must be a multiple of the smallest increment possible given the `Position Decimal Places` (PDP) specified in the [Market Framework](./0001-MKTF-market_framework.md), i.e. is PDP = 2 then quantity must be a whole multiple of 0.01. (<aname="0004-AMND-004"href="#0004-AMND-004">0004-AMND-004</a>). For product spot: (<aname="0004-AMND-055"href="#0004-AMND-055">0004-AMND-055</a>)
9
-
- Increasing the quantity causes the order to be removed from the book and inserted at the back of the price level queue with the updated quantity (<aname="0004-AMND-005"href="#0004-AMND-005">0004-AMND-005</a>). For product spot: (<aname="0004-AMND-033"href="#0004-AMND-033">0004-AMND-033</a>)
7
+
- Reducing the quantity by specifying a `sizeDelta` leaves the order in its current spot but reduces the remaining amount accordingly (<aname="0004-AMND-003"href="#0004-AMND-003">0004-AMND-003</a>). For product spot: (<aname="0004-AMND-032"href="#0004-AMND-032">0004-AMND-032</a>)
8
+
- Quantity after amendment using a `sizeDelta` must be a multiple of the smallest increment possible given the `Position Decimal Places` (PDP) specified in the [Market Framework](./0001-MKTF-market_framework.md), i.e. is PDP = 2 then quantity must be a whole multiple of 0.01. (<aname="0004-AMND-004"href="#0004-AMND-004">0004-AMND-004</a>). For product spot: (<aname="0004-AMND-055"href="#0004-AMND-055">0004-AMND-055</a>)
9
+
- Increasing the quantity by specifying a `sizeDelta` causes the order to be removed from the book and inserted at the back of the price level queue with the updated quantity (<aname="0004-AMND-005"href="#0004-AMND-005">0004-AMND-005</a>). For product spot: (<aname="0004-AMND-033"href="#0004-AMND-033">0004-AMND-033</a>)
10
+
- Size change amends specifying a `size` greater than the current size remove and reinsert the order at the back of the price level and increase the remaining amount accordingly (<aname="0004-AMND-056"href="#0004-AMND-056">0004-AMND-056</a>).
11
+
- Size change amends specifying a `size` lower than the current size leave the order in its current spot and reduce the remaining amount of the order accordingly (<aname="0004-AMND-057"href="#0004-AMND-057">0004-AMND-057</a>).
12
+
- Size change amends which would result in the remaining part of the order being reduced below zero should instead cancel the order (<aname="0004-AMND-058"href="#0004-AMND-058">0004-AMND-058</a>).
13
+
- A transaction specifying both a `sizeDelta` and `size` field should be rejected as invalid (<aname="0004-AMND-059"href="#0004-AMND-059">0004-AMND-059</a>).
10
14
- Changing the `TIF` can only occur between `GTC` and `GTT`. Any attempt to amend to another `TIF` flag is rejected. A `GTT` must have an `expiresAt` value but a `GTC` must not have one. (<aname="0004-AMND-006"href="#0004-AMND-006">0004-AMND-006</a>). For product spot: (<aname="0004-AMND-034"href="#0004-AMND-034">0004-AMND-034</a>)
11
15
- Any attempt to amend to or from the `TIF` values `GFA` and `GFN` will result in a rejected amend. (<aname="0004-AMND-007"href="#0004-AMND-007">0004-AMND-007</a>). For product spot: (<aname="0004-AMND-035"href="#0004-AMND-035">0004-AMND-035</a>)
12
16
- All updates to an existing order update the `UpdatedAt` time stamp field in the order (<aname="0004-AMND-008"href="#0004-AMND-008">0004-AMND-008</a>). For product spot: (<aname="0004-AMND-036"href="#0004-AMND-036">0004-AMND-036</a>)
@@ -42,7 +46,7 @@ The amend order can alter the quantity, price and expiry time/`TIF` type. For pe
42
46
43
47
## Guide-level explanation
44
48
45
-
The amend order message is a custom message containing the `orderID` of the original order and optional fields that can be altered. Prices can be changed with a new absolute value, quantity can be reduced or increased from their current remaining size. Expiry time can be set to a new value and the `TIF` type can be toggled between `GTC` and `GTT`. Changing the `TIF` field will impact the value in the `ExpiryTime` field as it will either be blanked or set to a new valid value.
49
+
The amend order message is a custom message containing the `orderID` of the original order and optional fields that can be altered. Prices can be changed with a new absolute value, sizes can be changed by either specifying a size delta or a new absolute value. If a user attempts to amend the size of an order by specifying both a size delta and anew absolute value the order should be rejected. Expiry time can be set to a new value and the `TIF` type can be toggled between `GTC` and `GTT`. Changing the `TIF` field will impact the value in the `ExpiryTime` field as it will either be blanked or set to a new valid value.
46
50
47
51
Some examples:
48
52
A LIMIT order sitting on the bid side of the order book:
@@ -86,7 +99,9 @@ The fields which can be altered are:
86
99
-`Price`
87
100
- Amending the price causes the order to be removed from the book and re-inserted at the new price level. This can result in the order being filled if the price is moved to a level that would cross.
88
101
-`SizeDelta`
89
-
- A size change is specified as a delta to the current amount. This will be applied to both the `Size` and `Remaining` part of the order. In the case that the remaining amount it reduced to zero or less, the order is cancelled. This must be a multiple of the smallest value allowed by the `Position Decimal Places` (PDP) specified in the [Market Framework](./0001-MKTF-market_framework.md), i.e. is PDP = 2 then `SizeDelta` must be a whole multiple of 0.01. (NB: `SizeDelta` may use an int64 where the int value 1 is the smallest multiple allowable given the configured dp). In case PDP is negative this again applies e.g. if PDP = -1 then `SizeDelta` must be a whole multiple of 10.
102
+
- Amending the size by specifying a `sizeDelta` will be applied to both the `Size` and `Remaining` part of the order. In the case that the remaining amount it reduced to zero or less, the order is cancelled. This must be a multiple of the smallest value allowed by the `Position Decimal Places` (PDP) specified in the [Market Framework](./0001-MKTF-market_framework.md), i.e. is PDP = 2 then `SizeDelta` must be a whole multiple of 0.01. (NB: `SizeDelta` may use an int64 where the int value 1 is the smallest multiple allowable given the configured dp). In case PDP is negative this again applies e.g. if PDP = -1 then `SizeDelta` must be a whole multiple of 10.
103
+
-`Size`
104
+
- Amending the size by specifying a new `size` causes the the `Size` and `Remaining` part of the order to be amended by the difference between the original and amended size. In the case that the remaining amount it reduced to zero or less, the order is cancelled. This must be a multiple of the smallest value allowed by the `Position Decimal Places` (PDP) specified in the [Market Framework](./0001-MKTF-market_framework.md), i.e. is PDP = 2 then `Size` must be a whole multiple of 0.01. (NB: `Size` may use an int64 where the int value 1 is the smallest multiple allowable given the configured dp). In case PDP is negative this again applies e.g. if PDP = -1 then `Size` must be a whole multiple of 10.
90
105
-`TimeInForce`
91
106
- The `TIF` enumeration can only be toggled between `GTT` and `GTC`. Amending to `GTT` requires an `expiryTime` value to be set. Amending to `GTC` removes the `expiryTime` value.
92
107
-`ExpiryTime`
@@ -110,10 +125,11 @@ message amendOrder {
110
125
enum TIF 4;
111
126
int64 expiryTime 5;
112
127
PeggedOrder *peggedOrder 6;
128
+
int64 size 7;
113
129
}
114
130
```
115
131
116
-
An example of using a negative size is shown below:
Copy file name to clipboardExpand all lines: protocol/0010-MARG-margin_orchestration.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,9 +34,10 @@ This specification outlines:
34
34
35
35
### **Background - how margin levels are calculated**
36
36
37
-
The [margin calculator](./0019-MCAL-margin_calculator.md) will calculate the margin levels when instructed to do so. It will return four margin levels for each trader:
37
+
The [margin calculator](./0019-MCAL-margin_calculator.md) will calculate the margin levels when instructed to do so. It will return five margin levels for each trader:
0 commit comments