Configuring a strategy with the API

 

Configure and deploy a user or marketplace strategy to a user's trading bot. First get the list of all available strategies of the user, secondly configure the strategy in the users trading bot.

To make API requests you will need to create an app and have an access token. If you haven't created an access token yet, please follow the tutorial Get an access token with Oauth2 first.

Get all strategies of a user

There are 3 types of strategies at Cryptohopper: built-in strategies, user created strategies and marketplace strategies. Underneath you will find a list of built-in strategies.

Built-in strategies:

multiple_ta The Multiple TA strategy uses a limited set of TA indicators to determine buys and sells.
bbands Bollinger Bands strategy, the first strategy ever available on Cryptohopper.
bbands_advanced Bollinger Bands strategy, the first strategy ever available on Cryptohopper.
rsi The RSI strategy.
fixed The fixed rates strategy, used for building ping-pong bots.
no_strategy Disable strategy.

To get the strategies of a user and the marketplace strategies a user has bought or download, you will need to perform a GET request to the API.

GET user strategies:

https://api.cryptohopper.com/v1/strategy

GET marketplace strategies of the user:

https://api.cryptohopper.com/v1/strategy/market

Step 2: Configure a strategy in your trading bot

Now that you have a list of available strategies, it is time to configure the strategy in your trading bot so that you can start trading automatically with it. All updates to your trading bot will be done by accessing the trading bot endpoints with your id, like /hopper/{id}. To update the configuration of your trading bot you will need to make a PATCH request to this endpoint. Underneath you will find the endpoint where you will need send your PATCH request to. Please replace {id} with the id of your hopper.

API endpoint:

https://api.cryptohopper.com/v1/hopper/{id}

Example JSON PATCH request:

{
    "config": {
    	"strategy": "The key of the strategy to configure"
    }
}

The config->strategy value needs to be the key of the built-in strategy you wish to configure, or a user or market strategy. For example: rsi, multiple_ta. If you do not wish to configure a strategy enter the key: no_strategy. If you wish to configure a user made strategy you will need to have the id of the strategy and configure it like: user_{id}, for example: user_1. If you wish to configure a marketplace strategy you will need to have the id of the strategy received from the strategy/market endpoint and configure it like: market_{id}, for example: market_1.

When you have successfully updated the configuration of your trading bot, you will receive a 200 response with your complete config object returned. If the request failed, you will receive a 400 status with an error message explaining the error.

Hopefully you managed to configure a different strategy for your trading bot after reading this tutorial. You will now be able to configure different strategies for your trading bots, or disable strategies in your trading bots.