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.
Files changed (259) hide show
  1. crypticorn/__init__.py +3 -3
  2. crypticorn/auth/__init__.py +2 -0
  3. crypticorn/auth/client/__init__.py +112 -0
  4. crypticorn/auth/client/api/__init__.py +8 -0
  5. crypticorn/auth/client/api/admin_api.py +522 -0
  6. crypticorn/auth/client/api/auth_api.py +2089 -0
  7. crypticorn/auth/client/api/service_api.py +309 -0
  8. crypticorn/auth/client/api/user_api.py +2540 -0
  9. crypticorn/auth/client/api/wallet_api.py +1698 -0
  10. crypticorn/auth/client/api_client.py +758 -0
  11. crypticorn/auth/client/api_response.py +20 -0
  12. crypticorn/auth/client/configuration.py +584 -0
  13. crypticorn/auth/client/exceptions.py +220 -0
  14. crypticorn/auth/client/models/__init__.py +91 -0
  15. crypticorn/auth/client/models/add_wallet200_response.py +86 -0
  16. crypticorn/auth/client/models/add_wallet_request.py +107 -0
  17. crypticorn/auth/client/models/authorize_user200_response.py +107 -0
  18. crypticorn/auth/client/models/authorize_user200_response_auth.py +101 -0
  19. crypticorn/auth/client/models/authorize_user_request.py +96 -0
  20. crypticorn/auth/client/models/create_user_request.py +114 -0
  21. crypticorn/auth/client/models/list_wallets200_response.py +137 -0
  22. crypticorn/auth/client/models/list_wallets200_response_balances_inner.py +115 -0
  23. crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +115 -0
  24. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +168 -0
  25. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +191 -0
  26. crypticorn/auth/client/models/list_wallets200_response_data_inner.py +102 -0
  27. crypticorn/auth/client/models/list_wallets200_response_user_value.py +118 -0
  28. crypticorn/auth/client/models/logout_default_response.py +108 -0
  29. crypticorn/auth/client/models/logout_default_response_issues_inner.py +83 -0
  30. crypticorn/auth/client/models/refresh_token_info200_response.py +97 -0
  31. crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +105 -0
  32. crypticorn/auth/client/models/resend_verification_email_request.py +84 -0
  33. crypticorn/auth/client/models/revoke_user_tokens_request.py +83 -0
  34. crypticorn/auth/client/models/rotate_tokens200_response.py +110 -0
  35. crypticorn/auth/client/models/token_info200_response.py +97 -0
  36. crypticorn/auth/client/models/unlink_wallet_request.py +83 -0
  37. crypticorn/auth/client/models/update_user_request.py +93 -0
  38. crypticorn/auth/client/models/user_reset_password_request.py +87 -0
  39. crypticorn/auth/client/models/user_set_password_request.py +89 -0
  40. crypticorn/auth/client/models/verify200_response.py +110 -0
  41. crypticorn/auth/client/models/verify_email200_response.py +107 -0
  42. crypticorn/auth/client/models/verify_email200_response_auth.py +101 -0
  43. crypticorn/auth/client/models/verify_email200_response_auth_auth.py +110 -0
  44. crypticorn/auth/client/models/verify_email_request.py +83 -0
  45. crypticorn/auth/client/models/verify_wallet_request.py +91 -0
  46. crypticorn/auth/client/models/wallet_verified200_response.py +83 -0
  47. crypticorn/auth/client/models/whoami200_response.py +104 -0
  48. crypticorn/auth/client/rest.py +195 -0
  49. crypticorn/auth/main.py +45 -0
  50. crypticorn/client.py +46 -8
  51. crypticorn/common/__init__.py +5 -0
  52. crypticorn/common/auth.py +43 -0
  53. crypticorn/common/auth_client.py +163 -0
  54. crypticorn/common/errors.py +432 -0
  55. crypticorn/common/scopes.py +29 -0
  56. crypticorn/common/urls.py +25 -0
  57. crypticorn/hive/__init__.py +2 -1
  58. crypticorn/hive/client/__init__.py +57 -0
  59. crypticorn/hive/client/api/__init__.py +6 -0
  60. crypticorn/hive/client/api/data_api.py +594 -0
  61. crypticorn/hive/client/api/models_api.py +1680 -0
  62. crypticorn/hive/client/api/status_api.py +263 -0
  63. crypticorn/hive/client/api_client.py +758 -0
  64. crypticorn/hive/client/api_response.py +20 -0
  65. crypticorn/hive/client/configuration.py +612 -0
  66. crypticorn/hive/client/exceptions.py +220 -0
  67. crypticorn/hive/client/models/__init__.py +38 -0
  68. crypticorn/hive/client/models/coins.py +44 -0
  69. crypticorn/hive/client/models/data_download_response.py +113 -0
  70. crypticorn/hive/client/models/data_info.py +115 -0
  71. crypticorn/hive/client/models/data_value_value_value_inner.py +154 -0
  72. crypticorn/hive/client/models/data_version.py +35 -0
  73. crypticorn/hive/client/models/download_links.py +91 -0
  74. crypticorn/hive/client/models/evaluation.py +86 -0
  75. crypticorn/hive/client/models/evaluation_response.py +85 -0
  76. crypticorn/hive/client/models/feature_size.py +36 -0
  77. crypticorn/hive/client/models/http_validation_error.py +99 -0
  78. crypticorn/hive/client/models/model.py +133 -0
  79. crypticorn/hive/client/models/model_create.py +93 -0
  80. crypticorn/hive/client/models/model_status.py +35 -0
  81. crypticorn/hive/client/models/model_update.py +83 -0
  82. crypticorn/hive/client/models/target.py +36 -0
  83. crypticorn/hive/client/models/target_type.py +35 -0
  84. crypticorn/hive/client/models/validation_error.py +105 -0
  85. crypticorn/hive/client/models/validation_error_loc_inner.py +159 -0
  86. crypticorn/hive/client/py.typed +0 -0
  87. crypticorn/hive/client/rest.py +195 -0
  88. crypticorn/hive/main.py +27 -100
  89. crypticorn/klines/client/__init__.py +21 -7
  90. crypticorn/klines/client/api/__init__.py +0 -1
  91. crypticorn/klines/client/api/funding_rates_api.py +90 -79
  92. crypticorn/klines/client/api/health_check_api.py +29 -45
  93. crypticorn/klines/client/api/ohlcv_data_api.py +104 -87
  94. crypticorn/klines/client/api/symbols_api.py +36 -54
  95. crypticorn/klines/client/api/udf_api.py +228 -352
  96. crypticorn/klines/client/api_client.py +106 -148
  97. crypticorn/klines/client/api_response.py +2 -3
  98. crypticorn/klines/client/configuration.py +64 -50
  99. crypticorn/klines/client/exceptions.py +20 -16
  100. crypticorn/klines/client/models/__init__.py +21 -7
  101. crypticorn/klines/client/models/base_response_health_check_response.py +21 -15
  102. crypticorn/klines/client/models/base_response_list_funding_rate_response.py +21 -15
  103. crypticorn/klines/client/models/base_response_list_str.py +16 -14
  104. crypticorn/klines/client/models/base_response_ohlcv_response.py +21 -15
  105. crypticorn/klines/client/models/error_response.py +23 -15
  106. crypticorn/klines/client/models/exchange.py +11 -11
  107. crypticorn/klines/client/models/funding_rate_response.py +11 -11
  108. crypticorn/klines/client/models/health_check_response.py +14 -12
  109. crypticorn/klines/client/models/history_error_response.py +11 -11
  110. crypticorn/klines/client/models/history_no_data_response.py +16 -16
  111. crypticorn/klines/client/models/history_success_response.py +16 -16
  112. crypticorn/klines/client/models/http_validation_error.py +14 -10
  113. crypticorn/klines/client/models/market.py +2 -4
  114. crypticorn/klines/client/models/ohlcv_response.py +22 -15
  115. crypticorn/klines/client/models/resolution.py +5 -7
  116. crypticorn/klines/client/models/response_get_history_udf_history_get.py +71 -22
  117. crypticorn/klines/client/models/search_symbol_response.py +22 -15
  118. crypticorn/klines/client/models/sort_direction.py +2 -4
  119. crypticorn/klines/client/models/symbol_group_response.py +5 -9
  120. crypticorn/klines/client/models/symbol_info_response.py +40 -24
  121. crypticorn/klines/client/models/symbol_type.py +5 -10
  122. crypticorn/klines/client/models/timeframe.py +5 -7
  123. crypticorn/klines/client/models/udf_config_response.py +60 -21
  124. crypticorn/klines/client/models/validation_error.py +19 -13
  125. crypticorn/klines/client/models/validation_error_loc_inner.py +32 -11
  126. crypticorn/klines/client/rest.py +30 -41
  127. crypticorn/klines/main.py +52 -15
  128. crypticorn/pay/__init__.py +2 -0
  129. crypticorn/pay/client/__init__.py +52 -0
  130. crypticorn/pay/client/api/__init__.py +7 -0
  131. crypticorn/pay/client/api/now_payments_api.py +813 -0
  132. crypticorn/pay/client/api/payments_api.py +799 -0
  133. crypticorn/pay/client/api/products_api.py +891 -0
  134. crypticorn/pay/client/api/status_api.py +260 -0
  135. crypticorn/pay/client/api_client.py +758 -0
  136. crypticorn/pay/client/api_response.py +20 -0
  137. crypticorn/pay/client/configuration.py +612 -0
  138. crypticorn/pay/client/exceptions.py +220 -0
  139. crypticorn/pay/client/models/__init__.py +32 -0
  140. crypticorn/pay/client/models/api_status_res.py +83 -0
  141. crypticorn/pay/client/models/combined_payment_history.py +101 -0
  142. crypticorn/pay/client/models/create_invoice_req.py +188 -0
  143. crypticorn/pay/client/models/create_invoice_res.py +188 -0
  144. crypticorn/pay/client/models/currency.py +165 -0
  145. crypticorn/pay/client/models/estimate_price_req.py +91 -0
  146. crypticorn/pay/client/models/estimate_price_res.py +102 -0
  147. crypticorn/pay/client/models/get_currencies_res.py +99 -0
  148. crypticorn/pay/client/models/get_payment_status_res.py +222 -0
  149. crypticorn/pay/client/models/get_payments_list_res.py +109 -0
  150. crypticorn/pay/client/models/http_validation_error.py +99 -0
  151. crypticorn/pay/client/models/min_amount_req.py +124 -0
  152. crypticorn/pay/client/models/min_amount_res.py +105 -0
  153. crypticorn/pay/client/models/now_api_status_res.py +83 -0
  154. crypticorn/pay/client/models/now_create_invoice_req.py +188 -0
  155. crypticorn/pay/client/models/now_create_invoice_res.py +188 -0
  156. crypticorn/pay/client/models/now_fee_structure.py +104 -0
  157. crypticorn/pay/client/models/now_payment_model.py +124 -0
  158. crypticorn/pay/client/models/now_payment_status.py +42 -0
  159. crypticorn/pay/client/models/now_webhook_payload.py +181 -0
  160. crypticorn/pay/client/models/payment.py +231 -0
  161. crypticorn/pay/client/models/payment_status.py +40 -0
  162. crypticorn/pay/client/models/product.py +87 -0
  163. crypticorn/pay/client/models/product_model.py +119 -0
  164. crypticorn/pay/client/models/product_subs_model.py +108 -0
  165. crypticorn/pay/client/models/services.py +34 -0
  166. crypticorn/pay/client/models/unified_payment_model.py +112 -0
  167. crypticorn/pay/client/models/validation_error.py +105 -0
  168. crypticorn/pay/client/models/validation_error_loc_inner.py +159 -0
  169. crypticorn/pay/client/py.typed +0 -0
  170. crypticorn/pay/client/rest.py +195 -0
  171. crypticorn/pay/main.py +35 -0
  172. crypticorn/trade/client/__init__.py +9 -4
  173. crypticorn/trade/client/api/__init__.py +0 -1
  174. crypticorn/trade/client/api/api_keys_api.py +203 -304
  175. crypticorn/trade/client/api/bots_api.py +177 -250
  176. crypticorn/trade/client/api/exchanges_api.py +38 -57
  177. crypticorn/trade/client/api/futures_trading_panel_api.py +223 -321
  178. crypticorn/trade/client/api/notifications_api.py +247 -364
  179. crypticorn/trade/client/api/orders_api.py +44 -63
  180. crypticorn/trade/client/api/status_api.py +35 -53
  181. crypticorn/trade/client/api/strategies_api.py +852 -64
  182. crypticorn/trade/client/api/trading_actions_api.py +126 -203
  183. crypticorn/trade/client/api_client.py +115 -154
  184. crypticorn/trade/client/api_response.py +2 -3
  185. crypticorn/trade/client/configuration.py +128 -90
  186. crypticorn/trade/client/exceptions.py +21 -17
  187. crypticorn/trade/client/models/__init__.py +9 -4
  188. crypticorn/trade/client/models/action_model.py +114 -50
  189. crypticorn/trade/client/models/api_error_identifier.py +60 -51
  190. crypticorn/trade/client/models/api_error_level.py +37 -0
  191. crypticorn/trade/client/models/api_error_type.py +37 -0
  192. crypticorn/trade/client/models/api_key_model.py +49 -28
  193. crypticorn/trade/client/models/bot_model.py +76 -31
  194. crypticorn/trade/client/models/bot_status.py +37 -0
  195. crypticorn/trade/client/models/exchange.py +3 -5
  196. crypticorn/trade/client/models/execution_ids.py +14 -14
  197. crypticorn/trade/client/models/futures_balance.py +39 -23
  198. crypticorn/trade/client/models/futures_trading_action.py +98 -46
  199. crypticorn/trade/client/models/http_validation_error.py +15 -11
  200. crypticorn/trade/client/models/margin_mode.py +3 -5
  201. crypticorn/trade/client/models/market_type.py +3 -5
  202. crypticorn/trade/client/models/notification_model.py +60 -27
  203. crypticorn/trade/client/models/notification_type.py +4 -6
  204. crypticorn/trade/client/models/order_model.py +125 -65
  205. crypticorn/trade/client/models/order_status.py +6 -8
  206. crypticorn/trade/client/models/post_futures_action.py +16 -12
  207. crypticorn/trade/client/models/strategy_exchange_info.py +11 -12
  208. crypticorn/trade/client/models/strategy_model.py +66 -27
  209. crypticorn/trade/client/models/strategy_model_input.py +160 -0
  210. crypticorn/trade/client/models/strategy_model_output.py +160 -0
  211. crypticorn/trade/client/models/tpsl.py +35 -21
  212. crypticorn/trade/client/models/trading_action_type.py +5 -7
  213. crypticorn/trade/client/models/update_notification.py +17 -13
  214. crypticorn/trade/client/models/validation_error.py +20 -14
  215. crypticorn/trade/client/models/validation_error_loc_inner.py +33 -12
  216. crypticorn/trade/client/rest.py +108 -170
  217. crypticorn/trade/main.py +26 -19
  218. crypticorn-2.0.0.dist-info/METADATA +74 -0
  219. crypticorn-2.0.0.dist-info/RECORD +226 -0
  220. {crypticorn-1.0.2rc3.dist-info → crypticorn-2.0.0.dist-info}/WHEEL +1 -1
  221. crypticorn/hive/requirements.txt +0 -4
  222. crypticorn/hive/utils.py +0 -109
  223. crypticorn/klines/requirements.txt +0 -4
  224. crypticorn/klines/test/test_base_response_health_check_response.py +0 -56
  225. crypticorn/klines/test/test_base_response_list_funding_rate_response.py +0 -59
  226. crypticorn/klines/test/test_base_response_list_str.py +0 -56
  227. crypticorn/klines/test/test_base_response_ohlcv_response.py +0 -72
  228. crypticorn/klines/test/test_error_response.py +0 -57
  229. crypticorn/klines/test/test_exchange.py +0 -56
  230. crypticorn/klines/test/test_funding_rate_response.py +0 -56
  231. crypticorn/klines/test/test_funding_rates_api.py +0 -38
  232. crypticorn/klines/test/test_health_check_api.py +0 -38
  233. crypticorn/klines/test/test_health_check_response.py +0 -52
  234. crypticorn/klines/test/test_history_error_response.py +0 -53
  235. crypticorn/klines/test/test_history_no_data_response.py +0 -69
  236. crypticorn/klines/test/test_history_success_response.py +0 -87
  237. crypticorn/klines/test/test_http_validation_error.py +0 -58
  238. crypticorn/klines/test/test_market.py +0 -33
  239. crypticorn/klines/test/test_ohlcv_data_api.py +0 -38
  240. crypticorn/klines/test/test_ohlcv_response.py +0 -86
  241. crypticorn/klines/test/test_resolution.py +0 -33
  242. crypticorn/klines/test/test_response_get_history_udf_history_get.py +0 -89
  243. crypticorn/klines/test/test_search_symbol_response.py +0 -62
  244. crypticorn/klines/test/test_sort_direction.py +0 -33
  245. crypticorn/klines/test/test_symbol_group_response.py +0 -53
  246. crypticorn/klines/test/test_symbol_info_response.py +0 -84
  247. crypticorn/klines/test/test_symbol_type.py +0 -54
  248. crypticorn/klines/test/test_symbols_api.py +0 -38
  249. crypticorn/klines/test/test_timeframe.py +0 -33
  250. crypticorn/klines/test/test_udf_api.py +0 -80
  251. crypticorn/klines/test/test_udf_config_response.py +0 -95
  252. crypticorn/klines/test/test_validation_error.py +0 -60
  253. crypticorn/klines/test/test_validation_error_loc_inner.py +0 -50
  254. crypticorn/trade/requirements.txt +0 -4
  255. crypticorn-1.0.2rc3.dist-info/LICENSE.md +0 -19
  256. crypticorn-1.0.2rc3.dist-info/METADATA +0 -47
  257. crypticorn-1.0.2rc3.dist-info/RECORD +0 -128
  258. /crypticorn/{klines/test/__init__.py → auth/client/py.typed} +0 -0
  259. {crypticorn-1.0.2rc3.dist-info → crypticorn-2.0.0.dist-info}/top_level.txt +0 -0
