crypticorn 2.1.5__py3-none-any.whl → 2.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crypticorn/auth/main.py +2 -19
- crypticorn/client.py +75 -22
- crypticorn/common/__init__.py +1 -2
- crypticorn/common/auth.py +205 -1
- crypticorn/common/scopes.py +2 -2
- crypticorn/common/urls.py +21 -9
- crypticorn/hive/main.py +4 -12
- crypticorn/klines/client/configuration.py +2 -2
- crypticorn/klines/main.py +2 -12
- crypticorn/metrics/__init__.py +4 -0
- crypticorn/metrics/client/__init__.py +60 -0
- crypticorn/metrics/client/api/__init__.py +10 -0
- crypticorn/metrics/client/api/exchanges_api.py +1003 -0
- crypticorn/metrics/client/api/health_check_api.py +265 -0
- crypticorn/metrics/client/api/indicators_api.py +680 -0
- crypticorn/metrics/client/api/logs_api.py +356 -0
- crypticorn/metrics/client/api/marketcap_api.py +1315 -0
- crypticorn/metrics/client/api/markets_api.py +618 -0
- crypticorn/metrics/client/api/tokens_api.py +300 -0
- crypticorn/metrics/client/api_client.py +758 -0
- crypticorn/metrics/client/api_response.py +20 -0
- crypticorn/metrics/client/configuration.py +575 -0
- crypticorn/metrics/client/exceptions.py +220 -0
- crypticorn/metrics/client/models/__init__.py +37 -0
- crypticorn/metrics/client/models/base_response_dict.py +106 -0
- crypticorn/metrics/client/models/base_response_health_check_response.py +114 -0
- crypticorn/metrics/client/models/base_response_list_dict.py +106 -0
- crypticorn/metrics/client/models/base_response_list_exchange_mapping.py +118 -0
- crypticorn/metrics/client/models/base_response_list_str.py +106 -0
- crypticorn/metrics/client/models/error_response.py +109 -0
- crypticorn/metrics/client/models/exchange_mapping.py +132 -0
- crypticorn/metrics/client/models/health_check_response.py +91 -0
- crypticorn/metrics/client/models/http_validation_error.py +99 -0
- crypticorn/metrics/client/models/market.py +35 -0
- crypticorn/metrics/client/models/severity.py +36 -0
- crypticorn/metrics/client/models/validation_error.py +105 -0
- crypticorn/metrics/client/models/validation_error_loc_inner.py +159 -0
- crypticorn/metrics/client/py.typed +0 -0
- crypticorn/metrics/client/rest.py +195 -0
- crypticorn/metrics/main.py +102 -0
- crypticorn/pay/main.py +2 -12
- crypticorn/trade/main.py +2 -12
- crypticorn-2.2.0.dist-info/METADATA +146 -0
- {crypticorn-2.1.5.dist-info → crypticorn-2.2.0.dist-info}/RECORD +46 -16
- crypticorn/common/auth_client.py +0 -213
- crypticorn-2.1.5.dist-info/METADATA +0 -92
- {crypticorn-2.1.5.dist-info → crypticorn-2.2.0.dist-info}/WHEEL +0 -0
- {crypticorn-2.1.5.dist-info → crypticorn-2.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,146 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: crypticorn
|
3
|
+
Version: 2.2.0
|
4
|
+
Summary: Maximise Your Crypto Trading Profits with AI Predictions
|
5
|
+
Author-email: Crypticorn <timon@crypticorn.com>
|
6
|
+
Project-URL: Homepage, https://crypticorn.com
|
7
|
+
Keywords: machine learning,data science,crypto,modelling
|
8
|
+
Classifier: Topic :: Scientific/Engineering
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
11
|
+
Classifier: Operating System :: OS Independent
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
13
|
+
Classifier: Typing :: Typed
|
14
|
+
Requires-Python: >=3.10
|
15
|
+
Description-Content-Type: text/markdown
|
16
|
+
Requires-Dist: fastapi
|
17
|
+
Requires-Dist: urllib3<3.0.0,>=1.25.3
|
18
|
+
Requires-Dist: python_dateutil<3.0.0,>=2.8.2
|
19
|
+
Requires-Dist: aiohttp<4.0.0,>=3.8.4
|
20
|
+
Requires-Dist: aiohttp-retry<3.0.0,>=2.8.3
|
21
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
22
|
+
Requires-Dist: typing-extensions<5.0.0,>=4.7.1
|
23
|
+
Requires-Dist: pandas<3.0.0,>=2.2.0
|
24
|
+
Requires-Dist: requests<3.0.0,>=2.32.0
|
25
|
+
Requires-Dist: tqdm<5.0.0,>=4.67.0
|
26
|
+
Provides-Extra: dev
|
27
|
+
Requires-Dist: streamlit; extra == "dev"
|
28
|
+
Requires-Dist: httpx; extra == "dev"
|
29
|
+
Requires-Dist: build; extra == "dev"
|
30
|
+
Requires-Dist: black; extra == "dev"
|
31
|
+
Requires-Dist: twine; extra == "dev"
|
32
|
+
Requires-Dist: pyflakes; extra == "dev"
|
33
|
+
Provides-Extra: test
|
34
|
+
Requires-Dist: pytest==8.3.5; extra == "test"
|
35
|
+
Requires-Dist: pytest-asyncio==0.26.0; extra == "test"
|
36
|
+
Requires-Dist: pytest-cov==6.1.1; extra == "test"
|
37
|
+
Requires-Dist: python-dotenv==1.0.1; extra == "test"
|
38
|
+
|
39
|
+
# What is Crypticorn?
|
40
|
+
|
41
|
+
Crypticorn is at the forefront of cutting-edge artificial intelligence cryptocurrency trading.
|
42
|
+
Crypticorn offers AI-based solutions for both active and passive investors, including:
|
43
|
+
- Prediction Dashboard with trading terminal,
|
44
|
+
- AI Agents with different strategies,
|
45
|
+
- DEX AI Signals for newly launched tokens,
|
46
|
+
- DEX AI Bots
|
47
|
+
|
48
|
+
Use this API Client to contribute to the so-called Hive AI, a community driven AI Meta Model for predicting the
|
49
|
+
cryptocurrency market.
|
50
|
+
|
51
|
+
## Installation
|
52
|
+
|
53
|
+
You can install the latest stable version from PyPi:
|
54
|
+
```bash
|
55
|
+
pip install crypticorn
|
56
|
+
```
|
57
|
+
|
58
|
+
If you want a specific version, run:
|
59
|
+
```bash
|
60
|
+
pip install crypticorn==2.0.0
|
61
|
+
```
|
62
|
+
|
63
|
+
If you want the latest version, which could be a pre release, run:
|
64
|
+
```bash
|
65
|
+
pip install --pre crypticorn
|
66
|
+
```
|
67
|
+
|
68
|
+
## Structure
|
69
|
+
|
70
|
+
Our API is available as an asynchronous Python SDK. The main entry point you need is the `ApiClient` class, which you would import like this:
|
71
|
+
```python
|
72
|
+
from crypticorn import ApiClient
|
73
|
+
```
|
74
|
+
|
75
|
+
## Usage
|
76
|
+
|
77
|
+
### With Async Context Protocol
|
78
|
+
```python
|
79
|
+
async with ApiClient(base_url=BaseUrl.Prod, api_key="your-api-key") as client:
|
80
|
+
await client.pay.products.get_products()
|
81
|
+
```
|
82
|
+
|
83
|
+
### Without Async Context Protocol
|
84
|
+
Without the context you need to close the session manually.
|
85
|
+
```python
|
86
|
+
client = ApiClient(base_url=BaseUrl.Prod, api_key="your-api-key")
|
87
|
+
asyncio.run(client.pay.models.get_products())
|
88
|
+
asyncio.run(client.close())
|
89
|
+
```
|
90
|
+
|
91
|
+
## Response Types
|
92
|
+
|
93
|
+
There are three different available output formats you can choose from:
|
94
|
+
|
95
|
+
### Serialized Response
|
96
|
+
You can get fully serialized responses as pydantic models. Using this, you get the full benefits of pydantic's type checking.
|
97
|
+
```python
|
98
|
+
response = await client.pay.products.get_products()
|
99
|
+
print(response)
|
100
|
+
```
|
101
|
+
The output would look like this:
|
102
|
+
```python
|
103
|
+
[ProductModel(id='67e8146e7bae32f3838fe36a', name='Awesome Product', price=5.0, scopes=None, duration=30, description='You need to buy this', is_active=True)]
|
104
|
+
```
|
105
|
+
|
106
|
+
### Serialized Response with HTTP Info
|
107
|
+
```python
|
108
|
+
await client.pay.products.get_products_with_http_info()
|
109
|
+
print(res)
|
110
|
+
```
|
111
|
+
The output would look like this:
|
112
|
+
```python
|
113
|
+
status_code=200 headers={'Date': 'Wed, 09 Apr 2025 19:15:19 GMT', 'Content-Type': 'application/json', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Alt-Svc': 'h3=":443"; ma=86400', 'Server': 'cloudflare', 'Cf-Cache-Status': 'DYNAMIC', 'Content-Encoding': 'gzip', 'CF-RAY': '92dc551a687bbe5e-ZRH'} data=[ProductModel(id='67e8146e7bae32f3838fe36a', name='Awesome Product', price=5.0, scopes=None, duration=30, description='You need to buy this', is_active=True)] raw_data=b'[{"id":"67e8146e7bae32f3838fe36a","name":"Awesome Product","price":5.0,"duration":30,"description":"You need to buy this","is_active":true}]'
|
114
|
+
```
|
115
|
+
You can then access the data of the response (as serialized output) with:
|
116
|
+
```python
|
117
|
+
print(res.data)
|
118
|
+
```
|
119
|
+
On top of that you get some information about the request:
|
120
|
+
```python
|
121
|
+
print(res.status_code)
|
122
|
+
print(res.raw_data)
|
123
|
+
print(res.headers)
|
124
|
+
|
125
|
+
|
126
|
+
### JSON Response
|
127
|
+
You can receive a classical JSON response by suffixing the function name with `_without_preload_content`
|
128
|
+
```python
|
129
|
+
response = await client.pay.products.get_products_without_preload_content()
|
130
|
+
print(await response.json())
|
131
|
+
```
|
132
|
+
The output would look like this:
|
133
|
+
```python
|
134
|
+
[{'id': '67e8146e7bae32f3838fe36a', 'name': 'Awesome Product', 'price': 5.0, 'duration': 30, 'description': 'You need to buy this', 'is_active': True}]
|
135
|
+
```
|
136
|
+
|
137
|
+
## Advanced Usage
|
138
|
+
|
139
|
+
You can override some configuration for specific sub clients. If just want to use the API as is you don't need to configure anything.
|
140
|
+
This might be of use if you are testing a specific API locally.
|
141
|
+
|
142
|
+
This will override the host for the Hive client to connect to http://localhost:8000 instead of the default caddy proxy:
|
143
|
+
```python
|
144
|
+
async with ApiClient(base_url=BaseUrl.DEV, jwt=jwt) as client:
|
145
|
+
client.configure(config=HiveConfig(host="http://localhost:8000"), sub_client=client.hive)
|
146
|
+
```
|
@@ -1,7 +1,7 @@
|
|
1
1
|
crypticorn/__init__.py,sha256=TL41V09dmtbd2ee07wmOuG9KJJpyvLMPJi5DEd9bDyU,129
|
2
|
-
crypticorn/client.py,sha256=
|
2
|
+
crypticorn/client.py,sha256=VleHzia13Fa_N3CK5ifktdd43IQl4u0CKQrfWtu2WiU,4320
|
3
3
|
crypticorn/auth/__init__.py,sha256=JAl1tBLK9pYLr_-YKaj581c-c94PWLoqnatTIVAVvMM,81
|
4
|
-
crypticorn/auth/main.py,sha256=
|
4
|
+
crypticorn/auth/main.py,sha256=1ggu7V--I43TLWu2TLFRSnQmtaJEs8C8FbSXycCdvkI,686
|
5
5
|
crypticorn/auth/client/__init__.py,sha256=ziGgrJ7judjAwOaSKF-7lgs1zhE-XEZkMYKD0WUkHfs,4990
|
6
6
|
crypticorn/auth/client/api_client.py,sha256=H2jviD8CKiFnK1ZZXWKbSdBszBYcCQNcga9pwgM03D4,26908
|
7
7
|
crypticorn/auth/client/api_response.py,sha256=WhxwYDSMm6wPixp9CegO8dJzjFxDz3JF1yCq9s0ZqKE,639
|
@@ -54,15 +54,14 @@ crypticorn/auth/client/models/verify_email_request.py,sha256=8MBfxPTLn5X6Z3vE2bl
|
|
54
54
|
crypticorn/auth/client/models/verify_wallet_request.py,sha256=b0DAocvhKzPXPjM62DZqezlHxq3cNL7UVKl0d2judHQ,2691
|
55
55
|
crypticorn/auth/client/models/wallet_verified200_response.py,sha256=QILnTLsCKdI-WdV_fsLBy1UH4ZZU-U-wWJ9ot8v08tI,2465
|
56
56
|
crypticorn/auth/client/models/whoami200_response.py,sha256=uehdq5epgeOphhrIR3tbrseflxcLAzGyKF-VW-o5cY8,2974
|
57
|
-
crypticorn/common/__init__.py,sha256=
|
58
|
-
crypticorn/common/auth.py,sha256=
|
59
|
-
crypticorn/common/auth_client.py,sha256=7ICjLRPOIXzEJXW76BgVxkNfi_QjuRdLZBX6TNvTpJE,7588
|
57
|
+
crypticorn/common/__init__.py,sha256=8QvHfHNl5CsTOuNBag9fXZ6PZdfyAveIBeVL_37Db1U,151
|
58
|
+
crypticorn/common/auth.py,sha256=NZMM0zGCgMn0lBV71EZ428it9tGdnPnTUHKthPx4kyg,7482
|
60
59
|
crypticorn/common/errors.py,sha256=Yd3zLtrqCe0NvjfqxIHohT48T4yfSi-V4s_WyYAi8t4,12614
|
61
|
-
crypticorn/common/scopes.py,sha256
|
60
|
+
crypticorn/common/scopes.py,sha256=-dkEjY2AVAjdub4zLMy6IFltzii_Ll0NBaSWtI7w4BU,1419
|
62
61
|
crypticorn/common/sorter.py,sha256=DPkQmxDeuti4onCiE8IJZUkTc5WZp1j4dIIc7wN9En0,1167
|
63
|
-
crypticorn/common/urls.py,sha256=
|
62
|
+
crypticorn/common/urls.py,sha256=twMpsXnGZhxa4-sV8Pmt4n0VUzVd_xUNiyGD2BckFKM,803
|
64
63
|
crypticorn/hive/__init__.py,sha256=hRfTlEzEql4msytdUC_04vfaHzVKG5CGZle1M-9QFgY,81
|
65
|
-
crypticorn/hive/main.py,sha256=
|
64
|
+
crypticorn/hive/main.py,sha256=U4wurkxnKai2i7iiq049ah9nVzBxmexRxBdFIWfd9qE,631
|
66
65
|
crypticorn/hive/client/__init__.py,sha256=DIj3v16Yq5l6yMPoywrL2sOvQ6ZqpAsSJuhssIp8JFQ,2396
|
67
66
|
crypticorn/hive/client/api_client.py,sha256=KAz4MLfl1U6HCTx4qDWnWlIR6_SF4Q3Bq_Uq7OhHkT8,26889
|
68
67
|
crypticorn/hive/client/api_response.py,sha256=WhxwYDSMm6wPixp9CegO8dJzjFxDz3JF1yCq9s0ZqKE,639
|
@@ -94,11 +93,11 @@ crypticorn/hive/client/models/target_type.py,sha256=8mdPpdfY_HZCMHhAWqiC1FQlrGSL
|
|
94
93
|
crypticorn/hive/client/models/validation_error.py,sha256=YUfTXf3JIoubcwOkCqoNB4agJ6RrBIkJOFDfEjvgEiA,3166
|
95
94
|
crypticorn/hive/client/models/validation_error_loc_inner.py,sha256=YeiVGPRvKAIijEbK6-fAnVo1A4U2d5d_LOyZ7P3jPoY,5070
|
96
95
|
crypticorn/klines/__init__.py,sha256=9UUW013uZ5x4evz5zRUxbNid-6O9WAPPYvPZIHpAwms,87
|
97
|
-
crypticorn/klines/main.py,sha256=
|
96
|
+
crypticorn/klines/main.py,sha256=r43Q2CVp7-gqNT9gjtfALRyN5Dp4xCyw6YOWAPVIDik,1710
|
98
97
|
crypticorn/klines/client/__init__.py,sha256=i4zgrQsA1BXPYa0YLnSOrStKk1iJyJw-2KDOtTDdizg,3795
|
99
98
|
crypticorn/klines/client/api_client.py,sha256=Sih490VSmIfdDEq0A_ULlx7HR_e03bExGYta1kZEO7Y,27135
|
100
99
|
crypticorn/klines/client/api_response.py,sha256=WhxwYDSMm6wPixp9CegO8dJzjFxDz3JF1yCq9s0ZqKE,639
|
101
|
-
crypticorn/klines/client/configuration.py,sha256=
|
100
|
+
crypticorn/klines/client/configuration.py,sha256=P6k85BelMIOrjKPPyBel6JKZXgNgG_wy4q6wo1J0_jk,17997
|
102
101
|
crypticorn/klines/client/exceptions.py,sha256=TlbbWk-rYbzR4im1prdyzhVe_btHSeNTRPrvlN8bbik,6735
|
103
102
|
crypticorn/klines/client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
104
103
|
crypticorn/klines/client/rest.py,sha256=KQv_jWLyX6hglTGnkwmyx1lbhxXYLwpOOFxFw-sY5XA,9577
|
@@ -134,8 +133,39 @@ crypticorn/klines/client/models/timeframe.py,sha256=MD4l74KnVeFr2fXJXrR8Wos58_5v
|
|
134
133
|
crypticorn/klines/client/models/udf_config_response.py,sha256=VRBMwoCmtjSooF_TxqcofGmT0JYd0HAVqjGdOWJXeds,5982
|
135
134
|
crypticorn/klines/client/models/validation_error.py,sha256=TMfS5WKx6jSNPdppQA5Yax-r3k0Gn31raWyTZPMsDPg,3509
|
136
135
|
crypticorn/klines/client/models/validation_error_loc_inner.py,sha256=tUClZ2b89NWJWHagBsZ5rlEjiV1vn4sgpAncHKUIZRg,5411
|
136
|
+
crypticorn/metrics/__init__.py,sha256=VT1pPYATCS_t_FFB14xYheb1YVyghFiHAT-RapO3NEY,120
|
137
|
+
crypticorn/metrics/main.py,sha256=k0JYZyEgjtvYJmAxkKqETsBOFH9ZZkohhNh6dvKXHwM,3120
|
138
|
+
crypticorn/metrics/client/__init__.py,sha256=9ooMGJCbi9evO8IklEjgRXdVZsuA8d4sTcKhijo7IHs,2799
|
139
|
+
crypticorn/metrics/client/api_client.py,sha256=vP_byGPqgDnmt9nV2YXUiiYWFsJ3HWWi2s81f7gp8vU,27139
|
140
|
+
crypticorn/metrics/client/api_response.py,sha256=WhxwYDSMm6wPixp9CegO8dJzjFxDz3JF1yCq9s0ZqKE,639
|
141
|
+
crypticorn/metrics/client/configuration.py,sha256=vlHI58g76MvBjIYj_lU9T0YiPf5dC_OWW9HHBaQEask,17626
|
142
|
+
crypticorn/metrics/client/exceptions.py,sha256=Hg4u41-JvnlRV5Eu4ZxaFClHP5apqNNbHBFRfE6P3u8,6626
|
143
|
+
crypticorn/metrics/client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
144
|
+
crypticorn/metrics/client/rest.py,sha256=1XJWcgpqjCTmKQkkDASF3IhBu58fSaWRPoalizOO_5c,7160
|
145
|
+
crypticorn/metrics/client/api/__init__.py,sha256=6Oe65QZrPMVsKFm0EozbaSh2bCsjwM7JnamjheerrcM,517
|
146
|
+
crypticorn/metrics/client/api/exchanges_api.py,sha256=A4KTYRcuxTA11vAjn17wgmsvQyzWOw6MDk_6-X6xpCA,41666
|
147
|
+
crypticorn/metrics/client/api/health_check_api.py,sha256=FuGyOWzkOo1mQaI8agGUXMSlwvzEm7MKyDXqwNWjjUM,10600
|
148
|
+
crypticorn/metrics/client/api/indicators_api.py,sha256=6k4mXpOg9MIIjIVYAjpvt8FK2X8P0Rli6x1ETANEeK0,26502
|
149
|
+
crypticorn/metrics/client/api/logs_api.py,sha256=VoLkymPD2yX8yepAfqPSqDxLy--clbgBiZJipX1-M40,14244
|
150
|
+
crypticorn/metrics/client/api/marketcap_api.py,sha256=zx2ypWL15ZecMhm3f9DqupFMzwA3jHApFvsC58RcIQs,52841
|
151
|
+
crypticorn/metrics/client/api/markets_api.py,sha256=92o2Hak9pFeJ7wmkphqEzrjT9gw4gZE49JsE35pO0m4,25304
|
152
|
+
crypticorn/metrics/client/api/tokens_api.py,sha256=tO21gzbvFCQYTrfenVlsDK_YxzEu_ut6VOatryC4Hcc,12057
|
153
|
+
crypticorn/metrics/client/models/__init__.py,sha256=pIOxE1-Ui53O5mR0cHPSd9FjSr9d7WIm8tsrX-a1KkI,1686
|
154
|
+
crypticorn/metrics/client/models/base_response_dict.py,sha256=a1ZcrL_AleMfxwT-zfPYV4cd1LwS-Wz4a9A92CIEFRo,3547
|
155
|
+
crypticorn/metrics/client/models/base_response_health_check_response.py,sha256=hWZJ8WUcLO1Ml7D0uvmSjrhxGxkEOmEPUmjK-rElbSI,4000
|
156
|
+
crypticorn/metrics/client/models/base_response_list_dict.py,sha256=exP8bxgkyhNchQSHwnLBeJFu5FkJstcB5foqctBUfIE,3569
|
157
|
+
crypticorn/metrics/client/models/base_response_list_exchange_mapping.py,sha256=-g0UMGlwwhJuxfcBp0QG60m0bW2ORnyvHyPpPprBSb0,4165
|
158
|
+
crypticorn/metrics/client/models/base_response_list_str.py,sha256=5lp3KqkdDDHqFR-7qWharb-PkzY07J9zRMhLgmOc7uQ,3560
|
159
|
+
crypticorn/metrics/client/models/error_response.py,sha256=_8ph1nXwGgGQ0mlsZZuoBBFYakNeetg-lGn6OrsMsAw,3473
|
160
|
+
crypticorn/metrics/client/models/exchange_mapping.py,sha256=VnWJVALy0pVT5e26XrNykCJBfl4RtRh99xlnkB_cu-g,4376
|
161
|
+
crypticorn/metrics/client/models/health_check_response.py,sha256=aCtQQ9EG9uEYir0Ny-oyIB49Mztn9J_HCEloxk3IvpE,2955
|
162
|
+
crypticorn/metrics/client/models/http_validation_error.py,sha256=LA7UuqNMKxqG7iO_bi1Kgx5mdodtLAgxL5VOdefpgJk,3291
|
163
|
+
crypticorn/metrics/client/models/market.py,sha256=mJBN2REbwvJags4iWgfnyec3XDyJDtGAQClC0LrJAcE,902
|
164
|
+
crypticorn/metrics/client/models/severity.py,sha256=7qCflKy5HPy6EL6Ig3bencZnddnupas9vfxoh1D1fSE,936
|
165
|
+
crypticorn/metrics/client/models/validation_error.py,sha256=yCwcbJ9w7lr_jSgcbsl2C37Zr9h93iAZxdHc7lKqeZs,3401
|
166
|
+
crypticorn/metrics/client/models/validation_error_loc_inner.py,sha256=Rki-HutGR9cicKt_OP2vN-5-ofpvPsmT6VpSYeMfJfI,5302
|
137
167
|
crypticorn/pay/__init__.py,sha256=ux-B-YbNetpTlZTb2fijuGUOEmSm4IB0fYtieGnVDBg,78
|
138
|
-
crypticorn/pay/main.py,sha256=
|
168
|
+
crypticorn/pay/main.py,sha256=6sCELtBpQglCDpHlOtCMfWct_itCNv9QZCeumZI22A0,601
|
139
169
|
crypticorn/pay/client/__init__.py,sha256=-Nk_UoRtKtpbY1-9iP1hUdDczdP6eE3T_Z1wVNhkAZo,2377
|
140
170
|
crypticorn/pay/client/api_client.py,sha256=kZqhvF9r2vqqOYnnu6hTAQVWPmzjFKhC9efShUCfr7o,26944
|
141
171
|
crypticorn/pay/client/api_response.py,sha256=WhxwYDSMm6wPixp9CegO8dJzjFxDz3JF1yCq9s0ZqKE,639
|
@@ -185,7 +215,7 @@ crypticorn/pay/client/models/unified_payment_model.py,sha256=_Y9OtWZ-N7QDxsCte0U
|
|
185
215
|
crypticorn/pay/client/models/validation_error.py,sha256=vzw1GCCSx0Tct-t8b4IfNQe4jaioantmwbwz2Cmi4AA,3226
|
186
216
|
crypticorn/pay/client/models/validation_error_loc_inner.py,sha256=8Fp046J4qWnAIBATnrzS9qiKZKDY4C3UxSOJo9DTTcQ,5131
|
187
217
|
crypticorn/trade/__init__.py,sha256=QzScH9n-ly3QSaBSpPP7EqYwhdzDqYCZJs0-AhEhrsY,84
|
188
|
-
crypticorn/trade/main.py,sha256=
|
218
|
+
crypticorn/trade/main.py,sha256=UZQ9ZJlus5CHLZBOimF6Cr4vx9ocTL5SjRA69MZ73tQ,1044
|
189
219
|
crypticorn/trade/client/__init__.py,sha256=Wa4Pn_QmZfZpScj3eM5hTh1gxcg9j9O13jImEySmQJ0,3480
|
190
220
|
crypticorn/trade/client/api_client.py,sha256=GZFlYDIxGpPWtK6CnTqZLN8kWSSSzcdziNY4kTB1hE4,26956
|
191
221
|
crypticorn/trade/client/api_response.py,sha256=WhxwYDSMm6wPixp9CegO8dJzjFxDz3JF1yCq9s0ZqKE,639
|
@@ -229,7 +259,7 @@ crypticorn/trade/client/models/tpsl.py,sha256=QGPhcgadjxAgyzpRSwlZJg_CDLnKxdZgse
|
|
229
259
|
crypticorn/trade/client/models/trading_action_type.py,sha256=jW0OsNz_ZNXlITxAfh979BH5U12oTXSr6qUVcKcGHhw,847
|
230
260
|
crypticorn/trade/client/models/validation_error.py,sha256=uTkvsKrOAt-21UC0YPqCdRl_OMsuu7uhPtWuwRSYvv0,3228
|
231
261
|
crypticorn/trade/client/models/validation_error_loc_inner.py,sha256=22ql-H829xTBgfxNQZsqd8fS3zQt9tLW1pj0iobo0jY,5131
|
232
|
-
crypticorn-2.
|
233
|
-
crypticorn-2.
|
234
|
-
crypticorn-2.
|
235
|
-
crypticorn-2.
|
262
|
+
crypticorn-2.2.0.dist-info/METADATA,sha256=aLpVj-g7X_LrGymsLqnbiByREFUDLZsHSScoeo2djPk,5393
|
263
|
+
crypticorn-2.2.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
264
|
+
crypticorn-2.2.0.dist-info/top_level.txt,sha256=EP3NY216qIBYfmvGl0L2Zc9ItP0DjGSkiYqd9xJwGcM,11
|
265
|
+
crypticorn-2.2.0.dist-info/RECORD,,
|
crypticorn/common/auth_client.py
DELETED
@@ -1,213 +0,0 @@
|
|
1
|
-
from fastapi import Depends, HTTPException, Query, status
|
2
|
-
from fastapi.security import HTTPAuthorizationCredentials, SecurityScopes
|
3
|
-
from typing_extensions import Annotated, Doc
|
4
|
-
import json
|
5
|
-
|
6
|
-
from crypticorn.auth import AuthClient, Verify200Response
|
7
|
-
from crypticorn.auth.client.exceptions import ApiException
|
8
|
-
from crypticorn.common import (
|
9
|
-
ApiError,
|
10
|
-
Scope,
|
11
|
-
ApiVersion,
|
12
|
-
BaseURL,
|
13
|
-
Domain,
|
14
|
-
apikey_header,
|
15
|
-
http_bearer,
|
16
|
-
)
|
17
|
-
|
18
|
-
|
19
|
-
class AuthHandler:
|
20
|
-
"""
|
21
|
-
Middleware for verifying API requests. Verifies the validity of the authentication token, allowed scopes, etc.
|
22
|
-
"""
|
23
|
-
|
24
|
-
def __init__(
|
25
|
-
self,
|
26
|
-
base_url: Annotated[
|
27
|
-
BaseURL, Doc("The base URL for the auth service.")
|
28
|
-
] = BaseURL.PROD,
|
29
|
-
api_version: Annotated[
|
30
|
-
ApiVersion, Doc("The API version of the auth service.")
|
31
|
-
] = ApiVersion.V1,
|
32
|
-
whitelist: Annotated[
|
33
|
-
list[Domain],
|
34
|
-
Doc(
|
35
|
-
"The domains of which requests are allowed full access to the service."
|
36
|
-
),
|
37
|
-
] = [
|
38
|
-
Domain.PROD,
|
39
|
-
Domain.DEV,
|
40
|
-
], # TODO: decide whether this is needed, else omit
|
41
|
-
):
|
42
|
-
self.whitelist = whitelist
|
43
|
-
self.auth_client = AuthClient(base_url=base_url, api_version=api_version)
|
44
|
-
|
45
|
-
self.no_credentials_exception = HTTPException(
|
46
|
-
status_code=status.HTTP_401_UNAUTHORIZED,
|
47
|
-
detail=ApiError.NO_CREDENTIALS.identifier,
|
48
|
-
)
|
49
|
-
|
50
|
-
async def _verify_api_key(self, api_key: str) -> None:
|
51
|
-
"""
|
52
|
-
Verifies the API key.
|
53
|
-
"""
|
54
|
-
return await self.auth_client.login.verify_api_key(api_key)
|
55
|
-
|
56
|
-
async def _verify_bearer(
|
57
|
-
self, bearer: HTTPAuthorizationCredentials
|
58
|
-
) -> Verify200Response:
|
59
|
-
"""
|
60
|
-
Verifies the bearer token.
|
61
|
-
"""
|
62
|
-
self.auth_client.config.access_token = bearer.credentials
|
63
|
-
return await self.auth_client.login.verify()
|
64
|
-
|
65
|
-
async def _validate_scopes(
|
66
|
-
self, api_scopes: list[Scope], user_scopes: list[Scope]
|
67
|
-
) -> bool:
|
68
|
-
"""
|
69
|
-
Checks if the user scopes are a subset of the API scopes.
|
70
|
-
"""
|
71
|
-
if not set(api_scopes).issubset(user_scopes):
|
72
|
-
raise HTTPException(
|
73
|
-
status_code=status.HTTP_403_FORBIDDEN,
|
74
|
-
detail=ApiError.INSUFFICIENT_SCOPES.identifier,
|
75
|
-
)
|
76
|
-
|
77
|
-
async def _extract_message(self, e: ApiException) -> str:
|
78
|
-
"""
|
79
|
-
Tries to extract the message from the body of the exception.
|
80
|
-
"""
|
81
|
-
try:
|
82
|
-
load = json.loads(e.body)
|
83
|
-
except (json.JSONDecodeError, TypeError):
|
84
|
-
return e.body
|
85
|
-
else:
|
86
|
-
common_keys = ["message"]
|
87
|
-
for key in common_keys:
|
88
|
-
if key in load:
|
89
|
-
return load[key]
|
90
|
-
return load
|
91
|
-
|
92
|
-
async def _handle_exception(self, e: Exception) -> HTTPException:
|
93
|
-
"""
|
94
|
-
Handles exceptions and returns a HTTPException with the appropriate status code and detail.
|
95
|
-
"""
|
96
|
-
if isinstance(e, ApiException):
|
97
|
-
return HTTPException(
|
98
|
-
status_code=e.status,
|
99
|
-
detail=await self._extract_message(e),
|
100
|
-
)
|
101
|
-
elif isinstance(e, HTTPException):
|
102
|
-
return e
|
103
|
-
else:
|
104
|
-
return HTTPException(
|
105
|
-
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
106
|
-
detail=str(e),
|
107
|
-
)
|
108
|
-
|
109
|
-
async def api_key_auth(
|
110
|
-
self,
|
111
|
-
api_key: Annotated[str | None, Depends(apikey_header)] = None,
|
112
|
-
sec: SecurityScopes = SecurityScopes(),
|
113
|
-
) -> Verify200Response:
|
114
|
-
"""
|
115
|
-
Verifies the API key and checks if the user scopes are a subset of the API scopes.
|
116
|
-
Use this function if you only want to allow access via the API key.
|
117
|
-
"""
|
118
|
-
return await self.combined_auth(bearer=None, api_key=api_key, sec=sec)
|
119
|
-
|
120
|
-
async def bearer_auth(
|
121
|
-
self,
|
122
|
-
bearer: Annotated[
|
123
|
-
HTTPAuthorizationCredentials | None,
|
124
|
-
Depends(http_bearer),
|
125
|
-
] = None,
|
126
|
-
sec: SecurityScopes = SecurityScopes(),
|
127
|
-
) -> Verify200Response:
|
128
|
-
"""
|
129
|
-
Verifies the bearer token and checks if the user scopes are a subset of the API scopes.
|
130
|
-
Use this function if you only want to allow access via the bearer token.
|
131
|
-
"""
|
132
|
-
return await self.combined_auth(bearer=bearer, api_key=None, sec=sec)
|
133
|
-
|
134
|
-
async def combined_auth(
|
135
|
-
self,
|
136
|
-
bearer: Annotated[
|
137
|
-
HTTPAuthorizationCredentials | None, Depends(http_bearer)
|
138
|
-
] = None,
|
139
|
-
api_key: Annotated[str | None, Depends(apikey_header)] = None,
|
140
|
-
sec: SecurityScopes = SecurityScopes(),
|
141
|
-
) -> Verify200Response:
|
142
|
-
"""
|
143
|
-
Verifies the bearer token and/or API key and checks if the user scopes are a subset of the API scopes.
|
144
|
-
Returns early on the first successful verification, otherwise tries all available tokens.
|
145
|
-
Use this function if you want to allow access via either the bearer token or the API key.
|
146
|
-
"""
|
147
|
-
tokens = [bearer, api_key]
|
148
|
-
|
149
|
-
last_error = None
|
150
|
-
for token in tokens:
|
151
|
-
try:
|
152
|
-
if token is None:
|
153
|
-
continue
|
154
|
-
res = None
|
155
|
-
if isinstance(token, str):
|
156
|
-
res = await self._verify_api_key(token)
|
157
|
-
elif isinstance(token, HTTPAuthorizationCredentials):
|
158
|
-
res = await self._verify_bearer(token)
|
159
|
-
if res is None:
|
160
|
-
continue
|
161
|
-
if sec:
|
162
|
-
await self._validate_scopes(sec.scopes, res.scopes)
|
163
|
-
return res
|
164
|
-
|
165
|
-
except Exception as e:
|
166
|
-
last_error = await self._handle_exception(e)
|
167
|
-
continue
|
168
|
-
|
169
|
-
raise last_error or self.no_credentials_exception
|
170
|
-
|
171
|
-
async def ws_api_key_auth(
|
172
|
-
self,
|
173
|
-
api_key: Annotated[str | None, Query()] = None,
|
174
|
-
sec: SecurityScopes = SecurityScopes(),
|
175
|
-
) -> Verify200Response:
|
176
|
-
"""
|
177
|
-
Verifies the API key and checks if the user scopes are a subset of the API scopes.
|
178
|
-
Use this function if you only want to allow access via the API key.
|
179
|
-
"""
|
180
|
-
return await self.api_key_auth(api_key=api_key, sec=sec)
|
181
|
-
|
182
|
-
async def ws_bearer_auth(
|
183
|
-
self,
|
184
|
-
bearer: Annotated[str | None, Query()] = None,
|
185
|
-
sec: SecurityScopes = SecurityScopes(),
|
186
|
-
) -> Verify200Response:
|
187
|
-
"""
|
188
|
-
Verifies the bearer token and checks if the user scopes are a subset of the API scopes.
|
189
|
-
Use this function if you only want to allow access via the bearer token.
|
190
|
-
"""
|
191
|
-
credentials = (
|
192
|
-
HTTPAuthorizationCredentials(scheme="Bearer", credentials=bearer)
|
193
|
-
if bearer
|
194
|
-
else None
|
195
|
-
)
|
196
|
-
return await self.bearer_auth(bearer=credentials, sec=sec)
|
197
|
-
|
198
|
-
async def ws_combined_auth(
|
199
|
-
self,
|
200
|
-
bearer: Annotated[str | None, Query()] = None,
|
201
|
-
api_key: Annotated[str | None, Query()] = None,
|
202
|
-
sec: SecurityScopes = SecurityScopes(),
|
203
|
-
) -> Verify200Response:
|
204
|
-
"""
|
205
|
-
Verifies the bearer token and/or API key and checks if the user scopes are a subset of the API scopes.
|
206
|
-
Use this function if you want to allow access via either the bearer token or the API key.
|
207
|
-
"""
|
208
|
-
credentials = (
|
209
|
-
HTTPAuthorizationCredentials(scheme="Bearer", credentials=bearer)
|
210
|
-
if bearer
|
211
|
-
else None
|
212
|
-
)
|
213
|
-
return await self.combined_auth(bearer=credentials, api_key=api_key, sec=sec)
|
@@ -1,92 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: crypticorn
|
3
|
-
Version: 2.1.5
|
4
|
-
Summary: Maximise Your Crypto Trading Profits with AI Predictions
|
5
|
-
Author-email: Crypticorn <timon@crypticorn.com>
|
6
|
-
Project-URL: Homepage, https://crypticorn.com
|
7
|
-
Keywords: machine learning,data science,crypto,modelling
|
8
|
-
Classifier: Topic :: Scientific/Engineering
|
9
|
-
Classifier: Development Status :: 4 - Beta
|
10
|
-
Classifier: Intended Audience :: Science/Research
|
11
|
-
Classifier: Operating System :: OS Independent
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
13
|
-
Classifier: Typing :: Typed
|
14
|
-
Requires-Python: >=3.10
|
15
|
-
Description-Content-Type: text/markdown
|
16
|
-
Requires-Dist: fastapi
|
17
|
-
Requires-Dist: urllib3<3.0.0,>=1.25.3
|
18
|
-
Requires-Dist: python_dateutil<3.0.0,>=2.8.2
|
19
|
-
Requires-Dist: aiohttp<4.0.0,>=3.8.4
|
20
|
-
Requires-Dist: aiohttp-retry<3.0.0,>=2.8.3
|
21
|
-
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
22
|
-
Requires-Dist: typing-extensions<5.0.0,>=4.7.1
|
23
|
-
Requires-Dist: pandas<3.0.0,>=2.2.0
|
24
|
-
Requires-Dist: requests<3.0.0,>=2.32.0
|
25
|
-
Requires-Dist: tqdm<5.0.0,>=4.67.0
|
26
|
-
Provides-Extra: dev
|
27
|
-
Requires-Dist: streamlit; extra == "dev"
|
28
|
-
Requires-Dist: httpx; extra == "dev"
|
29
|
-
Requires-Dist: build; extra == "dev"
|
30
|
-
Requires-Dist: black; extra == "dev"
|
31
|
-
Requires-Dist: twine; extra == "dev"
|
32
|
-
Requires-Dist: pyflakes; extra == "dev"
|
33
|
-
Provides-Extra: test
|
34
|
-
Requires-Dist: pytest==8.3.5; extra == "test"
|
35
|
-
Requires-Dist: pytest-asyncio==0.26.0; extra == "test"
|
36
|
-
Requires-Dist: pytest-cov==6.1.1; extra == "test"
|
37
|
-
Requires-Dist: python-dotenv==1.0.1; extra == "test"
|
38
|
-
|
39
|
-
# What is Crypticorn?
|
40
|
-
|
41
|
-
Crypticorn is at the forefront of cutting-edge artificial intelligence cryptocurrency trading.
|
42
|
-
Crypticorn offers AI-based solutions for both active and passive investors, including:
|
43
|
-
- Prediction Dashboard with trading terminal,
|
44
|
-
- AI Agents with different strategies,
|
45
|
-
- DEX AI Signals for newly launched tokens,
|
46
|
-
- DEX AI Bots
|
47
|
-
|
48
|
-
Use this API Client to contribute to the so-called Hive AI, a community driven AI Meta Model for predicting the
|
49
|
-
cryptocurrency market.
|
50
|
-
|
51
|
-
## Installation
|
52
|
-
|
53
|
-
You can install the latest stable version from PyPi:
|
54
|
-
```bash
|
55
|
-
pip install crypticorn
|
56
|
-
```
|
57
|
-
|
58
|
-
If you want a specific version, run:
|
59
|
-
```bash
|
60
|
-
pip install crypticorn==2.0.0
|
61
|
-
```
|
62
|
-
|
63
|
-
If you want the latest version, which could be a pre release, run:
|
64
|
-
```bash
|
65
|
-
pip install --pre crypticorn
|
66
|
-
```
|
67
|
-
|
68
|
-
## Usage
|
69
|
-
|
70
|
-
As of know the library is available in async mode only. There are two was of using it.
|
71
|
-
|
72
|
-
## With Async Context Protocol
|
73
|
-
```python
|
74
|
-
async with ApiClient(base_url=BaseUrl.Prod, api_key="your-api-key") as client:
|
75
|
-
# json response
|
76
|
-
response = await client.pay.products.get_products_without_preload_content()
|
77
|
-
print(await response.json())
|
78
|
-
# serialized response with pydantic models
|
79
|
-
response = await client.pay.products.get_products()
|
80
|
-
print(response)
|
81
|
-
# json response with http info
|
82
|
-
response = await client.pay.products.get_products_with_http_info()
|
83
|
-
print(response)
|
84
|
-
```
|
85
|
-
|
86
|
-
## Without Async Context Protocol
|
87
|
-
Without the context you need to close the session manually.
|
88
|
-
```python
|
89
|
-
client = ApiClient(base_url=BaseUrl.Prod, api_key="your-api-key")
|
90
|
-
response = asyncio.run(client.hive.models.get_all_models())
|
91
|
-
asyncio.run(client.close())
|
92
|
-
```
|
File without changes
|
File without changes
|