This is the python demo for CYBEX ROME API.
The demo applicationcybex_demo.py
can be used as a quick start to the CYBEX ROME API.
Please prepare the below information before using cybex-demo.py
:
- Account Name
- Password
The Account Name and Password are the cloud wallet account name and password you use to logon to the CYBEX exchange at https://dex.cybex.io/.
Usage:
python3 cybex-demo.py -n <account name> -p <password>
e.g. python3 cybex-demo.py -n test_user -p xxxxxxxx
NOTE: Please use python3, you may encounter problems if python2 is used.
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 the latest CYBEX ROME API, it still requires cyb signer (see below).
The Private Key can also be used for authentication to use the ROME API. The Private Key, however, is NOT the password you use for the web logon.
To find your private key, go to https://olddex.cybex.io (NOTE that this is the old version):
- logon with your account name and password
- on the top left of the web page, go to ACCOUNT, then to the middle left of the page, click 'Permissions'
- under 'Active Permissions'->ACCOUNT/KEY/ADDRESS, click the public key string, which looks like CYB81SdxxxxxxxxxxxxxxxxxxxxxxxxJW
- on the pop up box titled 'Private key viewer', click 'SHOW', then the private key string will be shown under 'Private key (WIF - Wallet Import Format)', which looks like '5HyMuxxxxxxxxxxxxxxxxxxxxxxxxxx4ka'
- copy and save the private key string in a secure place to use with the CYBEX ROME API
Usage:
python3 cybex-demo.py -n <account name> -k <private key>
e.g. python3 cybex-demo.py -n test_user -k 5JbxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxXd
cybexapi_connector.py
provides two 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.
The Cyb Signer is a standalone Java program, it provides a way to sign a transaction through RESTful API.