ccxt 4.5.18 → 4.5.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/README.md +7 -6
  2. package/dist/ccxt.browser.min.js +40 -16
  3. package/dist/cjs/_virtual/index.cjs.js +1459 -9
  4. package/dist/cjs/ccxt.js +8 -2
  5. package/dist/cjs/src/abstract/dydx.js +11 -0
  6. package/dist/cjs/src/base/Exchange.js +164 -10
  7. package/dist/cjs/src/base/ws/Client.js +3 -1
  8. package/dist/cjs/src/binance.js +8 -1
  9. package/dist/cjs/src/bingx.js +20 -0
  10. package/dist/cjs/src/bitget.js +43 -41
  11. package/dist/cjs/src/bybit.js +21 -23
  12. package/dist/cjs/src/deribit.js +6 -0
  13. package/dist/cjs/src/dydx.js +2454 -0
  14. package/dist/cjs/src/gate.js +4 -4
  15. package/dist/cjs/src/hibachi.js +1 -1
  16. package/dist/cjs/src/hyperliquid.js +207 -9
  17. package/dist/cjs/src/kucoin.js +711 -109
  18. package/dist/cjs/src/mexc.js +2 -3
  19. package/dist/cjs/src/pro/binance.js +59 -144
  20. package/dist/cjs/src/pro/dydx.js +418 -0
  21. package/dist/cjs/src/pro/kraken.js +4 -3
  22. package/dist/cjs/src/pro/xt.js +218 -4
  23. package/dist/cjs/src/protobuf/mexc/compiled.cjs.js +1 -0
  24. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.js +56 -0
  25. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.js +56 -0
  26. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.js +48 -0
  27. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.js +343 -0
  28. package/dist/cjs/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.js +717 -0
  29. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.js +60 -0
  30. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.js +45 -0
  31. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.js +380 -0
  32. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.js +72 -0
  33. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.js +211 -0
  34. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.js +195 -0
  35. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.js +49 -0
  36. package/dist/cjs/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.js +57 -0
  37. package/dist/cjs/src/static_dependencies/dydx-v4-client/google/protobuf/any.js +56 -0
  38. package/dist/cjs/src/static_dependencies/dydx-v4-client/helpers.js +79 -0
  39. package/dist/cjs/src/static_dependencies/dydx-v4-client/long/index.cjs.js +9 -0
  40. package/dist/cjs/src/static_dependencies/dydx-v4-client/onboarding.js +59 -0
  41. package/dist/cjs/src/static_dependencies/dydx-v4-client/registry.js +39 -0
  42. package/dist/cjs/src/static_dependencies/noble-hashes/pbkdf2.js +69 -0
  43. package/dist/cjs/src/static_dependencies/noble-hashes/ripemd160.js +108 -0
  44. package/dist/cjs/src/static_dependencies/noble-hashes/utils.js +50 -1
  45. package/dist/cjs/src/static_dependencies/scure-base/index.js +29 -0
  46. package/dist/cjs/src/static_dependencies/scure-bip32/index.js +278 -0
  47. package/dist/cjs/src/static_dependencies/scure-bip39/index.js +97 -0
  48. package/dist/cjs/src/static_dependencies/scure-bip39/wordlists/english.js +2060 -0
  49. package/dist/cjs/src/static_dependencies/zklink/zklink-sdk-web.js +2 -0
  50. package/dist/cjs/src/toobit.js +2 -1
  51. package/js/ccxt.d.ts +8 -2
  52. package/js/ccxt.js +6 -2
  53. package/js/src/abstract/binance.d.ts +7 -0
  54. package/js/src/abstract/binancecoinm.d.ts +7 -0
  55. package/js/src/abstract/binanceus.d.ts +7 -0
  56. package/js/src/abstract/binanceusdm.d.ts +7 -0
  57. package/js/src/abstract/bitget.d.ts +1 -0
  58. package/js/src/abstract/dydx.d.ts +61 -0
  59. package/js/src/abstract/dydx.js +11 -0
  60. package/js/src/abstract/kucoin.d.ts +1 -1
  61. package/js/src/abstract/kucoinfutures.d.ts +1 -1
  62. package/js/src/base/Exchange.d.ts +7 -0
  63. package/js/src/base/Exchange.js +163 -10
  64. package/js/src/base/ws/Client.js +3 -1
  65. package/js/src/binance.js +8 -1
  66. package/js/src/bingx.js +20 -0
  67. package/js/src/bitget.d.ts +3 -3
  68. package/js/src/bitget.js +43 -41
  69. package/js/src/bybit.d.ts +3 -3
  70. package/js/src/bybit.js +21 -23
  71. package/js/src/deribit.js +6 -0
  72. package/js/src/dydx.d.ts +364 -0
  73. package/js/src/dydx.js +2453 -0
  74. package/js/src/gate.d.ts +2 -2
  75. package/js/src/gate.js +4 -4
  76. package/js/src/hibachi.js +1 -1
  77. package/js/src/hyperliquid.d.ts +17 -0
  78. package/js/src/hyperliquid.js +207 -9
  79. package/js/src/kucoin.d.ts +48 -1
  80. package/js/src/kucoin.js +711 -109
  81. package/js/src/mexc.js +2 -3
  82. package/js/src/pro/binance.d.ts +2 -2
  83. package/js/src/pro/binance.js +59 -144
  84. package/js/src/pro/dydx.d.ts +81 -0
  85. package/js/src/pro/dydx.js +417 -0
  86. package/js/src/pro/kraken.js +4 -3
  87. package/js/src/pro/xt.d.ts +85 -2
  88. package/js/src/pro/xt.js +218 -4
  89. package/js/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.d.ts +90 -0
  90. package/js/src/static_dependencies/dydx-v4-client/cosmos/base/v1beta1/coin.js +163 -0
  91. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/keys.d.ts +26 -0
  92. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/keys.js +51 -0
  93. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.d.ts +48 -0
  94. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/multisig/v1beta1/multisig.js +85 -0
  95. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.d.ts +40 -0
  96. package/js/src/static_dependencies/dydx-v4-client/cosmos/crypto/secp256k1/keys.js +77 -0
  97. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.d.ts +162 -0
  98. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/signing/v1beta1/signing.js +329 -0
  99. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.d.ts +460 -0
  100. package/js/src/static_dependencies/dydx-v4-client/cosmos/tx/v1beta1/tx.js +698 -0
  101. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.d.ts +127 -0
  102. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/accountplus/tx.js +286 -0
  103. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/block_rate_limit_config.d.ts +66 -0
  104. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/block_rate_limit_config.js +109 -0
  105. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.d.ts +127 -0
  106. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/clob_pair.js +257 -0
  107. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/equity_tier_limit_config.d.ts +48 -0
  108. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/equity_tier_limit_config.js +93 -0
  109. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/finalize_block.d.ts +23 -0
  110. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/finalize_block.js +43 -0
  111. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations.d.ts +92 -0
  112. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations.js +164 -0
  113. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations_config.d.ts +124 -0
  114. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/liquidations_config.js +196 -0
  115. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/matches.d.ts +159 -0
  116. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/matches.js +324 -0
  117. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.d.ts +546 -0
  118. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order.js +872 -0
  119. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.d.ts +84 -0
  120. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/order_removals.js +181 -0
  121. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.d.ts +397 -0
  122. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/clob/tx.js +757 -0
  123. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.d.ts +120 -0
  124. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/transfer.js +246 -0
  125. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.d.ts +79 -0
  126. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/sending/tx.js +147 -0
  127. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/asset_position.d.ts +32 -0
  128. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/asset_position.js +59 -0
  129. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/perpetual_position.d.ts +34 -0
  130. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/perpetual_position.js +66 -0
  131. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.d.ts +62 -0
  132. package/js/src/static_dependencies/dydx-v4-client/dydxprotocol/subaccounts/subaccount.js +111 -0
  133. package/js/src/static_dependencies/dydx-v4-client/google/protobuf/any.d.ts +207 -0
  134. package/js/src/static_dependencies/dydx-v4-client/google/protobuf/any.js +50 -0
  135. package/js/src/static_dependencies/dydx-v4-client/helpers.d.ts +82 -0
  136. package/js/src/static_dependencies/dydx-v4-client/helpers.js +172 -0
  137. package/js/src/static_dependencies/dydx-v4-client/long/index.cjs +1473 -0
  138. package/js/src/static_dependencies/dydx-v4-client/long/index.d.cts +2 -0
  139. package/js/src/static_dependencies/dydx-v4-client/onboarding.d.ts +35 -0
  140. package/js/src/static_dependencies/dydx-v4-client/onboarding.js +56 -0
  141. package/js/src/static_dependencies/dydx-v4-client/registry.d.ts +7 -0
  142. package/js/src/static_dependencies/dydx-v4-client/registry.js +36 -0
  143. package/js/src/static_dependencies/noble-hashes/utils.d.ts +1 -0
  144. package/js/src/static_dependencies/noble-hashes/utils.js +4 -0
  145. package/js/src/static_dependencies/scure-bip32/index.d.ts +49 -0
  146. package/js/src/static_dependencies/scure-bip32/index.js +295 -0
  147. package/js/src/static_dependencies/scure-bip39/index.d.ts +54 -0
  148. package/js/src/static_dependencies/scure-bip39/index.js +140 -0
  149. package/js/src/static_dependencies/scure-bip39/wordlists/english.d.ts +1 -0
  150. package/js/src/static_dependencies/scure-bip39/wordlists/english.js +2054 -0
  151. package/js/src/toobit.js +2 -1
  152. package/package.json +9 -3
