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,115 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Klines Service API
5
+
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
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, StrictBool, StrictInt, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class SymbolInfoResponse(BaseModel):
26
+ """
27
+ SymbolInfoResponse
28
+ """ # noqa: E501
29
+ name: StrictStr
30
+ exchange_traded: StrictStr = Field(alias="exchange-traded")
31
+ exchange_listed: StrictStr = Field(alias="exchange-listed")
32
+ timezone: StrictStr
33
+ minmov: StrictInt
34
+ minmov2: StrictInt
35
+ pointvalue: StrictInt
36
+ session: StrictStr
37
+ has_intraday: StrictBool
38
+ has_no_volume: StrictBool
39
+ description: StrictStr
40
+ type: StrictStr
41
+ supported_resolutions: List[StrictStr]
42
+ pricescale: StrictInt
43
+ ticker: StrictStr
44
+ __properties: ClassVar[List[str]] = ["name", "exchange-traded", "exchange-listed", "timezone", "minmov", "minmov2", "pointvalue", "session", "has_intraday", "has_no_volume", "description", "type", "supported_resolutions", "pricescale", "ticker"]
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
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 SymbolInfoResponse 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
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of SymbolInfoResponse from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "name": obj.get("name"),
98
+ "exchange-traded": obj.get("exchange-traded"),
99
+ "exchange-listed": obj.get("exchange-listed"),
100
+ "timezone": obj.get("timezone"),
101
+ "minmov": obj.get("minmov"),
102
+ "minmov2": obj.get("minmov2"),
103
+ "pointvalue": obj.get("pointvalue"),
104
+ "session": obj.get("session"),
105
+ "has_intraday": obj.get("has_intraday"),
106
+ "has_no_volume": obj.get("has_no_volume"),
107
+ "description": obj.get("description"),
108
+ "type": obj.get("type"),
109
+ "supported_resolutions": obj.get("supported_resolutions"),
110
+ "pricescale": obj.get("pricescale"),
111
+ "ticker": obj.get("ticker")
112
+ })
113
+ return _obj
114
+
115
+
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- FastAPI
4
+ Klines Service API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
7
7
 
8
- The version of the OpenAPI document: 0.1.0
8
+ The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -17,17 +17,18 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List
22
22
  from typing import Optional, Set
23
23
  from typing_extensions import Self
24
24
 
25
- class ID(BaseModel):
25
+ class SymbolType(BaseModel):
26
26
  """
27
- ID
27
+ SymbolType
28
28
  """ # noqa: E501
29
- id: StrictStr = Field(description="UID, required in the request body")
30
- __properties: ClassVar[List[str]] = ["id"]
29
+ name: StrictStr
30
+ value: StrictStr
31
+ __properties: ClassVar[List[str]] = ["name", "value"]
31
32
 
