crypticorn 2.17.0rc3__py3-none-any.whl → 2.17.0rc5__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 (137) hide show
  1. crypticorn/auth/client/api/admin_api.py +0 -2
  2. crypticorn/auth/client/api/auth_api.py +0 -4
  3. crypticorn/auth/client/api/service_api.py +0 -4
  4. crypticorn/auth/client/api/user_api.py +0 -4
  5. crypticorn/auth/client/api/wallet_api.py +0 -4
  6. crypticorn/auth/client/api_client.py +0 -5
  7. crypticorn/auth/client/models/add_wallet_request.py +1 -1
  8. crypticorn/auth/client/models/authorize_user_request.py +1 -1
  9. crypticorn/auth/client/models/create_api_key_request.py +1 -1
  10. crypticorn/auth/client/models/create_user_request.py +1 -1
  11. crypticorn/auth/client/models/get_api_keys200_response_inner.py +1 -1
  12. crypticorn/auth/client/models/list_wallets200_response_balances_inner_sale_round.py +1 -1
  13. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet.py +1 -1
  14. crypticorn/auth/client/models/list_wallets200_response_balances_inner_wallet_vesting_wallets_inner.py +1 -1
  15. crypticorn/auth/client/models/list_wallets200_response_data_inner.py +1 -1
  16. crypticorn/auth/client/models/logout_default_response.py +1 -1
  17. crypticorn/auth/client/models/oauth_callback200_response_user.py +1 -1
  18. crypticorn/auth/client/models/refresh_token_info200_response_user_session.py +1 -1
  19. crypticorn/auth/client/models/rotate_tokens200_response.py +1 -1
  20. crypticorn/auth/client/models/token_info200_response.py +1 -1
  21. crypticorn/auth/client/models/update_user_request.py +1 -1
  22. crypticorn/auth/client/models/user_by_username200_response.py +1 -1
  23. crypticorn/auth/client/models/verify200_response.py +1 -1
  24. crypticorn/auth/client/models/verify_email200_response_auth.py +1 -1
  25. crypticorn/auth/client/models/verify_email200_response_auth_auth.py +1 -1
  26. crypticorn/auth/client/models/whoami200_response.py +1 -1
  27. crypticorn/cli/init.py +1 -1
  28. crypticorn/cli/templates/.env.docker.temp +3 -0
  29. crypticorn/cli/templates/.env.example.temp +4 -0
  30. crypticorn/client.py +0 -1
  31. crypticorn/common/auth.py +5 -16
  32. crypticorn/common/decorators.py +1 -2
  33. crypticorn/common/enums.py +0 -2
  34. crypticorn/common/metrics.py +1 -1
  35. crypticorn/common/middleware.py +0 -1
  36. crypticorn/common/pagination.py +135 -22
  37. crypticorn/common/utils.py +1 -2
  38. crypticorn/dex/__init__.py +6 -0
  39. crypticorn/dex/client/__init__.py +49 -0
  40. crypticorn/dex/client/api/__init__.py +6 -0
  41. crypticorn/dex/client/api/admin_api.py +3046 -0
  42. crypticorn/dex/client/api/signals_api.py +1821 -0
  43. crypticorn/dex/client/api/status_api.py +907 -0
  44. crypticorn/dex/client/api_client.py +753 -0
  45. crypticorn/dex/client/api_response.py +20 -0
  46. crypticorn/dex/client/configuration.py +620 -0
  47. crypticorn/dex/client/exceptions.py +220 -0
  48. crypticorn/dex/client/models/__init__.py +30 -0
  49. crypticorn/dex/client/models/api_error_identifier.py +121 -0
  50. crypticorn/dex/client/models/api_error_level.py +37 -0
  51. crypticorn/dex/client/models/api_error_type.py +37 -0
  52. crypticorn/dex/client/models/exception_detail.py +117 -0
  53. crypticorn/dex/client/models/log_level.py +38 -0
  54. crypticorn/dex/client/models/paginated_response_signal_with_token.py +134 -0
  55. crypticorn/dex/client/models/risk.py +86 -0
  56. crypticorn/dex/client/models/signal_overview_stats.py +156 -0
  57. crypticorn/dex/client/models/signal_volume.py +84 -0
  58. crypticorn/dex/client/models/signal_with_token.py +163 -0
  59. crypticorn/dex/client/models/token_data.py +127 -0
  60. crypticorn/dex/client/models/token_detail.py +116 -0
  61. crypticorn/dex/client/py.typed +0 -0
  62. crypticorn/dex/client/rest.py +217 -0
  63. crypticorn/dex/main.py +1 -0
  64. crypticorn/hive/client/api/admin_api.py +0 -3
  65. crypticorn/hive/client/api/data_api.py +0 -4
  66. crypticorn/hive/client/api/models_api.py +1 -4
  67. crypticorn/hive/client/api/status_api.py +0 -3
  68. crypticorn/hive/client/api_client.py +0 -5
  69. crypticorn/hive/client/models/coin_info.py +1 -1
  70. crypticorn/hive/client/models/exception_detail.py +1 -1
  71. crypticorn/hive/client/models/target_info.py +1 -1
  72. crypticorn/hive/utils.py +2 -2
  73. crypticorn/klines/client/api/admin_api.py +0 -3
  74. crypticorn/klines/client/api/change_in_timeframe_api.py +0 -4
  75. crypticorn/klines/client/api/funding_rates_api.py +0 -4
  76. crypticorn/klines/client/api/ohlcv_data_api.py +0 -4
  77. crypticorn/klines/client/api/status_api.py +0 -3
  78. crypticorn/klines/client/api/symbols_api.py +0 -4
  79. crypticorn/klines/client/api/udf_api.py +0 -2
  80. crypticorn/klines/client/api_client.py +0 -5
  81. crypticorn/klines/client/models/exception_detail.py +1 -1
  82. crypticorn/klines/client/models/ohlcv.py +1 -1
  83. crypticorn/klines/client/models/symbol_group.py +1 -1
  84. crypticorn/klines/client/models/udf_config.py +1 -1
  85. crypticorn/metrics/client/api/admin_api.py +0 -3
  86. crypticorn/metrics/client/api/exchanges_api.py +0 -4
  87. crypticorn/metrics/client/api/indicators_api.py +0 -4
  88. crypticorn/metrics/client/api/logs_api.py +0 -4
  89. crypticorn/metrics/client/api/marketcap_api.py +0 -4
  90. crypticorn/metrics/client/api/markets_api.py +0 -4
  91. crypticorn/metrics/client/api/quote_currencies_api.py +0 -4
  92. crypticorn/metrics/client/api/status_api.py +0 -3
  93. crypticorn/metrics/client/api/tokens_api.py +0 -2
  94. crypticorn/metrics/client/api_client.py +0 -5
  95. crypticorn/metrics/client/models/exception_detail.py +1 -1
  96. crypticorn/metrics/client/models/exchange_mapping.py +1 -1
  97. crypticorn/metrics/client/models/marketcap_ranking.py +1 -1
  98. crypticorn/metrics/client/models/marketcap_symbol_ranking.py +1 -1
  99. crypticorn/metrics/client/models/ohlcv.py +1 -1
  100. crypticorn/pay/client/api/admin_api.py +0 -3
  101. crypticorn/pay/client/api/now_payments_api.py +0 -4
  102. crypticorn/pay/client/api/payments_api.py +0 -4
  103. crypticorn/pay/client/api/products_api.py +0 -4
  104. crypticorn/pay/client/api/status_api.py +0 -3
  105. crypticorn/pay/client/api_client.py +0 -5
  106. crypticorn/pay/client/models/exception_detail.py +1 -1
  107. crypticorn/pay/client/models/now_create_invoice_req.py +1 -1
  108. crypticorn/pay/client/models/now_create_invoice_res.py +1 -1
  109. crypticorn/pay/client/models/product.py +1 -1
  110. crypticorn/pay/client/models/product_create.py +1 -1
  111. crypticorn/pay/client/models/product_update.py +1 -1
  112. crypticorn/trade/client/__init__.py +5 -0
  113. crypticorn/trade/client/api/admin_api.py +22 -23
  114. crypticorn/trade/client/api/bots_api.py +4712 -168
  115. crypticorn/trade/client/api/orders_api.py +220 -106
  116. crypticorn/trade/client/configuration.py +2 -2
  117. crypticorn/trade/client/models/__init__.py +5 -0
  118. crypticorn/trade/client/models/bot.py +7 -18
  119. crypticorn/trade/client/models/bot_create.py +17 -1
  120. crypticorn/trade/client/models/bot_update.py +17 -1
  121. crypticorn/trade/client/models/exchange_key_create.py +17 -1
  122. crypticorn/trade/client/models/exchange_key_update.py +17 -1
  123. crypticorn/trade/client/models/notification.py +17 -1
  124. crypticorn/trade/client/models/notification_create.py +17 -1
  125. crypticorn/trade/client/models/notification_update.py +17 -1
  126. crypticorn/trade/client/models/orders_count.py +88 -0
  127. crypticorn/trade/client/models/paginated_response_order.py +134 -0
  128. crypticorn/trade/client/models/pn_l.py +95 -0
  129. crypticorn/trade/client/models/strategy.py +17 -1
  130. crypticorn/trade/client/models/strategy_create.py +17 -1
  131. crypticorn/trade/client/models/strategy_update.py +17 -1
  132. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/METADATA +1 -1
  133. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/RECORD +137 -106
  134. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/WHEEL +0 -0
  135. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/entry_points.txt +0 -0
  136. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/licenses/LICENSE +0 -0
  137. {crypticorn-2.17.0rc3.dist-info → crypticorn-2.17.0rc5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,127 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DEX AI API
5
+
6
+ API for DEX AI
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
22
+ from crypticorn.dex.client.models.risk import Risk
23
+ from crypticorn.dex.client.models.token_detail import TokenDetail
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+
28
+ class TokenData(BaseModel):
29
+ """
30
+ Main model for complete token data
31
+ """ # noqa: E501
32
+
33
+ token: TokenDetail = Field(description="Token details")
34
+ mcap: StrictStr = Field(description="Market cap")
35
+ price: StrictStr = Field(description="Price")
36
+ liquidity: StrictStr = Field(description="The liquidity of the token in USD")
37
+ risk: Risk = Field(description="Risk assessment")
38
+ buys: StrictInt = Field(description="Number of buys")
39
+ sells: StrictInt = Field(description="Number of sells")
40
+ txns: StrictInt = Field(description="Total transactions")
41
+ holders: StrictInt = Field(description="Number of holders")
42
+ __properties: ClassVar[List[str]] = [
43
+ "token",
44
+ "mcap",
45
+ "price",
46
+ "liquidity",
47
+ "risk",
48
+ "buys",
49
+ "sells",
50
+ "txns",
51
+ "holders",
52
+ ]
53
+
54
+ model_config = ConfigDict(
55
+ populate_by_name=True,
56
+ validate_assignment=True,
57
+ protected_namespaces=(),
58
+ )
59
+
60
+ def to_str(self) -> str:
61
+ """Returns the string representation of the model using alias"""
62
+ return pprint.pformat(self.model_dump(by_alias=True))
63
+
64
+ def to_json(self) -> str:
65
+ """Returns the JSON representation of the model using alias"""
66
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
67
+ return json.dumps(self.to_dict())
68
+
69
+ @classmethod
70
+ def from_json(cls, json_str: str) -> Optional[Self]:
71
+ """Create an instance of TokenData from a JSON string"""
72
+ return cls.from_dict(json.loads(json_str))
73
+
74
+ def to_dict(self) -> Dict[str, Any]:
75
+ """Return the dictionary representation of the model using alias.
76
+
77
+ This has the following differences from calling pydantic's
78
+ `self.model_dump(by_alias=True)`:
79
+
80
+ * `None` is only added to the output dict for nullable fields that
81
+ were set at model initialization. Other fields with value `None`
82
+ are ignored.
83
+ """
84
+ excluded_fields: Set[str] = set([])
85
+
86
+ _dict = self.model_dump(
87
+ by_alias=True,
88
+ exclude=excluded_fields,
89
+ exclude_none=True,
90
+ )
91
+ # override the default output from pydantic by calling `to_dict()` of token
92
+ if self.token:
93
+ _dict["token"] = self.token.to_dict()
94
+ # override the default output from pydantic by calling `to_dict()` of risk
95
+ if self.risk:
96
+ _dict["risk"] = self.risk.to_dict()
97
+ return _dict
98
+
99
+ @classmethod
100
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
101
+ """Create an instance of TokenData from a dict"""
102
+ if obj is None:
103
+ return None
104
+
105
+ if not isinstance(obj, dict):
106
+ return cls.model_validate(obj)
107
+
108
+ _obj = cls.model_validate(
109
+ {
110
+ "token": (
111
+ TokenDetail.from_dict(obj["token"])
112
+ if obj.get("token") is not None
113
+ else None
114
+ ),
115
+ "mcap": obj.get("mcap"),
116
+ "price": obj.get("price"),
117
+ "liquidity": obj.get("liquidity"),
118
+ "risk": (
119
+ Risk.from_dict(obj["risk"]) if obj.get("risk") is not None else None
120
+ ),
121
+ "buys": obj.get("buys"),
122
+ "sells": obj.get("sells"),
123
+ "txns": obj.get("txns"),
124
+ "holders": obj.get("holders"),
125
+ }
126
+ )
127
+ return _obj
@@ -0,0 +1,116 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DEX AI API
5
+
6
+ API for DEX AI
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Set
23
+ from typing_extensions import Self
24
+
25
+
26
+ class TokenDetail(BaseModel):
27
+ """
28
+ Model for detailed token information
29
+ """ # noqa: E501
30
+
31
+ name: StrictStr = Field(description="Token name")
32
+ symbol: StrictStr = Field(description="Token symbol")
33
+ mint: StrictStr = Field(description="Token mint address (aka contract address)")
34
+ description: Optional[StrictStr] = None
35
+ image: Optional[StrictStr] = None
36
+ strict_socials: Optional[Dict[str, Any]] = Field(
37
+ default=None, description="Social media links", alias="strictSocials"
38
+ )
39
+ __properties: ClassVar[List[str]] = [
40
+ "name",
41
+ "symbol",
42
+ "mint",
43
+ "description",
44
+ "image",
45
+ "strictSocials",
46
+ ]
47
+
48
+ model_config = ConfigDict(
49
+ populate_by_name=True,
50
+ validate_assignment=True,
51
+ protected_namespaces=(),
52
+ )
53
+
54
+ def to_str(self) -> str:
55
+ """Returns the string representation of the model using alias"""
56
+ return pprint.pformat(self.model_dump(by_alias=True))
57
+
58
+ def to_json(self) -> str:
59
+ """Returns the JSON representation of the model using alias"""
60
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
61
+ return json.dumps(self.to_dict())
62
+
63
+ @classmethod
64
+ def from_json(cls, json_str: str) -> Optional[Self]:
65
+ """Create an instance of TokenDetail from a JSON string"""
66
+ return cls.from_dict(json.loads(json_str))
67
+
68
+ def to_dict(self) -> Dict[str, Any]:
69
+ """Return the dictionary representation of the model using alias.
70
+
71
+ This has the following differences from calling pydantic's
72
+ `self.model_dump(by_alias=True)`:
73
+
74
+ * `None` is only added to the output dict for nullable fields that
75
+ were set at model initialization. Other fields with value `None`
76
+ are ignored.
77
+ """
78
+ excluded_fields: Set[str] = set([])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ # set to None if description (nullable) is None
86
+ # and model_fields_set contains the field
87
+ if self.description is None and "description" in self.model_fields_set:
88
+ _dict["description"] = None
89
+
90
+ # set to None if image (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.image is None and "image" in self.model_fields_set:
93
+ _dict["image"] = None
94
+
95
+ return _dict
96
+
97
+ @classmethod
98
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
+ """Create an instance of TokenDetail from a dict"""
100
+ if obj is None:
101
+ return None
102
+
103
+ if not isinstance(obj, dict):
104
+ return cls.model_validate(obj)
105
+
106
+ _obj = cls.model_validate(
107
+ {
108
+ "name": obj.get("name"),
109
+ "symbol": obj.get("symbol"),
110
+ "mint": obj.get("mint"),
111
+ "description": obj.get("description"),
112
+ "image": obj.get("image"),
113
+ "strictSocials": obj.get("strictSocials"),
114
+ }
115
+ )
116
+ return _obj
File without changes
@@ -0,0 +1,217 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ DEX AI API
5
+
6
+ API for DEX AI
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
+ import io
16
+ import json
17
+ import re
18
+ import ssl
19
+ from typing import Optional, Union
20
+
21
+ import aiohttp
22
+ import aiohttp_retry
23
+
24
+ from crypticorn.dex.client.exceptions import ApiException, ApiValueError
25
+
26
+ RESTResponseType = aiohttp.ClientResponse
27
+
28
+ ALLOW_RETRY_METHODS = frozenset({"DELETE", "GET", "HEAD", "OPTIONS", "PUT", "TRACE"})
29
+
30
+
31
+ class RESTResponse(io.IOBase):
32
+
33
+ def __init__(self, resp) -> None:
34
+ self.response = resp
35
+ self.status = resp.status
36
+ self.reason = resp.reason
37
+ self.data = None
38
+
39
+ async def read(self):
40
+ if self.data is None:
41
+ self.data = await self.response.read()
42
+ return self.data
43
+
44
+ def getheaders(self):
45
+ """Returns a CIMultiDictProxy of the response headers."""
46
+ return self.response.headers
47
+
48
+ def getheader(self, name, default=None):
49
+ """Returns a given response header."""
50
+ return self.response.headers.get(name, default)
51
+
52
+
53
+ class RESTClientObject:
54
+
55
+ def __init__(self, configuration) -> None:
56
+
57
+ # maxsize is number of requests to host that are allowed in parallel
58
+ self.maxsize = configuration.connection_pool_maxsize
59
+
60
+ self.ssl_context = ssl.create_default_context(
61
+ cafile=configuration.ssl_ca_cert,
62
+ cadata=configuration.ca_cert_data,
63
+ )
64
+ if configuration.cert_file:
65
+ self.ssl_context.load_cert_chain(
66
+ configuration.cert_file, keyfile=configuration.key_file
67
+ )
68
+
69
+ if not configuration.verify_ssl:
70
+ self.ssl_context.check_hostname = False
71
+ self.ssl_context.verify_mode = ssl.CERT_NONE
72
+
73
+ self.proxy = configuration.proxy
74
+ self.proxy_headers = configuration.proxy_headers
75
+
76
+ self.retries = configuration.retries
77
+
78
+ self.pool_manager: Optional[aiohttp.ClientSession] = None
79
+ self.retry_client: Optional[aiohttp_retry.RetryClient] = None
80
+ self.is_sync: bool = False # Track whether this is sync or async mode
81
+
82
+ async def close(self) -> None:
83
+ if self.pool_manager:
84
+ await self.pool_manager.close()
85
+ if self.retry_client is not None:
86
+ await self.retry_client.close()
87
+
88
+ async def request(
89
+ self,
90
+ method,
91
+ url,
92
+ headers=None,
93
+ body=None,
94
+ post_params=None,
95
+ _request_timeout=None,
96
+ ):
97
+ """Execute request
98
+
99
+ :param method: http request method
100
+ :param url: http request url
101
+ :param headers: http request headers
102
+ :param body: request json body, for `application/json`
103
+ :param post_params: request post parameters,
104
+ `application/x-www-form-urlencoded`
105
+ and `multipart/form-data`
106
+ :param _request_timeout: timeout setting for this request. If one
107
+ number provided, it will be total request
108
+ timeout. It can also be a pair (tuple) of
109
+ (connection, read) timeouts.
110
+ """
111
+ method = method.upper()
112
+ assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]
113
+
114
+ if post_params and body:
115
+ raise ApiValueError(
116
+ "body parameter cannot be used with post_params parameter."
117
+ )
118
+
119
+ post_params = post_params or {}
120
+ headers = headers or {}
121
+ # url already contains the URL query string
122
+ timeout = _request_timeout or 5 * 60
123
+
124
+ if "Content-Type" not in headers:
125
+ headers["Content-Type"] = "application/json"
126
+
127
+ args = {"method": method, "url": url, "timeout": timeout, "headers": headers}
128
+
129
+ if self.proxy:
130
+ args["proxy"] = self.proxy
131
+ if self.proxy_headers:
132
+ args["proxy_headers"] = self.proxy_headers
133
+
134
+ # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
135
+ if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
136
+ if re.search("json", headers["Content-Type"], re.IGNORECASE):
137
+ if body is not None:
138
+ body = json.dumps(body)
139
+ args["data"] = body
140
+ elif headers["Content-Type"] == "application/x-www-form-urlencoded":
141
+ args["data"] = aiohttp.FormData(post_params)
142
+ elif headers["Content-Type"] == "multipart/form-data":
143
+ # must del headers['Content-Type'], or the correct
144
+ # Content-Type which generated by aiohttp
145
+ del headers["Content-Type"]
146
+ data = aiohttp.FormData()
147
+ for param in post_params:
148
+ k, v = param
149
+ if isinstance(v, tuple) and len(v) == 3:
150
+ data.add_field(k, value=v[1], filename=v[0], content_type=v[2])
151
+ else:
152
+ # Ensures that dict objects are serialized
153
+ if isinstance(v, dict):
154
+ v = json.dumps(v)
155
+ elif isinstance(v, int):
156
+ v = str(v)
157
+ data.add_field(k, v)
158
+ args["data"] = data
159
+
160
+ # Pass a `bytes` or `str` parameter directly in the body to support
161
+ # other content types than Json when `body` argument is provided
162
+ # in serialized form
163
+ elif isinstance(body, str) or isinstance(body, bytes):
164
+ args["data"] = body
165
+ else:
166
+ # Cannot generate the request from given parameters
167
+ msg = """Cannot prepare a request message for provided
168
+ arguments. Please check that your arguments match
169
+ declared content type."""
170
+ raise ApiException(status=0, reason=msg)
171
+
172
+ pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient]
173
+
174
+ # For sync operations, always use a fresh session
175
+ should_close_session = False
176
+
177
+ if self.pool_manager is None:
178
+ self.pool_manager = aiohttp.ClientSession(
179
+ connector=aiohttp.TCPConnector(
180
+ limit=self.maxsize, ssl=self.ssl_context
181
+ ),
182
+ trust_env=True,
183
+ )
184
+ # Only close session automatically in sync mode
185
+ should_close_session = self.is_sync
186
+
187
+ pool_manager = self.pool_manager
188
+
189
+ if self.retries is not None and method in ALLOW_RETRY_METHODS:
190
+ if self.retry_client is None:
191
+ self.retry_client = aiohttp_retry.RetryClient(
192
+ client_session=self.pool_manager,
193
+ retry_options=aiohttp_retry.ExponentialRetry(
194
+ attempts=self.retries,
195
+ factor=2.0,
196
+ start_timeout=0.1,
197
+ max_timeout=120.0,
198
+ ),
199
+ )
200
+ pool_manager = self.retry_client
201
+
202
+ try:
203
+ r = await pool_manager.request(**args)
204
+ # For sessions we're about to close, read the data immediately
205
+ if should_close_session:
206
+ response = RESTResponse(r)
207
+ await response.read() # Read data before closing session
208
+ return response
209
+ else:
210
+ return RESTResponse(r)
211
+ finally:
212
+ if should_close_session:
213
+ if self.retry_client is not None:
214
+ await self.retry_client.close()
215
+ self.retry_client = None
216
+ await self.pool_manager.close()
217
+ self.pool_manager = None
crypticorn/dex/main.py ADDED
@@ -0,0 +1 @@
1
+ # Edit this file. You can look in the other modules for examples.
@@ -16,9 +16,6 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
16
  from typing import Any, Dict, List, Optional, Tuple, Union
