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

Uploaded CPython 3.12Windows x86-64

cybotrade-1.5.0-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.0-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.0-cp312-cp312-macosx_11_0_arm64.whl (11.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cybotrade-1.5.0-cp311-none-win_amd64.whl (13.5 MB view details)

Uploaded CPython 3.11Windows x86-64

cybotrade-1.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

cybotrade-1.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

cybotrade-1.5.0-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.0-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.0-1-cp312-cp312-macosx_11_0_arm64.whl (11.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cybotrade-1.5.0-1-cp311-none-win_amd64.whl (13.5 MB view details)

Uploaded CPython 3.11Windows x86-64

cybotrade-1.5.0-1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (14.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

cybotrade-1.5.0-1-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.5.0-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.0-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 dbaf5abb889165c2a20327b50c26f8cf3459dd8248b7b1da8a3700f96739904b
MD5 62e9ed7207b2344fa5c457eb4a4e8194
BLAKE2b-256 03f84ced2ea834881598d80a8ae8cc37700e57741414db86a7773b81e87fae83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 13d949c9703518ef7834076e04db1fa5b24c87c5913bd676a318167b2e0a83c8
MD5 080a8a153135157a6eb9f61de9cfa80e
BLAKE2b-256 d2466d11a164a8d8376fae76a978e1f22f86aa933585da83b1a4cf8d48e0706c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e0039df067959e8009b6c86f3cb297197a72d85847a59505f21413f77f70cc1f
MD5 9e547b76d4becbfb743ffa535a711e97
BLAKE2b-256 55387e2fe0d2a77f6942e7fa0f8d249561cbc4e067d5ba268c13c7fff96d1dd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 752beeede6a2a15b97c2ac6f395df1678b7564bf130803cdb85f4c234f0f000a
MD5 4bdc1bffdbfe82ec12aee82cfb8ea16d
BLAKE2b-256 4b18728e0df89cbdab870f566703a52f4197f1f5c8cdde03d624cd76edaa59f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 c9ec1df3c3beaf80d6bf78b525e3b7d7e94c7cb75fcf89ffdc875e7cf7bc3295
MD5 f706398d0b5d9c4566b8ef2d73c7252f
BLAKE2b-256 33360f476632dc10b8e9210d6d8569459683f278ecf0bd4857b1750c72d85fc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 57d6865b2e7c8aaefb2c5bcf45f7fe3bc325584eca10eb9da58f9f7f3320b1ab
MD5 c38819e97490fb56702ea8467d2e393a
BLAKE2b-256 f4a30555d1434984f40dccc21428d66f4ec8d03718cda3d037b982f2893846dd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e09fb8e1c7f7e657e6fce5deed132eeeb24868b9b2325abeea95c868a87164bf
MD5 e0a6800ca661019da588cbe975d29b69
BLAKE2b-256 851ccb023b9e8137136099339fe795f2eb8634b242259ded85ca27938dc5b586

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a4de9229b28a87f7aef833173a5f38754f6e0724ca5242bd1d9dfe9318c454e4
MD5 76d072cbff521144b84defd3d9f1af46
BLAKE2b-256 8408dd6103b4f84bcc4f88ddde074ed54e6e2690572bd3741b0af36887f7d1f0

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.0-2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.0-2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c693f31887b3104db8a81de5a070aee397773092833db4b7f8e1ee4f20122a31
MD5 2912ceb51a41c69e10ba8f183bc7a877
BLAKE2b-256 bf1487bbcdd42d11345ee43849feef3fbef81675998044421c110d7ff05605e8

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.0-2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.0-2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d1dc982f2db72bffc6dc29689f3257022797b63e581a25fbd7b836e1d1a41fe8
MD5 89e21b48863615c052c07f8eeba6a3b8
BLAKE2b-256 31c34290a815a08e41999fe6e1d0261a0bd41619ecde429d48f6a8f314e9f37a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 261e7a2778b59d1fe04218baa52bda18a9dc722f7580aec92f735d209e718611
MD5 6f0bc6879d19ae8e0c8384941aa47e83
BLAKE2b-256 4c56aa292199b395a205ddaa393132a4362f4166df84bfc3b17a4d2a2b8c1058

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8be351ad43e8b7e08a780589cb91a3d6a310001207883fb2ce2766c29605dfc5
MD5 c4c9a04b1a06b1a94caade279c764bbb
BLAKE2b-256 b1c3b70f59a1621d7255ecc4b91d782b1593b20d8cf934e3d2fef5567646761b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cybotrade-1.5.0-1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 771bd15b2f8b3dfa78dfb96f9009da753716d7510dcb99143e39eda99f24dcce
MD5 9d9249c5373f8dcb6d19fbb220c0c3c0
BLAKE2b-256 96db9cc78ee5d3047d0241dfefde668ada05455b8c161f3397d4318e74a08763

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.0-1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.0-1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 69397bfa3fc2bd0a70e3d91a79d4e7528b391287a8c807b1fb42c0be57d89c3c
MD5 675fceed53d818db67440a4f6673e216
BLAKE2b-256 62b9df2a8c395b6f7b3c868d40b79321dc56a9a37c0f130b26cbe7c111ca840e

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.0-1-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.0-1-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 ad1d98c5b647b750e6f3968f3b6b94c30725d62d14a70764c94d41c9dca3b1eb
MD5 52a6c577ea7bc2a65b1ce248dc5ceb13
BLAKE2b-256 458c86286913b83abde465bf47b78f9781f890993e429315edcb2c7d382e38bb

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.0-1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.0-1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45af73772b6f973c354e650d21b8a17d9c628c479f7bb46105dbb244dbb50e66
MD5 d88d548adf1959073094f5f81cafd832
BLAKE2b-256 dd8316a44be28ebdb2ea9715055afbc40c11e7b42cb32741099a06796b24a222

See more details on using hashes here.

File details

Details for the file cybotrade-1.5.0-1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cybotrade-1.5.0-1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c1e5b71e851bab95b9ec488246da3329169ff93e0f0f65bda49e877d3936a53b
MD5 681bd436393b907b7f1176b09042de01
BLAKE2b-256 78e5173ca18c67bb5edf2ad8f4b6e87edbbe6588e15d42a2d6a4dae2fb876f8d

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