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

Uploaded CPython 3.12Windows x86-64

cybotrade-1.4.35-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.35-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (14.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

cybotrade-1.4.35-cp312-cp312-macosx_11_0_arm64.whl (11.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cybotrade-1.4.35-cp311-none-win_amd64.whl (13.7 MB view details)

Uploaded CPython 3.11Windows x86-64

cybotrade-1.4.35-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.4.35-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.35-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.35-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for cybotrade-1.4.35-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 6f59754f529af5f2633e6779fff0b08a3395ca9b3350e4fa8e469514e72b30d2
MD5 8b19f291c5d85894f84b835a1f40a41e
BLAKE2b-256 3e558d377ad12ed5309c58c5d5171c241144f201e235cee84c733b89d8920487

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.35-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 87033700af80bb2a9c43062221880fad5886d420296d7718e36baf83283d051f
MD5 7c4bcfc3730fc3b798b3c5978b61634b
BLAKE2b-256 8cb8d71810f6df4458a2f8ec07850bce18c53cf805e6c9f332be225ffe6d7458

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.35-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 81657c4654888e5cca0a96182693f4d81d392923b5f31b59ebd39da65b1dec00
MD5 dd9ccee90aa7c96d117985f60aca1aa7
BLAKE2b-256 4af9371fbcf3e3cb664b182f2fcdae12686444b4e1dd3746a250dfb8b2fad242

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.35-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26473eb84e1bd8a56830f673f0d4850ec3ab8ab1c58c1895b2ef5089058ce101
MD5 4d9ed53d924eced9d675fc94b7eb8d38
BLAKE2b-256 1f612ce868fcf649379a6705563d49f347e375a55518d0c86e90f99ac322b13f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.35-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 91fefbabc40b068741a560522c4fc44953b1347d1c64f9fb5640494131c67f19
MD5 e4645884361abd451c3bd839c4e62e52
BLAKE2b-256 304e58fa3493f8bed916a33d4f6296ca00eb7f288c006156f071d5e99765968d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.35-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0331ec9c7475b3d8efa7d5a6edc29df4dac4eaff59ce58158e0ac69f8431a690
MD5 ee01fda7b4ad3186f85ace07e10fb4b3
BLAKE2b-256 968d560cd0f4d1f5a70b910ebd10fa6c2f696f60ec935b150c4ad59d2b3e8a0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.35-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7b34f4c9f182a523572f968fabbb97efdd8c932f52b6ad33e31c5d0fa03b1bce
MD5 63a945e66c871c62e67b47c8930305ca
BLAKE2b-256 ce86ed9a05007911425f61e6ff981093ac7052e35edc93029c49d0a4553ccd99

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.4.35-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e226ac8106554501fed0507e946933925836df9971ca59d141dc619fca1a6612
MD5 3061623ac59d86834f625fb024490c76
BLAKE2b-256 649752efb9b70beed2effd3611f8f8520fb3145f850b45c8314e443bae9ad087

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