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

Uploaded CPython 3.12Windows x86-64

cybotrade-1.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cybotrade-1.5.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

cybotrade-1.5.1-cp312-cp312-macosx_11_0_arm64.whl (11.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cybotrade-1.5.1-cp311-none-win_amd64.whl (13.6 MB view details)

Uploaded CPython 3.11Windows x86-64

cybotrade-1.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

cybotrade-1.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

cybotrade-1.5.1-cp311-cp311-macosx_11_0_arm64.whl (11.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

cybotrade-1.5.1-1-cp312-none-win_amd64.whl (13.6 MB view details)

Uploaded CPython 3.12Windows x86-64

cybotrade-1.5.1-1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

cybotrade-1.5.1-1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: cybotrade-1.5.1-cp312-none-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.3

File hashes

Hashes for cybotrade-1.5.1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 3ba513e885747840b6b25275604939d61a470fe02dcbbc8a3d0ff02b49492043
MD5 1d53de3fef9fe65692a586e90182fc7d
BLAKE2b-256 bfcf8aa9ee3675dce05c1c9896275728258398148eab924c52d267f1143829d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b052d5d40cd251ffe283b51c133ec2fa92de26e04a6c4117616862725d4ca2b4
MD5 82f5a8e4b0dab2fbecff0c73346e73c7
BLAKE2b-256 bf0df118f43f2e07e31a124b9dbce3ecf3d93a3f28599c102bae972194b02d65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a4d8b471a64ccf9c5e4cf9304736b1e0b99445eb7092f4bfd31d6af1869bb454
MD5 85e545d928880336218dc2d2779d6455
BLAKE2b-256 551760594308b5c3f5e694d41dd696e9655f2b931e4e72570945fdf4b37614d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a6062cffa976bc7de2434c9a67e2430199e88602a5e35e0de7c979bae7c98619
MD5 fe2eaa95694d188242b5c52bca664d60
BLAKE2b-256 2b2f7b1399bdd0422c51d38c771118dfd2fc40b6e6f2d7cd8c3585a61bb8599e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cybotrade-1.5.1-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 13.6 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.1-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 e7c1243dff2d06d604ef5f4fa862501279eed233ad4accab08bd4c3460a88f45
MD5 7c8215da32a4558b52d6639f1d08af14
BLAKE2b-256 a79f3f91590d2c918b24dd180e9d2d587f68089735d0fa469d5e4deceb72adde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e75652132acfc9982bca2081f4694a2cde6db36619ca014d1702a156ec9f43be
MD5 0f6ae61e36d991caf3382f795fb4d429
BLAKE2b-256 4b27b0c177507da2472bd3d1bb8cde79670eab449f3ad5a6a9c5d86f5c570c3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e096427b7fa42e13a1a136b05a031a478834423de07068be087d786e7109dd77
MD5 79729929b038472dc660e5d402186ff5
BLAKE2b-256 5d3c6e92ab9cb7c7c52665bf2c03361f0fd4ec840c4a68fa4cb0618522a0e74c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90fe5dc79daf61e37923b16f44993b55a67624661c07b735d33697ad41cc12a5
MD5 9f25d1a3e47d75ebb44534608ca5a2a7
BLAKE2b-256 9975d7c540cce0f1462922bcd4b7cfad79b6b46cb149334870083d1a86d0f2f6

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.1-1-cp312-none-win_amd64.whl.

File metadata

  • Download URL: cybotrade-1.5.1-1-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 13.6 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.1-1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 e516388cc42f91800a800fd8cc8f5c17f6400ca7aaac1be9fb8a97e2365d1a94
MD5 2c075f15303182380407a71b52b88ecf
BLAKE2b-256 43f8505bcfca56a533df2c4d8026a88460124194baa07255a30c30dd47154acf

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.1-1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.1-1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0d01f4fa1690f204636a662c549d8335505212450fbea91ca37bc6c9edbde05a
MD5 0deec6b3d2ba3b3f42f400c8d7445532
BLAKE2b-256 245cf07fce844d3a861543533d8f229389c1eaf7806572cfe6996c15139444a1

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.1-1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.1-1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 80bc7bf5c18d438c6b2da470aba47ab73cc467d1ca9bcdd503be2f449705fa0e
MD5 e18eaace9ffab7f0323ed2643c3d2ca5
BLAKE2b-256 f52a65aad53f66020b2e9821e6e90decacb9093974f8b7c7d6c69056993e16f9

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