@@ -19,14 +19,18 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict, StrictStr
21
21
  from typing import Any, ClassVar, Dict, List
22
- from crypticorn.klines.client.models.validation_error_loc_inner import ValidationErrorLocInner
22
+ from crypticorn.klines.client.models.validation_error_loc_inner import (
23
+ ValidationErrorLocInner,
24
+ )
23
25
  from typing import Optional, Set
24
26
  from typing_extensions import Self
25
27
 
28
+
26
29
  class ValidationError(BaseModel):
27
30
  """
28
31
  ValidationError
29
- """ # noqa: E501
32
+ """ # noqa: E501
33
+
30
34
  loc: List[ValidationErrorLocInner]
31
35
  msg: StrictStr
32
36
  type: StrictStr
@@ -38,7 +42,6 @@ class ValidationError(BaseModel):
38
42
  protected_namespaces=(),
39
43
  )
40
44
 
41
-
42
45
  def to_str(self) -> str:
43
46
  """Returns the string representation of the model using alias"""
44
47
  return pprint.pformat(self.model_dump(by_alias=True))
@@ -63,8 +66,7 @@ class ValidationError(BaseModel):
63
66
  were set at model initialization. Other fields with value `None`
64
67
  are ignored.
65
68
  """
66
- excluded_fields: Set[str] = set([
67
- ])
69
+ excluded_fields: Set[str] = set([])
68
70
 
