crypticorn 1.0.2rc3__py3-none-any.whl → 2.0.0__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.
- crypticorn/__init__.py +3 -3
- crypticorn/auth/__init__.py +2 -0
- crypticorn/auth/client/__init__.py +112 -0
- crypticorn/auth/client/api/__init__.py +8 -0
- crypticorn/auth/client/api/admin_api.py +522 -0
- crypticorn/auth/client/api/auth_api.py +2089 -0
- crypticorn/auth/client/api/service_api.py +309 -0
- crypticorn/auth/client/api/user_api.py +2540 -0
- crypticorn/auth/client/api/wallet_api.py +1698 -0
- crypticorn/auth/client/api_client.py +758 -0
- crypticorn/auth/client/api_response.py +20 -0
- crypticorn/auth/client/configuration.py +584 -0
- crypticorn/auth/client/exceptions.py +220 -0
- crypticorn/auth/client/models/__init__.py +91 -0
- crypticorn/auth/client/models/add_wallet200_response.py +86 -0
- crypticorn/auth/client/models/add_wallet_request.py +107 -0
- crypticorn/auth/client/models/authorize_user200_response.py +107 -0
- crypticorn/auth/client/models/authorize_user200_response_auth.py +101 -0
- crypticorn/auth/client/models/authorize_user_request.py +96 -0
- crypticorn/auth/client/models/create_user_request.py +114 -0
- crypticorn/auth/client/models/list_wallets200_response.py +137 -0
- crypticorn/auth/client/models/list_wallets200_response_balances_inner.py +115 -0
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +115 -0
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +168 -0
- crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +191 -0
- crypticorn/auth/client/models/list_wallets200_response_data_inner.py +102 -0
- crypticorn/auth/client/models/list_wallets200_response_user_value.py +118 -0
- crypticorn/auth/client/models/logout_default_response.py +108 -0
- crypticorn/auth/client/models/logout_default_response_issues_inner.py +83 -0
- crypticorn/auth/client/models/refresh_token_info200_response.py +97 -0
- crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +105 -0
- crypticorn/auth/client/models/resend_verification_email_request.py +84 -0
- crypticorn/auth/client/models/revoke_user_tokens_request.py +83 -0
- crypticorn/auth/client/models/rotate_tokens200_response.py +110 -0
- crypticorn/auth/client/models/token_info200_response.py +97 -0
- crypticorn/auth/client/models/unlink_wallet_request.py +83 -0
- crypticorn/auth/client/models/update_user_request.py +93 -0
- crypticorn/auth/client/models/user_reset_password_request.py +87 -0
- crypticorn/auth/client/models/user_set_password_request.py +89 -0
- crypticorn/auth/client/models/verify200_response.py +110 -0
- crypticorn/auth/client/models/verify_email200_response.py +107 -0
- crypticorn/auth/client/models/verify_email200_response_auth.py +101 -0
- crypticorn/auth/client/models/verify_email200_response_auth_auth.py +110 -0
- crypticorn/auth/client/models/verify_email_request.py +83 -0
- crypticorn/auth/client/models/verify_wallet_request.py +91 -0
- crypticorn/auth/client/models/wallet_verified200_response.py +83 -0
- crypticorn/auth/client/models/whoami200_response.py +104 -0
- crypticorn/auth/client/rest.py +195 -0
- crypticorn/auth/main.py +45 -0
- crypticorn/client.py +46 -8
- crypticorn/common/__init__.py +5 -0
- crypticorn/common/auth.py +43 -0
- crypticorn/common/auth_client.py +163 -0
- crypticorn/common/errors.py +432 -0
- crypticorn/common/scopes.py +29 -0
- crypticorn/common/urls.py +25 -0
- crypticorn/hive/__init__.py +2 -1
- crypticorn/hive/client/__init__.py +57 -0
- crypticorn/hive/client/api/__init__.py +6 -0
- crypticorn/hive/client/api/data_api.py +594 -0
- crypticorn/hive/client/api/models_api.py +1680 -0
- crypticorn/hive/client/api/status_api.py +263 -0
- crypticorn/hive/client/api_client.py +758 -0
- crypticorn/hive/client/api_response.py +20 -0
- crypticorn/hive/client/configuration.py +612 -0
- crypticorn/hive/client/exceptions.py +220 -0
- crypticorn/hive/client/models/__init__.py +38 -0
- crypticorn/hive/client/models/coins.py +44 -0
- crypticorn/hive/client/models/data_download_response.py +113 -0
- crypticorn/hive/client/models/data_info.py +115 -0
- crypticorn/hive/client/models/data_value_value_value_inner.py +154 -0
- crypticorn/hive/client/models/data_version.py +35 -0
- crypticorn/hive/client/models/download_links.py +91 -0
- crypticorn/hive/client/models/evaluation.py +86 -0
- crypticorn/hive/client/models/evaluation_response.py +85 -0
- crypticorn/hive/client/models/feature_size.py +36 -0
- crypticorn/hive/client/models/http_validation_error.py +99 -0
- crypticorn/hive/client/models/model.py +133 -0
- crypticorn/hive/client/models/model_create.py +93 -0
- crypticorn/hive/client/models/model_status.py +35 -0
- crypticorn/hive/client/models/model_update.py +83 -0
- crypticorn/hive/client/models/target.py +36 -0
- crypticorn/hive/client/models/target_type.py +35 -0
- crypticorn/hive/client/models/validation_error.py +105 -0
- crypticorn/hive/client/models/validation_error_loc_inner.py +159 -0
- crypticorn/hive/client/py.typed +0 -0
- crypticorn/hive/client/rest.py +195 -0
- crypticorn/hive/main.py +27 -100
- crypticorn/klines/client/__init__.py +21 -7
- crypticorn/klines/client/api/__init__.py +0 -1
- crypticorn/klines/client/api/funding_rates_api.py +90 -79
- crypticorn/klines/client/api/health_check_api.py +29 -45
- crypticorn/klines/client/api/ohlcv_data_api.py +104 -87
- crypticorn/klines/client/api/symbols_api.py +36 -54
- crypticorn/klines/client/api/udf_api.py +228 -352
- crypticorn/klines/client/api_client.py +106 -148
- crypticorn/klines/client/api_response.py +2 -3
- crypticorn/klines/client/configuration.py +64 -50
- crypticorn/klines/client/exceptions.py +20 -16
- crypticorn/klines/client/models/__init__.py +21 -7
- crypticorn/klines/client/models/base_response_health_check_response.py +21 -15
- crypticorn/klines/client/models/base_response_list_funding_rate_response.py +21 -15
- crypticorn/klines/client/models/base_response_list_str.py +16 -14
- crypticorn/klines/client/models/base_response_ohlcv_response.py +21 -15
- crypticorn/klines/client/models/error_response.py +23 -15
- crypticorn/klines/client/models/exchange.py +11 -11
- crypticorn/klines/client/models/funding_rate_response.py +11 -11
- crypticorn/klines/client/models/health_check_response.py +14 -12
- crypticorn/klines/client/models/history_error_response.py +11 -11
- crypticorn/klines/client/models/history_no_data_response.py +16 -16
- crypticorn/klines/client/models/history_success_response.py +16 -16
- crypticorn/klines/client/models/http_validation_error.py +14 -10
- crypticorn/klines/client/models/market.py +2 -4
- crypticorn/klines/client/models/ohlcv_response.py +22 -15
- crypticorn/klines/client/models/resolution.py +5 -7
- crypticorn/klines/client/models/response_get_history_udf_history_get.py +71 -22
- crypticorn/klines/client/models/search_symbol_response.py +22 -15
- crypticorn/klines/client/models/sort_direction.py +2 -4
- crypticorn/klines/client/models/symbol_group_response.py +5 -9
- crypticorn/klines/client/models/symbol_info_response.py +40 -24
- crypticorn/klines/client/models/symbol_type.py +5 -10
- crypticorn/klines/client/models/timeframe.py +5 -7
- crypticorn/klines/client/models/udf_config_response.py +60 -21
- crypticorn/klines/client/models/validation_error.py +19 -13
- crypticorn/klines/client/models/validation_error_loc_inner.py +32 -11
- crypticorn/klines/client/rest.py +30 -41
- crypticorn/klines/main.py +52 -15
- crypticorn/pay/__init__.py +2 -0
- crypticorn/pay/client/__init__.py +52 -0
- crypticorn/pay/client/api/__init__.py +7 -0
- crypticorn/pay/client/api/now_payments_api.py +813 -0
- crypticorn/pay/client/api/payments_api.py +799 -0
- crypticorn/pay/client/api/products_api.py +891 -0
- crypticorn/pay/client/api/status_api.py +260 -0
- crypticorn/pay/client/api_client.py +758 -0
- crypticorn/pay/client/api_response.py +20 -0
- crypticorn/pay/client/configuration.py +612 -0
- crypticorn/pay/client/exceptions.py +220 -0
- crypticorn/pay/client/models/__init__.py +32 -0
- crypticorn/pay/client/models/api_status_res.py +83 -0
- crypticorn/pay/client/models/combined_payment_history.py +101 -0
- crypticorn/pay/client/models/create_invoice_req.py +188 -0
- crypticorn/pay/client/models/create_invoice_res.py +188 -0
- crypticorn/pay/client/models/currency.py +165 -0
- crypticorn/pay/client/models/estimate_price_req.py +91 -0
- crypticorn/pay/client/models/estimate_price_res.py +102 -0
- crypticorn/pay/client/models/get_currencies_res.py +99 -0
- crypticorn/pay/client/models/get_payment_status_res.py +222 -0
- crypticorn/pay/client/models/get_payments_list_res.py +109 -0
- crypticorn/pay/client/models/http_validation_error.py +99 -0
- crypticorn/pay/client/models/min_amount_req.py +124 -0
- crypticorn/pay/client/models/min_amount_res.py +105 -0
- crypticorn/pay/client/models/now_api_status_res.py +83 -0
- crypticorn/pay/client/models/now_create_invoice_req.py +188 -0
- crypticorn/pay/client/models/now_create_invoice_res.py +188 -0
- crypticorn/pay/client/models/now_fee_structure.py +104 -0
- crypticorn/pay/client/models/now_payment_model.py +124 -0
- crypticorn/pay/client/models/now_payment_status.py +42 -0
- crypticorn/pay/client/models/now_webhook_payload.py +181 -0
- crypticorn/pay/client/models/payment.py +231 -0
- crypticorn/pay/client/models/payment_status.py +40 -0
- crypticorn/pay/client/models/product.py +87 -0
- crypticorn/pay/client/models/product_model.py +119 -0
- crypticorn/pay/client/models/product_subs_model.py +108 -0
- crypticorn/pay/client/models/services.py +34 -0
- crypticorn/pay/client/models/unified_payment_model.py +112 -0
- crypticorn/pay/client/models/validation_error.py +105 -0
- crypticorn/pay/client/models/validation_error_loc_inner.py +159 -0
- crypticorn/pay/client/py.typed +0 -0
- crypticorn/pay/client/rest.py +195 -0
- crypticorn/pay/main.py +35 -0
- crypticorn/trade/client/__init__.py +9 -4
- crypticorn/trade/client/api/__init__.py +0 -1
- crypticorn/trade/client/api/api_keys_api.py +203 -304
- crypticorn/trade/client/api/bots_api.py +177 -250
- crypticorn/trade/client/api/exchanges_api.py +38 -57
- crypticorn/trade/client/api/futures_trading_panel_api.py +223 -321
- crypticorn/trade/client/api/notifications_api.py +247 -364
- crypticorn/trade/client/api/orders_api.py +44 -63
- crypticorn/trade/client/api/status_api.py +35 -53
- crypticorn/trade/client/api/strategies_api.py +852 -64
- crypticorn/trade/client/api/trading_actions_api.py +126 -203
- crypticorn/trade/client/api_client.py +115 -154
- crypticorn/trade/client/api_response.py +2 -3
- crypticorn/trade/client/configuration.py +128 -90
- crypticorn/trade/client/exceptions.py +21 -17
- crypticorn/trade/client/models/__init__.py +9 -4
- crypticorn/trade/client/models/action_model.py +114 -50
- crypticorn/trade/client/models/api_error_identifier.py +60 -51
- crypticorn/trade/client/models/api_error_level.py +37 -0
- crypticorn/trade/client/models/api_error_type.py +37 -0
- crypticorn/trade/client/models/api_key_model.py +49 -28
- crypticorn/trade/client/models/bot_model.py +76 -31
- crypticorn/trade/client/models/bot_status.py +37 -0
- crypticorn/trade/client/models/exchange.py +3 -5
- crypticorn/trade/client/models/execution_ids.py +14 -14
- crypticorn/trade/client/models/futures_balance.py +39 -23
- crypticorn/trade/client/models/futures_trading_action.py +98 -46
- crypticorn/trade/client/models/http_validation_error.py +15 -11
- crypticorn/trade/client/models/margin_mode.py +3 -5
- crypticorn/trade/client/models/market_type.py +3 -5
- crypticorn/trade/client/models/notification_model.py +60 -27
- crypticorn/trade/client/models/notification_type.py +4 -6
- crypticorn/trade/client/models/order_model.py +125 -65
- crypticorn/trade/client/models/order_status.py +6 -8
- crypticorn/trade/client/models/post_futures_action.py +16 -12
- crypticorn/trade/client/models/strategy_exchange_info.py +11 -12
- crypticorn/trade/client/models/strategy_model.py +66 -27
- crypticorn/trade/client/models/strategy_model_input.py +160 -0
- crypticorn/trade/client/models/strategy_model_output.py +160 -0
- crypticorn/trade/client/models/tpsl.py +35 -21
- crypticorn/trade/client/models/trading_action_type.py +5 -7
- crypticorn/trade/client/models/update_notification.py +17 -13
- crypticorn/trade/client/models/validation_error.py +20 -14
- crypticorn/trade/client/models/validation_error_loc_inner.py +33 -12
- crypticorn/trade/client/rest.py +108 -170
- crypticorn/trade/main.py +26 -19
- crypticorn-2.0.0.dist-info/METADATA +74 -0
- crypticorn-2.0.0.dist-info/RECORD +226 -0
- {crypticorn-1.0.2rc3.dist-info → crypticorn-2.0.0.dist-info}/WHEEL +1 -1
- crypticorn/hive/requirements.txt +0 -4
- crypticorn/hive/utils.py +0 -109
- crypticorn/klines/requirements.txt +0 -4
- crypticorn/klines/test/test_base_response_health_check_response.py +0 -56
- crypticorn/klines/test/test_base_response_list_funding_rate_response.py +0 -59
- crypticorn/klines/test/test_base_response_list_str.py +0 -56
- crypticorn/klines/test/test_base_response_ohlcv_response.py +0 -72
- crypticorn/klines/test/test_error_response.py +0 -57
- crypticorn/klines/test/test_exchange.py +0 -56
- crypticorn/klines/test/test_funding_rate_response.py +0 -56
- crypticorn/klines/test/test_funding_rates_api.py +0 -38
- crypticorn/klines/test/test_health_check_api.py +0 -38
- crypticorn/klines/test/test_health_check_response.py +0 -52
- crypticorn/klines/test/test_history_error_response.py +0 -53
- crypticorn/klines/test/test_history_no_data_response.py +0 -69
- crypticorn/klines/test/test_history_success_response.py +0 -87
- crypticorn/klines/test/test_http_validation_error.py +0 -58
- crypticorn/klines/test/test_market.py +0 -33
- crypticorn/klines/test/test_ohlcv_data_api.py +0 -38
- crypticorn/klines/test/test_ohlcv_response.py +0 -86
- crypticorn/klines/test/test_resolution.py +0 -33
- crypticorn/klines/test/test_response_get_history_udf_history_get.py +0 -89
- crypticorn/klines/test/test_search_symbol_response.py +0 -62
- crypticorn/klines/test/test_sort_direction.py +0 -33
- crypticorn/klines/test/test_symbol_group_response.py +0 -53
- crypticorn/klines/test/test_symbol_info_response.py +0 -84
- crypticorn/klines/test/test_symbol_type.py +0 -54
- crypticorn/klines/test/test_symbols_api.py +0 -38
- crypticorn/klines/test/test_timeframe.py +0 -33
- crypticorn/klines/test/test_udf_api.py +0 -80
- crypticorn/klines/test/test_udf_config_response.py +0 -95
- crypticorn/klines/test/test_validation_error.py +0 -60
- crypticorn/klines/test/test_validation_error_loc_inner.py +0 -50
- crypticorn/trade/requirements.txt +0 -4
- crypticorn-1.0.2rc3.dist-info/LICENSE.md +0 -19
- crypticorn-1.0.2rc3.dist-info/METADATA +0 -47
- crypticorn-1.0.2rc3.dist-info/RECORD +0 -128
- /crypticorn/{klines/test/__init__.py → auth/client/py.typed} +0 -0
- {crypticorn-1.0.2rc3.dist-info → crypticorn-2.0.0.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
@@ -17,27 +17,47 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from pydantic import BaseModel, ConfigDict, Field,
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
22
|
+
from crypticorn.trade.client.models.api_error_identifier import ApiErrorIdentifier
|
23
|
+
from crypticorn.trade.client.models.bot_status import BotStatus
|
22
24
|
from typing import Optional, Set
|
23
25
|
from typing_extensions import Self
|
24
26
|
|
27
|
+
|
25
28
|
class BotModel(BaseModel):
|
26
29
|
"""
|
27
30
|
BotModel
|
28
|
-
"""
|
29
|
-
|
30
|
-
|
31
|
+
""" # noqa: E501
|
32
|
+
|
33
|
+
created_at: Optional[StrictInt] = None
|
34
|
+
updated_at: Optional[StrictInt] = None
|
31
35
|
id: Optional[StrictStr] = None
|
32
36
|
name: StrictStr = Field(description="Name of the bot")
|
33
|
-
strategy_id: StrictStr = Field(
|
37
|
+
strategy_id: StrictStr = Field(
|
38
|
+
description="UID for the trading strategy used by the bot"
|
39
|
+
)
|
34
40
|
api_key_id: StrictStr = Field(description="UID for the API key")
|
35
41
|
allocation: StrictInt = Field(description="Initial allocation for the bot")
|
36
|
-
|
37
|
-
|
42
|
+
status: BotStatus = Field(description="Status of the bot")
|
43
|
+
status_code: Optional[ApiErrorIdentifier] = None
|
38
44
|
user_id: Optional[StrictStr] = None
|
39
45
|
current_allocation: Optional[Union[StrictFloat, StrictInt]] = None
|
40
|
-
|
46
|
+
current_exposure: Optional[Union[StrictFloat, StrictInt]] = None
|
47
|
+
__properties: ClassVar[List[str]] = [
|
48
|
+
"created_at",
|
49
|
+
"updated_at",
|
50
|
+
"id",
|
51
|
+
"name",
|
52
|
+
"strategy_id",
|
53
|
+
"api_key_id",
|
54
|
+
"allocation",
|
55
|
+
"status",
|
56
|
+
"status_code",
|
57
|
+
"user_id",
|
58
|
+
"current_allocation",
|
59
|
+
"current_exposure",
|
60
|
+
]
|
41
61
|
|
42
62
|
model_config = ConfigDict(
|
43
63
|
populate_by_name=True,
|
@@ -45,7 +65,6 @@ class BotModel(BaseModel):
|
|
45
65
|
protected_namespaces=(),
|
46
66
|
)
|
47
67
|
|
48
|
-
|
49
68
|
def to_str(self) -> str:
|
50
69
|
"""Returns the string representation of the model using alias"""
|
51
70
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -70,28 +89,53 @@ class BotModel(BaseModel):
|
|
70
89
|
were set at model initialization. Other fields with value `None`
|
71
90
|
are ignored.
|
72
91
|
"""
|
73
|
-
excluded_fields: Set[str] = set([
|
74
|
-
])
|
92
|
+
excluded_fields: Set[str] = set([])
|
75
93
|
|
76
94
|
_dict = self.model_dump(
|
77
95
|
by_alias=True,
|
78
96
|
exclude=excluded_fields,
|
79
97
|
exclude_none=True,
|
80
98
|
)
|
99
|
+
# set to None if created_at (nullable) is None
|
100
|
+
# and model_fields_set contains the field
|
101
|
+
if self.created_at is None and "created_at" in self.model_fields_set:
|
102
|
+
_dict["created_at"] = None
|
103
|
+
|
104
|
+
# set to None if updated_at (nullable) is None
|
105
|
+
# and model_fields_set contains the field
|
106
|
+
if self.updated_at is None and "updated_at" in self.model_fields_set:
|
107
|
+
_dict["updated_at"] = None
|
108
|
+
|
81
109
|
# set to None if id (nullable) is None
|
82
110
|
# and model_fields_set contains the field
|
83
111
|
if self.id is None and "id" in self.model_fields_set:
|
84
|
-
_dict[
|
112
|
+
_dict["id"] = None
|
113
|
+
|
114
|
+
# set to None if status_code (nullable) is None
|
115
|
+
# and model_fields_set contains the field
|
116
|
+
if self.status_code is None and "status_code" in self.model_fields_set:
|
117
|
+
_dict["status_code"] = None
|
85
118
|
|
86
119
|
# set to None if user_id (nullable) is None
|
87
120
|
# and model_fields_set contains the field
|
88
121
|
if self.user_id is None and "user_id" in self.model_fields_set:
|
89
|
-
_dict[
|
122
|
+
_dict["user_id"] = None
|
90
123
|
|
91
124
|
# set to None if current_allocation (nullable) is None
|
92
125
|
# and model_fields_set contains the field
|
93
|
-
if
|
94
|
-
|
126
|
+
if (
|
127
|
+
self.current_allocation is None
|
128
|
+
and "current_allocation" in self.model_fields_set
|
129
|
+
):
|
130
|
+
_dict["current_allocation"] = None
|
131
|
+
|
132
|
+
# set to None if current_exposure (nullable) is None
|
133
|
+
# and model_fields_set contains the field
|
134
|
+
if (
|
135
|
+
self.current_exposure is None
|
136
|
+
and "current_exposure" in self.model_fields_set
|
137
|
+
):
|
138
|
+
_dict["current_exposure"] = None
|
95
139
|
|
96
140
|
return _dict
|
97
141
|
|
@@ -104,19 +148,20 @@ class BotModel(BaseModel):
|
|
104
148
|
if not isinstance(obj, dict):
|
105
149
|
return cls.model_validate(obj)
|
106
150
|
|
107
|
-
_obj = cls.model_validate(
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
151
|
+
_obj = cls.model_validate(
|
152
|
+
{
|
153
|
+
"created_at": obj.get("created_at"),
|
154
|
+
"updated_at": obj.get("updated_at"),
|
155
|
+
"id": obj.get("id"),
|
156
|
+
"name": obj.get("name"),
|
157
|
+
"strategy_id": obj.get("strategy_id"),
|
158
|
+
"api_key_id": obj.get("api_key_id"),
|
159
|
+
"allocation": obj.get("allocation"),
|
160
|
+
"status": obj.get("status"),
|
161
|
+
"status_code": obj.get("status_code"),
|
162
|
+
"user_id": obj.get("user_id"),
|
163
|
+
"current_allocation": obj.get("current_allocation"),
|
164
|
+
"current_exposure": obj.get("current_exposure"),
|
165
|
+
}
|
166
|
+
)
|
120
167
|
return _obj
|
121
|
-
|
122
|
-
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Trading API
|
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
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class BotStatus(str, Enum):
|
22
|
+
"""
|
23
|
+
BotStatus
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
RUNNING = "running"
|
30
|
+
STOPPING = "stopping"
|
31
|
+
STOPPED = "stopped"
|
32
|
+
DELETED = "deleted"
|
33
|
+
|
34
|
+
@classmethod
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
36
|
+
"""Create an instance of BotStatus from a JSON string"""
|
37
|
+
return cls(json.loads(json_str))
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
@@ -26,12 +26,10 @@ class Exchange(str, Enum):
|
|
26
26
|
"""
|
27
27
|
allowed enum values
|
28
28
|
"""
|
29
|
-
KUCOIN =
|
30
|
-
BINGX =
|
29
|
+
KUCOIN = "kucoin"
|
30
|
+
BINGX = "bingx"
|
31
31
|
|
32
32
|
@classmethod
|
33
33
|
def from_json(cls, json_str: str) -> Self:
|
34
34
|
"""Create an instance of Exchange from a JSON string"""
|
35
35
|
return cls(json.loads(json_str))
|
36
|
-
|
37
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
@@ -22,13 +22,19 @@ from typing import Any, ClassVar, Dict, List
|
|
22
22
|
from typing import Optional, Set
|
23
23
|
from typing_extensions import Self
|
24
24
|
|
25
|
+
|
25
26
|
class ExecutionIds(BaseModel):
|
26
27
|
"""
|
27
28
|
ExecutionIds
|
28
|
-
"""
|
29
|
+
""" # noqa: E501
|
30
|
+
|
29
31
|
main: List[StrictStr] = Field(description="Main execution ID. List with one item.")
|
30
|
-
sl: List[StrictStr] = Field(
|
31
|
-
|
32
|
+
sl: List[StrictStr] = Field(
|
33
|
+
description="Stop loss execution IDs. List with multiple items ordered by the next stop loss."
|
34
|
+
)
|
35
|
+
tp: List[StrictStr] = Field(
|
36
|
+
description="Take profit execution IDs. List with multiple items ordered by the next take profit."
|
37
|
+
)
|
32
38
|
__properties: ClassVar[List[str]] = ["main", "sl", "tp"]
|
33
39
|
|
34
40
|
model_config = ConfigDict(
|
@@ -37,7 +43,6 @@ class ExecutionIds(BaseModel):
|
|
37
43
|
protected_namespaces=(),
|
38
44
|
)
|
39
45
|
|
40
|
-
|
41
46
|
def to_str(self) -> str:
|
42
47
|
"""Returns the string representation of the model using alias"""
|
43
48
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -62,8 +67,7 @@ class ExecutionIds(BaseModel):
|
|
62
67
|
were set at model initialization. Other fields with value `None`
|
63
68
|
are ignored.
|
64
69
|
"""
|
65
|
-
excluded_fields: Set[str] = set([
|
66
|
-
])
|
70
|
+
excluded_fields: Set[str] = set([])
|
67
71
|
|
68
72
|
_dict = self.model_dump(
|
69
73
|
by_alias=True,
|
@@ -81,11 +85,7 @@ class ExecutionIds(BaseModel):
|
|
81
85
|
if not isinstance(obj, dict):
|
82
86
|
return cls.model_validate(obj)
|
83
87
|
|
84
|
-
_obj = cls.model_validate(
|
85
|
-
"main": obj.get("main"),
|
86
|
-
|
87
|
-
"tp": obj.get("tp")
|
88
|
-
})
|
88
|
+
_obj = cls.model_validate(
|
89
|
+
{"main": obj.get("main"), "sl": obj.get("sl"), "tp": obj.get("tp")}
|
90
|
+
)
|
89
91
|
return _obj
|
90
|
-
|
91
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
@@ -22,18 +22,36 @@ from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
22
22
|
from typing import Optional, Set
|
23
23
|
from typing_extensions import Self
|
24
24
|
|
25
|
+
|
25
26
|
class FuturesBalance(BaseModel):
|
26
27
|
"""
|
27
28
|
Model for futures balance
|
28
|
-
"""
|
29
|
+
""" # noqa: E501
|
30
|
+
|
29
31
|
api_key_id: StrictStr = Field(description="API key ID", alias="apiKeyId")
|
30
32
|
asset: StrictStr = Field(description="Asset/Currency code")
|
31
33
|
balance: Union[StrictFloat, StrictInt] = Field(description="Total balance/equity")
|
32
|
-
available: Union[StrictFloat, StrictInt] = Field(
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
available: Union[StrictFloat, StrictInt] = Field(
|
35
|
+
description="Available balance for trading/withdrawal"
|
36
|
+
)
|
37
|
+
unrealized_pnl: Union[StrictFloat, StrictInt] = Field(
|
38
|
+
description="Unrealized profit and loss", alias="unrealizedPnl"
|
39
|
+
)
|
40
|
+
used_margin: Optional[Union[StrictFloat, StrictInt]] = Field(
|
41
|
+
default=None, alias="usedMargin"
|
42
|
+
)
|
43
|
+
frozen_amount: Optional[Union[StrictFloat, StrictInt]] = Field(
|
44
|
+
default=None, alias="frozenAmount"
|
45
|
+
)
|
46
|
+
__properties: ClassVar[List[str]] = [
|
47
|
+
"apiKeyId",
|
48
|
+
"asset",
|
49
|
+
"balance",
|
50
|
+
"available",
|
51
|
+
"unrealizedPnl",
|
52
|
+
"usedMargin",
|
53
|
+
"frozenAmount",
|
54
|
+
]
|
37
55
|
|
38
56
|
model_config = ConfigDict(
|
39
57
|
populate_by_name=True,
|
@@ -41,7 +59,6 @@ class FuturesBalance(BaseModel):
|
|
41
59
|
protected_namespaces=(),
|
42
60
|
)
|
43
61
|
|
44
|
-
|
45
62
|
def to_str(self) -> str:
|
46
63
|
"""Returns the string representation of the model using alias"""
|
47
64
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -66,8 +83,7 @@ class FuturesBalance(BaseModel):
|
|
66
83
|
were set at model initialization. Other fields with value `None`
|
67
84
|
are ignored.
|
68
85
|
"""
|
69
|
-
excluded_fields: Set[str] = set([
|
70
|
-
])
|
86
|
+
excluded_fields: Set[str] = set([])
|
71
87
|
|
72
88
|
_dict = self.model_dump(
|
73
89
|
by_alias=True,
|
@@ -77,12 +93,12 @@ class FuturesBalance(BaseModel):
|
|
77
93
|
# set to None if used_margin (nullable) is None
|
78
94
|
# and model_fields_set contains the field
|
79
95
|
if self.used_margin is None and "used_margin" in self.model_fields_set:
|
80
|
-
_dict[
|
96
|
+
_dict["usedMargin"] = None
|
81
97
|
|
82
98
|
# set to None if frozen_amount (nullable) is None
|
83
99
|
# and model_fields_set contains the field
|
84
100
|
if self.frozen_amount is None and "frozen_amount" in self.model_fields_set:
|
85
|
-
_dict[
|
101
|
+
_dict["frozenAmount"] = None
|
86
102
|
|
87
103
|
return _dict
|
88
104
|
|
@@ -95,15 +111,15 @@ class FuturesBalance(BaseModel):
|
|
95
111
|
if not isinstance(obj, dict):
|
96
112
|
return cls.model_validate(obj)
|
97
113
|
|
98
|
-
_obj = cls.model_validate(
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
114
|
+
_obj = cls.model_validate(
|
115
|
+
{
|
116
|
+
"apiKeyId": obj.get("apiKeyId"),
|
117
|
+
"asset": obj.get("asset"),
|
118
|
+
"balance": obj.get("balance"),
|
119
|
+
"available": obj.get("available"),
|
120
|
+
"unrealizedPnl": obj.get("unrealizedPnl"),
|
121
|
+
"usedMargin": obj.get("usedMargin"),
|
122
|
+
"frozenAmount": obj.get("frozenAmount"),
|
123
|
+
}
|
124
|
+
)
|
107
125
|
return _obj
|
108
|
-
|
109
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
6
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
@@ -17,7 +17,15 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from pydantic import
|
20
|
+
from pydantic import (
|
21
|
+
BaseModel,
|
22
|
+
ConfigDict,
|
23
|
+
Field,
|
24
|
+
StrictBool,
|
25
|
+
StrictFloat,
|
26
|
+
StrictInt,
|
27
|
+
StrictStr,
|
28
|
+
)
|
21
29
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
22
30
|
from typing_extensions import Annotated
|
23
31
|
from crypticorn.trade.client.models.margin_mode import MarginMode
|
@@ -27,10 +35,12 @@ from crypticorn.trade.client.models.trading_action_type import TradingActionType
|
|
27
35
|
from typing import Optional, Set
|
28
36
|
from typing_extensions import Self
|
29
37
|
|
38
|
+
|
30
39
|
class FuturesTradingAction(BaseModel):
|
31
40
|
"""
|
32
41
|
Model for futures trading actions
|
33
|
-
"""
|
42
|
+
""" # noqa: E501
|
43
|
+
|
34
44
|
id: Optional[StrictStr] = None
|
35
45
|
execution_id: Optional[StrictStr] = None
|
36
46
|
open_order_execution_id: Optional[StrictStr] = None
|
@@ -38,17 +48,45 @@ class FuturesTradingAction(BaseModel):
|
|
38
48
|
action_type: TradingActionType = Field(description="The type of action.")
|
39
49
|
market_type: MarketType = Field(description="The type of market the action is for.")
|
40
50
|
strategy_id: StrictStr = Field(description="UID for the strategy.")
|
41
|
-
symbol: StrictStr = Field(
|
51
|
+
symbol: StrictStr = Field(
|
52
|
+
description="Trading symbol or asset pair in format: 'symbol/quote_currency' (see market service for valid symbols)"
|
53
|
+
)
|
42
54
|
is_limit: Optional[StrictBool] = None
|
43
55
|
limit_price: Optional[Union[StrictFloat, StrictInt]] = None
|
44
|
-
allocation: Optional[
|
56
|
+
allocation: Optional[
|
57
|
+
Union[
|
58
|
+
Annotated[float, Field(le=1.0, strict=True)],
|
59
|
+
Annotated[int, Field(le=1, strict=True)],
|
60
|
+
]
|
61
|
+
] = Field(
|
62
|
+
default=None,
|
63
|
+
description="How much of bot's balance to use for the order (for open actions). How much of the reference open order (open_order_execution_id) to close (for close actions). 0=0%, 1=100%.",
|
64
|
+
)
|
45
65
|
take_profit: Optional[List[TPSL]] = None
|
46
66
|
stop_loss: Optional[List[TPSL]] = None
|
47
67
|
expiry_timestamp: Optional[StrictInt] = None
|
48
68
|
position_id: Optional[StrictStr] = None
|
49
69
|
leverage: Optional[Annotated[int, Field(strict=True, ge=1)]]
|
50
70
|
margin_mode: Optional[MarginMode] = None
|
51
|
-
__properties: ClassVar[List[str]] = [
|
71
|
+
__properties: ClassVar[List[str]] = [
|
72
|
+
"id",
|
73
|
+
"execution_id",
|
74
|
+
"open_order_execution_id",
|
75
|
+
"client_order_id",
|
76
|
+
"action_type",
|
77
|
+
"market_type",
|
78
|
+
"strategy_id",
|
79
|
+
"symbol",
|
80
|
+
"is_limit",
|
81
|
+
"limit_price",
|
82
|
+
"allocation",
|
83
|
+
"take_profit",
|
84
|
+
"stop_loss",
|
85
|
+
"expiry_timestamp",
|
86
|
+
"position_id",
|
87
|
+
"leverage",
|
88
|
+
"margin_mode",
|
89
|
+
]
|
52
90
|
|
53
91
|
model_config = ConfigDict(
|
54
92
|
populate_by_name=True,
|
@@ -56,7 +94,6 @@ class FuturesTradingAction(BaseModel):
|
|
56
94
|
protected_namespaces=(),
|
57
95
|
)
|
58
96
|
|
59
|
-
|
60
97
|
def to_str(self) -> str:
|
61
98
|
"""Returns the string representation of the model using alias"""
|
62
99
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -81,8 +118,7 @@ class FuturesTradingAction(BaseModel):
|
|
81
118
|
were set at model initialization. Other fields with value `None`
|
82
119
|
are ignored.
|
83
120
|
"""
|
84
|
-
excluded_fields: Set[str] = set([
|
85
|
-
])
|
121
|
+
excluded_fields: Set[str] = set([])
|
86
122
|
|
87
123
|
_dict = self.model_dump(
|
88
124
|
by_alias=True,
|
@@ -95,73 +131,79 @@ class FuturesTradingAction(BaseModel):
|
|
95
131
|
for _item_take_profit in self.take_profit:
|
96
132
|
if _item_take_profit:
|
97
133
|
_items.append(_item_take_profit.to_dict())
|
98
|
-
_dict[
|
134
|
+
_dict["take_profit"] = _items
|
99
135
|
# override the default output from pydantic by calling `to_dict()` of each item in stop_loss (list)
|
100
136
|
_items = []
|
101
137
|
if self.stop_loss:
|
102
138
|
for _item_stop_loss in self.stop_loss:
|
103
139
|
if _item_stop_loss:
|
104
140
|
_items.append(_item_stop_loss.to_dict())
|
105
|
-
_dict[
|
141
|
+
_dict["stop_loss"] = _items
|
106
142
|
# set to None if id (nullable) is None
|
107
143
|
# and model_fields_set contains the field
|
108
144
|
if self.id is None and "id" in self.model_fields_set:
|
109
|
-
_dict[
|
145
|
+
_dict["id"] = None
|
110
146
|
|
111
147
|
# set to None if execution_id (nullable) is None
|
112
148
|
# and model_fields_set contains the field
|
113
149
|
if self.execution_id is None and "execution_id" in self.model_fields_set:
|
114
|
-
_dict[
|
150
|
+
_dict["execution_id"] = None
|
115
151
|
|
116
152
|
# set to None if open_order_execution_id (nullable) is None
|
117
153
|
# and model_fields_set contains the field
|
118
|
-
if
|
119
|
-
|
154
|
+
if (
|
155
|
+
self.open_order_execution_id is None
|
156
|
+
and "open_order_execution_id" in self.model_fields_set
|
157
|
+
):
|
158
|
+
_dict["open_order_execution_id"] = None
|
120
159
|
|
121
160
|
# set to None if client_order_id (nullable) is None
|
122
161
|
# and model_fields_set contains the field
|
123
162
|
if self.client_order_id is None and "client_order_id" in self.model_fields_set:
|
124
|
-
_dict[
|
163
|
+
_dict["client_order_id"] = None
|
125
164
|
|
126
165
|
# set to None if is_limit (nullable) is None
|
127
166
|
# and model_fields_set contains the field
|
128
167
|
if self.is_limit is None and "is_limit" in self.model_fields_set:
|
129
|
-
_dict[
|
168
|
+
_dict["is_limit"] = None
|
130
169
|
|
131
170
|
# set to None if limit_price (nullable) is None
|
132
171
|
# and model_fields_set contains the field
|
133
172
|
if self.limit_price is None and "limit_price" in self.model_fields_set:
|
134
|
-
_dict[
|
173
|
+
_dict["limit_price"] = None
|
135
174
|
|
136
175
|
# set to None if take_profit (nullable) is None
|
137
176
|
# and model_fields_set contains the field
|
138
177
|
if self.take_profit is None and "take_profit" in self.model_fields_set:
|
139
|
-
_dict[
|
178
|
+
_dict["take_profit"] = None
|
140
179
|
|
141
180
|
# set to None if stop_loss (nullable) is None
|
142
181
|
# and model_fields_set contains the field
|
143
182
|
if self.stop_loss is None and "stop_loss" in self.model_fields_set:
|
144
|
-
_dict[
|
183
|
+
_dict["stop_loss"] = None
|
145
184
|
|
146
185
|
# set to None if expiry_timestamp (nullable) is None
|
147
186
|
# and model_fields_set contains the field
|
148
|
-
if
|
149
|
-
|
187
|
+
if (
|
188
|
+
self.expiry_timestamp is None
|
189
|
+
and "expiry_timestamp" in self.model_fields_set
|
190
|
+
):
|
191
|
+
_dict["expiry_timestamp"] = None
|
150
192
|
|
151
193
|
# set to None if position_id (nullable) is None
|
152
194
|
# and model_fields_set contains the field
|
153
195
|
if self.position_id is None and "position_id" in self.model_fields_set:
|
154
|
-
_dict[
|
196
|
+
_dict["position_id"] = None
|
155
197
|
|
156
198
|
# set to None if leverage (nullable) is None
|
157
199
|
# and model_fields_set contains the field
|
158
200
|
if self.leverage is None and "leverage" in self.model_fields_set:
|
159
|
-
_dict[
|
201
|
+
_dict["leverage"] = None
|
160
202
|
|
161
203
|
# set to None if margin_mode (nullable) is None
|
162
204
|
# and model_fields_set contains the field
|
163
205
|
if self.margin_mode is None and "margin_mode" in self.model_fields_set:
|
164
|
-
_dict[
|
206
|
+
_dict["margin_mode"] = None
|
165
207
|
|
166
208
|
return _dict
|
167
209
|
|
@@ -174,25 +216,35 @@ class FuturesTradingAction(BaseModel):
|
|
174
216
|
if not isinstance(obj, dict):
|
175
217
|
return cls.model_validate(obj)
|
176
218
|
|
177
|
-
_obj = cls.model_validate(
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
219
|
+
_obj = cls.model_validate(
|
220
|
+
{
|
221
|
+
"id": obj.get("id"),
|
222
|
+
"execution_id": obj.get("execution_id"),
|
223
|
+
"open_order_execution_id": obj.get("open_order_execution_id"),
|
224
|
+
"client_order_id": obj.get("client_order_id"),
|
225
|
+
"action_type": obj.get("action_type"),
|
226
|
+
"market_type": obj.get("market_type"),
|
227
|
+
"strategy_id": obj.get("strategy_id"),
|
228
|
+
"symbol": obj.get("symbol"),
|
229
|
+
"is_limit": obj.get("is_limit"),
|
230
|
+
"limit_price": obj.get("limit_price"),
|
231
|
+
"allocation": obj.get("allocation"),
|
232
|
+
"take_profit": (
|
233
|
+
[TPSL.from_dict(_item) for _item in obj["take_profit"]]
|
234
|
+
if obj.get("take_profit") is not None
|
235
|
+
else None
|
236
|
+
),
|
237
|
+
"stop_loss": (
|
238
|
+
[TPSL.from_dict(_item) for _item in obj["stop_loss"]]
|
239
|
+
if obj.get("stop_loss") is not None
|
240
|
+
else None
|
241
|
+
),
|
242
|
+
"expiry_timestamp": obj.get("expiry_timestamp"),
|
243
|
+
"position_id": obj.get("position_id"),
|
244
|
+
"leverage": (
|
245
|
+
obj.get("leverage") if obj.get("leverage") is not None else 1
|
246
|
+
),
|
247
|
+
"margin_mode": obj.get("margin_mode"),
|
248
|
+
}
|
249
|
+
)
|
196
250
|
return _obj
|
197
|
-
|
198
|
-
|