This is the python demo for CYBEX Python API.
cybex_demo.py
can be used as a quick start to use Cybex Python API.
The CYBEX Python API is able to sign a transactions with the provided private key. The standalone Cyb Signer is not required if you use the CYBEX Python API.
Please prepare below information before using cybex-demo.py
:
- Account Name
- Private Key
Usage:
python3 cybex-demo.py <account name> <private key>
e.g. python3 cybex-demo.py test_user 5JbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxXd
Note: Please use python3, you may encounter problems if python2 is used.
cybexapi_connector.py
provides 2 wrappers.
One wraps around the CYBEX Restful API server.
The Cybex API server mainly provides API calls to send transaction, query position, query order, etc
The other one wraps the Transaction Signer.
Transaction Signer provies 3 api calls to provide signature to new order, cancel and cancel all orders.
autotrader.py
is a sample (simple) strategy implemented using python.
It looks at huobi's market data, calculate 1 minute MACD crossing signals.
Whenever the MACD cross up, the auto-trader buys.
Whenever the MACD corss down,the auto-trader sells.
This auto-trader will require a config.ini to contain API keys for the Huobi market data api.
Note: Currently auto trader is not updated to use latest cybex python api, it still requires cyb signer.
The Cyb Signer is a standalone Java program, it provides a way to sign a transaction through RESTful API.