@siebly/kraken-api 0.0.9

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 (204) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +624 -0
  3. package/dist/cjs/DerivativesClient.d.ts +657 -0
  4. package/dist/cjs/DerivativesClient.js +726 -0
  5. package/dist/cjs/DerivativesClient.js.map +1 -0
  6. package/dist/cjs/InstitutionalClient.d.ts +183 -0
  7. package/dist/cjs/InstitutionalClient.js +266 -0
  8. package/dist/cjs/InstitutionalClient.js.map +1 -0
  9. package/dist/cjs/PartnerClient.d.ts +257 -0
  10. package/dist/cjs/PartnerClient.js +344 -0
  11. package/dist/cjs/PartnerClient.js.map +1 -0
  12. package/dist/cjs/SpotClient.d.ts +547 -0
  13. package/dist/cjs/SpotClient.js +607 -0
  14. package/dist/cjs/SpotClient.js.map +1 -0
  15. package/dist/cjs/WebsocketAPIClient.d.ts +95 -0
  16. package/dist/cjs/WebsocketAPIClient.js +136 -0
  17. package/dist/cjs/WebsocketAPIClient.js.map +1 -0
  18. package/dist/cjs/WebsocketClient.d.ts +120 -0
  19. package/dist/cjs/WebsocketClient.js +669 -0
  20. package/dist/cjs/WebsocketClient.js.map +1 -0
  21. package/dist/cjs/index.d.ts +24 -0
  22. package/dist/cjs/index.js +41 -0
  23. package/dist/cjs/index.js.map +1 -0
  24. package/dist/cjs/lib/BaseRestClient.d.ts +66 -0
  25. package/dist/cjs/lib/BaseRestClient.js +548 -0
  26. package/dist/cjs/lib/BaseRestClient.js.map +1 -0
  27. package/dist/cjs/lib/BaseWSClient.d.ts +230 -0
  28. package/dist/cjs/lib/BaseWSClient.js +935 -0
  29. package/dist/cjs/lib/BaseWSClient.js.map +1 -0
  30. package/dist/cjs/lib/misc-util.d.ts +1 -0
  31. package/dist/cjs/lib/misc-util.js +7 -0
  32. package/dist/cjs/lib/misc-util.js.map +1 -0
  33. package/dist/cjs/lib/requestUtils.d.ts +68 -0
  34. package/dist/cjs/lib/requestUtils.js +82 -0
  35. package/dist/cjs/lib/requestUtils.js.map +1 -0
  36. package/dist/cjs/lib/webCryptoAPI.d.ts +15 -0
  37. package/dist/cjs/lib/webCryptoAPI.js +85 -0
  38. package/dist/cjs/lib/webCryptoAPI.js.map +1 -0
  39. package/dist/cjs/lib/websocket/WsStore.d.ts +75 -0
  40. package/dist/cjs/lib/websocket/WsStore.js +303 -0
  41. package/dist/cjs/lib/websocket/WsStore.js.map +1 -0
  42. package/dist/cjs/lib/websocket/WsStore.types.d.ts +51 -0
  43. package/dist/cjs/lib/websocket/WsStore.types.js +14 -0
  44. package/dist/cjs/lib/websocket/WsStore.types.js.map +1 -0
  45. package/dist/cjs/lib/websocket/logger.d.ts +7 -0
  46. package/dist/cjs/lib/websocket/logger.js +16 -0
  47. package/dist/cjs/lib/websocket/logger.js.map +1 -0
  48. package/dist/cjs/lib/websocket/rest-client-cache.d.ts +22 -0
  49. package/dist/cjs/lib/websocket/rest-client-cache.js +66 -0
  50. package/dist/cjs/lib/websocket/rest-client-cache.js.map +1 -0
  51. package/dist/cjs/lib/websocket/websocket-util.d.ts +76 -0
  52. package/dist/cjs/lib/websocket/websocket-util.js +59 -0
  53. package/dist/cjs/lib/websocket/websocket-util.js.map +1 -0
  54. package/dist/cjs/package.json +3 -0
  55. package/dist/cjs/types/request/derivatives.types.d.ts +186 -0
  56. package/dist/cjs/types/request/derivatives.types.js +6 -0
  57. package/dist/cjs/types/request/derivatives.types.js.map +1 -0
  58. package/dist/cjs/types/request/institutional.types.d.ts +313 -0
  59. package/dist/cjs/types/request/institutional.types.js +4 -0
  60. package/dist/cjs/types/request/institutional.types.js.map +1 -0
  61. package/dist/cjs/types/request/partner.types.d.ts +291 -0
  62. package/dist/cjs/types/request/partner.types.js +4 -0
  63. package/dist/cjs/types/request/partner.types.js.map +1 -0
  64. package/dist/cjs/types/request/spot.types.d.ts +324 -0
  65. package/dist/cjs/types/request/spot.types.js +6 -0
  66. package/dist/cjs/types/request/spot.types.js.map +1 -0
  67. package/dist/cjs/types/request/wsapi.types.d.ts +90 -0
  68. package/dist/cjs/types/request/wsapi.types.js +6 -0
  69. package/dist/cjs/types/request/wsapi.types.js.map +1 -0
  70. package/dist/cjs/types/response/derivatives.types.d.ts +712 -0
  71. package/dist/cjs/types/response/derivatives.types.js +6 -0
  72. package/dist/cjs/types/response/derivatives.types.js.map +1 -0
  73. package/dist/cjs/types/response/institutional.types.d.ts +318 -0
  74. package/dist/cjs/types/response/institutional.types.js +4 -0
  75. package/dist/cjs/types/response/institutional.types.js.map +1 -0
  76. package/dist/cjs/types/response/partner.types.d.ts +332 -0
  77. package/dist/cjs/types/response/partner.types.js +4 -0
  78. package/dist/cjs/types/response/partner.types.js.map +1 -0
  79. package/dist/cjs/types/response/shared.types.d.ts +27 -0
  80. package/dist/cjs/types/response/shared.types.js +3 -0
  81. package/dist/cjs/types/response/shared.types.js.map +1 -0
  82. package/dist/cjs/types/response/spot.types.d.ts +590 -0
  83. package/dist/cjs/types/response/spot.types.js +6 -0
  84. package/dist/cjs/types/response/spot.types.js.map +1 -0
  85. package/dist/cjs/types/response/ws.d.ts +11 -0
  86. package/dist/cjs/types/response/ws.js +3 -0
  87. package/dist/cjs/types/response/ws.js.map +1 -0
  88. package/dist/cjs/types/response/wsapi.types.d.ts +44 -0
  89. package/dist/cjs/types/response/wsapi.types.js +6 -0
  90. package/dist/cjs/types/response/wsapi.types.js.map +1 -0
  91. package/dist/cjs/types/websockets/ws-api.d.ts +71 -0
  92. package/dist/cjs/types/websockets/ws-api.js +18 -0
  93. package/dist/cjs/types/websockets/ws-api.js.map +1 -0
  94. package/dist/cjs/types/websockets/ws-events.d.ts +11 -0
  95. package/dist/cjs/types/websockets/ws-events.js +11 -0
  96. package/dist/cjs/types/websockets/ws-events.js.map +1 -0
  97. package/dist/cjs/types/websockets/ws-general.d.ts +67 -0
  98. package/dist/cjs/types/websockets/ws-general.js +3 -0
  99. package/dist/cjs/types/websockets/ws-general.js.map +1 -0
  100. package/dist/cjs/types/websockets/ws-subscriptions.d.ts +11 -0
  101. package/dist/cjs/types/websockets/ws-subscriptions.js +31 -0
  102. package/dist/cjs/types/websockets/ws-subscriptions.js.map +1 -0
  103. package/dist/mjs/DerivativesClient.d.ts +657 -0
  104. package/dist/mjs/DerivativesClient.js +722 -0
  105. package/dist/mjs/DerivativesClient.js.map +1 -0
  106. package/dist/mjs/InstitutionalClient.d.ts +183 -0
  107. package/dist/mjs/InstitutionalClient.js +262 -0
  108. package/dist/mjs/InstitutionalClient.js.map +1 -0
  109. package/dist/mjs/PartnerClient.d.ts +257 -0
  110. package/dist/mjs/PartnerClient.js +340 -0
  111. package/dist/mjs/PartnerClient.js.map +1 -0
  112. package/dist/mjs/SpotClient.d.ts +547 -0
  113. package/dist/mjs/SpotClient.js +603 -0
  114. package/dist/mjs/SpotClient.js.map +1 -0
  115. package/dist/mjs/WebsocketAPIClient.d.ts +95 -0
  116. package/dist/mjs/WebsocketAPIClient.js +132 -0
  117. package/dist/mjs/WebsocketAPIClient.js.map +1 -0
  118. package/dist/mjs/WebsocketClient.d.ts +120 -0
  119. package/dist/mjs/WebsocketClient.js +665 -0
  120. package/dist/mjs/WebsocketClient.js.map +1 -0
  121. package/dist/mjs/index.d.ts +24 -0
  122. package/dist/mjs/index.js +25 -0
  123. package/dist/mjs/index.js.map +1 -0
  124. package/dist/mjs/lib/BaseRestClient.d.ts +66 -0
  125. package/dist/mjs/lib/BaseRestClient.js +541 -0
  126. package/dist/mjs/lib/BaseRestClient.js.map +1 -0
  127. package/dist/mjs/lib/BaseWSClient.d.ts +230 -0
  128. package/dist/mjs/lib/BaseWSClient.js +928 -0
  129. package/dist/mjs/lib/BaseWSClient.js.map +1 -0
  130. package/dist/mjs/lib/misc-util.d.ts +1 -0
  131. package/dist/mjs/lib/misc-util.js +4 -0
  132. package/dist/mjs/lib/misc-util.js.map +1 -0
  133. package/dist/mjs/lib/requestUtils.d.ts +68 -0
  134. package/dist/mjs/lib/requestUtils.js +76 -0
  135. package/dist/mjs/lib/requestUtils.js.map +1 -0
  136. package/dist/mjs/lib/webCryptoAPI.d.ts +15 -0
  137. package/dist/mjs/lib/webCryptoAPI.js +80 -0
  138. package/dist/mjs/lib/webCryptoAPI.js.map +1 -0
  139. package/dist/mjs/lib/websocket/WsStore.d.ts +75 -0
  140. package/dist/mjs/lib/websocket/WsStore.js +298 -0
  141. package/dist/mjs/lib/websocket/WsStore.js.map +1 -0
  142. package/dist/mjs/lib/websocket/WsStore.types.d.ts +51 -0
  143. package/dist/mjs/lib/websocket/WsStore.types.js +11 -0
  144. package/dist/mjs/lib/websocket/WsStore.types.js.map +1 -0
  145. package/dist/mjs/lib/websocket/logger.d.ts +7 -0
  146. package/dist/mjs/lib/websocket/logger.js +13 -0
  147. package/dist/mjs/lib/websocket/logger.js.map +1 -0
  148. package/dist/mjs/lib/websocket/rest-client-cache.d.ts +22 -0
  149. package/dist/mjs/lib/websocket/rest-client-cache.js +62 -0
  150. package/dist/mjs/lib/websocket/rest-client-cache.js.map +1 -0
  151. package/dist/mjs/lib/websocket/websocket-util.d.ts +76 -0
  152. package/dist/mjs/lib/websocket/websocket-util.js +54 -0
  153. package/dist/mjs/lib/websocket/websocket-util.js.map +1 -0
  154. package/dist/mjs/package.json +3 -0
  155. package/dist/mjs/types/request/derivatives.types.d.ts +186 -0
  156. package/dist/mjs/types/request/derivatives.types.js +5 -0
  157. package/dist/mjs/types/request/derivatives.types.js.map +1 -0
  158. package/dist/mjs/types/request/institutional.types.d.ts +313 -0
  159. package/dist/mjs/types/request/institutional.types.js +3 -0
  160. package/dist/mjs/types/request/institutional.types.js.map +1 -0
  161. package/dist/mjs/types/request/partner.types.d.ts +291 -0
  162. package/dist/mjs/types/request/partner.types.js +3 -0
  163. package/dist/mjs/types/request/partner.types.js.map +1 -0
  164. package/dist/mjs/types/request/spot.types.d.ts +324 -0
  165. package/dist/mjs/types/request/spot.types.js +5 -0
  166. package/dist/mjs/types/request/spot.types.js.map +1 -0
  167. package/dist/mjs/types/request/wsapi.types.d.ts +90 -0
  168. package/dist/mjs/types/request/wsapi.types.js +5 -0
  169. package/dist/mjs/types/request/wsapi.types.js.map +1 -0
  170. package/dist/mjs/types/response/derivatives.types.d.ts +712 -0
  171. package/dist/mjs/types/response/derivatives.types.js +5 -0
  172. package/dist/mjs/types/response/derivatives.types.js.map +1 -0
  173. package/dist/mjs/types/response/institutional.types.d.ts +318 -0
  174. package/dist/mjs/types/response/institutional.types.js +3 -0
  175. package/dist/mjs/types/response/institutional.types.js.map +1 -0
  176. package/dist/mjs/types/response/partner.types.d.ts +332 -0
  177. package/dist/mjs/types/response/partner.types.js +3 -0
  178. package/dist/mjs/types/response/partner.types.js.map +1 -0
  179. package/dist/mjs/types/response/shared.types.d.ts +27 -0
  180. package/dist/mjs/types/response/shared.types.js +2 -0
  181. package/dist/mjs/types/response/shared.types.js.map +1 -0
  182. package/dist/mjs/types/response/spot.types.d.ts +590 -0
  183. package/dist/mjs/types/response/spot.types.js +5 -0
  184. package/dist/mjs/types/response/spot.types.js.map +1 -0
  185. package/dist/mjs/types/response/ws.d.ts +11 -0
  186. package/dist/mjs/types/response/ws.js +2 -0
  187. package/dist/mjs/types/response/ws.js.map +1 -0
  188. package/dist/mjs/types/response/wsapi.types.d.ts +44 -0
  189. package/dist/mjs/types/response/wsapi.types.js +5 -0
  190. package/dist/mjs/types/response/wsapi.types.js.map +1 -0
  191. package/dist/mjs/types/websockets/ws-api.d.ts +71 -0
  192. package/dist/mjs/types/websockets/ws-api.js +15 -0
  193. package/dist/mjs/types/websockets/ws-api.js.map +1 -0
  194. package/dist/mjs/types/websockets/ws-events.d.ts +11 -0
  195. package/dist/mjs/types/websockets/ws-events.js +8 -0
  196. package/dist/mjs/types/websockets/ws-events.js.map +1 -0
  197. package/dist/mjs/types/websockets/ws-general.d.ts +67 -0
  198. package/dist/mjs/types/websockets/ws-general.js +2 -0
  199. package/dist/mjs/types/websockets/ws-general.js.map +1 -0
  200. package/dist/mjs/types/websockets/ws-subscriptions.d.ts +11 -0
  201. package/dist/mjs/types/websockets/ws-subscriptions.js +28 -0
  202. package/dist/mjs/types/websockets/ws-subscriptions.js.map +1 -0
  203. package/llms.txt +10925 -0
  204. package/package.json +89 -0
