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.29-cp312-none-win_amd64.whl (12.1 MB view details)

Uploaded CPython 3.12 Windows x86-64

cybotrade-1.4.29-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.3 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

cybotrade-1.4.29-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.5 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

cybotrade-1.4.29-cp312-cp312-macosx_11_0_arm64.whl (9.9 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

cybotrade-1.4.29-cp312-cp312-macosx_10_12_x86_64.whl (10.6 MB view details)

Uploaded CPython 3.12 macOS 10.12+ x86-64

cybotrade-1.4.29-cp311-none-win_amd64.whl (12.1 MB view details)

Uploaded CPython 3.11 Windows x86-64

cybotrade-1.4.29-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.3 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

cybotrade-1.4.29-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

cybotrade-1.4.29-cp311-cp311-macosx_11_0_arm64.whl (10.0 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

cybotrade-1.4.29-cp311-cp311-macosx_10_12_x86_64.whl (10.6 MB view details)

Uploaded CPython 3.11 macOS 10.12+ x86-64

File details

Details for the file cybotrade-1.4.29-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 63748235665d176d84f254c5ec2bc6032651a327c473ab6bd7dccfc67bc83081
MD5 acc536468b9c3e031548ee0fc3fd99f0
BLAKE2b-256 d527947685ef2d7744e9a46bb665865258d01fd9e3b755273fea84a36b0066db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0a87e873787e63f0e2ffec321e92799203d74eba6997535a9707db23f56374af
MD5 b5a18d207a76739a2275e89e22342c29
BLAKE2b-256 eed0e4df785b12ad352b00e015380de5e22464486a1270c8899fc176fea002b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 695bf4763c51f1cf77069e03aafdf3ee64fe790849272582a7760216611391e7
MD5 576a984a4c3d8f7b2ed4608baf117eee
BLAKE2b-256 ffe9ee1bc18464d4929905443542564fe2ba88c293857a450cbcac1140344b8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41190dbe57c85ec948d506bcf5b497795ca50e41f275a668e70709291f758a78
MD5 2a217b9808937f7972b7858167d137ed
BLAKE2b-256 6a5d5fdf37aefe564269daadc3bc59302aa862cc0a512fedac836913ce32f10c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 721f73568c765bdfa6d2f8c036851410d637ba7e8181814a5445827e6f81e668
MD5 78de00c741005c5703e8a66a6925b8c9
BLAKE2b-256 dc6761033f56793d13713533c85540cb95f24342b22a07d8f39c19279459bdef

See more details on using hashes here.

File details

Details for the file cybotrade-1.4.29-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 7fea82b723d7aed4af812d37a1beb202fcb6470176d0e43c7ee89602248534f9
MD5 b8d438a0aa7843fe649951d6e77e653e
BLAKE2b-256 9ef3cdac3f57f2a6bc4c715f7c4ce4df4599d0bb1a8045e501b0ecbaec460119

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d85696b549548bc21cbfa6fbf107f0500415fda3c071f2a243e5ce46e7f152d7
MD5 e66f469f204b79a94d21b0f94e701f2d
BLAKE2b-256 72ace4cc318c66c30684f945e7827ecb38ee1a2d6a8c3675b6ec6c443b933e3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9bdf4e6efbacaf1e076987070ba39a28f63ca506a6761e6be384333ac1f50b18
MD5 45c31ce4f19e6cd6aed59e2d50f01a6e
BLAKE2b-256 58203f05eb545d615c3d65e91a3c96e7012384debad68bb8447002417a14ac98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5db98d1ab11a401b75179fbd4e6ee523916b78670d0a6522a0839476237513e
MD5 752908c08dd24a42b1df9897a232a900
BLAKE2b-256 1121665e185021fa3440e896497a6a9f97b87f221733cc8c9c32932f18da1b1c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.29-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4d8984be188a3cf81d8632d3474201105a4e9c99242b8eb1855d83d544a8461d
MD5 7714786c8628de2ff23f4d6a22a922be
BLAKE2b-256 0b19fad828547de3c83f72ee68d530414a70386d53000257dfd5b808fa5998b2

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