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

Uploaded CPython 3.12 Windows x86-64

cybotrade-1.4.30-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

cybotrade-1.4.30-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.30-cp312-cp312-macosx_11_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

cybotrade-1.4.30-cp312-cp312-macosx_10_12_x86_64.whl (12.1 MB view details)

Uploaded CPython 3.12 macOS 10.12+ x86-64

cybotrade-1.4.30-cp311-none-win_amd64.whl (13.8 MB view details)

Uploaded CPython 3.11 Windows x86-64

cybotrade-1.4.30-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.30-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.30-cp311-cp311-macosx_11_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

cybotrade-1.4.30-cp311-cp311-macosx_10_12_x86_64.whl (12.1 MB view details)

Uploaded CPython 3.11 macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 87240613cd6c9c2e93c3397b41e606356853466eb2994c455772253b9c79ad46
MD5 120ed2ed5d4a14bddc23f60ee74659f8
BLAKE2b-256 8d349018ddf83af7e98f454c78e3024cde334987074271539496bc0d6b121bd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1aa686c1fb4d106d8cc12bd5e9d0bbd2d2521a4d48812b8e0242dc7a0fd65d86
MD5 68c93e291807df0694aaec32bd664398
BLAKE2b-256 eef6cbc1a0824466625d55c97f716c7cf039d021195f532d36a3c80ee537bbe3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0e29f7c2879fe0e289ab33da3314f23919f78dfdeda499a5fc80f40532b9a92e
MD5 18721ed788f601dd047150852d8b42d3
BLAKE2b-256 b093f22cbf039d24b812f6d35acc2fa258d09f407a645a5b16075aa86c61066d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9124134f90174520358a16a58fdaa5374fdafd464cf726194b0599bed6d99aaf
MD5 94647786df0c773df814bbaca6bff58d
BLAKE2b-256 65ce92d2c475f489397d5198e7088f80581f2f3b187852719848949e32725682

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8f1dbd65bc96ff5a9d1a9e85f5e3db9cd43adcd91a4ed0e0afafdc2ca39aa8e0
MD5 8541c2f999d3903fafee33f4b1be1887
BLAKE2b-256 1e26a46363dd5521eb786c025c6e351b8582d787f4c19d6cab98de931075bfc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 d53136c515d7ef53c12adce2397b094502d4e21b136c6e579671c24a215c16ce
MD5 e4f7bb4c994acad1bb88328d8dac922f
BLAKE2b-256 fce451ef3746c629ea5a1fb58ad587f62b349187476b0c8dacb615b2be489fab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f8911a6e6ac3ac85ea1b113ab9142289d7c4c648a196fc22cc75443d7a15c6f
MD5 ad450f4961b9d89b58adfeb9d9529e89
BLAKE2b-256 c22a4db8c6fd3e8243fc480f5e6ccfe1bafcfd987d2dd9703b39226e0e493650

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 33cffcfb5a42ecbd03c59d73c79cb29e08a29f060f7b5c903fe16a981f653354
MD5 b16fa15538d83ac1e40164d061ca83e5
BLAKE2b-256 6c7a9542627fe96ef1bc6677274ebcbdd2dd14ed189fd334769ba42a26559c0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 923caaf02377b4b23fa5ed2ac7b8988d9485b688ef8882b0e5432d3dc420d267
MD5 9894d0238c06ad2480328d7d92d8afc4
BLAKE2b-256 9ca90ce46c5dc40415e15dab123fbc754ade9cc1f4534d01bbefedc33c636e9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.30-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b6b65a688881081f71811c077c7f8cf88964d7b8468d14f445d81e462efdcf94
MD5 8c08d9fbba4cd875598556362a293dae
BLAKE2b-256 6cbaf142dc14779b5e42e102cfd167e62e270d8479cb2ba86c7af9d31e21ea92

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