69
71
  _dict = self.model_dump(
70
72
  by_alias=True,
@@ -77,7 +79,7 @@ class ValidationError(BaseModel):
77
79
  for _item_loc in self.loc:
78
80
  if _item_loc:
79
81
  _items.append(_item_loc.to_dict())
80
- _dict['loc'] = _items
82
+ _dict["loc"] = _items
81
83
  return _dict
82
84
 
83
85
  @classmethod
@@ -89,11 +91,15 @@ class ValidationError(BaseModel):
89
91
  if not isinstance(obj, dict):
90
92
  return cls.model_validate(obj)
91
93
 
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
- })
94
+ _obj = cls.model_validate(
95
+ {
96
+ "loc": (
97
+ [ValidationErrorLocInner.from_dict(_item) for _item in obj["loc"]]
98
+ if obj.get("loc") is not None
99
+ else None
100
+ ),
101
+ "msg": obj.get("msg"),
102
+ "type": obj.get("type"),
103
+ }
104
+ )
97
105
  return _obj
98
-
99
-
@@ -17,7 +17,15 @@ 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, StrictInt, StrictStr, ValidationError, field_validator
20
+ from pydantic import (
21
+ BaseModel,
22
+ ConfigDict,
23
+ Field,
24
+ StrictInt,
25
+ StrictStr,
26
+ ValidationError,
27
+ field_validator,
28
+ )
21
29
  from typing import Optional
