## 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.9+ installed to be able to use this library.
You can install the latest stable version from [PyPi](https://pypi.org/project/crypticorn/):
```bash
pip install crypticorn
```
If you want the latest version, which could be a pre release, run:
```bash
pip install --pre crypticorn
```
You can install extra dependencies grouped in the extras `extra`, `dev` (development) and `test` (testing). The `extra` dependencies include heavy libraries like `pandas`, which is only used in a few custom API operations (see [data processing](#data-preprocessing)), 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 usage
- `SyncClient` - Synchronous client for traditional blocking calls
```python
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. These are structured the following:
<img src="static/pip-structure.svg" alt="pip package structure" />
You can either explore each API by clicking through the library or checkout the [API Documentation](https://docs.crypticorn.com/api).
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.
```python
from crypticorn.trade import BotCreate
from crypticorn.klines import MarketType
```
## Authentication
To get started, [create an API key in your dashboard](https://app.crypticorn.com/account/developer).
The scopes you can assign, resemble the [package structure](#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...
```python
async with AsyncClient(api_key="your-api-key") as client:
await client.pay.products.get_products()
```
...or without it like this...
```python
client = AsyncClient(api_key="your-api-key")
asyncio.run(client.pay.products.get_products())
asyncio.run(client.close())
```
...or this.
```python
client = AsyncClient(api_key="your-api-key")
async def main():
await client.pay.products.get_products()
asyncio.run(main())
asyncio.run(client.close())
```
### Synchronous Client
For traditional synchronous usage without async/await, use the `SyncClient`:
```python
from crypticorn import SyncClient
# With context manager (recommended)
with SyncClient(api_key="your-api-key") as client:
products = client.pay.products.get_products()
status = client.trade.status.ping()
# Or without context manager
client = SyncClient(api_key="your-api-key")
try:
products = client.pay.products.get_products()
status = client.trade.status.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.
```python
# Async client
res = await client.pay.products.get_products()
# Sync client
res = client.pay.products.get_products()
print(res)
```
The output would look like this:
```python
[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
```python
# Async client
res = await client.pay.products.get_products_with_http_info()
# Sync client
res = client.pay.products.get_products_with_http_info()
print(res)
```
The output would look like this:
```python
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:
```python
print(res.data)
print(res.raw_data)
```
On top of that you get some information about the request:
```python
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`
```python
# Async client
response = await client.pay.products.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.products.get_products_without_preload_content()
```
The output would look like this:
```python
[{'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](#response-types). To use this functionality you have to install `pandas`, which is available in the [`extra` dependency group](#installation).
### 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.data.download_data()` (overrides the [default response](https://docs.crypticorn.com/api/?api=hive-ai-api#tag/data/GET/data))
## 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:
```python
from crypticorn.hive import Configuration as HiveConfig
# Async client
async with AsyncClient() as client:
client.configure(config=HiveConfig(host="http://localhost:8000"), service='hive-v1')
# Sync client
with SyncClient() as client:
client.configure(config=HiveConfig(host="http://localhost:8000"), service='hive-v1')
```
### 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.
```python
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.status.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.
Raw data
{
"_id": null,
"home_page": null,
"name": "crypticorn",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "machine learning, data science, crypto, modelling",
"author": null,
"author_email": "Crypticorn <timon@crypticorn.com>",
"download_url": "https://files.pythonhosted.org/packages/b1/a5/a0ea521934e04d99ce283bcc1f6eacccf25dafbfa1b822fa0fd76e9fd4ef/crypticorn-2.19.0.tar.gz",
"platform": null,
"description": "## What is Crypticorn?\n\nCrypticorn is at the forefront of cutting-edge crypto trading with Machine Learning.\n\nUse this API Client to access valuable data sources, contribute to the Hive AI - a community driven AI Meta Model for predicting the\ncrypto market - and programmatically interact with the entire Crypticorn ecosystem.\n\n## Installation\n\nYou need Python 3.9+ installed to be able to use this library.\n\nYou can install the latest stable version from [PyPi](https://pypi.org/project/crypticorn/):\n```bash\npip install crypticorn\n```\n\nIf you want the latest version, which could be a pre release, run:\n```bash\npip install --pre crypticorn\n```\n\nYou can install extra dependencies grouped in the extras `extra`, `dev` (development) and `test` (testing). The `extra` dependencies include heavy libraries like `pandas`, which is only used in a few custom API operations (see [data processing](#data-preprocessing)), which preprocess the response data as a pandas Dataframe for convenience.\n\n## Structure\n\nOur API is available as both an asynchronous and synchronous Python SDK. The main entry points are:\n\n- `AsyncClient` - Asynchronous client for async/await usage\n- `SyncClient` - Synchronous client for traditional blocking calls\n\n```python\nfrom crypticorn import AsyncClient, SyncClient\n```\nBoth clients serve as the central interface for API operations and instantiate multiple API wrappers corresponding to our micro services. These are structured the following:\n\n<img src=\"static/pip-structure.svg\" alt=\"pip package structure\" />\n\nYou can either explore each API by clicking through the library or checkout the [API Documentation](https://docs.crypticorn.com/api).\n\nRequest 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.\n\n```python\nfrom crypticorn.trade import BotCreate\nfrom crypticorn.klines import MarketType\n```\n\n## Authentication\n\nTo get started, [create an API key in your dashboard](https://app.crypticorn.com/account/developer). \n\nThe scopes you can assign, resemble the [package structure](#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. \n\nThere 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`).\n\n\n## Basic Usage\n\n### Asynchronous Client\n\nYou can use the async client with the context manager protocol...\n```python\nasync with AsyncClient(api_key=\"your-api-key\") as client:\n await client.pay.products.get_products()\n```\n...or without it like this...\n```python\nclient = AsyncClient(api_key=\"your-api-key\")\nasyncio.run(client.pay.products.get_products())\nasyncio.run(client.close())\n```\n...or this.\n```python\nclient = AsyncClient(api_key=\"your-api-key\")\n\nasync def main():\n await client.pay.products.get_products()\n\nasyncio.run(main())\nasyncio.run(client.close())\n```\n\n### Synchronous Client\n\nFor traditional synchronous usage without async/await, use the `SyncClient`:\n\n```python\nfrom crypticorn import SyncClient\n\n# With context manager (recommended)\nwith SyncClient(api_key=\"your-api-key\") as client:\n products = client.pay.products.get_products()\n status = client.trade.status.ping()\n\n# Or without context manager\nclient = SyncClient(api_key=\"your-api-key\")\ntry:\n products = client.pay.products.get_products()\n status = client.trade.status.ping()\nfinally:\n client.close() # Manual cleanup required\n```\n\nThe 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.\n\n## Response Types\n\nThere are three different available output formats you can choose from:\n\n### Serialized Response\nYou can get fully serialized responses as pydantic models. Using this, you get the full benefits of pydantic's type checking.\n```python\n# Async client\nres = await client.pay.products.get_products()\n# Sync client \nres = client.pay.products.get_products()\nprint(res)\n```\nThe output would look like this:\n```python\n[ProductModel(id='67e8146e7bae32f3838fe36a', name='Awesome Product', price=5.0, scopes=None, duration=30, description='You need to buy this', is_active=True)]\n```\n\n### Serialized Response with HTTP Info\n```python\n# Async client\nres = await client.pay.products.get_products_with_http_info()\n# Sync client\nres = client.pay.products.get_products_with_http_info()\nprint(res)\n```\nThe output would look like this:\n```python\nstatus_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}]'\n```\nYou can then access the data of the response (as serialized output (1) or as JSON string in bytes (2)) with:\n```python\nprint(res.data)\nprint(res.raw_data)\n```\nOn top of that you get some information about the request:\n```python\nprint(res.status_code)\nprint(res.headers)\n```\n\n### JSON Response\nYou can receive a classical JSON response by suffixing the function name with `_without_preload_content`\n```python\n# Async client\nresponse = await client.pay.products.get_products_without_preload_content()\nprint(await response.json())\n\n# Sync client - Note: use regular methods instead as response.json() returns a coroutine\nresponse = client.pay.products.get_products_without_preload_content()\n```\nThe output would look like this:\n```python\n[{'id': '67e8146e7bae32f3838fe36a', 'name': 'Awesome Product', 'price': 5.0, 'duration': 30, 'description': 'You need to buy this', 'is_active': True}]\n```\n\n## Wrapper Utilities\n\nOur SDK provides a collection of wrapper utilities designed to make interacting with the API more efficient and user-friendly.\n\n### Data Preprocessing\nSome 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](#response-types). To use this functionality you have to install `pandas`, which is available in the [`extra` dependency group](#installation).\n\n### Data Downloads\nThis utility allows direct data streaming to your local disk, instead of only returning download links. It is being used in the following functions:\n- `client.hive.data.download_data()` (overrides the [default response](https://docs.crypticorn.com/api/?api=hive-ai-api#tag/data/GET/data))\n\n## Advanced Usage\n\n### Sub Client Configuration\n\nYou can override some configuration for specific services. If you just want to use the API as is, you don't need to configure anything.\nThis might be of use if you are testing a specific API locally.\n\nTo override e.g. the host for the Hive client to connect to localhost:8000 instead of the default proxy, you would do:\n```python\nfrom crypticorn.hive import Configuration as HiveConfig\n\n# Async client\nasync with AsyncClient() as client:\n client.configure(config=HiveConfig(host=\"http://localhost:8000\"), service='hive-v1')\n\n# Sync client\nwith SyncClient() as client:\n client.configure(config=HiveConfig(host=\"http://localhost:8000\"), service='hive-v1')\n```\n\n### Session Management\n\nBy default, `AsyncClient` manages a single shared `aiohttp.ClientSession` for all service wrappers. \nHowever, you can pass your own pre-configured `aiohttp.ClientSession` if you need advanced control \u2014 for example, to add retries, custom headers, logging, or mocking behavior.\n\nWhen you inject a custom session, you are responsible for managing its lifecycle, including closing when you're done.\n\n```python\nimport aiohttp\nfrom crypticorn import AsyncClient\n\nasync def main():\n custom_session = aiohttp.ClientSession()\n async with AsyncClient(api_key=\"your-key\", http_client=custom_session) as client:\n await client.trade.status.ping()\n await custom_session.close()\n\n```\nIf you don\u2019t 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.\n\n**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.\n",
"bugtrack_url": null,
"license": null,
"summary": "Maximise Your Crypto Trading Profits with Machine Learning",
"version": "2.19.0",
"project_urls": {
"Dashboard": "https://app.crypticorn.com",
"Documentation": "https://docs.crypticorn.com",
"Homepage": "https://crypticorn.com"
},
"split_keywords": [
"machine learning",
" data science",
" crypto",
" modelling"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "668ad84c89b656a7fafeca800024a3ffac1134144b48a8d2de6aaa2f7bb7d059",
"md5": "41a546a47f491a01b1449cd1bb717f5c",
"sha256": "675c88d1a65d06565a98f4d70a9430c15bbed388fc3ac94ae757fca95db07b1a"
},
"downloads": -1,
"filename": "crypticorn-2.19.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "41a546a47f491a01b1449cd1bb717f5c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 585294,
"upload_time": "2025-07-20T23:55:35",
"upload_time_iso_8601": "2025-07-20T23:55:35.723659Z",
"url": "https://files.pythonhosted.org/packages/66/8a/d84c89b656a7fafeca800024a3ffac1134144b48a8d2de6aaa2f7bb7d059/crypticorn-2.19.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b1a5a0ea521934e04d99ce283bcc1f6eacccf25dafbfa1b822fa0fd76e9fd4ef",
"md5": "0fb1bafb35b160700a620088fd3ee452",
"sha256": "60c697ccbd9d227127b3c7f36fbb66ffaf7a4b428ce3b3efa9d2cb2587bfe4f4"
},
"downloads": -1,
"filename": "crypticorn-2.19.0.tar.gz",
"has_sig": false,
"md5_digest": "0fb1bafb35b160700a620088fd3ee452",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 369228,
"upload_time": "2025-07-20T23:55:37",
"upload_time_iso_8601": "2025-07-20T23:55:37.736765Z",
"url": "https://files.pythonhosted.org/packages/b1/a5/a0ea521934e04d99ce283bcc1f6eacccf25dafbfa1b822fa0fd76e9fd4ef/crypticorn-2.19.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-20 23:55:37",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "crypticorn"
}