crypticorn 1.0.1__py3-none-any.whl → 1.0.2rc2__py3-none-any.whl

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 (132) hide show
  1. crypticorn/__init__.py +3 -3
  2. crypticorn/client.py +722 -0
  3. crypticorn/hive/__init__.py +1 -0
  4. crypticorn/{api.py → hive/main.py} +6 -6
  5. crypticorn/hive/requirements.txt +4 -0
  6. crypticorn/{utils.py → hive/utils.py} +2 -2
  7. crypticorn/klines/__init__.py +2 -0
  8. crypticorn/klines/client/__init__.py +62 -0
  9. crypticorn/klines/client/api/__init__.py +9 -0
  10. crypticorn/klines/client/api/funding_rates_api.py +362 -0
  11. crypticorn/klines/client/api/health_check_api.py +281 -0
  12. crypticorn/klines/client/api/ohlcv_data_api.py +409 -0
  13. crypticorn/klines/client/api/symbols_api.py +308 -0
  14. crypticorn/klines/client/api/udf_api.py +1929 -0
  15. crypticorn/klines/client/api_client.py +797 -0
  16. crypticorn/klines/client/api_response.py +21 -0
  17. crypticorn/klines/client/configuration.py +565 -0
  18. crypticorn/klines/client/exceptions.py +216 -0
  19. crypticorn/klines/client/models/__init__.py +41 -0
  20. crypticorn/klines/client/models/base_response_health_check_response.py +108 -0
  21. crypticorn/klines/client/models/base_response_list_funding_rate_response.py +112 -0
  22. crypticorn/klines/client/models/base_response_list_str.py +104 -0
  23. crypticorn/klines/client/models/base_response_ohlcv_response.py +108 -0
  24. crypticorn/klines/client/models/error_response.py +101 -0
  25. crypticorn/{models/deleted.py → klines/client/models/exchange.py} +15 -11
  26. crypticorn/klines/client/models/funding_rate_response.py +92 -0
  27. crypticorn/klines/client/models/health_check_response.py +89 -0
  28. crypticorn/{models/create_api_key_response.py → klines/client/models/history_error_response.py} +12 -22
  29. crypticorn/klines/client/models/history_no_data_response.py +99 -0
  30. crypticorn/klines/client/models/history_success_response.py +99 -0
  31. crypticorn/klines/client/models/http_validation_error.py +95 -0
  32. crypticorn/klines/client/models/market.py +37 -0
  33. crypticorn/klines/client/models/ohlcv_response.py +98 -0
  34. crypticorn/klines/client/models/resolution.py +40 -0
  35. crypticorn/klines/client/models/response_get_history_udf_history_get.py +149 -0
  36. crypticorn/klines/client/models/search_symbol_response.py +97 -0
  37. crypticorn/klines/client/models/sort_direction.py +37 -0
  38. crypticorn/{models/futures_balance_error.py → klines/client/models/symbol_group_response.py} +12 -14
  39. crypticorn/klines/client/models/symbol_info_response.py +115 -0
  40. crypticorn/{models/id.py → klines/client/models/symbol_type.py} +13 -11
  41. crypticorn/klines/client/models/timeframe.py +40 -0
  42. crypticorn/klines/client/models/udf_config_response.py +121 -0
  43. crypticorn/klines/client/models/validation_error.py +99 -0
  44. crypticorn/{models/get_futures_balance200_response_inner.py → klines/client/models/validation_error_loc_inner.py} +39 -35
  45. crypticorn/klines/client/py.typed +0 -0
  46. crypticorn/klines/client/rest.py +257 -0
  47. crypticorn/klines/main.py +42 -0
  48. crypticorn/klines/requirements.txt +4 -0
  49. crypticorn/klines/test/__init__.py +0 -0
  50. crypticorn/klines/test/test_base_response_health_check_response.py +56 -0
  51. crypticorn/klines/test/test_base_response_list_funding_rate_response.py +59 -0
  52. crypticorn/klines/test/test_base_response_list_str.py +56 -0
  53. crypticorn/klines/test/test_base_response_ohlcv_response.py +72 -0
  54. crypticorn/klines/test/test_error_response.py +57 -0
  55. crypticorn/klines/test/test_exchange.py +56 -0
  56. crypticorn/klines/test/test_funding_rate_response.py +56 -0
  57. crypticorn/klines/test/test_funding_rates_api.py +38 -0
  58. crypticorn/klines/test/test_health_check_api.py +38 -0
  59. crypticorn/klines/test/test_health_check_response.py +52 -0
  60. crypticorn/klines/test/test_history_error_response.py +53 -0
  61. crypticorn/klines/test/test_history_no_data_response.py +69 -0
  62. crypticorn/klines/test/test_history_success_response.py +87 -0
  63. crypticorn/klines/test/test_http_validation_error.py +58 -0
  64. crypticorn/klines/test/test_market.py +33 -0
  65. crypticorn/klines/test/test_ohlcv_data_api.py +38 -0
  66. crypticorn/klines/test/test_ohlcv_response.py +86 -0
  67. crypticorn/klines/test/test_resolution.py +33 -0
  68. crypticorn/klines/test/test_response_get_history_udf_history_get.py +89 -0
  69. crypticorn/klines/test/test_search_symbol_response.py +62 -0
  70. crypticorn/klines/test/test_sort_direction.py +33 -0
  71. crypticorn/klines/test/test_symbol_group_response.py +53 -0
  72. crypticorn/klines/test/test_symbol_info_response.py +84 -0
  73. crypticorn/klines/test/test_symbol_type.py +54 -0
  74. crypticorn/klines/test/test_symbols_api.py +38 -0
  75. crypticorn/klines/test/test_timeframe.py +33 -0
  76. crypticorn/klines/test/test_udf_api.py +80 -0
  77. crypticorn/klines/test/test_udf_config_response.py +95 -0
  78. crypticorn/klines/test/test_validation_error.py +60 -0
  79. crypticorn/klines/test/test_validation_error_loc_inner.py +50 -0
  80. crypticorn/trade/__init__.py +2 -0
  81. crypticorn/trade/client/__init__.py +63 -0
  82. crypticorn/trade/client/api/__init__.py +13 -0
  83. crypticorn/trade/client/api/api_keys_api.py +1468 -0
  84. crypticorn/trade/client/api/bots_api.py +1211 -0
  85. crypticorn/trade/client/api/exchanges_api.py +297 -0
  86. crypticorn/trade/client/api/futures_trading_panel_api.py +1463 -0
  87. crypticorn/trade/client/api/notifications_api.py +1767 -0
  88. crypticorn/trade/client/api/orders_api.py +331 -0
  89. crypticorn/trade/client/api/status_api.py +278 -0
  90. crypticorn/trade/client/api/strategies_api.py +331 -0
  91. crypticorn/trade/client/api/trading_actions_api.py +898 -0
  92. crypticorn/trade/client/api_client.py +797 -0
  93. crypticorn/trade/client/api_response.py +21 -0
  94. crypticorn/trade/client/configuration.py +574 -0
  95. crypticorn/trade/client/exceptions.py +216 -0
  96. crypticorn/trade/client/models/__init__.py +38 -0
  97. crypticorn/{models → trade/client/models}/action_model.py +17 -20
  98. crypticorn/{models → trade/client/models}/api_error_identifier.py +3 -1
  99. crypticorn/{models → trade/client/models}/api_key_model.py +5 -8
  100. crypticorn/{models → trade/client/models}/bot_model.py +15 -11
  101. crypticorn/{models → trade/client/models}/futures_trading_action.py +12 -12
  102. crypticorn/{models → trade/client/models}/http_validation_error.py +1 -1
  103. crypticorn/{models → trade/client/models}/notification_model.py +8 -6
  104. crypticorn/{models → trade/client/models}/order_model.py +12 -15
  105. crypticorn/{models → trade/client/models}/post_futures_action.py +1 -1
  106. crypticorn/{models → trade/client/models}/strategy_exchange_info.py +1 -1
  107. crypticorn/{models → trade/client/models}/strategy_model.py +6 -2
  108. crypticorn/{models → trade/client/models}/validation_error.py +1 -1
  109. crypticorn/trade/client/py.typed +0 -0
  110. crypticorn/trade/client/rest.py +257 -0
  111. crypticorn/trade/main.py +39 -0
  112. crypticorn/trade/requirements.txt +4 -0
  113. crypticorn-1.0.2rc2.dist-info/METADATA +47 -0
  114. crypticorn-1.0.2rc2.dist-info/RECORD +128 -0
  115. {crypticorn-1.0.1.dist-info → crypticorn-1.0.2rc2.dist-info}/WHEEL +1 -1
  116. crypticorn/models/__init__.py +0 -31
  117. crypticorn/models/modified.py +0 -87
  118. crypticorn-1.0.1.dist-info/METADATA +0 -40
  119. crypticorn-1.0.1.dist-info/RECORD +0 -38
  120. /crypticorn/{models → trade/client/models}/exchange.py +0 -0
  121. /crypticorn/{models → trade/client/models}/execution_ids.py +0 -0
  122. /crypticorn/{models → trade/client/models}/futures_balance.py +0 -0
  123. /crypticorn/{models → trade/client/models}/margin_mode.py +0 -0
  124. /crypticorn/{models → trade/client/models}/market_type.py +0 -0
  125. /crypticorn/{models → trade/client/models}/notification_type.py +0 -0
  126. /crypticorn/{models → trade/client/models}/order_status.py +0 -0
  127. /crypticorn/{models → trade/client/models}/tpsl.py +0 -0
  128. /crypticorn/{models → trade/client/models}/trading_action_type.py +0 -0
  129. /crypticorn/{models → trade/client/models}/update_notification.py +0 -0
  130. /crypticorn/{models → trade/client/models}/validation_error_loc_inner.py +0 -0
  131. {crypticorn-1.0.1.dist-info → crypticorn-1.0.2rc2.dist-info}/LICENSE.md +0 -0
  132. {crypticorn-1.0.1.dist-info → crypticorn-1.0.2rc2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,898 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ FastAPI
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import StrictInt, StrictStr
20
+ from typing import Any, List, Optional
21
+ from crypticorn.trade.client.models.action_model import ActionModel
22
+ from crypticorn.trade.client.models.futures_trading_action import FuturesTradingAction
23
+ from crypticorn.trade.client.models.post_futures_action import PostFuturesAction
24
+
25
+ from crypticorn.trade.client.api_client import ApiClient, RequestSerialized
26
+ from crypticorn.trade.client.api_response import ApiResponse
27
+ from crypticorn.trade.client.rest import RESTResponseType
28
+
29
+
30
+ class TradingActionsApi:
31
+ """NOTE: This class is auto generated by OpenAPI Generator
32
+ Ref: https://openapi-generator.tech
33
+
34
+ Do not edit the class manually.
35
+ """
36
+
37
+ def __init__(self, api_client=None) -> None:
38
+ if api_client is None:
39
+ api_client = ApiClient.get_default()
40
+ self.api_client = api_client
41
+
42
+
43
+ @validate_call
44
+ def get_actions(
45
+ self,
46
+ limit: Optional[StrictInt] = None,
47
+ offset: Optional[StrictInt] = None,
48
+ access_token: Optional[StrictStr] = None,
49
+ _request_timeout: Union[
50
+ None,
51
+ Annotated[StrictFloat, Field(gt=0)],
52
+ Tuple[
53
+ Annotated[StrictFloat, Field(gt=0)],
54
+ Annotated[StrictFloat, Field(gt=0)]
55
+ ]
56
+ ] = None,
57
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
58
+ _content_type: Optional[StrictStr] = None,
59
+ _headers: Optional[Dict[StrictStr, Any]] = None,
60
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
61
+ ) -> List[ActionModel]:
62
+ """Get Actions
63
+
64
+
65
+ :param limit:
66
+ :type limit: int
67
+ :param offset:
68
+ :type offset: int
69
+ :param access_token:
70
+ :type access_token: str
71
+ :param _request_timeout: timeout setting for this request. If one
72
+ number provided, it will be total request
73
+ timeout. It can also be a pair (tuple) of
74
+ (connection, read) timeouts.
75
+ :type _request_timeout: int, tuple(int, int), optional
76
+ :param _request_auth: set to override the auth_settings for an a single
77
+ request; this effectively ignores the
78
+ authentication in the spec for a single request.
79
+ :type _request_auth: dict, optional
80
+ :param _content_type: force content-type for the request.
81
+ :type _content_type: str, Optional
82
+ :param _headers: set to override the headers for a single
83
+ request; this effectively ignores the headers
84
+ in the spec for a single request.
85
+ :type _headers: dict, optional
86
+ :param _host_index: set to override the host_index for a single
87
+ request; this effectively ignores the host_index
88
+ in the spec for a single request.
89
+ :type _host_index: int, optional
90
+ :return: Returns the result object.
91
+ """ # noqa: E501
92
+
93
+ _param = self._get_actions_serialize(
94
+ limit=limit,
95
+ offset=offset,
96
+ access_token=access_token,
97
+ _request_auth=_request_auth,
98
+ _content_type=_content_type,
99
+ _headers=_headers,
100
+ _host_index=_host_index
101
+ )
102
+
103
+ _response_types_map: Dict[str, Optional[str]] = {
104
+ '200': "List[ActionModel]",
105
+ '422': "HTTPValidationError",
106
+ }
107
+ response_data = self.api_client.call_api(
108
+ *_param,
109
+ _request_timeout=_request_timeout
110
+ )
111
+ response_data.read()
112
+ return self.api_client.response_deserialize(
113
+ response_data=response_data,
114
+ response_types_map=_response_types_map,
115
+ ).data
116
+
117
+
118
+ @validate_call
119
+ def get_actions_with_http_info(
120
+ self,
121
+ limit: Optional[StrictInt] = None,
122
+ offset: Optional[StrictInt] = None,
123
+ access_token: Optional[StrictStr] = None,
124
+ _request_timeout: Union[
125
+ None,
126
+ Annotated[StrictFloat, Field(gt=0)],
127
+ Tuple[
128
+ Annotated[StrictFloat, Field(gt=0)],
129
+ Annotated[StrictFloat, Field(gt=0)]
130
+ ]
131
+ ] = None,
132
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
133
+ _content_type: Optional[StrictStr] = None,
134
+ _headers: Optional[Dict[StrictStr, Any]] = None,
135
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
136
+ ) -> ApiResponse[List[ActionModel]]:
137
+ """Get Actions
138
+
139
+
140
+ :param limit:
141
+ :type limit: int
142
+ :param offset:
143
+ :type offset: int
144
+ :param access_token:
145
+ :type access_token: str
146
+ :param _request_timeout: timeout setting for this request. If one
147
+ number provided, it will be total request
148
+ timeout. It can also be a pair (tuple) of
149
+ (connection, read) timeouts.
150
+ :type _request_timeout: int, tuple(int, int), optional
151
+ :param _request_auth: set to override the auth_settings for an a single
152
+ request; this effectively ignores the
153
+ authentication in the spec for a single request.
154
+ :type _request_auth: dict, optional
155
+ :param _content_type: force content-type for the request.
156
+ :type _content_type: str, Optional
157
+ :param _headers: set to override the headers for a single
158
+ request; this effectively ignores the headers
159
+ in the spec for a single request.
160
+ :type _headers: dict, optional
161
+ :param _host_index: set to override the host_index for a single
162
+ request; this effectively ignores the host_index
163
+ in the spec for a single request.
164
+ :type _host_index: int, optional
165
+ :return: Returns the result object.
166
+ """ # noqa: E501
167
+
168
+ _param = self._get_actions_serialize(
169
+ limit=limit,
170
+ offset=offset,
171
+ access_token=access_token,
172
+ _request_auth=_request_auth,
173
+ _content_type=_content_type,
174
+ _headers=_headers,
175
+ _host_index=_host_index
176
+ )
177
+
178
+ _response_types_map: Dict[str, Optional[str]] = {
179
+ '200': "List[ActionModel]",
180
+ '422': "HTTPValidationError",
181
+ }
182
+ response_data = self.api_client.call_api(
183
+ *_param,
184
+ _request_timeout=_request_timeout
185
+ )
186
+ response_data.read()
187
+ return self.api_client.response_deserialize(
188
+ response_data=response_data,
189
+ response_types_map=_response_types_map,
190
+ )
191
+
192
+
193
+ @validate_call
194
+ def get_actions_without_preload_content(
195
+ self,
196
+ limit: Optional[StrictInt] = None,
197
+ offset: Optional[StrictInt] = None,
198
+ access_token: Optional[StrictStr] = None,
199
+ _request_timeout: Union[
200
+ None,
201
+ Annotated[StrictFloat, Field(gt=0)],
202
+ Tuple[
203
+ Annotated[StrictFloat, Field(gt=0)],
204
+ Annotated[StrictFloat, Field(gt=0)]
205
+ ]
206
+ ] = None,
207
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
208
+ _content_type: Optional[StrictStr] = None,
209
+ _headers: Optional[Dict[StrictStr, Any]] = None,
210
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
211
+ ) -> RESTResponseType:
212
+ """Get Actions
213
+
214
+
215
+ :param limit:
216
+ :type limit: int
217
+ :param offset:
218
+ :type offset: int
219
+ :param access_token:
220
+ :type access_token: str
221
+ :param _request_timeout: timeout setting for this request. If one
222
+ number provided, it will be total request
223
+ timeout. It can also be a pair (tuple) of
224
+ (connection, read) timeouts.
225
+ :type _request_timeout: int, tuple(int, int), optional
226
+ :param _request_auth: set to override the auth_settings for an a single
227
+ request; this effectively ignores the
228
+ authentication in the spec for a single request.
229
+ :type _request_auth: dict, optional
230
+ :param _content_type: force content-type for the request.
231
+ :type _content_type: str, Optional
232
+ :param _headers: set to override the headers for a single
233
+ request; this effectively ignores the headers
234
+ in the spec for a single request.
235
+ :type _headers: dict, optional
236
+ :param _host_index: set to override the host_index for a single
237
+ request; this effectively ignores the host_index
238
+ in the spec for a single request.
239
+ :type _host_index: int, optional
240
+ :return: Returns the result object.
241
+ """ # noqa: E501
242
+
243
+ _param = self._get_actions_serialize(
244
+ limit=limit,
245
+ offset=offset,
246
+ access_token=access_token,
247
+ _request_auth=_request_auth,
248
+ _content_type=_content_type,
249
+ _headers=_headers,
250
+ _host_index=_host_index
251
+ )
252
+
253
+ _response_types_map: Dict[str, Optional[str]] = {
254
+ '200': "List[ActionModel]",
255
+ '422': "HTTPValidationError",
256
+ }
257
+ response_data = self.api_client.call_api(
258
+ *_param,
259
+ _request_timeout=_request_timeout
260
+ )
261
+ return response_data.response
262
+
263
+
264
+ def _get_actions_serialize(
265
+ self,
266
+ limit,
267
+ offset,
268
+ access_token,
269
+ _request_auth,
270
+ _content_type,
271
+ _headers,
272
+ _host_index,
273
+ ) -> RequestSerialized:
274
+
275
+ _host = None
276
+
277
+ _collection_formats: Dict[str, str] = {
278
+ }
279
+
280
+ _path_params: Dict[str, str] = {}
281
+ _query_params: List[Tuple[str, str]] = []
282
+ _header_params: Dict[str, Optional[str]] = _headers or {}
283
+ _form_params: List[Tuple[str, str]] = []
284
+ _files: Dict[
285
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
286
+ ] = {}
287
+ _body_params: Optional[bytes] = None
288
+
289
+ # process the path parameters
290
+ # process the query parameters
291
+ if limit is not None:
292
+
293
+ _query_params.append(('limit', limit))
294
+
295
+ if offset is not None:
296
+
297
+ _query_params.append(('offset', offset))
298
+
299
+ # process the header parameters
300
+ # process the form parameters
301
+ # process the body parameter
302
+
303
+
304
+ # set the HTTP header `Accept`
305
+ if 'Accept' not in _header_params:
306
+ _header_params['Accept'] = self.api_client.select_header_accept(
307
+ [
308
+ 'application/json'
309
+ ]
310
+ )
311
+
312
+
313
+ # authentication setting
314
+ _auth_settings: List[str] = [
315
+ 'OAuth2PasswordBearer'
316
+ ]
317
+
318
+ return self.api_client.param_serialize(
319
+ method='GET',
320
+ resource_path='/actions',
321
+ path_params=_path_params,
322
+ query_params=_query_params,
323
+ header_params=_header_params,
324
+ body=_body_params,
325
+ post_params=_form_params,
326
+ files=_files,
327
+ auth_settings=_auth_settings,
328
+ collection_formats=_collection_formats,
329
+ _host=_host,
330
+ _request_auth=_request_auth
331
+ )
332
+
333
+
334
+
335
+
336
+ @validate_call
337
+ def post_futures_action(
338
+ self,
339
+ futures_trading_action: FuturesTradingAction,
340
+ authorization: Optional[StrictStr] = None,
341
+ _request_timeout: Union[
342
+ None,
343
+ Annotated[StrictFloat, Field(gt=0)],
344
+ Tuple[
345
+ Annotated[StrictFloat, Field(gt=0)],
346
+ Annotated[StrictFloat, Field(gt=0)]
347
+ ]
348
+ ] = None,
349
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
350
+ _content_type: Optional[StrictStr] = None,
351
+ _headers: Optional[Dict[StrictStr, Any]] = None,
352
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
353
+ ) -> PostFuturesAction:
354
+ """Post Futures Action
355
+
356
+ Endpoint to receive futures trading actions from the trading strategy
357
+
358
+ :param futures_trading_action: (required)
359
+ :type futures_trading_action: FuturesTradingAction
360
+ :param authorization:
361
+ :type authorization: str
362
+ :param _request_timeout: timeout setting for this request. If one
363
+ number provided, it will be total request
364
+ timeout. It can also be a pair (tuple) of
365
+ (connection, read) timeouts.
366
+ :type _request_timeout: int, tuple(int, int), optional
367
+ :param _request_auth: set to override the auth_settings for an a single
368
+ request; this effectively ignores the
369
+ authentication in the spec for a single request.
370
+ :type _request_auth: dict, optional
371
+ :param _content_type: force content-type for the request.
372
+ :type _content_type: str, Optional
373
+ :param _headers: set to override the headers for a single
374
+ request; this effectively ignores the headers
375
+ in the spec for a single request.
376
+ :type _headers: dict, optional
377
+ :param _host_index: set to override the host_index for a single
378
+ request; this effectively ignores the host_index
379
+ in the spec for a single request.
380
+ :type _host_index: int, optional
381
+ :return: Returns the result object.
382
+ """ # noqa: E501
383
+
384
+ _param = self._post_futures_action_serialize(
385
+ futures_trading_action=futures_trading_action,
386
+ authorization=authorization,
387
+ _request_auth=_request_auth,
388
+ _content_type=_content_type,
389
+ _headers=_headers,
390
+ _host_index=_host_index
391
+ )
392
+
393
+ _response_types_map: Dict[str, Optional[str]] = {
394
+ '200': "PostFuturesAction",
395
+ '422': "HTTPValidationError",
396
+ }
397
+ response_data = self.api_client.call_api(
398
+ *_param,
399
+ _request_timeout=_request_timeout
400
+ )
401
+ response_data.read()
402
+ return self.api_client.response_deserialize(
403
+ response_data=response_data,
404
+ response_types_map=_response_types_map,
405
+ ).data
406
+
407
+
408
+ @validate_call
409
+ def post_futures_action_with_http_info(
410
+ self,
411
+ futures_trading_action: FuturesTradingAction,
412
+ authorization: Optional[StrictStr] = None,
413
+ _request_timeout: Union[
414
+ None,
415
+ Annotated[StrictFloat, Field(gt=0)],
416
+ Tuple[
417
+ Annotated[StrictFloat, Field(gt=0)],
418
+ Annotated[StrictFloat, Field(gt=0)]
419
+ ]
420
+ ] = None,
421
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
422
+ _content_type: Optional[StrictStr] = None,
423
+ _headers: Optional[Dict[StrictStr, Any]] = None,
424
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
425
+ ) -> ApiResponse[PostFuturesAction]:
426
+ """Post Futures Action
427
+
428
+ Endpoint to receive futures trading actions from the trading strategy
429
+
430
+ :param futures_trading_action: (required)
431
+ :type futures_trading_action: FuturesTradingAction
432
+ :param authorization:
433
+ :type authorization: str
434
+ :param _request_timeout: timeout setting for this request. If one
435
+ number provided, it will be total request
436
+ timeout. It can also be a pair (tuple) of
437
+ (connection, read) timeouts.
438
+ :type _request_timeout: int, tuple(int, int), optional
439
+ :param _request_auth: set to override the auth_settings for an a single
440
+ request; this effectively ignores the
441
+ authentication in the spec for a single request.
442
+ :type _request_auth: dict, optional
443
+ :param _content_type: force content-type for the request.
444
+ :type _content_type: str, Optional
445
+ :param _headers: set to override the headers for a single
446
+ request; this effectively ignores the headers
447
+ in the spec for a single request.
448
+ :type _headers: dict, optional
449
+ :param _host_index: set to override the host_index for a single
450
+ request; this effectively ignores the host_index
451
+ in the spec for a single request.
452
+ :type _host_index: int, optional
453
+ :return: Returns the result object.
454
+ """ # noqa: E501
455
+
456
+ _param = self._post_futures_action_serialize(
457
+ futures_trading_action=futures_trading_action,
458
+ authorization=authorization,
459
+ _request_auth=_request_auth,
460
+ _content_type=_content_type,
461
+ _headers=_headers,
462
+ _host_index=_host_index
463
+ )
464
+
465
+ _response_types_map: Dict[str, Optional[str]] = {
466
+ '200': "PostFuturesAction",
467
+ '422': "HTTPValidationError",
468
+ }
469
+ response_data = self.api_client.call_api(
470
+ *_param,
471
+ _request_timeout=_request_timeout
472
+ )
473
+ response_data.read()
474
+ return self.api_client.response_deserialize(
475
+ response_data=response_data,
476
+ response_types_map=_response_types_map,
477
+ )
478
+
479
+
480
+ @validate_call
481
+ def post_futures_action_without_preload_content(
482
+ self,
483
+ futures_trading_action: FuturesTradingAction,
484
+ authorization: Optional[StrictStr] = None,
485
+ _request_timeout: Union[
486
+ None,
487
+ Annotated[StrictFloat, Field(gt=0)],
488
+ Tuple[
489
+ Annotated[StrictFloat, Field(gt=0)],
490
+ Annotated[StrictFloat, Field(gt=0)]
491
+ ]
492
+ ] = None,
493
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
494
+ _content_type: Optional[StrictStr] = None,
495
+ _headers: Optional[Dict[StrictStr, Any]] = None,
496
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
497
+ ) -> RESTResponseType:
498
+ """Post Futures Action
499
+
500
+ Endpoint to receive futures trading actions from the trading strategy
501
+
502
+ :param futures_trading_action: (required)
503
+ :type futures_trading_action: FuturesTradingAction
504
+ :param authorization:
505
+ :type authorization: str
506
+ :param _request_timeout: timeout setting for this request. If one
507
+ number provided, it will be total request
508
+ timeout. It can also be a pair (tuple) of
509
+ (connection, read) timeouts.
510
+ :type _request_timeout: int, tuple(int, int), optional
511
+ :param _request_auth: set to override the auth_settings for an a single
512
+ request; this effectively ignores the
513
+ authentication in the spec for a single request.
514
+ :type _request_auth: dict, optional
515
+ :param _content_type: force content-type for the request.
516
+ :type _content_type: str, Optional
517
+ :param _headers: set to override the headers for a single
518
+ request; this effectively ignores the headers
519
+ in the spec for a single request.
520
+ :type _headers: dict, optional
521
+ :param _host_index: set to override the host_index for a single
522
+ request; this effectively ignores the host_index
523
+ in the spec for a single request.
524
+ :type _host_index: int, optional
525
+ :return: Returns the result object.
526
+ """ # noqa: E501
527
+
528
+ _param = self._post_futures_action_serialize(
529
+ futures_trading_action=futures_trading_action,
530
+ authorization=authorization,
531
+ _request_auth=_request_auth,
532
+ _content_type=_content_type,
533
+ _headers=_headers,
534
+ _host_index=_host_index
535
+ )
536
+
537
+ _response_types_map: Dict[str, Optional[str]] = {
538
+ '200': "PostFuturesAction",
539
+ '422': "HTTPValidationError",
540
+ }
541
+ response_data = self.api_client.call_api(
542
+ *_param,
543
+ _request_timeout=_request_timeout
544
+ )
545
+ return response_data.response
546
+
547
+
548
+ def _post_futures_action_serialize(
549
+ self,
550
+ futures_trading_action,
551
+ authorization,
552
+ _request_auth,
553
+ _content_type,
554
+ _headers,
555
+ _host_index,
556
+ ) -> RequestSerialized:
557
+
558
+ _host = None
559
+
560
+ _collection_formats: Dict[str, str] = {
561
+ }
562
+
563
+ _path_params: Dict[str, str] = {}
564
+ _query_params: List[Tuple[str, str]] = []
565
+ _header_params: Dict[str, Optional[str]] = _headers or {}
566
+ _form_params: List[Tuple[str, str]] = []
567
+ _files: Dict[
568
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
569
+ ] = {}
570
+ _body_params: Optional[bytes] = None
571
+
572
+ # process the path parameters
573
+ # process the query parameters
574
+ # process the header parameters
575
+ if authorization is not None:
576
+ _header_params['authorization'] = authorization
577
+ # process the form parameters
578
+ # process the body parameter
579
+ if futures_trading_action is not None:
580
+ _body_params = futures_trading_action
581
+
582
+
583
+ # set the HTTP header `Accept`
584
+ if 'Accept' not in _header_params:
585
+ _header_params['Accept'] = self.api_client.select_header_accept(
586
+ [
587
+ 'application/json'
588
+ ]
589
+ )
590
+
591
+ # set the HTTP header `Content-Type`
592
+ if _content_type:
593
+ _header_params['Content-Type'] = _content_type
594
+ else:
595
+ _default_content_type = (
596
+ self.api_client.select_header_content_type(
597
+ [
598
+ 'application/json'
599
+ ]
600
+ )
601
+ )
602
+ if _default_content_type is not None:
603
+ _header_params['Content-Type'] = _default_content_type
604
+
605
+ # authentication setting
606
+ _auth_settings: List[str] = [
607
+ ]
608
+
609
+ return self.api_client.param_serialize(
610
+ method='POST',
611
+ resource_path='/actions/futures',
612
+ path_params=_path_params,
613
+ query_params=_query_params,
614
+ header_params=_header_params,
615
+ body=_body_params,
616
+ post_params=_form_params,
617
+ files=_files,
618
+ auth_settings=_auth_settings,
619
+ collection_formats=_collection_formats,
620
+ _host=_host,
621
+ _request_auth=_request_auth
622
+ )
623
+
624
+
625
+
626
+
627
+ @validate_call
628
+ def post_spot_action(
629
+ self,
630
+ futures_trading_action: FuturesTradingAction,
631
+ _request_timeout: Union[
632
+ None,
633
+ Annotated[StrictFloat, Field(gt=0)],
634
+ Tuple[
635
+ Annotated[StrictFloat, Field(gt=0)],
636
+ Annotated[StrictFloat, Field(gt=0)]
637
+ ]
638
+ ] = None,
639
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
640
+ _content_type: Optional[StrictStr] = None,
641
+ _headers: Optional[Dict[StrictStr, Any]] = None,
642
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
643
+ ) -> object:
644
+ """Post Spot Action
645
+
646
+
647
+ :param futures_trading_action: (required)
648
+ :type futures_trading_action: FuturesTradingAction
649
+ :param _request_timeout: timeout setting for this request. If one
650
+ number provided, it will be total request
651
+ timeout. It can also be a pair (tuple) of
652
+ (connection, read) timeouts.
653
+ :type _request_timeout: int, tuple(int, int), optional
654
+ :param _request_auth: set to override the auth_settings for an a single
655
+ request; this effectively ignores the
656
+ authentication in the spec for a single request.
657
+ :type _request_auth: dict, optional
658
+ :param _content_type: force content-type for the request.
659
+ :type _content_type: str, Optional
660
+ :param _headers: set to override the headers for a single
661
+ request; this effectively ignores the headers
662
+ in the spec for a single request.
663
+ :type _headers: dict, optional
664
+ :param _host_index: set to override the host_index for a single
665
+ request; this effectively ignores the host_index
666
+ in the spec for a single request.
667
+ :type _host_index: int, optional
668
+ :return: Returns the result object.
669
+ """ # noqa: E501
670
+
671
+ _param = self._post_spot_action_serialize(
672
+ futures_trading_action=futures_trading_action,
673
+ _request_auth=_request_auth,
674
+ _content_type=_content_type,
675
+ _headers=_headers,
676
+ _host_index=_host_index
677
+ )
678
+
679
+ _response_types_map: Dict[str, Optional[str]] = {
680
+ '200': "object",
681
+ '422': "HTTPValidationError",
682
+ }
683
+ response_data = self.api_client.call_api(
684
+ *_param,
685
+ _request_timeout=_request_timeout
686
+ )
687
+ response_data.read()
688
+ return self.api_client.response_deserialize(
689
+ response_data=response_data,
690
+ response_types_map=_response_types_map,
691
+ ).data
692
+
693
+
694
+ @validate_call
695
+ def post_spot_action_with_http_info(
696
+ self,
697
+ futures_trading_action: FuturesTradingAction,
698
+ _request_timeout: Union[
699
+ None,
700
+ Annotated[StrictFloat, Field(gt=0)],
701
+ Tuple[
702
+ Annotated[StrictFloat, Field(gt=0)],
703
+ Annotated[StrictFloat, Field(gt=0)]
704
+ ]
705
+ ] = None,
706
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
707
+ _content_type: Optional[StrictStr] = None,
708
+ _headers: Optional[Dict[StrictStr, Any]] = None,
709
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
710
+ ) -> ApiResponse[object]:
711
+ """Post Spot Action
712
+
713
+
714
+ :param futures_trading_action: (required)
715
+ :type futures_trading_action: FuturesTradingAction
716
+ :param _request_timeout: timeout setting for this request. If one
717
+ number provided, it will be total request
718
+ timeout. It can also be a pair (tuple) of
719
+ (connection, read) timeouts.
720
+ :type _request_timeout: int, tuple(int, int), optional
721
+ :param _request_auth: set to override the auth_settings for an a single
722
+ request; this effectively ignores the
723
+ authentication in the spec for a single request.
724
+ :type _request_auth: dict, optional
725
+ :param _content_type: force content-type for the request.
726
+ :type _content_type: str, Optional
727
+ :param _headers: set to override the headers for a single
728
+ request; this effectively ignores the headers
729
+ in the spec for a single request.
730
+ :type _headers: dict, optional
731
+ :param _host_index: set to override the host_index for a single
732
+ request; this effectively ignores the host_index
733
+ in the spec for a single request.
734
+ :type _host_index: int, optional
735
+ :return: Returns the result object.
736
+ """ # noqa: E501
737
+
738
+ _param = self._post_spot_action_serialize(
739
+ futures_trading_action=futures_trading_action,
740
+ _request_auth=_request_auth,
741
+ _content_type=_content_type,
742
+ _headers=_headers,
743
+ _host_index=_host_index
744
+ )
745
+
746
+ _response_types_map: Dict[str, Optional[str]] = {
747
+ '200': "object",
748
+ '422': "HTTPValidationError",
749
+ }
750
+ response_data = self.api_client.call_api(
751
+ *_param,
752
+ _request_timeout=_request_timeout
753
+ )
754
+ response_data.read()
755
+ return self.api_client.response_deserialize(
756
+ response_data=response_data,
757
+ response_types_map=_response_types_map,
758
+ )
759
+
760
+
761
+ @validate_call
762
+ def post_spot_action_without_preload_content(
763
+ self,
764
+ futures_trading_action: FuturesTradingAction,
765
+ _request_timeout: Union[
766
+ None,
767
+ Annotated[StrictFloat, Field(gt=0)],
768
+ Tuple[
769
+ Annotated[StrictFloat, Field(gt=0)],
770
+ Annotated[StrictFloat, Field(gt=0)]
771
+ ]
772
+ ] = None,
773
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
774
+ _content_type: Optional[StrictStr] = None,
775
+ _headers: Optional[Dict[StrictStr, Any]] = None,
776
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
777
+ ) -> RESTResponseType:
778
+ """Post Spot Action
779
+
780
+
781
+ :param futures_trading_action: (required)
782
+ :type futures_trading_action: FuturesTradingAction
783
+ :param _request_timeout: timeout setting for this request. If one
784
+ number provided, it will be total request
785
+ timeout. It can also be a pair (tuple) of
786
+ (connection, read) timeouts.
787
+ :type _request_timeout: int, tuple(int, int), optional
788
+ :param _request_auth: set to override the auth_settings for an a single
789
+ request; this effectively ignores the
790
+ authentication in the spec for a single request.
791
+ :type _request_auth: dict, optional
792
+ :param _content_type: force content-type for the request.
793
+ :type _content_type: str, Optional
794
+ :param _headers: set to override the headers for a single
795
+ request; this effectively ignores the headers
796
+ in the spec for a single request.
797
+ :type _headers: dict, optional
798
+ :param _host_index: set to override the host_index for a single
799
+ request; this effectively ignores the host_index
800
+ in the spec for a single request.
801
+ :type _host_index: int, optional
802
+ :return: Returns the result object.
803
+ """ # noqa: E501
804
+
805
+ _param = self._post_spot_action_serialize(
806
+ futures_trading_action=futures_trading_action,
807
+ _request_auth=_request_auth,
808
+ _content_type=_content_type,
809
+ _headers=_headers,
810
+ _host_index=_host_index
811
+ )
812
+
813
+ _response_types_map: Dict[str, Optional[str]] = {
814
+ '200': "object",
815
+ '422': "HTTPValidationError",
816
+ }
817
+ response_data = self.api_client.call_api(
818
+ *_param,
819
+ _request_timeout=_request_timeout
820
+ )
821
+ return response_data.response
822
+
823
+
824
+ def _post_spot_action_serialize(
825
+ self,
826
+ futures_trading_action,
827
+ _request_auth,
828
+ _content_type,
829
+ _headers,
830
+ _host_index,
831
+ ) -> RequestSerialized:
832
+
833
+ _host = None
834
+
835
+ _collection_formats: Dict[str, str] = {
836
+ }
837
+
838
+ _path_params: Dict[str, str] = {}
839
+ _query_params: List[Tuple[str, str]] = []
840
+ _header_params: Dict[str, Optional[str]] = _headers or {}
841
+ _form_params: List[Tuple[str, str]] = []
842
+ _files: Dict[
843
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
844
+ ] = {}
845
+ _body_params: Optional[bytes] = None
846
+
847
+ # process the path parameters
848
+ # process the query parameters
849
+ # process the header parameters
850
+ # process the form parameters
851
+ # process the body parameter
852
+ if futures_trading_action is not None:
853
+ _body_params = futures_trading_action
854
+
855
+
856
+ # set the HTTP header `Accept`
857
+ if 'Accept' not in _header_params:
858
+ _header_params['Accept'] = self.api_client.select_header_accept(
859
+ [
860
+ 'application/json'
861
+ ]
862
+ )
863
+
864
+ # set the HTTP header `Content-Type`
865
+ if _content_type:
866
+ _header_params['Content-Type'] = _content_type
867
+ else:
868
+ _default_content_type = (
869
+ self.api_client.select_header_content_type(
870
+ [
871
+ 'application/json'
872
+ ]
873
+ )
874
+ )
875
+ if _default_content_type is not None:
876
+ _header_params['Content-Type'] = _default_content_type
877
+
878
+ # authentication setting
879
+ _auth_settings: List[str] = [
880
+ 'OAuth2PasswordBearer'
881
+ ]
882
+
883
+ return self.api_client.param_serialize(
884
+ method='POST',
885
+ resource_path='/actions/spot',
886
+ path_params=_path_params,
887
+ query_params=_query_params,
888
+ header_params=_header_params,
889
+ body=_body_params,
890
+ post_params=_form_params,
891
+ files=_files,
892
+ auth_settings=_auth_settings,
893
+ collection_formats=_collection_formats,
894
+ _host=_host,
895
+ _request_auth=_request_auth
896
+ )
897
+
898
+