22
30
  from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
23
31
  from typing_extensions import Literal, Self
@@ -25,6 +33,7 @@ from pydantic import Field
25
33
 
26
34
  VALIDATIONERRORLOCINNER_ANY_OF_SCHEMAS = ["int", "str"]
27
35
 
36
+
28
37
  class ValidationErrorLocInner(BaseModel):
29
38
  """
30
39
  ValidationErrorLocInner
@@ -38,7 +47,7 @@ class ValidationErrorLocInner(BaseModel):
38
47
  actual_instance: Optional[Union[int, str]] = None
39
48
  else:
40
49
  actual_instance: Any = None
41
- any_of_schemas: Set[str] = { "int", "str" }
50
+ any_of_schemas: Set[str] = {"int", "str"}
42
51
 
43
52
  model_config = {
44
53
  "validate_assignment": True,
@@ -48,14 +57,18 @@ class ValidationErrorLocInner(BaseModel):
48
57
  def __init__(self, *args, **kwargs) -> None:
49
58
  if args:
50
59
  if len(args) > 1:
51
- raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
60
+ raise ValueError(
61
+ "If a position argument is used, only 1 is allowed to set `actual_instance`"
62
+ )
52
63
  if kwargs:
53
- raise ValueError("If a position argument is used, keyword arguments cannot be used.")
64
+ raise ValueError(
65
+ "If a position argument is used, keyword arguments cannot be used."
66
+ )
54
67
  super().__init__(actual_instance=args[0])
55
68
  else:
56
69
  super().__init__(**kwargs)
57
70
 
58
- @field_validator('actual_instance')
71
+ @field_validator("actual_instance")
59
72
  def actual_instance_must_validate_anyof(cls, v):
60
73
  instance = ValidationErrorLocInner.model_construct()
61
74
  error_messages = []
@@ -73,7 +86,10 @@ class ValidationErrorLocInner(BaseModel):
73
86
  error_messages.append(str(e))
74
87
  if error_messages:
75
88
  # no match
76
- raise ValueError("No match found when setting the actual_instance in ValidationErrorLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
89
+ raise ValueError(
90
+ "No match found when setting the actual_instance in ValidationErrorLocInner with anyOf schemas: int, str. Details: "
91
+ + ", ".join(error_messages)
92
+ )
77
93
  else:
78
94
  return v
79
95
 
@@ -107,7 +123,10 @@ class ValidationErrorLocInner(BaseModel):
107
123
 
108
124
  if error_messages:
109
125
  # no match
110
- raise ValueError("No match found when deserializing the JSON string into ValidationErrorLocInner with anyOf schemas: int, str. Details: " + ", ".join(error_messages))
126
+ raise ValueError(
127
+ "No match found when deserializing the JSON string into ValidationErrorLocInner with anyOf schemas: int, str. Details: "
128
+ + ", ".join(error_messages)
129
+ )
111
130
  else:
112
131
  return instance
113
132
 
@@ -116,7 +135,9 @@ class ValidationErrorLocInner(BaseModel):
116
135
  if self.actual_instance is None:
117
136
  return "null"
118
137
 
119
- if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
138
+ if hasattr(self.actual_instance, "to_json") and callable(
139
+ self.actual_instance.to_json
140
+ ):
120
141
  return self.actual_instance.to_json()
121
142
  else:
122
143
  return json.dumps(self.actual_instance)
@@ -126,7 +147,9 @@ class ValidationErrorLocInner(BaseModel):
126
147
  if self.actual_instance is None:
127
148
  return None
128
149
 
129
- if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
150
+ if hasattr(self.actual_instance, "to_dict") and callable(
151
+ self.actual_instance.to_dict
152
+ ):
130
153
  return self.actual_instance.to_dict()
131
154
  else:
132
155
  return self.actual_instance
@@ -134,5 +157,3 @@ class ValidationErrorLocInner(BaseModel):
134
157
  def to_str(self) -> str:
135
158
  """Returns the string representation of the actual instance"""
136
159
  return pprint.pformat(self.model_dump())
137
-
138
-
@@ -78,22 +78,19 @@ class RESTClientObject:
78
78
  "key_file": configuration.key_file,
79
79
  }
80
80
  if configuration.assert_hostname is not None:
81
- pool_args['assert_hostname'] = (
82
- configuration.assert_hostname
83
- )
81
+ pool_args["assert_hostname"] = configuration.assert_hostname
84
82
 
85
83
  if configuration.retries is not None:
86
- pool_args['retries'] = configuration.retries
84
+ pool_args["retries"] = configuration.retries
87
85
 
88
86
  if configuration.tls_server_name:
89
- pool_args['server_hostname'] = configuration.tls_server_name
90
-
87
+ pool_args["server_hostname"] = configuration.tls_server_name
91
88
 
92
89
  if configuration.socket_options is not None:
93
- pool_args['socket_options'] = configuration.socket_options
90
+ pool_args["socket_options"] = configuration.socket_options
94
91
 
95
92
  if configuration.connection_pool_maxsize is not None:
96
- pool_args['maxsize'] = configuration.connection_pool_maxsize
93
+ pool_args["maxsize"] = configuration.connection_pool_maxsize
97
94
 
98
95
  # https pool manager
99
96
  self.pool_manager: urllib3.PoolManager
@@ -101,6 +98,7 @@ class RESTClientObject:
101
98
  if configuration.proxy:
102
99
  if is_socks_proxy_url(configuration.proxy):
103
100
  from urllib3.contrib.socks import SOCKSProxyManager
101
+
104
102
  pool_args["proxy_url"] = configuration.proxy
105
103
  pool_args["headers"] = configuration.proxy_headers
106
104
  self.pool_manager = SOCKSProxyManager(**pool_args)
@@ -118,7 +116,7 @@ class RESTClientObject:
118
116
  headers=None,
119
117
  body=None,
120
118
  post_params=None,
121
- _request_timeout=None
119
+ _request_timeout=None,
122
120
  ):
123
121
  """Perform requests.
