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

Uploaded CPython 3.12Windows x86-64

cybotrade-1.4.34-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.4.34-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

cybotrade-1.4.34-cp312-cp312-macosx_11_0_arm64.whl (11.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

cybotrade-1.4.34-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.4.34-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

cybotrade-1.4.34-cp311-cp311-macosx_11_0_arm64.whl (11.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.34-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 8ffb4f7333e9d8877194628fd16abdde99daebf573ffcfbf95b2ca27a443eb41
MD5 c3ce77068e18bffa06529066f28966b5
BLAKE2b-256 95c3d1cd542c038b9f21189fd87e05d250c4f5eafec67a1ae06c3ffd32c83e8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.34-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3467f8f3323e0d0a8d1f96645daed197a62a840f897619ac76557e3cd5bd4134
MD5 a158572df186ab275c3acc4dc10b6488
BLAKE2b-256 62ab5d02128877fa83ae53e97d2b1782da6c7af16c7437062329effcb4413bdf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.34-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7afc95ac200d7e0940984df158943c3204235e0f32dbc5710d517a92ae3cb29f
MD5 b0411ea1031326f57ba90630e5fe3f6e
BLAKE2b-256 b6fdfc68469a5a40c7a1680125b9c9302a8780ac5decd00432748a38c7281bed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.34-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 662689805d1808b957cb1a69f2ee4caa602754278d7caae89c873899022d85dd
MD5 9ad4b4770e5fbe4efbddd8cf0522a199
BLAKE2b-256 615f46ea3c1f39aeb3e3b5d39227a3c589c8b5dfcb1e1164e8482953f01a3523

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.34-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 ad16305d39cce282a69606cab955d8bc162078ab5964704f8d7c4b480897e83c
MD5 f6b20ba91d5536a472dbfcb1461d5ce0
BLAKE2b-256 54ab0f5a43fe7e6fba70b41c1106054d593e467aaa100c3954fff7e1cc1852b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.34-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0f179beb3e4258d0ecab32daa146c8f04ecbf504bcedca1d12c714af918eef1
MD5 0165efb2064f14f9097a198776d5ba61
BLAKE2b-256 d0e95f17b6dd2a455abebcb6f5e0202dcadfc53912f8b58b07611b4ae12c9cb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.34-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4b99586d2ac035bd224342b39c959d076b882853c6c4f01ceaadb2b774728ab9
MD5 506fc4494f9c5e52a33702ca90411b3a
BLAKE2b-256 6e2a8d397495fedd620582046bbef3739895a052842aae430e7c384d5bc07f13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.34-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bac29ded0ce1b6e6c2b4abfa46cf7a3d29ca3362b64576594b8bf221b263f9d3
MD5 b672906bacd346f62b6b87aa54b4f965
BLAKE2b-256 bd097c76357e29357fc4e112ad1b42624b0061c7b0c8db850cb360a46d997f01

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