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.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

cybotrade_datasource-0.1.3-cp313-cp313-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cybotrade_datasource-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cybotrade_datasource-0.1.3-cp312-cp312-macosx_11_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for cybotrade_datasource-0.1.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ee8fc34a60de315e2792617bfe35225ef7cd2b06fadea108f7b202f5943dae1
MD5 ed8b7a24cdea380f5a7369abb9bfaaaf
BLAKE2b-256 44e5fdd07e7d9deae75b2b2d8579fe24e5a2a6847962cb0f3f6686579152cbbe

See more details on using hashes here.

File details

Details for the file cybotrade_datasource-0.1.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cybotrade_datasource-0.1.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e38135c4e3ab1bc62da28dc1c68e8e03c24a7d3080a4537282e75884af718104
MD5 562385feb95f16be67d566e3192cfc22
BLAKE2b-256 6448f4cb78e20a917be3bf36bcbdeb8057dadcb4ab5924e9f71450866797e173

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade_datasource-0.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c74a96795abb50626dc7113ab17cb2f33f5bc019332873dcd605bed15cf929d9
MD5 83d6936ba8e5600c1f707fe15726e3c9
BLAKE2b-256 34410551220e5c1954efe00c554ebf616af8ec1c28ce33fd0eaabc48c5274271

See more details on using hashes here.

File details

Details for the file cybotrade_datasource-0.1.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cybotrade_datasource-0.1.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db200c77a2715017d2fc3adcb56b86172184bd1f798163d61860684a092e703a
MD5 4fecbfc18f0b7c3e74e42b47f128361e
BLAKE2b-256 62987ca97c590ab898adee85d409629d625c68cbeba9298f22c6bd16ac19ecb4

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