124
122
 
@@ -135,15 +133,7 @@ class RESTClientObject:
135
133
  (connection, read) timeouts.
136
134
  """
137
135
  method = method.upper()
138
- assert method in [
139
- 'GET',
140
- 'HEAD',
141
- 'DELETE',
142
- 'POST',
143
- 'PUT',
144
- 'PATCH',
145
- 'OPTIONS'
146
- ]
136
+ assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]
147
137
 
148
138
  if post_params and body:
149
139
  raise ApiValueError(
@@ -157,25 +147,18 @@ class RESTClientObject:
157
147
  if _request_timeout:
158
148
  if isinstance(_request_timeout, (int, float)):
159
149
  timeout = urllib3.Timeout(total=_request_timeout)
160
- elif (
161
- isinstance(_request_timeout, tuple)
162
- and len(_request_timeout) == 2
163
- ):
150
+ elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2:
164
151
  timeout = urllib3.Timeout(
165
- connect=_request_timeout[0],
166
- read=_request_timeout[1]
152
+ connect=_request_timeout[0], read=_request_timeout[1]
167
153
  )
168
154
 
169
155
  try:
170
156
  # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
171
- if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
157
+ if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
172
158
 
173
159
  # no content type provided or payload is json
174
- content_type = headers.get('Content-Type')
175
- if (
176
- not content_type
177
- or re.search('json', content_type, re.IGNORECASE)
178
- ):
160
+ content_type = headers.get("Content-Type")
161
+ if not content_type or re.search("json", content_type, re.IGNORECASE):
179
162
  request_body = None
180
163
  if body is not None:
181
164
  request_body = json.dumps(body)
@@ -185,9 +168,9 @@ class RESTClientObject:
185
168
  body=request_body,
186
169
  timeout=timeout,
187
170
  headers=headers,
188
- preload_content=False
171
+ preload_content=False,
189
172
  )
190
- elif content_type == 'application/x-www-form-urlencoded':
173
+ elif content_type == "application/x-www-form-urlencoded":
191
174
  r = self.pool_manager.request(
192
175
  method,
193
176
  url,
@@ -195,15 +178,18 @@ class RESTClientObject:
195
178
  encode_multipart=False,
196
179
  timeout=timeout,
197
180
  headers=headers,
198
- preload_content=False
181
+ preload_content=False,
199
182
  )
200
- elif content_type == 'multipart/form-data':
183
+ elif content_type == "multipart/form-data":
201
184
  # must del headers['Content-Type'], or the correct
202
185
  # Content-Type which generated by urllib3 will be
203
186
  # overwritten.
204
- del headers['Content-Type']
187
+ del headers["Content-Type"]
205
188
  # Ensures that dict objects are serialized
206
- post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
189
+ post_params = [
190
+ (a, json.dumps(b)) if isinstance(b, dict) else (a, b)
191
+ for a, b in post_params
192
+ ]
207
193
  r = self.pool_manager.request(
208
194
  method,
209
195
  url,
@@ -211,7 +197,7 @@ class RESTClientObject:
211
197
  encode_multipart=True,
212
198
  timeout=timeout,
213
199
  headers=headers,
214
- preload_content=False
200
+ preload_content=False,
215
201
  )
216
202
  # Pass a `string` parameter directly in the body to support
217
203
  # other content types than JSON when `body` argument is
@@ -223,9 +209,11 @@ class RESTClientObject:
223
209
  body=body,
224
210
  timeout=timeout,
225
211
  headers=headers,
226
- preload_content=False
212
+ preload_content=False,
227
213
  )
228
- elif headers['Content-Type'].startswith('text/') and isinstance(body, bool):
214
+ elif headers["Content-Type"].startswith("text/") and isinstance(
215
+ body, bool
216
+ ):
229
217
  request_body = "true" if body else "false"
230
218
  r = self.pool_manager.request(
231
219
  method,
@@ -233,7 +221,8 @@ class RESTClientObject:
233
221
  body=request_body,
234
222
  preload_content=False,
235
223
  timeout=timeout,
236
- headers=headers)
224
+ headers=headers,
225
+ )
237
226
  else:
238
227
  # Cannot generate the request from given parameters
239
228
  msg = """Cannot prepare a request message for provided
