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