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.5-cp312-cp312-win_amd64.whl (13.5 MB view details)

Uploaded CPython 3.12Windows x86-64

cybotrade-1.5.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cybotrade-1.5.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

cybotrade-1.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

cybotrade-1.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: cybotrade-1.5.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 13.5 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for cybotrade-1.5.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e2b1c04831ef65328319fe4f70a0057a3f9846094b1ef0ad3e7b35c437fb3df8
MD5 0f1de220f2873268e841601f593181b8
BLAKE2b-256 0fee791ff8e6d5d9d8f5a260fe20d3bda6a300417e08ebcf17a34a159ad8c0c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2360e27b33b52d4187ab15d8a1bd98f0301f47735370bb6cd768831f407d0ce9
MD5 7c1bf90e282eba6db34f6f07de27a0d4
BLAKE2b-256 9ca4df27368b31742d50804b0c873f329dd7a3b4d54922ffb246e9c4406b1793

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2d17723e26eebced5081963bfbaa83132c5eadba5d972820bf31a395850aa278
MD5 bbd8256be705fba6bfc7e60383c3a226
BLAKE2b-256 a53e3e2e1fe603fc4c6a99f91359efe3dedf202cfeea837b78d3843378d95f34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 067715f895a021ab61ccb6cb3969d4bd201bd77a5de579f681283c71a84e11ec
MD5 50d09d095a72c41d5d42767a0a900bd7
BLAKE2b-256 8585c31e10b57600bf1f91438bd83d0c976943d63e7e9271546ec68488db5ff9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6b39f7b7236d41a35dc973a3ee4fbd09e71c33bc5c2c8cba801f77ae05e3d2f6
MD5 35c7b72d8d42b50eda2ba2769cf61237
BLAKE2b-256 3ebda173f0afd909d475e1fe808f9b6ecca13ff71177c42fe89377a4cb4eabcb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c9bb0be07cd979446ef4d00984adf32962eed95e100b78d8d452c8c0a4c8535c
MD5 42b85c4473b33c6c246f78995de323ef
BLAKE2b-256 723577f544814137e8ac3458208aae22052dee367a78f62a1d67830005da6bb1

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