@@ -248,7 +237,7 @@ class RESTClientObject:
248
237
  fields={},
249
238
  timeout=timeout,
250
239
  headers=headers,
251
- preload_content=False
240
+ preload_content=False,
252
241
  )
253
242
  except urllib3.exceptions.SSLError as e:
254
243
  msg = "\n".join([type(e).__name__, str(e)])
crypticorn/klines/main.py CHANGED
@@ -1,42 +1,79 @@
1
- from crypticorn.klines import FundingRatesApi, OHLCVDataApi, SymbolsApi, UDFApi, HealthCheckApi, Configuration, ApiClient
2
1
  import pandas as pd
2
+ from crypticorn.klines import (
3
+ ApiClient,
4
+ Configuration,
5
+ FundingRatesApi,
6
+ HealthCheckApi,
7
+ OHLCVDataApi,
8
+ SymbolsApi,
9
+ UDFApi,
10
+ )
11
+ from crypticorn.common import BaseURL, ApiVersion, Service, apikey_header as aph
12
+
3
13
 
4
14
  class FundingRatesApiWrapper(FundingRatesApi):
15
+ """
16
+ A wrapper for the FundingRatesApi class.
17
+ """
18
+
5
19
  def get_funding_rates_fmt(self):
6
20
  response = self.funding_rate_funding_rates_symbol_get()