32
33
  model_config = ConfigDict(
33
34
  populate_by_name=True,
@@ -47,7 +48,7 @@ class ID(BaseModel):
47
48
 
48
49
  @classmethod
49
50
  def from_json(cls, json_str: str) -> Optional[Self]:
50
- """Create an instance of ID from a JSON string"""
51
+ """Create an instance of SymbolType from a JSON string"""
51
52
  return cls.from_dict(json.loads(json_str))
52
53
 
53
54
  def to_dict(self) -> Dict[str, Any]:
@@ -72,7 +73,7 @@ class ID(BaseModel):
72
73
 
73
74
  @classmethod
74
75
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
- """Create an instance of ID from a dict"""
76
+ """Create an instance of SymbolType from a dict"""
76
77
  if obj is None:
77
78
  return None
78
79
 
@@ -80,7 +81,8 @@ class ID(BaseModel):
80
81
  return cls.model_validate(obj)
81
82
 
82
83
  _obj = cls.model_validate({
83
- "id": obj.get("id")
84
+ "name": obj.get("name"),
85
+ "value": obj.get("value")
84
86
  })
85
87
  return _obj
86
88
 
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Klines Service API
5
+
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
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 Timeframe(str, Enum):
22
+ """
23
+ Timeframe
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ ENUM_15M = '15m'
30
+ ENUM_30M = '30m'
31
+ ENUM_1H = '1h'
32
+ ENUM_4H = '4h'
33
+ ENUM_1D = '1d'
34
+
35
+ @classmethod
36
+ def from_json(cls, json_str: str) -> Self:
37
+ """Create an instance of Timeframe from a JSON string"""
38
+ return cls(json.loads(json_str))
39
+
40
+
@@ -0,0 +1,121 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Klines Service API
5
+
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
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, StrictBool, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from crypticorn.klines.client.models.exchange import Exchange
23
+ from crypticorn.klines.client.models.symbol_type import SymbolType
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class UDFConfigResponse(BaseModel):
28
+ """
29
+ UDFConfigResponse
30
+ """ # noqa: E501
31
+ supported_resolutions: List[StrictStr]
32
+ supports_group_request: Optional[StrictBool] = False
33
+ supports_marks: Optional[StrictBool] = False
34
+ supports_search: Optional[StrictBool] = True
35
+ supports_timescale_marks: Optional[StrictBool] = False
36
+ supports_time: Optional[StrictBool] = True
37
+ exchanges: List[Exchange]
38
+ symbols_types: List[SymbolType]
39
+ currency_codes: List[StrictStr]
40
+ supported_markets: List[StrictStr]
41
+ __properties: ClassVar[List[str]] = ["supported_resolutions", "supports_group_request", "supports_marks", "supports_search", "supports_timescale_marks", "supports_time", "exchanges", "symbols_types", "currency_codes", "supported_markets"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of UDFConfigResponse from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ # override the default output from pydantic by calling `to_dict()` of each item in exchanges (list)
83
+ _items = []
84
+ if self.exchanges:
85
+ for _item_exchanges in self.exchanges:
86
+ if _item_exchanges:
87
+ _items.append(_item_exchanges.to_dict())
88
+ _dict['exchanges'] = _items
89
+ # override the default output from pydantic by calling `to_dict()` of each item in symbols_types (list)
90
+ _items = []
91
+ if self.symbols_types:
92
+ for _item_symbols_types in self.symbols_types:
93
+ if _item_symbols_types:
94
+ _items.append(_item_symbols_types.to_dict())
95
+ _dict['symbols_types'] = _items
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
+ """Create an instance of UDFConfigResponse 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
+ "supported_resolutions": obj.get("supported_resolutions"),
109
+ "supports_group_request": obj.get("supports_group_request") if obj.get("supports_group_request") is not None else False,
110
+ "supports_marks": obj.get("supports_marks") if obj.get("supports_marks") is not None else False,
111
+ "supports_search": obj.get("supports_search") if obj.get("supports_search") is not None else True,
112
+ "supports_timescale_marks": obj.get("supports_timescale_marks") if obj.get("supports_timescale_marks") is not None else False,
113
+ "supports_time": obj.get("supports_time") if obj.get("supports_time") is not None else True,
114
+ "exchanges": [Exchange.from_dict(_item) for _item in obj["exchanges"]] if obj.get("exchanges") is not None else None,
115
+ "symbols_types": [SymbolType.from_dict(_item) for _item in obj["symbols_types"]] if obj.get("symbols_types") is not None else None,
116
+ "currency_codes": obj.get("currency_codes"),
117
+ "supported_markets": obj.get("supported_markets")
118
+ })
119
+ return _obj
120
+
121
+
@@ -0,0 +1,99 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Klines Service API
5
+
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from crypticorn.klines.client.models.validation_error_loc_inner import ValidationErrorLocInner
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ValidationError(BaseModel):
27
+ """
28
+ ValidationError
29
+ """ # noqa: E501
30
+ loc: List[ValidationErrorLocInner]
31
+ msg: StrictStr
32
+ type: StrictStr
33
+ __properties: ClassVar[List[str]] = ["loc", "msg", "type"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of ValidationError from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of each item in loc (list)
75
+ _items = []
76
+ if self.loc:
77
+ for _item_loc in self.loc:
78
+ if _item_loc:
79
+ _items.append(_item_loc.to_dict())
80
+ _dict['loc'] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of ValidationError from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({
93
+ "loc": [ValidationErrorLocInner.from_dict(_item) for _item in obj["loc"]] if obj.get("loc") is not None else None,
94
+ "msg": obj.get("msg"),
95
+ "type": obj.get("type")
96
+ })
97
+ return _obj
98
+
99
+
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
3
  """
4
- FastAPI
4
+ Klines Service API
5
5
 
6
- No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
6
+ API for retrieving OHLCV data, funding rates, and symbol information from Binance. ## WebSocket Support Connect to `/ws` to receive real-time OHLCV updates. Example subscription message: ```json { \"action\": \"subscribe\", \"market\": \"spot\", \"symbol\": \"BTCUSDT\", \"timeframe\": \"15m\" } ```
7
7
 
8
- The version of the OpenAPI document: 0.1.0
8
+ The version of the OpenAPI document: 1.0.0
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -17,30 +17,28 @@ from inspect import getfullargspec
17
17
  import json
18
18
  import pprint
19
19
  import re # noqa: F401
20
- from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, ValidationError, field_validator
21
21
  from typing import Optional
22
- from crypticorn.models.futures_balance import FuturesBalance
23
- from crypticorn.models.futures_balance_error import FuturesBalanceError
24
22
  from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
25
23
  from typing_extensions import Literal, Self
26
24
  from pydantic import Field
27
25
 
28
- GETFUTURESBALANCE200RESPONSEINNER_ANY_OF_SCHEMAS = ["FuturesBalance", "FuturesBalanceError"]
26
+ VALIDATIONERRORLOCINNER_ANY_OF_SCHEMAS = ["int", "str"]
29
27
 
30
- class GetFuturesBalance200ResponseInner(BaseModel):
28
+ class ValidationErrorLocInner(BaseModel):
31
29
  """
32
- GetFuturesBalance200ResponseInner
30
+ ValidationErrorLocInner
33
31
  """
34
32
 
35
- # data type: FuturesBalance
36
- anyof_schema_1_validator: Optional[FuturesBalance] = None
37
- # data type: FuturesBalanceError
38
- anyof_schema_2_validator: Optional[FuturesBalanceError] = None
33
+ # data type: str
34
+ anyof_schema_1_validator: Optional[StrictStr] = None
35
+ # data type: int
36
+ anyof_schema_2_validator: Optional[StrictInt] = None
39
37
  if TYPE_CHECKING:
40
- actual_instance: Optional[Union[FuturesBalance, FuturesBalanceError]] = None
38
+ actual_instance: Optional[Union[int, str]] = None
41
39
  else:
42
40
  actual_instance: Any = None
43
- any_of_schemas: Set[str] = { "FuturesBalance", "FuturesBalanceError" }
41
+ any_of_schemas: Set[str] = { "int", "str" }
44
42
 
45
43
  model_config = {
46
44
  "validate_assignment": True,
@@ -59,23 +57,23 @@ class GetFuturesBalance200ResponseInner(BaseModel):
59
57
 
60
58
  @field_validator('actual_instance')
61
59
  def actual_instance_must_validate_anyof(cls, v):
62
- instance = GetFuturesBalance200ResponseInner.model_construct()
60
+ instance = ValidationErrorLocInner.model_construct()
63
61
  error_messages = []
64
- # validate data type: FuturesBalance
65
- if not isinstance(v, FuturesBalance):
66
- error_messages.append(f"Error! Input type `{type(v)}` is not `FuturesBalance`")
67
- else:
62
+ # validate data type: str
63
+ try:
64
+ instance.anyof_schema_1_validator = v
68
65
  return v
69
-
70
- # validate data type: FuturesBalanceError
71
- if not isinstance(v, FuturesBalanceError):
72
- error_messages.append(f"Error! Input type `{type(v)}` is not `FuturesBalanceError`")
73
- else:
66
+ except (ValidationError, ValueError) as e:
67
+ error_messages.append(str(e))
68
+ # validate data type: int
69
+ try:
70
+ instance.anyof_schema_2_validator = v
74
71
  return v
75
-
72
+ except (ValidationError, ValueError) as e:
73
+ error_messages.append(str(e))
76
74
  if error_messages:
77
75
  # no match
78
- raise ValueError("No match found when setting the actual_instance in GetFuturesBalance200ResponseInner with anyOf schemas: FuturesBalance, FuturesBalanceError. Details: " + ", ".join(error_messages))
76
+ raise ValueError("No match found when setting the actual_instance in ValidationErrorLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
79
77
  else:
80
78
  return v
81
79
 
@@ -88,22 +86,28 @@ class GetFuturesBalance200ResponseInner(BaseModel):
88
86
  """Returns the object represented by the json string"""
89
87
  instance = cls.model_construct()
90
88
  error_messages = []
91
- # anyof_schema_1_validator: Optional[FuturesBalance] = None
89
+ # deserialize data into str
92
90
  try:
93
- instance.actual_instance = FuturesBalance.from_json(json_str)
91
+ # validation
92
+ instance.anyof_schema_1_validator = json.loads(json_str)
93
+ # assign value to actual_instance
94
+ instance.actual_instance = instance.anyof_schema_1_validator
94
95
  return instance
95
96
  except (ValidationError, ValueError) as e:
96
- error_messages.append(str(e))
97
- # anyof_schema_2_validator: Optional[FuturesBalanceError] = None
97
+ error_messages.append(str(e))
98
+ # deserialize data into int
98
99
  try:
99
- instance.actual_instance = FuturesBalanceError.from_json(json_str)
100
+ # validation
101
+ instance.anyof_schema_2_validator = json.loads(json_str)
102
+ # assign value to actual_instance
103
+ instance.actual_instance = instance.anyof_schema_2_validator
100
104
  return instance
101
105
  except (ValidationError, ValueError) as e:
102
- error_messages.append(str(e))
106
+ error_messages.append(str(e))
103
107
 
104
108
  if error_messages:
105
109
  # no match
106
- raise ValueError("No match found when deserializing the JSON string into GetFuturesBalance200ResponseInner with anyOf schemas: FuturesBalance, FuturesBalanceError. Details: " + ", ".join(error_messages))
110
+ raise ValueError("No match found when deserializing the JSON string into ValidationErrorLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
107
111
  else:
108
112
  return instance
109
113
 
@@ -117,7 +121,7 @@ class GetFuturesBalance200ResponseInner(BaseModel):
117
121
  else:
118
122
  return json.dumps(self.actual_instance)
119
123
 
120
- def to_dict(self) -> Optional[Union[Dict[str, Any], FuturesBalance, FuturesBalanceError]]:
124
+ def to_dict(self) -> Optional[Union[Dict[str, Any], int, str]]:
121
125
  """Returns the dict representation of the actual instance"""
122
126
  if self.actual_instance is None:
123
127
  return None
File without changes