17
17
  from typing_extensions import Annotated
18
18
 
19
- from pydantic import Field, StrictFloat, StrictInt, StrictStr, field_validator
20
- from typing import Any, Dict, List, Optional, Union
21
- from typing_extensions import Annotated
22
19
  from crypticorn.hive.client.models.log_level import LogLevel
23
20
 
24
21
  from crypticorn.hive.client.api_client import ApiClient, RequestSerialized
@@ -11,14 +11,10 @@ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
  Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
- import warnings
15
14
  from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
15
  from typing import Any, Dict, List, Optional, Tuple, Union
17
16
  from typing_extensions import Annotated
18
17
 
19
- from pydantic import Field, StrictInt
20
- from typing import Optional
21
- from typing_extensions import Annotated
22
18
  from crypticorn.hive.client.models.data_download_response import DataDownloadResponse
23
19
  from crypticorn.hive.client.models.data_info import DataInfo
24
20
  from crypticorn.hive.client.models.data_version import DataVersion
@@ -11,14 +11,11 @@ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
  Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
- import warnings
15
14
  from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
15
  from typing import Any, Dict, List, Optional, Tuple, Union
17
16
  from typing_extensions import Annotated
18
17
 
19
- from pydantic import Field, StrictBool, StrictInt, StrictStr
20
- from typing import Any, List, Optional
21
- from typing_extensions import Annotated
18
+ from pydantic import StrictBool
22
19
  from crypticorn.hive.client.models.data_version import DataVersion