7
21
  return pd.DataFrame(response.json())
8
-
22
+
23
+
9
24
  class OHLCVDataApiWrapper(OHLCVDataApi):
25
+ """
26
+ A wrapper for the OHLCVDataApi class.
27
+ """
28
+
10
29
  def get_ohlcv_data_fmt(self):
11
30
  response = self.get_ohlcv_market_timeframe_symbol_get()
12
31
  return pd.DataFrame(response.json())
13
-
32
+
33
+
14
34
  class SymbolsApiWrapper(SymbolsApi):
35
+ """
36
+ A wrapper for the SymbolsApi class.
37
+ """
38
+
15
39
  def get_symbols_fmt(self):
16
40
  response = self.symbols_symbols_market_get()
17
41
  return pd.DataFrame(response.json())
18
-
42
+
43
+
19
44
  class UDFApiWrapper(UDFApi):
45
+ """
46
+ A wrapper for the UDFApi class.
47
+ """
48
+
20
49
  def get_udf_fmt(self):
21
50
  response = self.get_history_udf_history_get()
22
51
  return pd.DataFrame(response.json())
23
52
 
53
+
24
54
  class KlinesClient:
25
55
  """
26
56
  A client for interacting with the Crypticorn Klines API.
27
57
  """
28
58
 
29
- def __init__(self, base_url: str = 'https://api.crypticorn.dev', api_key: str = None, jwt: str = None):
30
- # Configure Klines client
31
- self.host = f"{base_url}/v1/klines"
32
- klines_config = Configuration(
59
+ def __init__(
60
+ self,
61
+ base_url: BaseURL,
62
+ api_version: ApiVersion,
63
+ api_key: str = None,
64
+ jwt: str = None,
65
+ ):
66
+ self.host = f"{base_url.value}/{api_version.value}/{Service.KLINES.value}"
67
+ self.config = Configuration(
33
68
  host=self.host,
69
+ access_token=jwt,
70
+ api_key={aph.scheme_name: api_key} if api_key else None,
71
+ api_key_prefix=({aph.scheme_name: aph.model.name} if api_key else None),
34
72
  )
35
- base_client = ApiClient(configuration=klines_config)
73
+ self.base_client = ApiClient(configuration=self.config)
36
74
  # Instantiate all the endpoint clients
37
- self.funding = FundingRatesApiWrapper(base_client)
38
- self.ohlcv = OHLCVDataApiWrapper(base_client)
39
- self.symbols = SymbolsApiWrapper(base_client)
40
- self.udf = UDFApiWrapper(base_client)
41
- self.health = HealthCheckApi(base_client)
42
-
75
+ self.funding = FundingRatesApiWrapper(self.base_client)
76
+ self.ohlcv = OHLCVDataApiWrapper(self.base_client)
77
+ self.symbols = SymbolsApiWrapper(self.base_client)
78
+ self.udf = UDFApiWrapper(self.base_client)
79
+ self.health = HealthCheckApi(self.base_client)
@@ -0,0 +1,2 @@
1
+ from crypticorn.pay.client import *
2
+ from crypticorn.pay.main import PayClient
@@ -0,0 +1,52 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+
5
+ """
6
+ Payment API
7
+
8
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
9
+
10
+ The version of the OpenAPI document: 0.1.0
11
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
12
+
13
+ Do not edit the class manually.
14
+ """ # noqa: E501
15
+
16
+
17
+ __version__ = "1.0.0"
18
+
19
+ # import apis into sdk package
20
+ from crypticorn.pay.client.api.now_payments_api import NOWPaymentsApi
21
+ from crypticorn.pay.client.api.payments_api import PaymentsApi
22
+ from crypticorn.pay.client.api.products_api import ProductsApi
23
+ from crypticorn.pay.client.api.status_api import StatusApi
24
+
25
+ # import ApiClient
26
+ from crypticorn.pay.client.api_response import ApiResponse
27
+ from crypticorn.pay.client.api_client import ApiClient
28
+ from crypticorn.pay.client.configuration import Configuration
29
+ from crypticorn.pay.client.exceptions import OpenApiException
30
+ from crypticorn.pay.client.exceptions import ApiTypeError
31
+ from crypticorn.pay.client.exceptions import ApiValueError
32
+ from crypticorn.pay.client.exceptions import ApiKeyError
33
+ from crypticorn.pay.client.exceptions import ApiAttributeError
34
+ from crypticorn.pay.client.exceptions import ApiException
35
+
36
+ # import models into sdk package
37
+ from crypticorn.pay.client.models.http_validation_error import HTTPValidationError
38
+ from crypticorn.pay.client.models.now_api_status_res import NowAPIStatusRes
39
+ from crypticorn.pay.client.models.now_create_invoice_req import NowCreateInvoiceReq
40
+ from crypticorn.pay.client.models.now_create_invoice_res import NowCreateInvoiceRes
41
+ from crypticorn.pay.client.models.now_fee_structure import NowFeeStructure
42
+ from crypticorn.pay.client.models.now_payment_status import NowPaymentStatus
43
+ from crypticorn.pay.client.models.now_webhook_payload import NowWebhookPayload
44
+ from crypticorn.pay.client.models.payment_status import PaymentStatus
45
+ from crypticorn.pay.client.models.product_model import ProductModel
46
+ from crypticorn.pay.client.models.product_subs_model import ProductSubsModel
47
+ from crypticorn.pay.client.models.services import Services
48
+ from crypticorn.pay.client.models.unified_payment_model import UnifiedPaymentModel
49
+ from crypticorn.pay.client.models.validation_error import ValidationError
50
+ from crypticorn.pay.client.models.validation_error_loc_inner import (
51
+ ValidationErrorLocInner,
52
+ )
@@ -0,0 +1,7 @@
1
+ # flake8: noqa
2
+
3
+ # import apis into api package
4
+ from crypticorn.pay.client.api.now_payments_api import NOWPaymentsApi
5
+ from crypticorn.pay.client.api.payments_api import PaymentsApi
6
+ from crypticorn.pay.client.api.products_api import ProductsApi
7
+ from crypticorn.pay.client.api.status_api import StatusApi