Skip to main content

This library contains Cybotrade's core runtime, integrations with Exchanges API, historical and live market data collector and wrap them into a simple, easy-to-use Python SDK.

Project description

Cybotrade

This is the Client SDK for building automated trading strategies on Cybotrade. This library provides the core runtime, integration with Exchanges API, historical and live market data collector and wrap them into a simple, easy-to-use and easy-to-learn Python SDK as a foundation users' strategies.

Documentation

The documentation for the Cybotrade SDK can be found here.

Installation

pip install cybotrade

Usage

The following example shows how to create a simple strategy that buys 0.01 BTC when the price goes up and sells 0.01 BTC when the price goes down.

For a more advanced usage, please refer to the documentation.

from cybotrade.strategy import Strategy as BaseStrategy
from cybotrade.models import (
    OrderParams, 
    OrderSide,
    RuntimeMode,
    RuntimeConfig,
    Exchange,
)
from datetime import datetime, timedelta, timezone

import asyncio

class Strategy(BaseStrategy):
    async def on_candle_closed(self, strategy, topic, symbol, data_map):
        # Get the currently closed candles
        candles = data_map[topic] 

        if candles[-1].close > candles[-2].close:
            # Buy 0.01 BTC
            await strategy.open(
                side=OrderSide.Buy,
                take_profit=None,
                stop_loss=None,
                quantity=0.01,
                limit=None
            )
        else:
            # Sell 0.01 BTC
            await strategy.open(
                side=OrderSide.Sell,
                take_profit=None,
                stop_loss=None,
                quantity=0.01,
                limit=None
            )

async def main():
    runtime = await Runtime.connect(
        RuntimeConfig(
            mode=RuntimeMode.Backtest,
            exchange=Exchange.BybitLinear,
            datasource_topics=[],
            candle_topics=["candles-1h-BTC/USDT-bybit"],
            start_time=datetime.now(timezone.utc) - timedelta(minutes=10000),
            end_time=datetime.now(timezone.utc),
            api_key="YOUR_CYBOTRADE_API_KEY",
            api_secret="YOUR_CYBOTRAD_API_SECRET",
            data_count=100
        ),
        Strategy(),
    )

    await runtime.start()

asyncio.run(main())

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 Distributions

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

Built Distributions

cybotrade-1.4.31-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.7 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

cybotrade-1.4.31-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.0 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

cybotrade-1.4.31-cp312-cp312-macosx_11_0_arm64.whl (11.4 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

cybotrade-1.4.31-cp312-cp312-macosx_10_12_x86_64.whl (12.2 MB view details)

Uploaded CPython 3.12 macOS 10.12+ x86-64

cybotrade-1.4.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

cybotrade-1.4.31-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.0 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

cybotrade-1.4.31-cp311-cp311-macosx_11_0_arm64.whl (11.4 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

cybotrade-1.4.31-cp311-cp311-macosx_10_12_x86_64.whl (12.2 MB view details)

Uploaded CPython 3.11 macOS 10.12+ x86-64

File details

Details for the file cybotrade-1.4.31-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.31-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08fd3e854688872c29ce74cb2e3556c6e57f6724152e1d5b65b2e412de2628b8
MD5 ba3e94655f987b18332fb701737a0987
BLAKE2b-256 5adf1933d7d7a61ce2f39049f8e9724b665de8ce2d255ed9bbd7b791d8182f5f

See more details on using hashes here.

File details

Details for the file cybotrade-1.4.31-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.31-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f48fd1530b5a1f29b0d5b17b944d1a0d6eddf24c2f3e55e8f7b7a8c1815913f1
MD5 5de3bab54af7b2d47652f1f8ab0b0776
BLAKE2b-256 a23e5762ffc82426ada7575aacb5a78828594d41f390e703bad5a385c633db65

See more details on using hashes here.

File details

Details for the file cybotrade-1.4.31-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.31-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfe238e8ba73beba523874a1d263086a990d00408a3f9fd8efcb388132943439
MD5 6d8923cf66c0eda6e4c2028ce76fdec2
BLAKE2b-256 ce66cf304a3f64a1252c5144cf3e5d5e712a5f7fe422ddf340c21b74c44f424a

See more details on using hashes here.

File details

Details for the file cybotrade-1.4.31-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.31-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f0150fd8864e18721311bea4f9fe263fe7473b81c0cb1f48067df11bf8080ed6
MD5 ed8fe83fba7670e3ef5bbc296dfb85b5
BLAKE2b-256 2e85020e035b3329452909f3c1480286e65f9ece52200cb0bae0d5e03d0d2e5c

See more details on using hashes here.

File details

Details for the file cybotrade-1.4.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7295b88f2912f8187132902c8ddd69e3c730bb3056502281dc40be7121d7d67
MD5 46dcf08ed5d16871eea7696407e8f0f1
BLAKE2b-256 2e31d6209e0ab0a48e03fa7325947ed35bb72dec6a235dc2c8e596cd4c9a4aad

See more details on using hashes here.

File details

Details for the file cybotrade-1.4.31-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.31-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 197419a8d2c67831f01f60288866171246b04064d61af33a5d8d5bc860f8ad93
MD5 b1ccbd76ed1a42dfe7090993f32dbb14
BLAKE2b-256 4b7fe6b773ba415c733bd1bdfe3c827a1cd48764a8694cce01ed34647df8f36d

See more details on using hashes here.

File details

Details for the file cybotrade-1.4.31-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.31-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 04f5508683062c8d1c18c8162f68b7b463066441fd1ecd010594a6b5a14e3447
MD5 e6ff46b71a04dabd1340bb45a2fa105f
BLAKE2b-256 ed6551bf5b6878e627b5c2b571bf3cab4b54dc2b2b822b00cbeec23917d48410

See more details on using hashes here.

File details

Details for the file cybotrade-1.4.31-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.31-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1badf19a30da5f42bfa4c5e50bbe8b155a20b32be65f633cedbea17e7cfb66b6
MD5 0929a4f8d8b65cc70d7da136249777ea
BLAKE2b-256 825b9c36c5832b38b4195e6d506c8d58a203bfdd4750871749115fa835365078

See more details on using hashes here.

Supported by

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