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

Uploaded CPython 3.12Windows x86-64

cybotrade-1.5.2-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.2-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.2-cp312-cp312-macosx_11_0_arm64.whl (11.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cybotrade-1.5.2-cp311-none-win_amd64.whl (13.9 MB view details)

Uploaded CPython 3.11Windows x86-64

cybotrade-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

cybotrade-1.5.2-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.2-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.2-cp312-none-win_amd64.whl.

File metadata

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

File hashes

Hashes for cybotrade-1.5.2-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 f386ce904525d693c3d8ceb89293543d848a416a9e3509b54927a741a00b16c1
MD5 74d11420c486a6a24ed0e519142927e2
BLAKE2b-256 ddc498a7a6bdae5405a8f003909fb66f81cbd238a4bfd2e0b429fdfa9c377d8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8837db652ae622d04c3ea8d3a69e4c56b7bf8389e6c045da9ca95dcb5ad26744
MD5 d2266b96af257eeab46486f3c8a6db89
BLAKE2b-256 0e0a3da222fdfb3c3fb57b218e68184bc1ede536f0a11e516c565e82a5150b3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83112cb86538027c16146452eba0682ab7a77a3b1babf56427ed192bc5b4c6e0
MD5 2cf154ae2e2c1d0bc81310c3bc7bf4a1
BLAKE2b-256 45e5730be029bed979f2946b82a992910164243c852644dd7b57eec3b763575d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8bb7cc6602a856eed7d6bf0e8d86e19e73da3240d3d92842817bafa2af0c7155
MD5 1de06243d1448336148928af6c51de75
BLAKE2b-256 4848177bc1d9c5ef9966d5e25e64d8f06bd7b1da54e6ad802cbad69e7b4d5251

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cybotrade-1.5.2-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 13.9 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cybotrade-1.5.2-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 aea5ab6c4b4dba5f4ef2d4dfa2aa46b28f7d961cf56dec4de5c246070bc375ba
MD5 f7d85f5ff6994003b144cdbeb6bfc6da
BLAKE2b-256 1aa6355f6f7fbd1cf2a95820cc0c4c6117d52f170f318c44e703e9abbb17da07

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2dbd90ccd9e1acf0fef88173d9b21513a065840a24f4d7ba898d29aabe87ebdc
MD5 753857ce0e7eb4fd5c783f82b6666d53
BLAKE2b-256 d557076f22e6201980adbe9dbc4f69eaffdb4208767912c571106b24c773216a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 792ae926de0daad90c2be1655428d21c7ee4ba153528d53378f054753023ae0e
MD5 e7fc52560c63896dd7cac2ce4e27e35a
BLAKE2b-256 7f65e76503ce32d1c75726cdc57b33ef3a5f531d046c43003b327146f9341fb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2d6c7720cb912c77627e48bbdd44b7186ce281ce225e56d20b7b2f2da8f7e2a7
MD5 42944f5e6b13823276f917c45b6db573
BLAKE2b-256 53dcefc6f1e448064c4b60c1ce055be654e6b6d42f5ce3a717f871a9b3d0f491

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