@@ -0,0 +1,164 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ import { SubaccountId } from "../subaccounts/subaccount.js";
8
+ import * as _m0 from "protobufjs/minimal.js";
9
+ import { Long } from "../../helpers.js";
10
+ function createBasePerpetualLiquidationInfo() {
11
+ return {
12
+ subaccountId: undefined,
13
+ perpetualId: 0
14
+ };
15
+ }
16
+ export const PerpetualLiquidationInfo = {
17
+ encode(message, writer = _m0.Writer.create()) {
18
+ if (message.subaccountId !== undefined) {
19
+ SubaccountId.encode(message.subaccountId, writer.uint32(10).fork()).ldelim();
20
+ }
21
+ if (message.perpetualId !== 0) {
22
+ writer.uint32(16).uint32(message.perpetualId);
23
+ }
24
+ return writer;
25
+ },
26
+ decode(input, length) {
27
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
28
+ let end = length === undefined ? reader.len : reader.pos + length;
29
+ const message = createBasePerpetualLiquidationInfo();
30
+ while (reader.pos < end) {
31
+ const tag = reader.uint32();
32
+ switch (tag >>> 3) {
33
+ case 1:
34
+ message.subaccountId = SubaccountId.decode(reader, reader.uint32());
35
+ break;
36
+ case 2:
37
+ message.perpetualId = reader.uint32();
38
+ break;
39
+ default:
40
+ reader.skipType(tag & 7);
41
+ break;
42
+ }
43
+ }
44
+ return message;
45
+ },
46
+ fromPartial(object) {
47
+ const message = createBasePerpetualLiquidationInfo();
48
+ message.subaccountId = object.subaccountId !== undefined && object.subaccountId !== null ? SubaccountId.fromPartial(object.subaccountId) : undefined;
49
+ message.perpetualId = object.perpetualId ?? 0;
50
+ return message;
51
+ }
52
+ };
53
+ function createBaseSubaccountLiquidationInfo() {
54
+ return {
55
+ perpetualsLiquidated: [],
56
+ notionalLiquidated: Long.UZERO,
57
+ quantumsInsuranceLost: Long.UZERO
58
+ };
59
+ }
60
+ export const SubaccountLiquidationInfo = {
61
+ encode(message, writer = _m0.Writer.create()) {
62
+ writer.uint32(10).fork();
63
+ for (const v of message.perpetualsLiquidated) {
64
+ writer.uint32(v);
65
+ }
66
+ writer.ldelim();
67
+ if (!message.notionalLiquidated.isZero()) {
68
+ writer.uint32(16).uint64(message.notionalLiquidated);
69
+ }
70
+ if (!message.quantumsInsuranceLost.isZero()) {
71
+ writer.uint32(24).uint64(message.quantumsInsuranceLost);
72
+ }
73
+ return writer;
74
+ },
75
+ decode(input, length) {
76
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
77
+ let end = length === undefined ? reader.len : reader.pos + length;
78
+ const message = createBaseSubaccountLiquidationInfo();
79
+ while (reader.pos < end) {
80
+ const tag = reader.uint32();
81
+ switch (tag >>> 3) {
82
+ case 1:
83
+ if ((tag & 7) === 2) {
84
+ const end2 = reader.uint32() + reader.pos;
85
+ while (reader.pos < end2) {
86
+ message.perpetualsLiquidated.push(reader.uint32());
87
+ }
88
+ }
89
+ else {
90
+ message.perpetualsLiquidated.push(reader.uint32());
91
+ }
92
+ break;
93
+ case 2:
94
+ message.notionalLiquidated = reader.uint64();
95
+ break;
96
+ case 3:
97
+ message.quantumsInsuranceLost = reader.uint64();
98
+ break;
99
+ default:
100
+ reader.skipType(tag & 7);
101
+ break;
102
+ }
103
+ }
104
+ return message;
105
+ },
106
+ fromPartial(object) {
107
+ const message = createBaseSubaccountLiquidationInfo();
108
+ message.perpetualsLiquidated = object.perpetualsLiquidated?.map(e => e) || [];
109
+ message.notionalLiquidated = object.notionalLiquidated !== undefined && object.notionalLiquidated !== null ? Long.fromValue(object.notionalLiquidated) : Long.UZERO;
110
+ message.quantumsInsuranceLost = object.quantumsInsuranceLost !== undefined && object.quantumsInsuranceLost !== null ? Long.fromValue(object.quantumsInsuranceLost) : Long.UZERO;
111
+ return message;
112
+ }
113
+ };
114
+ function createBaseSubaccountOpenPositionInfo() {
115
+ return {
116
+ perpetualId: 0,
117
+ subaccountsWithLongPosition: [],
118
+ subaccountsWithShortPosition: []
119
+ };
120
+ }
121
+ export const SubaccountOpenPositionInfo = {
122
+ encode(message, writer = _m0.Writer.create()) {
123
+ if (message.perpetualId !== 0) {
124
+ writer.uint32(8).uint32(message.perpetualId);
125
+ }
126
+ for (const v of message.subaccountsWithLongPosition) {
127
+ SubaccountId.encode(v, writer.uint32(18).fork()).ldelim();
128
+ }
129
+ for (const v of message.subaccountsWithShortPosition) {
130
+ SubaccountId.encode(v, writer.uint32(26).fork()).ldelim();
131
+ }
132
+ return writer;
133
+ },
134
+ decode(input, length) {
135
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
136
+ let end = length === undefined ? reader.len : reader.pos + length;
137
+ const message = createBaseSubaccountOpenPositionInfo();
138
+ while (reader.pos < end) {
139
+ const tag = reader.uint32();
140
+ switch (tag >>> 3) {
141
+ case 1:
142
+ message.perpetualId = reader.uint32();
143
+ break;
144
+ case 2:
145
+ message.subaccountsWithLongPosition.push(SubaccountId.decode(reader, reader.uint32()));
146
+ break;
147
+ case 3:
148
+ message.subaccountsWithShortPosition.push(SubaccountId.decode(reader, reader.uint32()));
149
+ break;
150
+ default:
151
+ reader.skipType(tag & 7);
152
+ break;
153
+ }
154
+ }
155
+ return message;
156
+ },
157
+ fromPartial(object) {
158
+ const message = createBaseSubaccountOpenPositionInfo();
159
+ message.perpetualId = object.perpetualId ?? 0;
160
+ message.subaccountsWithLongPosition = object.subaccountsWithLongPosition?.map(e => SubaccountId.fromPartial(e)) || [];
161
+ message.subaccountsWithShortPosition = object.subaccountsWithShortPosition?.map(e => SubaccountId.fromPartial(e)) || [];
162
+ return message;
163
+ }
164
+ };
@@ -0,0 +1,124 @@
1
+ import _m0 from "protobufjs/minimal.js";
2
+ import { DeepPartial } from "../../helpers.js";
3
+ /** LiquidationsConfig stores all configurable fields related to liquidations. */
4
+ export interface LiquidationsConfig {
5
+ /**
6
+ * The maximum liquidation fee (in parts-per-million). This fee goes
7
+ * 100% to the insurance fund.
8
+ */
9
+ maxLiquidationFeePpm: number;
10
+ /**
11
+ * Limits around how much of a single position can be liquidated
12
+ * within a single block.
13
+ */
14
+ positionBlockLimits?: PositionBlockLimits;
15
+ /**
16
+ * Limits around how many quote quantums from a single subaccount can
17
+ * be liquidated within a single block.
18
+ */
19
+ subaccountBlockLimits?: SubaccountBlockLimits;
20
+ /**
21
+ * Config about how the fillable-price spread from the oracle price
22
+ * increases based on the adjusted bankruptcy rating of the subaccount.
23
+ */
24
+ fillablePriceConfig?: FillablePriceConfig;
25
+ }
26
+ /** LiquidationsConfig stores all configurable fields related to liquidations. */
27
+ export interface LiquidationsConfigSDKType {
28
+ max_liquidation_fee_ppm: number;
29
+ position_block_limits?: PositionBlockLimitsSDKType;
30
+ subaccount_block_limits?: SubaccountBlockLimitsSDKType;
31
+ fillable_price_config?: FillablePriceConfigSDKType;
32
+ }
33
+ /**
34
+ * PositionBlockLimits stores all configurable fields related to limits
35
+ * around how much of a single position can be liquidated within a single block.
36
+ */
37
+ export interface PositionBlockLimits {
38
+ /**
39
+ * The minimum amount of quantums to liquidate for each message (in
40
+ * quote quantums).
41
+ * Overridden by the maximum size of the position.
42
+ */
43
+ minPositionNotionalLiquidated: Long;
44
+ /**
45
+ * The maximum portion of the position liquidated (in parts-per-
46
+ * million). Overridden by min_position_notional_liquidated.
47
+ */
48
+ maxPositionPortionLiquidatedPpm: number;
49
+ }
50
+ /**
51
+ * PositionBlockLimits stores all configurable fields related to limits
52
+ * around how much of a single position can be liquidated within a single block.
53
+ */
54
+ export interface PositionBlockLimitsSDKType {
55
+ min_position_notional_liquidated: Long;
56
+ max_position_portion_liquidated_ppm: number;
57
+ }
58
+ /**
59
+ * SubaccountBlockLimits stores all configurable fields related to limits
60
+ * around how many quote quantums from a single subaccount can
61
+ * be liquidated within a single block.
62
+ */
63
+ export interface SubaccountBlockLimits {
64
+ /**
65
+ * The maximum notional amount that a single subaccount can have
66
+ * liquidated (in quote quantums) per block.
67
+ */
68
+ maxNotionalLiquidated: Long;
69
+ /**
70
+ * The maximum insurance-fund payout amount for a given subaccount
71
+ * per block. I.e. how much it can cover for that subaccount.
72
+ */
73
+ maxQuantumsInsuranceLost: Long;
74
+ }
75
+ /**
76
+ * SubaccountBlockLimits stores all configurable fields related to limits
77
+ * around how many quote quantums from a single subaccount can
78
+ * be liquidated within a single block.
79
+ */
80
+ export interface SubaccountBlockLimitsSDKType {
81
+ max_notional_liquidated: Long;
82
+ max_quantums_insurance_lost: Long;
83
+ }
84
+ /**
85
+ * FillablePriceConfig stores all configurable fields related to calculating
86
+ * the fillable price for liquidating a position.
87
+ */
88
+ export interface FillablePriceConfig {
89
+ /** The rate at which the Adjusted Bankruptcy Rating increases. */
90
+ bankruptcyAdjustmentPpm: number;
91
+ /**
92
+ * The maximum value that the liquidation spread can take, as
93
+ * a ratio against the position's maintenance margin.
94
+ */
95
+ spreadToMaintenanceMarginRatioPpm: number;
96
+ }
97
+ /**
98
+ * FillablePriceConfig stores all configurable fields related to calculating
99
+ * the fillable price for liquidating a position.
100
+ */
101
+ export interface FillablePriceConfigSDKType {
102
+ bankruptcy_adjustment_ppm: number;
103
+ spread_to_maintenance_margin_ratio_ppm: number;
104
+ }
105
+ export declare const LiquidationsConfig: {
106
+ encode(message: LiquidationsConfig, writer?: _m0.Writer): _m0.Writer;
107
+ decode(input: _m0.Reader | Uint8Array, length?: number): LiquidationsConfig;
108
+ fromPartial(object: DeepPartial<LiquidationsConfig>): LiquidationsConfig;
109
+ };
110
+ export declare const PositionBlockLimits: {
111
+ encode(message: PositionBlockLimits, writer?: _m0.Writer): _m0.Writer;
112
+ decode(input: _m0.Reader | Uint8Array, length?: number): PositionBlockLimits;
113
+ fromPartial(object: DeepPartial<PositionBlockLimits>): PositionBlockLimits;
114
+ };
115
+ export declare const SubaccountBlockLimits: {
116
+ encode(message: SubaccountBlockLimits, writer?: _m0.Writer): _m0.Writer;
117
+ decode(input: _m0.Reader | Uint8Array, length?: number): SubaccountBlockLimits;
118
+ fromPartial(object: DeepPartial<SubaccountBlockLimits>): SubaccountBlockLimits;
119
+ };
120
+ export declare const FillablePriceConfig: {
121
+ encode(message: FillablePriceConfig, writer?: _m0.Writer): _m0.Writer;
122
+ decode(input: _m0.Reader | Uint8Array, length?: number): FillablePriceConfig;
123
+ fromPartial(object: DeepPartial<FillablePriceConfig>): FillablePriceConfig;
124
+ };
@@ -0,0 +1,196 @@
1
+ // ----------------------------------------------------------------------------
2
+
3
+ // PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ // https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+ // EDIT THE CORRESPONDENT .ts FILE INSTEAD
6
+
7
+ import _m0 from "protobufjs/minimal.js";
8
+ import { Long } from "../../helpers.js";
9
+ function createBaseLiquidationsConfig() {
10
+ return {
11
+ maxLiquidationFeePpm: 0,
12
+ positionBlockLimits: undefined,
13
+ subaccountBlockLimits: undefined,
14
+ fillablePriceConfig: undefined
15
+ };
16
+ }
17
+ export const LiquidationsConfig = {
18
+ encode(message, writer = _m0.Writer.create()) {
19
+ if (message.maxLiquidationFeePpm !== 0) {
20
+ writer.uint32(8).uint32(message.maxLiquidationFeePpm);
21
+ }
22
+ if (message.positionBlockLimits !== undefined) {
23
+ PositionBlockLimits.encode(message.positionBlockLimits, writer.uint32(18).fork()).ldelim();
24
+ }
25
+ if (message.subaccountBlockLimits !== undefined) {
26
+ SubaccountBlockLimits.encode(message.subaccountBlockLimits, writer.uint32(26).fork()).ldelim();
27
+ }
28
+ if (message.fillablePriceConfig !== undefined) {
29
+ FillablePriceConfig.encode(message.fillablePriceConfig, writer.uint32(34).fork()).ldelim();
30
+ }
31
+ return writer;
32
+ },
33
+ decode(input, length) {
34
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
35
+ let end = length === undefined ? reader.len : reader.pos + length;
36
+ const message = createBaseLiquidationsConfig();
37
+ while (reader.pos < end) {
38
+ const tag = reader.uint32();
39
+ switch (tag >>> 3) {
40
+ case 1:
41
+ message.maxLiquidationFeePpm = reader.uint32();
42
+ break;
43
+ case 2:
44
+ message.positionBlockLimits = PositionBlockLimits.decode(reader, reader.uint32());
45
+ break;
46
+ case 3:
47
+ message.subaccountBlockLimits = SubaccountBlockLimits.decode(reader, reader.uint32());
48
+ break;
49
+ case 4:
50
+ message.fillablePriceConfig = FillablePriceConfig.decode(reader, reader.uint32());
51
+ break;
52
+ default:
53
+ reader.skipType(tag & 7);
54
+ break;
55
+ }
56
+ }
57
+ return message;
58
+ },
59
+ fromPartial(object) {
60
+ const message = createBaseLiquidationsConfig();
61
+ message.maxLiquidationFeePpm = object.maxLiquidationFeePpm ?? 0;
62
+ message.positionBlockLimits = object.positionBlockLimits !== undefined && object.positionBlockLimits !== null ? PositionBlockLimits.fromPartial(object.positionBlockLimits) : undefined;
63
+ message.subaccountBlockLimits = object.subaccountBlockLimits !== undefined && object.subaccountBlockLimits !== null ? SubaccountBlockLimits.fromPartial(object.subaccountBlockLimits) : undefined;
64
+ message.fillablePriceConfig = object.fillablePriceConfig !== undefined && object.fillablePriceConfig !== null ? FillablePriceConfig.fromPartial(object.fillablePriceConfig) : undefined;
65
+ return message;
66
+ }
67
+ };
68
+ function createBasePositionBlockLimits() {
69
+ return {
70
+ minPositionNotionalLiquidated: Long.UZERO,
71
+ maxPositionPortionLiquidatedPpm: 0
72
+ };
73
+ }
74
+ export const PositionBlockLimits = {
75
+ encode(message, writer = _m0.Writer.create()) {
76
+ if (!message.minPositionNotionalLiquidated.isZero()) {
77
+ writer.uint32(8).uint64(message.minPositionNotionalLiquidated);
78
+ }
79
+ if (message.maxPositionPortionLiquidatedPpm !== 0) {
80
+ writer.uint32(16).uint32(message.maxPositionPortionLiquidatedPpm);
81
+ }
82
+ return writer;
83
+ },
84
+ decode(input, length) {
85
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
86
+ let end = length === undefined ? reader.len : reader.pos + length;
87
+ const message = createBasePositionBlockLimits();
88
+ while (reader.pos < end) {
89
+ const tag = reader.uint32();
90
+ switch (tag >>> 3) {
91
+ case 1:
92
+ message.minPositionNotionalLiquidated = reader.uint64();
93
+ break;
94
+ case 2:
95
+ message.maxPositionPortionLiquidatedPpm = reader.uint32();
96
+ break;
97
+ default:
98
+ reader.skipType(tag & 7);
99
+ break;
100
+ }
101
+ }
102
+ return message;
103
+ },
104
+ fromPartial(object) {
105
+ const message = createBasePositionBlockLimits();
106
+ message.minPositionNotionalLiquidated = object.minPositionNotionalLiquidated !== undefined && object.minPositionNotionalLiquidated !== null ? Long.fromValue(object.minPositionNotionalLiquidated) : Long.UZERO;
107
+ message.maxPositionPortionLiquidatedPpm = object.maxPositionPortionLiquidatedPpm ?? 0;
108
+ return message;
109
+ }
110
+ };
111
+ function createBaseSubaccountBlockLimits() {
112
+ return {
113
+ maxNotionalLiquidated: Long.UZERO,
114
+ maxQuantumsInsuranceLost: Long.UZERO
115
+ };
116
+ }
117
+ export const SubaccountBlockLimits = {
118
+ encode(message, writer = _m0.Writer.create()) {
119
+ if (!message.maxNotionalLiquidated.isZero()) {
120
+ writer.uint32(8).uint64(message.maxNotionalLiquidated);
121
+ }
122
+ if (!message.maxQuantumsInsuranceLost.isZero()) {
123
+ writer.uint32(16).uint64(message.maxQuantumsInsuranceLost);
124
+ }
125
+ return writer;
126
+ },
127
+ decode(input, length) {
128
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
129
+ let end = length === undefined ? reader.len : reader.pos + length;
130
+ const message = createBaseSubaccountBlockLimits();
131
+ while (reader.pos < end) {
132
+ const tag = reader.uint32();
133
+ switch (tag >>> 3) {
134
+ case 1:
135
+ message.maxNotionalLiquidated = reader.uint64();
136
+ break;
137
+ case 2:
138
+ message.maxQuantumsInsuranceLost = reader.uint64();
139
+ break;
140
+ default:
141
+ reader.skipType(tag & 7);
142
+ break;
143
+ }
144
+ }
145
+ return message;
146
+ },
147
+ fromPartial(object) {
148
+ const message = createBaseSubaccountBlockLimits();
149
+ message.maxNotionalLiquidated = object.maxNotionalLiquidated !== undefined && object.maxNotionalLiquidated !== null ? Long.fromValue(object.maxNotionalLiquidated) : Long.UZERO;
150
+ message.maxQuantumsInsuranceLost = object.maxQuantumsInsuranceLost !== undefined && object.maxQuantumsInsuranceLost !== null ? Long.fromValue(object.maxQuantumsInsuranceLost) : Long.UZERO;
151
+ return message;
152
+ }
153
+ };
154
+ function createBaseFillablePriceConfig() {
155
+ return {
156
+ bankruptcyAdjustmentPpm: 0,
157
+ spreadToMaintenanceMarginRatioPpm: 0
158
+ };
159
+ }
160
+ export const FillablePriceConfig = {
161
+ encode(message, writer = _m0.Writer.create()) {
162
+ if (message.bankruptcyAdjustmentPpm !== 0) {
163
+ writer.uint32(8).uint32(message.bankruptcyAdjustmentPpm);
164
+ }
165
+ if (message.spreadToMaintenanceMarginRatioPpm !== 0) {
166
+ writer.uint32(16).uint32(message.spreadToMaintenanceMarginRatioPpm);
167
+ }
168
+ return writer;
169
+ },
170
+ decode(input, length) {
171
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
172
+ let end = length === undefined ? reader.len : reader.pos + length;
173
+ const message = createBaseFillablePriceConfig();
174
+ while (reader.pos < end) {
175
+ const tag = reader.uint32();
176
+ switch (tag >>> 3) {
177
+ case 1:
178
+ message.bankruptcyAdjustmentPpm = reader.uint32();
179
+ break;
180
+ case 2:
181
+ message.spreadToMaintenanceMarginRatioPpm = reader.uint32();
182
+ break;
183
+ default:
184
+ reader.skipType(tag & 7);
185
+ break;
186
+ }
187
+ }
188
+ return message;
189
+ },
190
+ fromPartial(object) {
191
+ const message = createBaseFillablePriceConfig();
192
+ message.bankruptcyAdjustmentPpm = object.bankruptcyAdjustmentPpm ?? 0;
193
+ message.spreadToMaintenanceMarginRatioPpm = object.spreadToMaintenanceMarginRatioPpm ?? 0;
194
+ return message;
195
+ }
196
+ };
@@ -0,0 +1,159 @@
1
+ import { OrderId, OrderIdSDKType } from "./order.js";
2
+ import { SubaccountId, SubaccountIdSDKType } from "../subaccounts/subaccount.js";
3
+ import _m0 from "protobufjs/minimal.js";
4
+ import { DeepPartial } from "../../helpers.js";
5
+ /**
6
+ * ClobMatch represents an operations queue entry around all different types
7
+ * of matches, specifically regular matches, liquidation matches, and
8
+ * deleveraging matches.
9
+ */
10
+ export interface ClobMatch {
11
+ matchOrders?: MatchOrders;
12
+ matchPerpetualLiquidation?: MatchPerpetualLiquidation;
13
+ matchPerpetualDeleveraging?: MatchPerpetualDeleveraging;
14
+ }
15
+ /**
16
+ * ClobMatch represents an operations queue entry around all different types
17
+ * of matches, specifically regular matches, liquidation matches, and
18
+ * deleveraging matches.
19
+ */
20
+ export interface ClobMatchSDKType {
21
+ match_orders?: MatchOrdersSDKType;
22
+ match_perpetual_liquidation?: MatchPerpetualLiquidationSDKType;
23
+ match_perpetual_deleveraging?: MatchPerpetualDeleveragingSDKType;
24
+ }
25
+ /** MakerFill represents the filled amount of a matched maker order. */
26
+ export interface MakerFill {
27
+ /**
28
+ * The filled amount of the matched maker order, in base quantums.
29
+ * TODO(CLOB-571): update to use SerializableInt.
30
+ */
31
+ fillAmount: Long;
32
+ /** The `OrderId` of the matched maker order. */
33
+ makerOrderId?: OrderId;
34
+ }
35
+ /** MakerFill represents the filled amount of a matched maker order. */
36
+ export interface MakerFillSDKType {
37
+ fill_amount: Long;
38
+ maker_order_id?: OrderIdSDKType;
39
+ }
40
+ /** MatchOrders is an injected message used for matching orders. */
41
+ export interface MatchOrders {
42
+ /** The `OrderId` of the taker order. */
43
+ takerOrderId?: OrderId;
44
+ /** An ordered list of fills created by this taker order. */
45
+ fills: MakerFill[];
46
+ }
47
+ /** MatchOrders is an injected message used for matching orders. */
48
+ export interface MatchOrdersSDKType {
49
+ taker_order_id?: OrderIdSDKType;
50
+ fills: MakerFillSDKType[];
51
+ }
52
+ /**
53
+ * MatchPerpetualLiquidation is an injected message used for liquidating a
54
+ * subaccount.
55
+ */
56
+ export interface MatchPerpetualLiquidation {
57
+ /** ID of the subaccount that was liquidated. */
58
+ liquidated?: SubaccountId;
59
+ /** The ID of the clob pair involved in the liquidation. */
60
+ clobPairId: number;
61
+ /** The ID of the perpetual involved in the liquidation. */
62
+ perpetualId: number;
63
+ /** The total size of the liquidation order including any unfilled size. */
64
+ totalSize: Long;
65
+ /** `true` if liquidating a short position, `false` otherwise. */
66
+ isBuy: boolean;
67
+ /** An ordered list of fills created by this liquidation. */
68
+ fills: MakerFill[];
69
+ }
70
+ /**
71
+ * MatchPerpetualLiquidation is an injected message used for liquidating a
72
+ * subaccount.
73
+ */
74
+ export interface MatchPerpetualLiquidationSDKType {
75
+ liquidated?: SubaccountIdSDKType;
76
+ clob_pair_id: number;
77
+ perpetual_id: number;
78
+ total_size: Long;
79
+ is_buy: boolean;
80
+ fills: MakerFillSDKType[];
81
+ }
82
+ /**
83
+ * MatchPerpetualDeleveraging is an injected message used for deleveraging a
84
+ * subaccount.
85
+ */
86
+ export interface MatchPerpetualDeleveraging {
87
+ /** ID of the subaccount that was liquidated. */
88
+ liquidated?: SubaccountId;
89
+ /** The ID of the perpetual that was liquidated. */
90
+ perpetualId: number;
91
+ /** An ordered list of fills created by this liquidation. */
92
+ fills: MatchPerpetualDeleveraging_Fill[];
93
+ /**
94
+ * Flag denoting whether the deleveraging operation was for the purpose
95
+ * of final settlement. Final settlement matches are at the oracle price,
96
+ * whereas deleveraging happens at the bankruptcy price of the deleveraged
97
+ * subaccount.
98
+ */
99
+ isFinalSettlement: boolean;
100
+ }
101
+ /**
102
+ * MatchPerpetualDeleveraging is an injected message used for deleveraging a
103
+ * subaccount.
104
+ */
105
+ export interface MatchPerpetualDeleveragingSDKType {
106
+ liquidated?: SubaccountIdSDKType;
107
+ perpetual_id: number;
108
+ fills: MatchPerpetualDeleveraging_FillSDKType[];
109
+ is_final_settlement: boolean;
110
+ }
111
+ /** Fill represents a fill between the liquidated and offsetting subaccount. */
112
+ export interface MatchPerpetualDeleveraging_Fill {
113
+ /**
114
+ * ID of the subaccount that was used to offset the liquidated subaccount's
115
+ * position.
116
+ */
117
+ offsettingSubaccountId?: SubaccountId;
118
+ /**
119
+ * The amount filled between the liquidated and offsetting position, in
120
+ * base quantums.
121
+ * TODO(CLOB-571): update to use SerializableInt.
122
+ */
123
+ fillAmount: Long;
124
+ }
125
+ /** Fill represents a fill between the liquidated and offsetting subaccount. */
126
+ export interface MatchPerpetualDeleveraging_FillSDKType {
127
+ offsetting_subaccount_id?: SubaccountIdSDKType;
128
+ fill_amount: Long;
129
+ }
130
+ export declare const ClobMatch: {
131
+ encode(message: ClobMatch, writer?: _m0.Writer): _m0.Writer;
132
+ decode(input: _m0.Reader | Uint8Array, length?: number): ClobMatch;
133
+ fromPartial(object: DeepPartial<ClobMatch>): ClobMatch;
134
+ };
135
+ export declare const MakerFill: {
136
+ encode(message: MakerFill, writer?: _m0.Writer): _m0.Writer;
137
+ decode(input: _m0.Reader | Uint8Array, length?: number): MakerFill;
138
+ fromPartial(object: DeepPartial<MakerFill>): MakerFill;
139
+ };
140
+ export declare const MatchOrders: {
141
+ encode(message: MatchOrders, writer?: _m0.Writer): _m0.Writer;
142
+ decode(input: _m0.Reader | Uint8Array, length?: number): MatchOrders;
143
+ fromPartial(object: DeepPartial<MatchOrders>): MatchOrders;
144
+ };
145
+ export declare const MatchPerpetualLiquidation: {
146
+ encode(message: MatchPerpetualLiquidation, writer?: _m0.Writer): _m0.Writer;
147
+ decode(input: _m0.Reader | Uint8Array, length?: number): MatchPerpetualLiquidation;
148
+ fromPartial(object: DeepPartial<MatchPerpetualLiquidation>): MatchPerpetualLiquidation;
149
+ };
150
+ export declare const MatchPerpetualDeleveraging: {
151
+ encode(message: MatchPerpetualDeleveraging, writer?: _m0.Writer): _m0.Writer;
152
+ decode(input: _m0.Reader | Uint8Array, length?: number): MatchPerpetualDeleveraging;
153
+ fromPartial(object: DeepPartial<MatchPerpetualDeleveraging>): MatchPerpetualDeleveraging;
154
+ };
155
+ export declare const MatchPerpetualDeleveraging_Fill: {
156
+ encode(message: MatchPerpetualDeleveraging_Fill, writer?: _m0.Writer): _m0.Writer;
157
+ decode(input: _m0.Reader | Uint8Array, length?: number): MatchPerpetualDeleveraging_Fill;
158
+ fromPartial(object: DeepPartial<MatchPerpetualDeleveraging_Fill>): MatchPerpetualDeleveraging_Fill;
159
+ };