crypticorn 2.5.0rc4__py3-none-any.whl → 2.5.1__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/auth/main.py +2 -0
- crypticorn/client.py +60 -69
- crypticorn/common/__init__.py +2 -1
- crypticorn/common/auth.py +38 -20
- crypticorn/common/enums.py +5 -34
- crypticorn/common/errors.py +33 -14
- crypticorn/common/exceptions.py +42 -25
- crypticorn/common/mixins.py +36 -0
- crypticorn/common/urls.py +2 -1
- crypticorn/common/utils.py +4 -2
- crypticorn/hive/main.py +2 -0
- crypticorn/klines/client/__init__.py +14 -42
- crypticorn/klines/client/api/__init__.py +1 -1
- crypticorn/klines/client/api/change_in_timeframe_api.py +8 -22
- crypticorn/klines/client/api/funding_rates_api.py +8 -22
- crypticorn/klines/client/api/ohlcv_data_api.py +13 -33
- crypticorn/klines/client/api/status_api.py +260 -0
- crypticorn/klines/client/api/symbols_api.py +14 -29
- crypticorn/klines/client/api/udf_api.py +48 -59
- crypticorn/klines/client/api_client.py +1 -1
- crypticorn/klines/client/configuration.py +1 -1
- crypticorn/klines/client/exceptions.py +1 -1
- crypticorn/klines/client/models/__init__.py +13 -41
- crypticorn/klines/client/models/api_error_identifier.py +108 -0
- crypticorn/klines/client/models/api_error_level.py +37 -0
- crypticorn/klines/client/models/api_error_type.py +37 -0
- crypticorn/klines/client/models/change_in_timeframe.py +86 -0
- crypticorn/klines/client/models/exception_detail.py +117 -0
- crypticorn/klines/client/models/funding_rate.py +92 -0
- crypticorn/klines/client/models/internal_exchange.py +39 -0
- crypticorn/klines/client/models/market_type.py +1 -1
- crypticorn/klines/client/models/ohlcv_history.py +105 -0
- crypticorn/klines/client/models/resolution.py +1 -1
- crypticorn/klines/client/models/search_symbol.py +94 -0
- crypticorn/klines/client/models/sort_direction.py +1 -1
- crypticorn/klines/client/models/symbol_group.py +83 -0
- crypticorn/klines/client/models/symbol_info.py +131 -0
- crypticorn/klines/client/models/symbol_type.py +1 -1
- crypticorn/klines/client/models/timeframe.py +1 -1
- crypticorn/klines/client/models/udf_config.py +149 -0
- crypticorn/klines/client/rest.py +1 -1
- crypticorn/klines/main.py +40 -23
- crypticorn/metrics/client/__init__.py +7 -21
- crypticorn/metrics/client/api/__init__.py +1 -1
- crypticorn/metrics/client/api/exchanges_api.py +36 -78
- crypticorn/metrics/client/api/indicators_api.py +12 -37
- crypticorn/metrics/client/api/logs_api.py +8 -23
- crypticorn/metrics/client/api/marketcap_api.py +22 -73
- crypticorn/metrics/client/api/markets_api.py +12 -40
- crypticorn/metrics/client/api/status_api.py +260 -0
- crypticorn/metrics/client/api/tokens_api.py +7 -21
- crypticorn/metrics/client/api_client.py +1 -1
- crypticorn/metrics/client/configuration.py +5 -3
- crypticorn/metrics/client/exceptions.py +1 -1
- crypticorn/metrics/client/models/__init__.py +6 -20
- crypticorn/{trade → metrics}/client/models/api_error_identifier.py +6 -2
- crypticorn/{trade → metrics}/client/models/api_error_level.py +2 -2
- crypticorn/{trade → metrics}/client/models/api_error_type.py +2 -2
- crypticorn/metrics/client/models/exception_detail.py +117 -0
- crypticorn/metrics/client/models/internal_exchange.py +39 -0
- crypticorn/metrics/client/models/market_type.py +1 -1
- crypticorn/metrics/client/models/severity.py +1 -1
- crypticorn/metrics/client/models/time_interval.py +1 -1
- crypticorn/metrics/client/models/trading_status.py +1 -1
- crypticorn/metrics/client/rest.py +1 -1
- crypticorn/metrics/main.py +51 -43
- crypticorn/pay/main.py +2 -0
- crypticorn/trade/client/__init__.py +0 -3
- crypticorn/trade/client/configuration.py +2 -2
- crypticorn/trade/client/models/__init__.py +0 -3
- crypticorn/trade/client/models/bot_model.py +3 -7
- crypticorn/trade/client/models/execution_ids.py +1 -1
- crypticorn/trade/client/models/notification_model.py +3 -12
- crypticorn/trade/client/models/order_model.py +3 -7
- crypticorn/trade/client/models/spot_trading_action.py +231 -0
- crypticorn/trade/main.py +2 -0
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/METADATA +7 -5
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/RECORD +82 -65
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/WHEEL +1 -1
- crypticorn/common/sorter.py +0 -40
- /crypticorn/common/{pydantic.py → decorators.py} +0 -0
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.5.0rc4.dist-info → crypticorn-2.5.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Klines Service API
|
5
|
+
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.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 ApiErrorIdentifier(str, Enum):
|
22
|
+
"""
|
23
|
+
API error identifiers
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
ALLOCATION_BELOW_CURRENT_EXPOSURE = "allocation_below_current_exposure"
|
30
|
+
ALLOCATION_BELOW_MIN_AMOUNT = "allocation_below_min_amount"
|
31
|
+
ALPHANUMERIC_CHARACTERS_ONLY = "alphanumeric_characters_only"
|
32
|
+
BLACK_SWAN = "black_swan"
|
33
|
+
BOT_ALREADY_DELETED = "bot_already_deleted"
|
34
|
+
BOT_DISABLED = "bot_disabled"
|
35
|
+
BOT_STOPPING_COMPLETED = "bot_stopping_completed"
|
36
|
+
CLIENT_ORDER_ID_ALREADY_EXISTS = "client_order_id_already_exists"
|
37
|
+
INVALID_CONTENT_TYPE = "invalid_content_type"
|
38
|
+
DELETE_BOT_ERROR = "delete_bot_error"
|
39
|
+
EXCHANGE_INVALID_SIGNATURE = "exchange_invalid_signature"
|
40
|
+
EXCHANGE_INVALID_TIMESTAMP = "exchange_invalid_timestamp"
|
41
|
+
EXCHANGE_IP_ADDRESS_IS_NOT_AUTHORIZED = "exchange_ip_address_is_not_authorized"
|
42
|
+
EXCHANGE_KEY_ALREADY_EXISTS = "exchange_key_already_exists"
|
43
|
+
EXCHANGE_KEY_IN_USE = "exchange_key_in_use"
|
44
|
+
EXCHANGE_SYSTEM_UNDER_MAINTENANCE = "exchange_system_under_maintenance"
|
45
|
+
EXCHANGE_RATE_LIMIT_EXCEEDED = "exchange_rate_limit_exceeded"
|
46
|
+
INSUFFICIENT_PERMISSIONS_SPOT_AND_FUTURES_REQUIRED = (
|
47
|
+
"insufficient_permissions_spot_and_futures_required"
|
48
|
+
)
|
49
|
+
EXCHANGE_SERVICE_TEMPORARILY_UNAVAILABLE = (
|
50
|
+
"exchange_service_temporarily_unavailable"
|
51
|
+
)
|
52
|
+
EXCHANGE_SYSTEM_IS_BUSY = "exchange_system_is_busy"
|
53
|
+
EXCHANGE_SYSTEM_CONFIGURATION_ERROR = "exchange_system_configuration_error"
|
54
|
+
EXCHANGE_INTERNAL_SYSTEM_ERROR = "exchange_internal_system_error"
|
55
|
+
EXCHANGE_USER_ACCOUNT_IS_FROZEN = "exchange_user_account_is_frozen"
|
56
|
+
FORBIDDEN = "forbidden"
|
57
|
+
HEDGE_MODE_NOT_ACTIVE = "hedge_mode_not_active"
|
58
|
+
HTTP_REQUEST_ERROR = "http_request_error"
|
59
|
+
INSUFFICIENT_BALANCE = "insufficient_balance"
|
60
|
+
INSUFFICIENT_MARGIN = "insufficient_margin"
|
61
|
+
INSUFFICIENT_SCOPES = "insufficient_scopes"
|
62
|
+
INVALID_API_KEY = "invalid_api_key"
|
63
|
+
INVALID_BEARER = "invalid_bearer"
|
64
|
+
INVALID_DATA = "invalid_data"
|
65
|
+
INVALID_DATA_RESPONSE = "invalid_data_response"
|
66
|
+
INVALID_EXCHANGE_KEY = "invalid_exchange_key"
|
67
|
+
INVALID_MARGIN_MODE = "invalid_margin_mode"
|
68
|
+
INVALID_PARAMETER_PROVIDED = "invalid_parameter_provided"
|
69
|
+
JWT_EXPIRED = "jwt_expired"
|
70
|
+
LEVERAGE_LIMIT_EXCEEDED = "leverage_limit_exceeded"
|
71
|
+
ORDER_VIOLATES_LIQUIDATION_PRICE_CONSTRAINTS = (
|
72
|
+
"order_violates_liquidation_price_constraints"
|
73
|
+
)
|
74
|
+
NO_CREDENTIALS = "no_credentials"
|
75
|
+
NOW_API_DOWN = "now_api_down"
|
76
|
+
OBJECT_NOT_FOUND = "object_not_found"
|
77
|
+
OBJECT_ALREADY_EXISTS = "object_already_exists"
|
78
|
+
ORDER_IS_ALREADY_FILLED = "order_is_already_filled"
|
79
|
+
ORDER_IS_BEING_PROCESSED = "order_is_being_processed"
|
80
|
+
ORDER_QUANTITY_LIMIT_EXCEEDED = "order_quantity_limit_exceeded"
|
81
|
+
ORDER_DOES_NOT_EXIST = "order_does_not_exist"
|
82
|
+
ORDER_PRICE_IS_INVALID = "order_price_is_invalid"
|
83
|
+
ORDER_SIZE_TOO_LARGE = "order_size_too_large"
|
84
|
+
ORDER_SIZE_TOO_SMALL = "order_size_too_small"
|
85
|
+
POSITION_LIMIT_EXCEEDED = "position_limit_exceeded"
|
86
|
+
POSITION_DOES_NOT_EXIST = "position_does_not_exist"
|
87
|
+
POSITION_OPENING_TEMPORARILY_SUSPENDED = "position_opening_temporarily_suspended"
|
88
|
+
POST_ONLY_ORDER_WOULD_IMMEDIATELY_MATCH = "post_only_order_would_immediately_match"
|
89
|
+
REQUEST_SCOPE_LIMIT_EXCEEDED = "request_scope_limit_exceeded"
|
90
|
+
RISK_LIMIT_EXCEEDED = "risk_limit_exceeded"
|
91
|
+
RPC_TIMEOUT = "rpc_timeout"
|
92
|
+
SYSTEM_SETTLEMENT_IN_PROCESS = "system_settlement_in_process"
|
93
|
+
STRATEGY_DISABLED = "strategy_disabled"
|
94
|
+
STRATEGY_LEVERAGE_MISMATCH = "strategy_leverage_mismatch"
|
95
|
+
STRATEGY_NOT_SUPPORTING_EXCHANGE = "strategy_not_supporting_exchange"
|
96
|
+
SUCCESS = "success"
|
97
|
+
SYMBOL_DOES_NOT_EXIST = "symbol_does_not_exist"
|
98
|
+
TRADING_ACTION_EXPIRED = "trading_action_expired"
|
99
|
+
TRADING_ACTION_SKIPPED = "trading_action_skipped"
|
100
|
+
TRADING_HAS_BEEN_LOCKED = "trading_has_been_locked"
|
101
|
+
TRADING_IS_SUSPENDED = "trading_is_suspended"
|
102
|
+
UNKNOWN_ERROR_OCCURRED = "unknown_error_occurred"
|
103
|
+
REQUESTED_RESOURCE_NOT_FOUND = "requested_resource_not_found"
|
104
|
+
|
105
|
+
@classmethod
|
106
|
+
def from_json(cls, json_str: str) -> Self:
|
107
|
+
"""Create an instance of ApiErrorIdentifier from a JSON string"""
|
108
|
+
return cls(json.loads(json_str))
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Klines Service API
|
5
|
+
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.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 ApiErrorLevel(str, Enum):
|
22
|
+
"""
|
23
|
+
API error levels
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
ERROR = "error"
|
30
|
+
INFO = "info"
|
31
|
+
SUCCESS = "success"
|
32
|
+
WARNING = "warning"
|
33
|
+
|
34
|
+
@classmethod
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
36
|
+
"""Create an instance of ApiErrorLevel from a JSON string"""
|
37
|
+
return cls(json.loads(json_str))
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Klines Service API
|
5
|
+
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.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 ApiErrorType(str, Enum):
|
22
|
+
"""
|
23
|
+
Type of API error
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
USER_ERROR = "user error"
|
30
|
+
EXCHANGE_ERROR = "exchange error"
|
31
|
+
SERVER_ERROR = "server error"
|
32
|
+
NO_ERROR = "no error"
|
33
|
+
|
34
|
+
@classmethod
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
36
|
+
"""Create an instance of ApiErrorType from a JSON string"""
|
37
|
+
return cls(json.loads(json_str))
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Klines Service API
|
5
|
+
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Union
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
|
26
|
+
class ChangeInTimeframe(BaseModel):
|
27
|
+
"""
|
28
|
+
ChangeInTimeframe
|
29
|
+
""" # noqa: E501
|
30
|
+
|
31
|
+
pair: StrictStr
|
32
|
+
change: Union[StrictFloat, StrictInt]
|
33
|
+
__properties: ClassVar[List[str]] = ["pair", "change"]
|
34
|
+
|
35
|
+
model_config = ConfigDict(
|
36
|
+
populate_by_name=True,
|
37
|
+
validate_assignment=True,
|
38
|
+
protected_namespaces=(),
|
39
|
+
)
|
40
|
+
|
41
|
+
def to_str(self) -> str:
|
42
|
+
"""Returns the string representation of the model using alias"""
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
44
|
+
|
45
|
+
def to_json(self) -> str:
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
47
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
48
|
+
return json.dumps(self.to_dict())
|
49
|
+
|
50
|
+
@classmethod
|
51
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
52
|
+
"""Create an instance of ChangeInTimeframe from a JSON string"""
|
53
|
+
return cls.from_dict(json.loads(json_str))
|
54
|
+
|
55
|
+
def to_dict(self) -> Dict[str, Any]:
|
56
|
+
"""Return the dictionary representation of the model using alias.
|
57
|
+
|
58
|
+
This has the following differences from calling pydantic's
|
59
|
+
`self.model_dump(by_alias=True)`:
|
60
|
+
|
61
|
+
* `None` is only added to the output dict for nullable fields that
|
62
|
+
were set at model initialization. Other fields with value `None`
|
63
|
+
are ignored.
|
64
|
+
"""
|
65
|
+
excluded_fields: Set[str] = set([])
|
66
|
+
|
67
|
+
_dict = self.model_dump(
|
68
|
+
by_alias=True,
|
69
|
+
exclude=excluded_fields,
|
70
|
+
exclude_none=True,
|
71
|
+
)
|
72
|
+
return _dict
|
73
|
+
|
74
|
+
@classmethod
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
76
|
+
"""Create an instance of ChangeInTimeframe from a dict"""
|
77
|
+
if obj is None:
|
78
|
+
return None
|
79
|
+
|
80
|
+
if not isinstance(obj, dict):
|
81
|
+
return cls.model_validate(obj)
|
82
|
+
|
83
|
+
_obj = cls.model_validate(
|
84
|
+
{"pair": obj.get("pair"), "change": obj.get("change")}
|
85
|
+
)
|
86
|
+
return _obj
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Klines Service API
|
5
|
+
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.klines.client.models.api_error_identifier import ApiErrorIdentifier
|
23
|
+
from crypticorn.klines.client.models.api_error_level import ApiErrorLevel
|
24
|
+
from crypticorn.klines.client.models.api_error_type import ApiErrorType
|
25
|
+
from typing import Optional, Set
|
26
|
+
from typing_extensions import Self
|
27
|
+
|
28
|
+
|
29
|
+
class ExceptionDetail(BaseModel):
|
30
|
+
"""
|
31
|
+
This is the detail of the exception. It is used to enrich the exception with additional information by unwrapping the ApiError into its components.
|
32
|
+
""" # noqa: E501
|
33
|
+
|
34
|
+
message: Optional[StrictStr] = None
|
35
|
+
code: ApiErrorIdentifier = Field(description="The unique error code")
|
36
|
+
type: ApiErrorType = Field(description="The type of error")
|
37
|
+
level: ApiErrorLevel = Field(description="The level of the error")
|
38
|
+
status_code: StrictInt = Field(description="The HTTP status code")
|
39
|
+
details: Optional[Any] = None
|
40
|
+
__properties: ClassVar[List[str]] = [
|
41
|
+
"message",
|
42
|
+
"code",
|
43
|
+
"type",
|
44
|
+
"level",
|
45
|
+
"status_code",
|
46
|
+
"details",
|
47
|
+
]
|
48
|
+
|
49
|
+
model_config = ConfigDict(
|
50
|
+
populate_by_name=True,
|
51
|
+
validate_assignment=True,
|
52
|
+
protected_namespaces=(),
|
53
|
+
)
|
54
|
+
|
55
|
+
def to_str(self) -> str:
|
56
|
+
"""Returns the string representation of the model using alias"""
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
58
|
+
|
59
|
+
def to_json(self) -> str:
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
62
|
+
return json.dumps(self.to_dict())
|
63
|
+
|
64
|
+
@classmethod
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
66
|
+
"""Create an instance of ExceptionDetail from a JSON string"""
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
68
|
+
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
71
|
+
|
72
|
+
This has the following differences from calling pydantic's
|
73
|
+
`self.model_dump(by_alias=True)`:
|
74
|
+
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
76
|
+
were set at model initialization. Other fields with value `None`
|
77
|
+
are ignored.
|
78
|
+
"""
|
79
|
+
excluded_fields: Set[str] = set([])
|
80
|
+
|
81
|
+
_dict = self.model_dump(
|
82
|
+
by_alias=True,
|
83
|
+
exclude=excluded_fields,
|
84
|
+
exclude_none=True,
|
85
|
+
)
|
86
|
+
# set to None if message (nullable) is None
|
87
|
+
# and model_fields_set contains the field
|
88
|
+
if self.message is None and "message" in self.model_fields_set:
|
89
|
+
_dict["message"] = None
|
90
|
+
|
91
|
+
# set to None if details (nullable) is None
|
92
|
+
# and model_fields_set contains the field
|
93
|
+
if self.details is None and "details" in self.model_fields_set:
|
94
|
+
_dict["details"] = None
|
95
|
+
|
96
|
+
return _dict
|
97
|
+
|
98
|
+
@classmethod
|
99
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
100
|
+
"""Create an instance of ExceptionDetail from a dict"""
|
101
|
+
if obj is None:
|
102
|
+
return None
|
103
|
+
|
104
|
+
if not isinstance(obj, dict):
|
105
|
+
return cls.model_validate(obj)
|
106
|
+
|
107
|
+
_obj = cls.model_validate(
|
108
|
+
{
|
109
|
+
"message": obj.get("message"),
|
110
|
+
"code": obj.get("code"),
|
111
|
+
"type": obj.get("type"),
|
112
|
+
"level": obj.get("level"),
|
113
|
+
"status_code": obj.get("status_code"),
|
114
|
+
"details": obj.get("details"),
|
115
|
+
}
|
116
|
+
)
|
117
|
+
return _obj
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Klines Service API
|
5
|
+
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from datetime import datetime
|
21
|
+
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr
|
22
|
+
from typing import Any, ClassVar, Dict, List, Union
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
|
27
|
+
class FundingRate(BaseModel):
|
28
|
+
"""
|
29
|
+
FundingRate
|
30
|
+
""" # noqa: E501
|
31
|
+
|
32
|
+
symbol: StrictStr
|
33
|
+
timestamp: datetime
|
34
|
+
funding_rate: Union[StrictFloat, StrictInt]
|
35
|
+
__properties: ClassVar[List[str]] = ["symbol", "timestamp", "funding_rate"]
|
36
|
+
|
37
|
+
model_config = ConfigDict(
|
38
|
+
populate_by_name=True,
|
39
|
+
validate_assignment=True,
|
40
|
+
protected_namespaces=(),
|
41
|
+
)
|
42
|
+
|
43
|
+
def to_str(self) -> str:
|
44
|
+
"""Returns the string representation of the model using alias"""
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
46
|
+
|
47
|
+
def to_json(self) -> str:
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
50
|
+
return json.dumps(self.to_dict())
|
51
|
+
|
52
|
+
@classmethod
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
54
|
+
"""Create an instance of FundingRate from a JSON string"""
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
56
|
+
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
59
|
+
|
60
|
+
This has the following differences from calling pydantic's
|
61
|
+
`self.model_dump(by_alias=True)`:
|
62
|
+
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
64
|
+
were set at model initialization. Other fields with value `None`
|
65
|
+
are ignored.
|
66
|
+
"""
|
67
|
+
excluded_fields: Set[str] = set([])
|
68
|
+
|
69
|
+
_dict = self.model_dump(
|
70
|
+
by_alias=True,
|
71
|
+
exclude=excluded_fields,
|
72
|
+
exclude_none=True,
|
73
|
+
)
|
74
|
+
return _dict
|
75
|
+
|
76
|
+
@classmethod
|
77
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
78
|
+
"""Create an instance of FundingRate from a dict"""
|
79
|
+
if obj is None:
|
80
|
+
return None
|
81
|
+
|
82
|
+
if not isinstance(obj, dict):
|
83
|
+
return cls.model_validate(obj)
|
84
|
+
|
85
|
+
_obj = cls.model_validate(
|
86
|
+
{
|
87
|
+
"symbol": obj.get("symbol"),
|
88
|
+
"timestamp": obj.get("timestamp"),
|
89
|
+
"funding_rate": obj.get("funding_rate"),
|
90
|
+
}
|
91
|
+
)
|
92
|
+
return _obj
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Klines Service API
|
5
|
+
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.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 InternalExchange(str, Enum):
|
22
|
+
"""
|
23
|
+
All exchanges we are using, including public (Exchange)
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
KUCOIN = "kucoin"
|
30
|
+
BINGX = "bingx"
|
31
|
+
BINANCE = "binance"
|
32
|
+
BYBIT = "bybit"
|
33
|
+
HYPERLIQUID = "hyperliquid"
|
34
|
+
BITGET = "bitget"
|
35
|
+
|
36
|
+
@classmethod
|
37
|
+
def from_json(cls, json_str: str) -> Self:
|
38
|
+
"""Create an instance of InternalExchange from a JSON string"""
|
39
|
+
return cls(json.loads(json_str))
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Klines Service API
|
5
5
|
|
6
|
-
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Klines Service API
|
5
|
+
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 1.0.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 pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from datetime import datetime
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt
|
22
|
+
from typing import Any, ClassVar, Dict, List, Union
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
|
27
|
+
class OHLCVHistory(BaseModel):
|
28
|
+
"""
|
29
|
+
OHLCVHistory
|
30
|
+
""" # noqa: E501
|
31
|
+
|
32
|
+
timestamps: List[datetime] = Field(description="Timestamps in seconds")
|
33
|
+
open: List[Union[StrictFloat, StrictInt]] = Field(description="Open prices")
|
34
|
+
high: List[Union[StrictFloat, StrictInt]] = Field(description="High prices")
|
35
|
+
low: List[Union[StrictFloat, StrictInt]] = Field(description="Low prices")
|
36
|
+
close: List[Union[StrictFloat, StrictInt]] = Field(description="Close prices")
|
37
|
+
volume: List[Union[StrictFloat, StrictInt]] = Field(description="Volume")
|
38
|
+
__properties: ClassVar[List[str]] = [
|
39
|
+
"timestamps",
|
40
|
+
"open",
|
41
|
+
"high",
|
42
|
+
"low",
|
43
|
+
"close",
|
44
|
+
"volume",
|
45
|
+
]
|
46
|
+
|
47
|
+
model_config = ConfigDict(
|
48
|
+
populate_by_name=True,
|
49
|
+
validate_assignment=True,
|
50
|
+
protected_namespaces=(),
|
51
|
+
)
|
52
|
+
|
53
|
+
def to_str(self) -> str:
|
54
|
+
"""Returns the string representation of the model using alias"""
|
55
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
56
|
+
|
57
|
+
def to_json(self) -> str:
|
58
|
+
"""Returns the JSON representation of the model using alias"""
|
59
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
60
|
+
return json.dumps(self.to_dict())
|
61
|
+
|
62
|
+
@classmethod
|
63
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
64
|
+
"""Create an instance of OHLCVHistory from a JSON string"""
|
65
|
+
return cls.from_dict(json.loads(json_str))
|
66
|
+
|
67
|
+
def to_dict(self) -> Dict[str, Any]:
|
68
|
+
"""Return the dictionary representation of the model using alias.
|
69
|
+
|
70
|
+
This has the following differences from calling pydantic's
|
71
|
+
`self.model_dump(by_alias=True)`:
|
72
|
+
|
73
|
+
* `None` is only added to the output dict for nullable fields that
|
74
|
+
were set at model initialization. Other fields with value `None`
|
75
|
+
are ignored.
|
76
|
+
"""
|
77
|
+
excluded_fields: Set[str] = set([])
|
78
|
+
|
79
|
+
_dict = self.model_dump(
|
80
|
+
by_alias=True,
|
81
|
+
exclude=excluded_fields,
|
82
|
+
exclude_none=True,
|
83
|
+
)
|
84
|
+
return _dict
|
85
|
+
|
86
|
+
@classmethod
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
88
|
+
"""Create an instance of OHLCVHistory from a dict"""
|
89
|
+
if obj is None:
|
90
|
+
return None
|
91
|
+
|
92
|
+
if not isinstance(obj, dict):
|
93
|
+
return cls.model_validate(obj)
|
94
|
+
|
95
|
+
_obj = cls.model_validate(
|
96
|
+
{
|
97
|
+
"timestamps": obj.get("timestamps"),
|
98
|
+
"open": obj.get("open"),
|
99
|
+
"high": obj.get("high"),
|
100
|
+
"low": obj.get("low"),
|
101
|
+
"close": obj.get("close"),
|
102
|
+
"volume": obj.get("volume"),
|
103
|
+
}
|
104
|
+
)
|
105
|
+
return _obj
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"""
|
4
4
|
Klines Service API
|
5
5
|
|
6
|
-
|
6
|
+
API for retrieving OHLCV data, funding rates, and symbol information from Binance.
|
7
7
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|