Maximise Your Crypto Trading Profits with Machine Learning
Project description
What is Crypticorn?
Crypticorn is at the forefront of cutting-edge crypto trading with Machine Learning.
Use this API Client to access valuable data sources, contribute to the Hive AI - a community driven AI Meta Model for predicting the crypto market - and programmatically interact with the entire Crypticorn ecosystem.
Installation
You need Python 3.10-3.14 installed to be able to use this library. It might work with older versions, but we don't test it.
You can install the latest stable version from PyPi:
pip install crypticorn
If you want the latest version, which could be a pre release, run:
pip install --pre crypticorn
You can install extra dependencies grouped in the extras extra. The extra dependencies include heavy libraries like pandas, which is only used in a few custom API operations (see data processing), which preprocess the response data as a pandas Dataframe for convenience.
Structure
Our API is available as both an asynchronous and synchronous Python SDK. The main entry points are:
AsyncClient- Asynchronous client for async/await usageSyncClient- Synchronous client for traditional blocking calls
from crypticorn import AsyncClient, SyncClient
Both clients serve as the central interface for API operations and instantiate multiple API wrappers corresponding to our micro services.
You can either explore each API by clicking through the library or checkout the API Documentation.
Request and response models for API operations should be accessed through the sub package you are using for an operation. All symbols are re-exported at the sub package level for convenience.
Versioning
The SDK major version tracks the highest supported API version. A new API major bump always triggers a new major release of this package. Minor and patch versions only add non-breaking changes. We follow Semantic Versioning.
| SDK Version | Auth | Trade | Klines | Metrics | Hive | Dex | Pay | Notification | Indicator |
|---|---|---|---|---|---|---|---|---|---|
| v2.x | v1 | v1 | - | v1 | v1 | v1 | v1 | v1 | - |
| v3.x | v1 | v2 | v1 (v3.3.0+) | v1 | v1 | v1 | v1 | v1 | v1 (v3.2.0+) |
| v4.x | v1 | v2 | v1 | v1 | v1 | v2 | v1 | v1 | v1 |
Authentication
To get started, create an API key in your dashboard.
The scopes you can assign, resemble the package structure. The first part defines if the scopes is for reading or writing a ressource, the second matches the API, the third the ROUTER being used. read scopes gives access to GET, write to PUT, PATCH, POST, DELETE endpoints.
There are scopes which don't follow this structure. Those are either scopes that must be purchased (e.g. read:predictions), give access to endpoints existing in all APIs (e.g. read:admin) or provide access to an entire service (e.g. read:sentiment).
Basic Usage
Asynchronous Client
You can use the async client with the context manager protocol...
async with AsyncClient(api_key="your-api-key") as client:
await client.pay.get_products()
...or without it like this...
client = AsyncClient(api_key="your-api-key")
asyncio.run(client.pay.get_products())
asyncio.run(client.close())
...or this.
client = AsyncClient(api_key="your-api-key")
async def main():
await client.pay.get_products()
asyncio.run(main())
asyncio.run(client.close())
Synchronous Client
For traditional synchronous usage without async/await, use the SyncClient:
from crypticorn import SyncClient
# With context manager (recommended)
with SyncClient(api_key="your-api-key") as client:
products = client.pay.get_products()
status = client.trade.ping()
# Or without context manager
client = SyncClient(api_key="your-api-key")
try:
products = client.pay.get_products()
status = client.trade.ping()
finally:
client.close() # Manual cleanup required
The sync client provides the same API surface as the async client, but all methods return results directly instead of coroutines. Under the hood, it uses asgiref.async_to_sync to bridge async operations to synchronous calls, ensuring reliable operation without requiring async/await syntax.
Response Types
There are three different available output formats you can choose from:
Serialized Response
You can get fully serialized responses as pydantic models. Using this, you get the full benefits of pydantic's type checking.
# Async client
res = await client.pay.get_products()
# Sync client
res = client.pay.get_products()
print(res)
The output would look like this:
[ProductModel(id='67e8146e7bae32f3838fe36a', name='Awesome Product', price=5.0, scopes=None, duration=30, description='You need to buy this', is_active=True)]
Serialized Response with HTTP Info
# Async client
res = await client.pay.get_products_with_http_info()
# Sync client
res = client.pay.get_products_with_http_info()
print(res)
The output would look like this:
status_code=200 headers={'Date': 'Wed, 09 Apr 2025 19:15:19 GMT', 'Content-Type': 'application/json'} 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}]'
You can then access the data of the response (as serialized output (1) or as JSON string in bytes (2)) with:
print(res.data)
print(res.raw_data)
On top of that you get some information about the request:
print(res.status_code)
print(res.headers)
JSON Response
You can receive a classical JSON response by suffixing the function name with _without_preload_content
# Async client
response = await client.pay.get_products_without_preload_content()
print(await response.json())
# Sync client - Note: use regular methods instead as response.json() returns a coroutine
response = client.pay.get_products_without_preload_content()
The output would look like this:
[{'id': '67e8146e7bae32f3838fe36a', 'name': 'Awesome Product', 'price': 5.0, 'duration': 30, 'description': 'You need to buy this', 'is_active': True}]
Wrapper Utilities
Our SDK provides a collection of wrapper utilities designed to make interacting with the API more efficient and user-friendly.
Data Preprocessing
Some API operations allow to get the returned data formatted as a pandas Dataframe. These operations are suffixed with _fmt and take the same inputs as the non-formatted function. They live alongside the other functions with the default response types. To use this functionality you have to install pandas, which is available in the extra dependency group.
Data Downloads
This utility allows direct data streaming to your local disk, instead of only returning download links. It is being used in the following functions:
client.hive.download_data()(overrides the default response)
Advanced Usage
Sub Client Configuration
You can override some configuration for specific services. If you just want to use the API as is, you don't need to configure anything. This might be of use if you are testing a specific API locally.
To override e.g. the host for the Hive client to connect to localhost:8000 instead of the default proxy, you would do:
from crypticorn.hive import Configuration as HiveConfig
# Async client
async with AsyncClient() as client:
client.configure(config=HiveConfig(host="http://localhost:8000"), service='hive')
# Sync client
with SyncClient() as client:
client.configure(config=HiveConfig(host="http://localhost:8000"), service='hive')
Session Management
By default, AsyncClient manages a single shared aiohttp.ClientSession for all service wrappers.
However, you can pass your own pre-configured aiohttp.ClientSession if you need advanced control — for example, to add retries, custom headers, logging, or mocking behavior.
When you inject a custom session, you are responsible for managing its lifecycle, including closing when you're done.
import aiohttp
from crypticorn import AsyncClient
async def main():
custom_session = aiohttp.ClientSession()
async with AsyncClient(api_key="your-key", http_client=custom_session) as client:
await client.trade.ping()
await custom_session.close()
If you don’t pass a session, AsyncClient will create and manage one internally. In that case, it will be automatically closed when using async with or when calling await client.close() manually.
Note on Sync Client: The SyncClient uses per-operation sessions (creates and closes a session for each API call) to ensure reliable synchronous behavior. Custom sessions are accepted but not used. This approach prevents event loop conflicts at the cost of slightly higher overhead per operation.
Typing Notes
This client supports both sync and async usage from the same API surface.
Because of this, method return types are annotated as:
Union[T, Awaitable[T]]
If you're using static type checking, you may see type errors due to this. This is intentional and reflects the dual sync/async support.
You can safely ignore the union type or use typing.cast to enforce the type. Otherwise, Python itself will do the right thing at runtime.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crypticorn-4.3.0.tar.gz.
File metadata
- Download URL: crypticorn-4.3.0.tar.gz
- Upload date:
- Size: 333.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
851aa69173bf856e46ba3545b40bc6c15e5e9235da0ab25886779f9cbca3f6bf
|
|
| MD5 |
d8130ade9dc8ee85cd6f4dfc410781b9
|
|
| BLAKE2b-256 |
bb9bce307fb24b1303c1b3836a56b6ce5ea2ef940b01325939a8242f7ad83dcd
|
Provenance
The following attestation bundles were made for crypticorn-4.3.0.tar.gz:
Publisher:
release.yml on crypticorn-ai/api-client-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crypticorn-4.3.0.tar.gz -
Subject digest:
851aa69173bf856e46ba3545b40bc6c15e5e9235da0ab25886779f9cbca3f6bf - Sigstore transparency entry: 847880984
- Sigstore integration time:
-
Permalink:
crypticorn-ai/api-client-python@48f28918e4f37e4e0a8c042eded0dacf3550ad6e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/crypticorn-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@48f28918e4f37e4e0a8c042eded0dacf3550ad6e -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file crypticorn-4.3.0-py3-none-any.whl.
File metadata
- Download URL: crypticorn-4.3.0-py3-none-any.whl
- Upload date:
- Size: 655.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
963caef9cc89950847fb8f3ce744aed4c79b09d940b4cb0b0f0b8437ba5229b6
|
|
| MD5 |
af75b9f5c0eb1c102789dd49d0f2a8ba
|
|
| BLAKE2b-256 |
83d02bb653e72799d94dba322a41eb29ed14ebdfc65ef90923aaba2204826931
|
Provenance
The following attestation bundles were made for crypticorn-4.3.0-py3-none-any.whl:
Publisher:
release.yml on crypticorn-ai/api-client-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crypticorn-4.3.0-py3-none-any.whl -
Subject digest:
963caef9cc89950847fb8f3ce744aed4c79b09d940b4cb0b0f0b8437ba5229b6 - Sigstore transparency entry: 847881026
- Sigstore integration time:
-
Permalink:
crypticorn-ai/api-client-python@48f28918e4f37e4e0a8c042eded0dacf3550ad6e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/crypticorn-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@48f28918e4f37e4e0a8c042eded0dacf3550ad6e -
Trigger Event:
workflow_run
-
Statement type: