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

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

cybotrade-1.5.4-cp312-cp312-win_amd64.whl (13.4 MB view details)

Uploaded CPython 3.12Windows x86-64

cybotrade-1.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

cybotrade-1.5.4-cp312-cp312-macosx_11_0_arm64.whl (11.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cybotrade-1.5.4-cp311-cp311-win_amd64.whl (13.5 MB view details)

Uploaded CPython 3.11Windows x86-64

cybotrade-1.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

cybotrade-1.5.4-cp311-cp311-macosx_11_0_arm64.whl (11.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file cybotrade-1.5.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 91204c97e4c3d092343f18c6a322a1d5d6d752c3f2a44aa0eeba396895e5aa79
MD5 c897aad94770902ee2c2d7e684e8a29e
BLAKE2b-256 e6f453d33a285221eefb550bee11caab18bec4ffc0702722f38edc003b0b21ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c564f3942ddcd064d0e825dee0fa13ffe3c7f6382d57b72a22e2a7c35b3e557d
MD5 679af424b267b6b18746d648cfbad955
BLAKE2b-256 16b44871016a013fb05dd22ef05b633639427805bf7ee2d59d574b90bff5644b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 af91b3eadcf55301ff84b177c93de3c820de564b36b03846ea953f1fa51453cf
MD5 5fb5d50bc8db160b392da3206f692815
BLAKE2b-256 fc3c9a11c4ee350e42cb5fc28139c425ecfd38030be02c422f99162b6d4919d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a00e0c59c57bb5769876def70033efe38c1b0a210a7dddc7adb677281d476c92
MD5 1a21d94a7b9ff69b083904e3525bb493
BLAKE2b-256 0dbd61efe919f4767691aeacc6f6a7e609a7ab82f7dcc93982a568493982d262

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b8b37a3377cb223dffa320419d8584113f010290bfaefebbbddb4e65011c79ca
MD5 caa91fef6dada7ddfe62d71a140069dc
BLAKE2b-256 f1ec6ff86f936a7d7c7a3180eb730c90898a6fd211d90dc6086a3a8062c2aab2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dfdd3111bff2137ad24b6373294ecfb7346056b60690b0154153486efd08bf59
MD5 b193bda397f029c92dd6e8588ff263e9
BLAKE2b-256 0e7821de7b24367fe1786ef0cba98b19f51dd3e89b00516e0facb3bdecff2896

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 89b6e2441d6fb503eae5af156bc746375cde72c9cfd5556a982737b49ea54c78
MD5 1e6c6ebf360048cd58dea6f33c41e389
BLAKE2b-256 ac214c50428eeb8436dcb2b0e0b3111e3211aafab27d910aa488b7c69700f49f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b03ec374dcfd21b351a49ce3b4a0894b2ae8425b7fa907d0727336d438af58fc
MD5 5e3fb032a27acd4f9f23018be5dd0478
BLAKE2b-256 49f41c29e59df5ce085c2e34db86c9edde87bb80ed047e8f0adf1c2d0c65c623

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