Coin Algorithm Python Client
This is the codetotrade.app Python client, which provides tools and functionalities to interact with the codetotrade.app platform.
Installation
To install the client, you can use pip:
pip install coin-algorithm==1.2
Usage
Create your bot
Create new python file (ex : bot/my_test_bot.py) and Implement the BaseBot class
from typing import Dict
from coin_algorithm.domain.base_bot import BaseBot
from coin_algorithm.domain.trade_metadata import TradeMetadata
class MyTestBot(BaseBot):
def init(self, config: Dict[str, str]) -> None:
pass
def is_buy(self, idx: int) -> bool:
pass
def is_sell(self, idx: int) -> bool:
pass
def buy(self, idx: int) -> TradeMetadata:
pass
def sell(self, idx: int) -> TradeMetadata:
pass
def is_close_current_position(self, idx: int) -> bool:
pass
Run your bot
There are 2 Params to indicate where your bot is located.
- bot_module : The path to the bot file without the extension (ex : bot.my_test_bot)
- bot_class : The class name of the bot (ex : MyTestBot)
Run back test for your bot
import os, sys
dir_path = os.path.dirname(os.path.realpath(__file__))
parent_dir_path = os.path.abspath(os.path.join(dir_path, os.pardir))
sys.path.insert(0, parent_dir_path)
from coin_algorithm.server import back_test_server
import logging
if __name__ == "__main__":
logging.basicConfig(level = logging.INFO)
back_test_server.serve(port='8888', bot_module='bot.my_test_bot', bot_class='MyTestBot')
Run exchange trade for your bot
import os, sys
dir_path = os.path.dirname(os.path.realpath(__file__))
parent_dir_path = os.path.abspath(os.path.join(dir_path, os.pardir))
sys.path.insert(0, parent_dir_path)
import logging
from coin_algorithm.server import binance_server
if __name__ == "__main__":
logging.basicConfig(level = logging.INFO)
binance_server.serve(port='8888', bot_module='bot.my_test_bot', bot_class='MyTestBot',
api_key='',
secret_key='',
is_test_net=True)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
coin_algorithm-1.4.tar.gz
(22.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file coin_algorithm-1.4.tar.gz.
File metadata
- Download URL: coin_algorithm-1.4.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1e5e0a90a89737816c2e585fb7e81dc28cf12e9d836f1d2944275aa39d226a1
|
|
| MD5 |
fe7fd489b591b2a92716bb393c0886a6
|
|
| BLAKE2b-256 |
9ac386e650a972c07fed0cddfdd6396d9181d4ab0d7f8cce555f9a407a0a2984
|
File details
Details for the file coin_algorithm-1.4-py3-none-any.whl.
File metadata
- Download URL: coin_algorithm-1.4-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2904d2ab6d192aad60c14a6fec9dfd11801064a3993de8d9b40a9c5b5e1d7dc1
|
|
| MD5 |
23f7cb6f5aa818153de7b7db72c72563
|
|
| BLAKE2b-256 |
a9f96d8eedc09aa275801e9dc456a0e21b332c736bd75e8214942f6471f0f147
|