@@ -0,0 +1,722 @@
1
+ import { nanoid } from 'nanoid';
2
+ import { BaseRestClient } from './lib/BaseRestClient.js';
3
+ import { REST_CLIENT_TYPE_ENUM } from './lib/requestUtils.js';
4
+ /**
5
+ * The DerivativesClient provides integration to the Kraken Derivatives API.
6
+ *
7
+ * Docs:
8
+ * - https://docs.kraken.com/api/docs/guides/futures-introduction
9
+ * - https://docs.kraken.com/api/docs/guides/futures-rest
10
+ * - https://docs.kraken.com/api/docs/futures-api/trading/get-history
11
+ */
12
+ export class DerivativesClient extends BaseRestClient {
13
+ getClientType() {
14
+ return REST_CLIENT_TYPE_ENUM.derivatives;
15
+ }
16
+ /**
17
+ *
18
+ * Misc Utility Methods
19
+ *
20
+ */
21
+ generateNewOrderID() {
22
+ return nanoid(32);
23
+ }
24
+ /**
25
+ *
26
+ * Futures REST API - Trading - Market Data
27
+ *
28
+ */
29
+ /**
30
+ * Get trade history
31
+ *
32
+ * This endpoint returns the most recent 100 trades prior to the specified lastTime value up to past 7 days or recent trading engine restart (whichever is sooner).
33
+ * If no lastTime specified, it will return 100 most recent trades.
34
+ */
35
+ getTradeHistory(params) {
36
+ return this.get('derivatives/api/v3/history', params);
37
+ }
38
+ /**
39
+ * Get orderbook
40
+ *
41
+ * This endpoint returns the entire non-cumulative order book of currently listed Futures contracts.
42
+ */
43
+ getOrderbook(params) {
44
+ return this.get('derivatives/api/v3/orderbook', params);
45
+ }
46
+ /**
47
+ * Get tickers
48
+ *
49
+ * This endpoint returns current market data for all currently listed Futures contracts and indices.
50
+ */
51
+ getTickers() {
52
+ return this.get('derivatives/api/v3/tickers');
53
+ }
54
+ /**
55
+ * Get ticker by symbol
56
+ *
57
+ * Get market data for contract or index by symbol.
58
+ */
59
+ getTicker(params) {
60
+ return this.get(`derivatives/api/v3/tickers/${params.symbol}`);
61
+ }
62
+ /**
63
+ *
64
+ * Futures REST API - Trading - Instrument Details
65
+ *
66
+ */
67
+ /**
68
+ * Get instruments
69
+ *
70
+ * Returns specifications for all currently listed markets and indices.
71
+ */
72
+ getInstruments() {
73
+ return this.get('derivatives/api/v3/instruments');
74
+ }
75
+ /**
76
+ * Get instrument status list
77
+ *
78
+ * Returns price dislocation and volatility details for all markets.
79
+ */
80
+ getInstrumentStatusList() {
81
+ return this.get('derivatives/api/v3/instruments/status');
82
+ }
83
+ /**
84
+ * Get instrument status
85
+ *
86
+ * Returns price dislocation and volatility details for given market.
87
+ */
88
+ getInstrumentStatus(params) {
89
+ return this.get(`derivatives/api/v3/instruments/${params.symbol}/status`);
90
+ }
91
+ /**
92
+ *
93
+ * Futures REST API - Trading - Order Management
94
+ *
95
+ */
96
+ /**
97
+ * Batch order management
98
+ *
99
+ * This endpoint allows sending limit or stop order(s) and/or cancelling open order(s) and/or editing open order(s) for a currently listed Futures contract in batch.
100
+ * When editing an order, if the trailingStopMaxDeviation and trailingStopDeviationUnit parameters are sent unchanged, the system will recalculate a new stop price upon successful order modification.
101
+ */
102
+ batchOrderManagement(params) {
103
+ const { ProcessBefore, json } = params;
104
+ return this.postPrivate('derivatives/api/v3/batchorder', {
105
+ body: {
106
+ ProcessBefore: ProcessBefore,
107
+ json,
108
+ },
109
+ });
110
+ }
111
+ /**
112
+ * Cancel all orders
113
+ *
114
+ * This endpoint allows cancelling orders which are associated with a future's contract or a margin account. If no arguments are specified all open orders will be cancelled.
115
+ */
116
+ cancelAllOrders(params) {
117
+ return this.postPrivate('derivatives/api/v3/cancelallorders', {
118
+ body: params,
119
+ });
120
+ }
121
+ /**
122
+ * Dead man's switch
123
+ *
124
+ * This endpoint provides a Dead Man's Switch mechanism to protect the user from network malfunctions. The user can send a request with a timeout in seconds which will trigger a countdown timer that will cancel all user orders when timeout expires. The user has to keep sending request to push back the timeout expiration or they can deactivate the mechanism by specifying a timeout of zero (0).
125
+ * The recommended mechanism usage is making a call every 15 to 20 seconds and provide a timeout of 60 seconds. This allows the user to keep the orders in place on a brief network failure, while keeping them safe in case of a network breakdown.
126
+ */
127
+ cancelAllOrdersAfter(params) {
128
+ return this.postPrivate('derivatives/api/v3/cancelallordersafter', {
129
+ body: params,
130
+ });
131
+ }
132
+ /**
133
+ * Cancel order
134
+ *
135
+ * This endpoint allows cancelling an open order for a Futures contract.
136
+ */
137
+ cancelOrder(params) {
138
+ return this.postPrivate('derivatives/api/v3/cancelorder', {
139
+ body: params,
140
+ });
141
+ }
142
+ /**
143
+ * Edit order
144
+ *
145
+ * This endpoint allows editing an existing order for a currently listed Futures contract.
146
+ * When editing an order, if the trailingStopMaxDeviation and trailingStopDeviationUnit parameters are sent unchanged, the system will recalculate a new stop price upon successful order modification.
147
+ */
148
+ editOrder(params) {
149
+ return this.postPrivate('derivatives/api/v3/editorder', {
150
+ body: params,
151
+ });
152
+ }
153
+ /**
154
+ * Get open orders
155
+ *
156
+ * This endpoint returns information on all open orders for all Futures contracts.
157
+ */
158
+ getOpenOrders() {
159
+ return this.getPrivate('derivatives/api/v3/openorders');
160
+ }
161
+ /**
162
+ * Send order
163
+ *
164
+ * This endpoint allows sending a limit, stop, take profit or immediate-or-cancel order for a currently listed Futures contract.
165
+ */
166
+ submitOrder(params) {
167
+ return this.postPrivate('derivatives/api/v3/sendorder', {
168
+ body: params,
169
+ });
170
+ }
171
+ /**
172
+ * Get Specific Orders' Status
173
+ *
174
+ * Returns information on specified orders which are open or were filled/cancelled in the last 5 seconds.
175
+ */
176
+ getOrderStatus(params) {
177
+ return this.postPrivate('derivatives/api/v3/orders/status', {
178
+ body: params,
179
+ });
180
+ }
181
+ /**
182
+ *
183
+ * Futures REST API - Trading - Multi-Collateral
184
+ *
185
+ */
186
+ /**
187
+ * Get PNL currency preferences
188
+ *
189
+ * The PNL currency preference is used to determine which currency to pay out when realizing PNL gains.
190
+ */
191
+ getPnlPreferences() {
192
+ return this.getPrivate('derivatives/api/v3/pnlpreferences');
193
+ }
194
+ /**
195
+ * Set PNL currency preference
196
+ *
197
+ * The PNL currency preference is used to determine which currency to pay out when realizing PNL gains.
198
+ * Calling this API can result in the following error codes: 87 (Contract does not exist), 88 (Contract not a multi-collateral futures contract), 89 (Currency does not exist), 90 (Currency is not enabled for multi-collateral futures), 41 (Would cause liquidation).
199
+ */
200
+ setPnlPreference(params) {
201
+ return this.putPrivate('derivatives/api/v3/pnlpreferences', {
202
+ query: params,
203
+ });
204
+ }
205
+ /**
206
+ * Get leverage settings
207
+ *
208
+ * Returns list of configured leverage preferences.
209
+ */
210
+ getLeverageSettings() {
211
+ return this.getPrivate('derivatives/api/v3/leveragepreferences');
212
+ }
213
+ /**
214
+ * Set leverage settings
215
+ *
216
+ * Sets a contract's margin mode, either "isolated" or "cross" margin.
217
+ * When specifying a max leverage, the contract's margin mode will be isolated.
218
+ */
219
+ setLeverageSettings(params) {
220
+ return this.putPrivate('derivatives/api/v3/leveragepreferences', {
221
+ query: params,
222
+ });
223
+ }
224
+ /**
225
+ *
226
+ * Futures REST API - Trading - Account Information
227
+ *
228
+ */
229
+ /**
230
+ * Get wallets
231
+ *
232
+ * This endpoint returns key information relating to all your accounts which may either be cash accounts or margin accounts.
233
+ * This includes digital asset balances, instrument balances, margin requirements, margin trigger estimates and
234
+ * auxiliary information such as available funds, PnL of open positions and portfolio value.
235
+ */
236
+ getAccounts() {
237
+ return this.getPrivate('derivatives/api/v3/accounts');
238
+ }
239
+ /**
240
+ * Get open positions
241
+ *
242
+ * This endpoint returns the size and average entry price of all open positions in Futures contracts.
243
+ * This includes Futures contracts that have matured but have not yet been settled.
244
+ */
245
+ getOpenPositions() {
246
+ return this.getPrivate('derivatives/api/v3/openpositions');
247
+ }
248
+ /**
249
+ * Get position percentile of unwind queue
250
+ *
251
+ * This endpoint returns the percentile of the open position in case of unwinding.
252
+ */
253
+ getPositionPercentile() {
254
+ return this.getPrivate('derivatives/api/v3/unwindqueue');
255
+ }
256
+ /**
257
+ * Get portfolio margin parameters
258
+ *
259
+ * Retrieve current portfolio margin calculation parameters.
260
+ * Also includes user specific limits related to options trading.
261
+ * Note: This is currently available exclusively in the Kraken Futures DEMO environment.
262
+ */
263
+ getPortfolioMarginParameters() {
264
+ return this.getPrivate('derivatives/api/v3/portfolio-margining/parameters');
265
+ }
266
+ /**
267
+ * Calculate portfolio margin, pnl and greeks
268
+ *
269
+ * For a given portfolio of balances and positions (futures and options), calculate the margin requirements, pnl and option greeks.
270
+ * Note: This is currently available exclusively in the Kraken Futures DEMO environment.
271
+ */
272
+ simulateMarginRequirements(params) {
273
+ return this.postPrivate('derivatives/api/v3/portfolio-margining/simulate', {
274
+ query: params,
275
+ });
276
+ }
277
+ /**
278
+ *
279
+ * Futures REST API - Trading - Assignment Program
280
+ *
281
+ */
282
+ /**
283
+ * List assignment programs
284
+ *
285
+ * This endpoint returns information on currently active assignment programs.
286
+ */
287
+ getAssignmentPrograms() {
288
+ return this.getPrivate('derivatives/api/v3/assignmentprogram/current');
289
+ }
290
+ /**
291
+ * Add assignment preference
292
+ *
293
+ * This endpoint adds an assignment program preference.
294
+ */
295
+ addAssignmentPreference(params) {
296
+ return this.postPrivate('derivatives/api/v3/assignmentprogram/add', {
297
+ body: params,
298
+ });
299
+ }
300
+ /**
301
+ * Delete assignment preference
302
+ *
303
+ * This endpoint deletes an assignment program preference.
304
+ */
305
+ deleteAssignmentPreference(params) {
306
+ return this.postPrivate('derivatives/api/v3/assignmentprogram/delete', {
307
+ body: params,
308
+ });
309
+ }
310
+ /**
311
+ * List assignment preferences history
312
+ *
313
+ * This endpoint returns information on assignment program preferences change history.
314
+ */
315
+ getAssignmentPreferencesHistory() {
316
+ return this.getPrivate('derivatives/api/v3/assignmentprogram/history');
317
+ }
318
+ /**
319
+ *
320
+ * Futures REST API - Trading - Fee Schedules
321
+ *
322
+ */
323
+ /**
324
+ * Get fee schedules
325
+ *
326
+ * This endpoint lists all fee schedules.
327
+ */
328
+ getFeeSchedules() {
329
+ return this.get('derivatives/api/v3/feeschedules');
330
+ }
331
+ /**
332
+ * Get fee schedule volumes
333
+ *
334
+ * Returns your fee schedule volumes for each fee schedule.
335
+ */
336
+ getFeeScheduleVolumes() {
337
+ return this.getPrivate('derivatives/api/v3/feeschedules/volumes');
338
+ }
339
+ /**
340
+ *
341
+ * Futures REST API - Trading - General
342
+ *
343
+ */
344
+ /**
345
+ * Get notifications
346
+ *
347
+ * This endpoint provides the platform's notifications.
348
+ */
349
+ getNotifications() {
350
+ return this.getPrivate('derivatives/api/v3/notifications');
351
+ }
352
+ /**
353
+ *
354
+ * Futures REST API - Trading - Historical Data
355
+ *
356
+ */
357
+ /**
358
+ * Get your fills
359
+ *
360
+ * This endpoint returns information on your filled orders for all futures contracts.
361
+ */
362
+ getFills(params) {
363
+ return this.getPrivate('derivatives/api/v3/fills', params);
364
+ }
365
+ /**
366
+ *
367
+ * Futures REST API - Trading - Historical Funding Rates
368
+ *
369
+ */
370
+ /**
371
+ * Historical funding rates
372
+ *
373
+ * Returns list of historical funding rates for given market.
374
+ */
375
+ getHistoricalFundingRates(params) {
376
+ return this.get('derivatives/api/v3/historical-funding-rates', params);
377
+ }
378
+ /**
379
+ *
380
+ * Futures REST API - Trading - Trading Settings
381
+ *
382
+ */
383
+ /**
384
+ * Get self trade strategy
385
+ *
386
+ * Returns account-wide self-trade matching strategy.
387
+ */
388
+ getSelfTradeStrategy() {
389
+ return this.getPrivate('derivatives/api/v3/self-trade-strategy');
390
+ }
391
+ /**
392
+ * Update self trade strategy
393
+ *
394
+ * Updates account-wide self-trade matching behavior to given strategy.
395
+ */
396
+ updateSelfTradeStrategy(params) {
397
+ return this.putPrivate('derivatives/api/v3/self-trade-strategy', {
398
+ query: params,
399
+ });
400
+ }
401
+ /**
402
+ *
403
+ * Futures REST API - Trading - Subaccounts
404
+ *
405
+ */
406
+ /**
407
+ * Check subaccount trading status
408
+ *
409
+ * Returns trading capability info for given subaccount.
410
+ */
411
+ getSubaccountTradingStatus(params) {
412
+ return this.getPrivate(`derivatives/api/v3/subaccount/${params.subaccountUid}/trading-enabled`);
413
+ }
414
+ /**
415
+ * Update subaccount trading status
416
+ *
417
+ * Updates trading capabilities for given subaccount.
418
+ */
419
+ updateSubaccountTradingStatus(params) {
420
+ const { subaccountUid, ...otherParams } = params;
421
+ return this.putPrivate(`derivatives/api/v3/subaccount/${subaccountUid}/trading-enabled`, { query: otherParams });
422
+ }
423
+ /**
424
+ * Get subaccounts
425
+ *
426
+ * Return information about subaccounts, including balances and UIDs.
427
+ */
428
+ getSubaccounts() {
429
+ return this.getPrivate('derivatives/api/v3/subaccounts');
430
+ }
431
+ /**
432
+ *
433
+ * Futures REST API - Trading - Transfers
434
+ *
435
+ */
436
+ /**
437
+ * Initiate wallet transfer
438
+ *
439
+ * This endpoint allows you to transfer funds between two margin accounts with the same collateral currency, or between a margin account and your cash account.
440
+ */
441
+ submitWalletTransfer(params) {
442
+ return this.postPrivate('derivatives/api/v3/transfer', {
443
+ body: params,
444
+ });
445
+ }
446
+ /**
447
+ * Initiate sub account transfer
448
+ *
449
+ * This endpoint allows you to transfer funds between the current account and a sub account, between two margin accounts with the same collateral currency, or between a margin account and your cash account.
450
+ */
451
+ submitSubaccountTransfer(params) {
452
+ return this.postPrivate('derivatives/api/v3/transfer/subaccount', {
453
+ body: params,
454
+ });
455
+ }
456
+ /**
457
+ * Initiate withdrawal to Spot wallet
458
+ *
459
+ * This endpoint allows you to request to withdraw digital assets to your Kraken Spot wallet.
460
+ * Wallet names can be found in the 'accounts' structure in the Get Wallets /accounts response.
461
+ */
462
+ submitTransferToSpot(params) {
463
+ return this.postPrivate('derivatives/api/v3/withdrawal', {
464
+ body: params,
465
+ });
466
+ }
467
+ /**
468
+ *
469
+ * Futures REST API - Trading - RFQs
470
+ *
471
+ */
472
+ /**
473
+ * List all open RFQs
474
+ *
475
+ * Retrieve all currently open RFQs.
476
+ * Note: This is currently available exclusively in the Kraken Futures DEMO environment.
477
+ */
478
+ getOpenRFQs() {
479
+ return this.get('derivatives/api/v3/rfqs');
480
+ }
481
+ /**
482
+ * Retrieve a single open RFQ
483
+ *
484
+ * Retrieve a specific open RFQ by its unique identifier.
485
+ * Note: This is currently available exclusively in the Kraken Futures DEMO environment.
486
+ */
487
+ getOpenRFQ(params) {
488
+ return this.get(`derivatives/api/v3/rfqs/${params.rfqUid}`);
489
+ }
490
+ /**
491
+ * List open offers on open RFQs
492
+ *
493
+ * Retrieve all open offers for the account on currently open RFQs.
494
+ * Note: This is currently available exclusively in the Kraken Futures DEMO environment.
495
+ */
496
+ getRFQOpenOffers() {
497
+ return this.getPrivate('derivatives/api/v3/rfqs/open-offers');
498
+ }
499
+ /**
500
+ * Place new offer on an open RFQ
501
+ *
502
+ * Place a new offer for the given amount in USD on the specified open RFQ, bid and ask are optional but at least one must be provided.
503
+ * Note: This is currently available exclusively in the Kraken Futures DEMO environment.
504
+ */
505
+ submitRFQNewOffer(params) {
506
+ const { rfqUid, ...bodyParams } = params;
507
+ return this.postPrivate(`derivatives/api/v3/rfqs/${rfqUid}/place-offer`, {
508
+ body: bodyParams,
509
+ });
510
+ }
511
+ /**
512
+ * Replace open offer on open RFQ
513
+ *
514
+ * Replace the current open offer on the specified open RFQ, bid and ask are optional but at least one must be provided.
515
+ * Note: This is currently available exclusively in the Kraken Futures DEMO environment.
516
+ */
517
+ updateRFQOpenOffer(params) {
518
+ const { rfqUid, ...bodyParams } = params;
519
+ return this.putPrivate(`derivatives/api/v3/rfqs/${rfqUid}/replace-offer`, {
520
+ body: bodyParams,
521
+ });
522
+ }
523
+ /**
524
+ * Cancel open offer on open RFQ
525
+ *
526
+ * Cancel the current open offer on the specified open RFQ.
527
+ * Note: This is currently available exclusively in the Kraken Futures DEMO environment.
528
+ */
529
+ cancelRFQOffer(params) {
530
+ return this.deletePrivate(`derivatives/api/v3/rfqs/${params.rfqUid}/cancel-offer`);
531
+ }
532
+ /**
533
+ *
534
+ * Futures REST API - History - Account History
535
+ *
536
+ */
537
+ /**
538
+ * Get execution events
539
+ *
540
+ * Lists executions/trades for authenticated account.
541
+ */
542
+ getExecutionEvents(params) {
543
+ return this.getPrivate('api/history/v3/executions', params);
544
+ }
545
+ /**
546
+ * Get order events
547
+ *
548
+ * Lists order events for authenticated account.
549
+ */
550
+ getOrderEvents(params) {
551
+ return this.getPrivate('api/history/v3/orders', params);
552
+ }
553
+ /**
554
+ * Get trigger events
555
+ *
556
+ * Lists trigger events for authenticated account.
557
+ */
558
+ getTriggerEvents(params) {
559
+ return this.getPrivate('api/history/v3/triggers', params);
560
+ }
561
+ /**
562
+ * Get position update events
563
+ *
564
+ * Lists position events for authenticated account.
565
+ */
566
+ getPositionEvents(params) {
567
+ return this.getPrivate('api/history/v3/positions', params);
568
+ }
569
+ /**
570
+ * Get account log
571
+ *
572
+ * Lists account log entries, paged by timestamp or by ID.
573
+ * To request entries by time range, use the since and before parameters. To request entries by ID range, use the from and to parameters. Any combination of since, before, from and to can be used to restrict the requested range of entries.
574
+ */
575
+ getAccountLog(params) {
576
+ return this.getPrivate('api/history/v3/account-log', params);
577
+ }
578
+ /**
579
+ * Account log (CSV)
580
+ *
581
+ * Lists recent account log entries in CSV format.
582
+ */
583
+ getAccountLogCsv(params) {
584
+ return this.getPrivate('api/history/v3/accountlogcsv', params);
585
+ }
586
+ /**
587
+ *
588
+ * Futures REST API - History - Market History
589
+ *
590
+ */
591
+ /**
592
+ * Get public execution events
593
+ *
594
+ * Lists trades for a market.
595
+ */
596
+ getPublicExecutionEvents(params) {
597
+ const { tradeable, ...otherParams } = params;
598
+ return this.get(`api/history/v3/market/${tradeable}/executions`, {
599
+ params: otherParams,
600
+ });
601
+ }
602
+ /**
603
+ * Get public order events
604
+ *
605
+ * Lists order events for a market.
606
+ */
607
+ getPublicOrderEvents(params) {
608
+ const { tradeable, ...otherParams } = params;
609
+ return this.get(`api/history/v3/market/${tradeable}/orders`, {
610
+ params: otherParams,
611
+ });
612
+ }
613
+ /**
614
+ * Get public mark price events
615
+ *
616
+ * Lists price events for a market.
617
+ */
618
+ getPublicMarkPriceEvents(params) {
619
+ const { tradeable, ...otherParams } = params;
620
+ return this.get(`api/history/v3/market/${tradeable}/price`, {
621
+ params: otherParams,
622
+ });
623
+ }
624
+ /**
625
+ *
626
+ * Futures REST API - Charts - Candles
627
+ *
628
+ */
629
+ /**
630
+ * Tick Types
631
+ *
632
+ * Returns all available tick types to use with the getMarketsForTickType() endpoint.
633
+ */
634
+ getTickTypes() {
635
+ return this.get('api/charts/v1/');
636
+ }
637
+ /**
638
+ * Markets
639
+ *
640
+ * Markets available for specified tick type.
641
+ * List of available tick types can be fetched from the getTickTypes() endpoint.
642
+ */
643
+ getMarketsForTickType(params) {
644
+ return this.get(`api/charts/v1/${params.tickType}`);
645
+ }
646
+ /**
647
+ * Resolutions
648
+ *
649
+ * Candle resolutions available for specified tick type and market.
650
+ * List of available tick types can be fetched from the getTickTypes() endpoint.
651
+ * List of available markets can be fetched from the getMarketsForTickType() endpoint.
652
+ */
653
+ getResolutions(params) {
654
+ return this.get(`api/charts/v1/${params.tickType}/${params.symbol}`);
655
+ }
656
+ /**
657
+ * Market Candles
658
+ *
659
+ * Candles for specified tick type, market, and resolution.
660
+ * List of available tick types can be fetched from the getTickTypes() endpoint.
661
+ * List of available markets can be fetched from the getMarketsForTickType() endpoint.
662
+ * List of available resolutions can be fetched from the getResolutions() endpoint.
663
+ */
664
+ getCandles(params) {
665
+ const { tickType, symbol, resolution, ...otherParams } = params;
666
+ return this.get(`api/charts/v1/${tickType}/${symbol}/${resolution}`, {
667
+ params: otherParams,
668
+ });
669
+ }
670
+ /**
671
+ *
672
+ * Futures REST API - Charts - Analytics
673
+ *
674
+ */
675
+ /**
676
+ * Get liquidity pool statistic
677
+ *
678
+ * Get liquidity pool statistic including usd value.
679
+ */
680
+ getLiquidityPoolStatistic(params) {
681
+ return this.get('api/charts/v1/analytics/liquidity-pool', params);
682
+ }
683
+ /**
684
+ * Market Analytics
685
+ *
686
+ * Analytics data divided into time buckets.
687
+ */
688
+ getMarketAnalytics(params) {
689
+ const { symbol, analyticsType, ...otherParams } = params;
690
+ return this.get(`api/charts/v1/analytics/${symbol}/${analyticsType}`, {
691
+ params: otherParams,
692
+ });
693
+ }
694
+ /**
695
+ *
696
+ * Futures REST API - Auth - API Keys
697
+ *
698
+ */
699
+ /**
700
+ * Check v3 API key
701
+ *
702
+ * Verify API key access and return the authenticated key's details.
703
+ */
704
+ checkApiKeyV3() {
705
+ return this.getPrivate('api/auth/v1/api-keys/v3/check');
706
+ }
707
+ /**
708
+ *
709
+ * Futures REST API - Stats - Market Share
710
+ *
711
+ */
712
+ /**
713
+ * Get account's market share
714
+ *
715
+ * Get account's market share, volumes, and accrued rebates data in contracts configured for rebates.
716
+ * The data may not be available immediately. In these cases HTTP 204 is returned.
717
+ */
718
+ getAccountMarketShare() {
719
+ return this.getPrivate('api/stats/v1/rebates/self-market-share');
720
+ }
721
+ }
722
+ //# sourceMappingURL=DerivativesClient.js.map