No project description provided
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
Close
Hashes for cybotrade-1.4.12-cp312-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37ebeb2c6cde3cda064c6f441d6b0525694f11977dcaef88871559abbd99c69f |
|
MD5 | f6e22b26569631e2bca9a2564d42ffcd |
|
BLAKE2b-256 | c54b0dc9306b801f157c78d51ead17403e9115e30fd3df61a649cf1448b77479 |
Close
Hashes for cybotrade-1.4.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c4263ec309e204f5cd7e377adcbc770a4d1de61f0bb90cfb3d0bfa4a1270476 |
|
MD5 | 0c83d7e923d945469764bd84a26c7aed |
|
BLAKE2b-256 | cc9d9038534168628c332ba4fdd63d6785503661aa4b0e6ba97b27e45a55dd48 |
Close
Hashes for cybotrade-1.4.12-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99a723b051e4aafbab9065b614086b048fe123dd790be5917722233b137fb4e9 |
|
MD5 | c63b7dc2f7662d765edd9226e2d7f126 |
|
BLAKE2b-256 | 85bbc84645791de0264870b73d468446d6a6dfd067209674e0a07c2889452253 |
Close
Hashes for cybotrade-1.4.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 022aeea5a5307370efcdc306cb44cd4f1c0298035daed04a1f65dfe0a322b396 |
|
MD5 | 41f0b7de9931392c2d57f57560f194bd |
|
BLAKE2b-256 | f8400c52b06657f829cdb2d7509379273afb299d4e3a2da75ce093306666fd85 |
Close
Hashes for cybotrade-1.4.12-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f80272005f2dc78f21890c848fd7ef5900493676e929a446fecf7070db763787 |
|
MD5 | e017b343ac50f65496ee554c4276029c |
|
BLAKE2b-256 | 628a0a3f693be758c664fae5df162965d595c747b78049017985dfdcd3dd967c |
Close
Hashes for cybotrade-1.4.12-cp311-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee4f357c46d05f6ad8a4991276378ff0a12430414763ac6c56d37528041155ab |
|
MD5 | 7990d519fd0a304b1281f19bd6cee7a2 |
|
BLAKE2b-256 | c0d70d2b124c05cf65c1d1d32b8b3ceffbe41f275eadcf549eaacc59db57a4ed |
Close
Hashes for cybotrade-1.4.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 725ec81817c4a1809bcd53aa328752f4e96e089b5ce7508d774d9f857390a690 |
|
MD5 | f18eca92000e240bafcb9d8b6a5bfe27 |
|
BLAKE2b-256 | 3fcd18367cfaac1169859afd09a3c49d19e8f36550df9d0ef6052782fa8117e9 |
Close
Hashes for cybotrade-1.4.12-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14b8764ea93f7432ae3ab6798ab0dd11368459392b9371221a6ee717a0af1add |
|
MD5 | ea5d6ea87fa91bce309957e16dd8c5fe |
|
BLAKE2b-256 | ec7fd46f294cc58f1cb513c2c608d7a322813f32cf98c46ed4873b7cf123c21d |
Close
Hashes for cybotrade-1.4.12-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11f9204d2afc2480f2d6ce8965d980593672b79f46c73de65bee872d6822ac6e |
|
MD5 | 3fbc992cfecf82809e2dea806dac7af7 |
|
BLAKE2b-256 | 1ab2ea3f88c903584e394f788f6a82b124a7346420e7f860d085a7cde28e4d64 |
Close
Hashes for cybotrade-1.4.12-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 109a87d7e3eb23ad5cf0aea1e3801b7660e38681acd06fa051a4af730ca60de4 |
|
MD5 | ac2fcd1c493c5161e16a9068b347ee9d |
|
BLAKE2b-256 | 550a251fd80a12e6081bfec65fbba907efbd20cab9b3bea9a0ad01b377506449 |