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.
Step 1: Retrieve the config pools of your hopper
To retrieve the config pools of your hopper you will need to make a GET request to the /hopper/{id}/config/pool endpoint, where {id} is the id of your hopper.
API endpoint:
https://api.cryptohopper.com/v1/hopper/{id}/config/pool
When the API request is successfull you will receive a JSON response with the config pools of your hopper in the data field.
JSON response example:
{ "data": [ { "id": "3242012", "name": "CONFIG POOL 01", "coins": "BTC", "config": { "max_buy_rate": "", "advanced_ta_candle_size": "1800", "advanced_ta_stoch_fast_k": "", "advanced_ta_stoch_slow_k": "", "advanced_ta_stoch_slow_k_matype": "0", "advanced_ta_stoch_slow_d": "", "advanced_ta_stoch_slow_d_matype": "0", "advanced_ta_stoch_oversold": "", "advanced_ta_stoch_overbought": "", "advanced_ta_stochrsi_period": "", "advanced_ta_stochrsi_fast_k": "", "advanced_ta_stochrsi_fast_d": "", "advanced_ta_stochrsi_fast_d_matype": "0", "advanced_ta_stochrsi_oversold": "", "advanced_ta_stochrsi_overbought": "", "advanced_ta_rsi_period": "", "advanced_ta_rsi_oversold": "", "advanced_ta_rsi_overbought": "", "advanced_ta_macd_fast_period": "", "advanced_ta_macd_slow_period": "", "advanced_ta_macd_signal_period": "", "advanced_ta_ema_short_period": "", "advanced_ta_ema_long_period": "", "advanced_ta_sma_short_period": "", "advanced_ta_sma_long_period": "", "advanced_ta_kama_short_period": "", "advanced_ta_kama_long_period": "", "advanced_ta_bbands_period": "", "advanced_ta_bbands_dev_up": "", "advanced_ta_bbands_dev_low": "", "advanced_ta_bbands_matype": "0", "buy_score_corrected": "0", "min_buy_score": "0.1", "sell_score_corrected": "0", "min_sell_score": "-1", "rsi_candle_size": "1800", "rsi_period": "", "rsi_oversold": "", "bbands_candle_size": "60", "bbands_days": "", "bbands_deviation": "", "set_percentage": "1000", "sell_order_type": "market", "max_open_time": "5", "ask_percentage": "0.1", "ask_percentage_type": "higher", "buy_order_type": "market", "bid_percentage": "0.2", "bid_percentage_type": "lower", "max_open_time_buy": "5", "cooldown_when": "buys", "cooldown_count": "1", "cooldown_val": "days", "stop_loss_percentage": "", "stop_loss_trailing": "1", "stop_loss_trailing_percentage": "0.50", "stop_loss_trailing_arm": "1.50", "trailing_stop_loss_reset": "1", "trailing_buy_percentage": "0.25", "auto_close_positions_time": "-7 days", "auto_dca": "1", "dca_order_type": "market", "auto_dca_time": "-1 hour", "auto_dca_max": "1", "auto_dca_percentage": "2", "auto_dca_size": "custom", "auto_dca_size_custom": "100" }, "updated": "2021-12-15 13:36:25", "status": "1" }, { "id": "3242015", "name": "CONFIG POOL 02", "coins": "ETH", "config": { "max_buy_rate": "", "advanced_ta_candle_size": "1800", "advanced_ta_stoch_fast_k": "", "advanced_ta_stoch_slow_k": "", "advanced_ta_stoch_slow_k_matype": "0", "advanced_ta_stoch_slow_d": "", "advanced_ta_stoch_slow_d_matype": "0", "advanced_ta_stoch_oversold": "", "advanced_ta_stoch_overbought": "", "advanced_ta_stochrsi_period": "", "advanced_ta_stochrsi_fast_k": "", "advanced_ta_stochrsi_fast_d": "", "advanced_ta_stochrsi_fast_d_matype": "0", "advanced_ta_stochrsi_oversold": "", "advanced_ta_stochrsi_overbought": "", "advanced_ta_rsi_period": "", "advanced_ta_rsi_oversold": "", "advanced_ta_rsi_overbought": "", "advanced_ta_macd_fast_period": "", "advanced_ta_macd_slow_period": "", "advanced_ta_macd_signal_period": "", "advanced_ta_ema_short_period": "", "advanced_ta_ema_long_period": "", "advanced_ta_sma_short_period": "", "advanced_ta_sma_long_period": "", "advanced_ta_kama_short_period": "", "advanced_ta_kama_long_period": "", "advanced_ta_bbands_period": "", "advanced_ta_bbands_dev_up": "", "advanced_ta_bbands_dev_low": "", "advanced_ta_bbands_matype": "0", "buy_score_corrected": "0", "min_buy_score": "0.1", "sell_score_corrected": "0", "min_sell_score": "-1", "rsi_candle_size": "1800", "rsi_period": "", "rsi_oversold": "", "bbands_candle_size": "60", "bbands_days": "", "bbands_deviation": "", "set_percentage": "1000", "sell_order_type": "market", "max_open_time": "5", "ask_percentage": "0.1", "ask_percentage_type": "higher", "buy_order_type": "market", "bid_percentage": "0.2", "bid_percentage_type": "lower", "max_open_time_buy": "5", "cooldown_when": "buys", "cooldown_count": "1", "cooldown_val": "days", "stop_loss_percentage": "", "stop_loss_trailing": "1", "stop_loss_trailing_percentage": "0.50", "stop_loss_trailing_arm": "1.50", "trailing_stop_loss_reset": "1", "trailing_buy_percentage": "0.25", "auto_close_positions_time": "-7 days", "auto_dca": "1", "dca_order_type": "market", "auto_dca_time": "-1 hour", "auto_dca_max": "1", "auto_dca_percentage": "2", "auto_dca_size": "custom", "auto_dca_size_custom": "100" }, "updated": "2021-12-15 13:36:48", "status": "1" } ] }
Step 2: Update a config pool of your hopper.
Now that we have retrieved the config pools of your hopper, we can update one of those config pools by sending a PATCH request to the same end point we used in the previous step. You will have to supply the id of the configuration (in {pool_id}) and the updated configuration . In this example we will change the stop_loss_trailing_percentage to 0.75.
API endpoint:
https://api.cryptohopper.com/v1/hopper/{id}/config/{pool_id}
Example JSON PATCH request:
{ "config": { "max_buy_rate": "", "advanced_ta_candle_size": "1800", "advanced_ta_stoch_fast_k": "", "advanced_ta_stoch_slow_k": "", "advanced_ta_stoch_slow_k_matype": "0", "advanced_ta_stoch_slow_d": "", "advanced_ta_stoch_slow_d_matype": "0", "advanced_ta_stoch_oversold": "", "advanced_ta_stoch_overbought": "", "advanced_ta_stochrsi_period": "", "advanced_ta_stochrsi_fast_k": "", "advanced_ta_stochrsi_fast_d": "", "advanced_ta_stochrsi_fast_d_matype": "0", "advanced_ta_stochrsi_oversold": "", "advanced_ta_stochrsi_overbought": "", "advanced_ta_rsi_period": "", "advanced_ta_rsi_oversold": "", "advanced_ta_rsi_overbought": "", "advanced_ta_macd_fast_period": "", "advanced_ta_macd_slow_period": "", "advanced_ta_macd_signal_period": "", "advanced_ta_ema_short_period": "", "advanced_ta_ema_long_period": "", "advanced_ta_sma_short_period": "", "advanced_ta_sma_long_period": "", "advanced_ta_kama_short_period": "", "advanced_ta_kama_long_period": "", "advanced_ta_bbands_period": "", "advanced_ta_bbands_dev_up": "", "advanced_ta_bbands_dev_low": "", "advanced_ta_bbands_matype": "0", "buy_score_corrected": "0", "min_buy_score": "0.1", "sell_score_corrected": "0", "min_sell_score": "-1", "rsi_candle_size": "1800", "rsi_period": "", "rsi_oversold": "", "bbands_candle_size": "60", "bbands_days": "", "bbands_deviation": "", "set_percentage": "1000", "sell_order_type": "market", "max_open_time": "5", "ask_percentage": "0.1", "ask_percentage_type": "higher", "buy_order_type": "market", "bid_percentage": "0.2", "bid_percentage_type": "lower", "max_open_time_buy": "5", "cooldown_when": "buys", "cooldown_count": "1", "cooldown_val": "days", "stop_loss_percentage": "", "stop_loss_trailing": "1", "stop_loss_trailing_percentage": "0.75", "stop_loss_trailing_arm": "1.50", "trailing_stop_loss_reset": "1", "trailing_buy_percentage": "0.25", "auto_close_positions_time": "-7 days", "auto_dca": "1", "dca_order_type": "market", "auto_dca_time": "-1 hour", "auto_dca_max": "1", "auto_dca_percentage": "2", "auto_dca_size": "custom", "auto_dca_size_custom": "100" } }
When the API request is successfull you will receive a 200 response with a message stating that the config pool was updated.
JSON response example:
{ "data": "Config pool updated." }
Hopefully you managed to update a config pool of your hopper after reading this tutorial.