23
20
  from crypticorn.hive.client.models.evaluation_response import EvaluationResponse
24
21
  from crypticorn.hive.client.models.model_create import ModelCreate
@@ -11,13 +11,10 @@ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
  Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
- import warnings
15
14
  from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
15
  from typing import Any, Dict, List, Optional, Tuple, Union
17
16
  from typing_extensions import Annotated
18
17
 
19
- from pydantic import StrictStr, field_validator
20
- from typing import Optional
21
18
 
22
19
  from crypticorn.hive.client.api_client import ApiClient, RequestSerialized
23
20
  from crypticorn.hive.client.api_response import ApiResponse
@@ -33,11 +33,6 @@ from crypticorn.hive.client import rest
33
33
  from crypticorn.hive.client.exceptions import (
34
34
  ApiValueError,
35
35
  ApiException,
36
- BadRequestException,
37
- UnauthorizedException,
38
- ForbiddenException,
39
- NotFoundException,
40
- ServiceException,
41
36
  )
42
37
 
43
38
  RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]]
@@ -21,7 +21,7 @@ from pydantic import BaseModel, ConfigDict, Field
21
21
  from typing import Any, ClassVar, Dict, List, Optional
22
22
  from crypticorn.hive.client.models.coins import Coins
23
23
  from crypticorn.hive.client.models.data_version import DataVersion
