Skip to main content

Python SDK to interact with Cybotrade Datasource API.

Project description

Cybotrade Datasource

Cybotrade Datsource is a financial data broker for the crypto market. This library provides a simple-to-use Python SDK to interact with the REST and Websocket API.

For more information regarding the API, refer to the docs.

Installation

pip install cybotrade-datasource

Usage

To fetch historical data for a particular time range:

import os
import pandas as pd
import asyncio
import cybotrade_datasource
from datetime import datetime, timezone


API_KEY = os.environ["API_KEY"]


async def main():
    data = await cybotrade_datasource.query_paginated(
        api_key=API_KEY, 
        topic='cryptoquant|btc/inter-entity-flows/miner-to-miner?from_miner=f2pool&to_miner=all_miner&window=hour', 
        start_time=datetime(year=2024, month=1, day=1, tzinfo=timezone.utc),
        end_time=datetime(year=2025, month=1, day=1, tzinfo=timezone.utc)
    )
    df = pd.DataFrame(data)
    print(df)
    

asyncio.run(main())

To fetch the latest 10000 data points:

import os
import pandas as pd
import asyncio
import cybotrade_datasource
from datetime import datetime, timezone


API_KEY = os.environ["API_KEY"]


async def main():
    data = await cybotrade_datasource.query_paginated(
        api_key=API_KEY, 
        topic='cryptoquant|btc/inter-entity-flows/miner-to-miner?from_miner=f2pool&to_miner=all_miner&window=hour', 
        limit=10000
    )
    df = pd.DataFrame(data)
    print(df)
    

asyncio.run(main())

To subscribe and listen to live updates:

import os
import pandas as pd
import asyncio
import cybotrade_datasource
from datetime import datetime, timezone


API_KEY = os.environ["API_KEY"]


async def main():
    stream = await cybotrade_datasource.stream(
        api_key=API_KEY,
        topics=[
            'cryptoquant|btc/inter-entity-flows/miner-to-miner?from_miner=f2pool&to_miner=all_miner&window=hour',
            'cryptoquant|btc/market-data/liquidations?exchange=deribit&window=min',
        ],
    )
    async for msg in stream:
        print(msg)
    

asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cybotrade_datasource-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

cybotrade_datasource-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

File details

Details for the file cybotrade_datasource-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade_datasource-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 71b13883bab086f86b15104b98a20f122f36b6718b6cddd5ea33b88e650b52eb
MD5 31315ac7eba9c4f7261e96f67f0667bf
BLAKE2b-256 0e0597c8474b7acb137676222b2a3fd27c0031f5b6be46102494a909983b3ef0

See more details on using hashes here.

File details

Details for the file cybotrade_datasource-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade_datasource-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7089b3313eaab9b18ca94edb4e7bac19d80602e4be6cb5ab0bc4779f250e3e9b
MD5 9fd86004d6c564405f6b179e52fdd27b
BLAKE2b-256 308189ed2553b4c7dcad0e21d1c6f6ddcfe58f1b759017750c2bd9e51c9f2fc3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page