24
- from typing import Optional, Set
24
+ from typing import Set
25
25
  from typing_extensions import Self
26
26
 
27
27
 
@@ -22,7 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from crypticorn.hive.client.models.api_error_identifier import ApiErrorIdentifier
23
23
  from crypticorn.hive.client.models.api_error_level import ApiErrorLevel
24
24
  from crypticorn.hive.client.models.api_error_type import ApiErrorType
25
- from typing import Optional, Set
25
+ from typing import Set
26
26
  from typing_extensions import Self
27
27
 
28
28
 
@@ -22,7 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional
22
22
  from crypticorn.hive.client.models.data_version import DataVersion
23
23
  from crypticorn.hive.client.models.target import Target
24
24
  from crypticorn.hive.client.models.target_type import TargetType
25
- from typing import Optional, Set
25
+ from typing import Set
26
26
  from typing_extensions import Self
27
27
 
28
28
 
crypticorn/hive/utils.py CHANGED
@@ -28,7 +28,7 @@ async def download_file(
28
28
 
29
29
  if file_size < total_size:
30
30
  # Download incomplete
31
- logger.info(f" resuming download")
31
+ logger.info(" resuming download")
32
32
  resume_header = {"Range": f"bytes={file_size}-"}
33
33
  req = requests.get(
34
34
  url,
@@ -45,7 +45,7 @@ async def download_file(
45
45
  file_size = 0
46
46
  else:
47
47
  # File does not exist, starting download
48
- logger.info(f" starting download")
48
+ logger.info(" starting download")
49
49
 
50
50
  # write dataset to file and show progress bar
51
51
  pbar = tqdm.tqdm(
@@ -16,9 +16,6 @@ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
16
  from typing import Any, Dict, List, Optional, Tuple, Union
17
17
  from typing_extensions import Annotated
18
18
 
19
- from pydantic import Field, StrictFloat, StrictInt, StrictStr, field_validator
20
- from typing import Any, Dict, List, Optional, Union
21
- from typing_extensions import Annotated
22
19
  from crypticorn.klines.client.models.log_level import LogLevel
23
20
 
24
21
  from crypticorn.klines.client.api_client import ApiClient, RequestSerialized
@@ -11,14 +11,10 @@ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
  Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
- import warnings
15
14
  from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
15
  from typing import Any, Dict, List, Optional, Tuple, Union
17
16
  from typing_extensions import Annotated
18
17
 
19
- from pydantic import Field
20
- from typing import List, Optional
21
- from typing_extensions import Annotated
22
18
  from crypticorn.klines.client.models.change_in_timeframe import ChangeInTimeframe
23
19
  from crypticorn.klines.client.models.market_type import MarketType
24
20
  from crypticorn.klines.client.models.timeframe import Timeframe
@@ -11,14 +11,10 @@ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
  Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
- import warnings
15
14
  from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
15
  from typing import Any, Dict, List, Optional, Tuple, Union
17
16
  from typing_extensions import Annotated
18
17
 
19
- from pydantic import Field, StrictInt, StrictStr
20
- from typing import Optional
21
- from typing_extensions import Annotated
22
18
  from crypticorn.klines.client.models.funding_rate_response import FundingRateResponse
23
19
 
24
20
  from crypticorn.klines.client.api_client import ApiClient, RequestSerialized
@@ -11,14 +11,10 @@ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
  Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
- import warnings
15
14
  from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
15
  from typing import Any, Dict, List, Optional, Tuple, Union
17
16
  from typing_extensions import Annotated
18
17
 
19
- from pydantic import Field, StrictInt, StrictStr
20
- from typing import List, Optional
21
- from typing_extensions import Annotated
22
18
  from crypticorn.klines.client.models.market_type import MarketType
23
19
  from crypticorn.klines.client.models.ohlcv import OHLCV
24
20
  from crypticorn.klines.client.models.sort_direction import SortDirection
@@ -11,13 +11,10 @@ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
  Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
- import warnings
15
14
  from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
15
  from typing import Any, Dict, List, Optional, Tuple, Union
17
16
  from typing_extensions import Annotated
18
17
 
19
- from pydantic import StrictStr, field_validator
20
- from typing import Optional
21
18
 
22
19
  from crypticorn.klines.client.api_client import ApiClient, RequestSerialized
23
20
  from crypticorn.klines.client.api_response import ApiResponse
@@ -11,14 +11,10 @@ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
  Do not edit the class manually.
12
12
  """ # noqa: E501
13
13
 
14
- import warnings
15
14
  from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
15
  from typing import Any, Dict, List, Optional, Tuple, Union
17
16
  from typing_extensions import Annotated
18
17
 
19
- from pydantic import Field, StrictStr
20
- from typing import List
21
- from typing_extensions import Annotated
22
18
  from crypticorn.klines.client.models.market_type import MarketType
23
19
 
24
20
  from crypticorn.klines.client.api_client import ApiClient, RequestSerialized