튜토리얼

베이스 설정 업데이트

 

API 요청을 하려면 앱을 만들고 액세스 토큰이 있어야 해. 아직 액세스 토큰을 만들지 않았다면, 먼저 Oauth2로 액세스 토큰을 받는 튜토리얼을 따라해 줘.

1단계: 트레이딩 봇의 기본 구성 가져오기

트레이딩 봇의 기본 구성을 가져오려면, hopper/{id}/config 엔드포인트에 POST 요청을 해야 해. 여기서 {id}는 네 트레이딩 봇의 ID야.

API 엔드포인트:

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

API 요청이 성공하면, 데이터 필드에 트레이딩 봇의 기본 구성이 담긴 JSON 응답을 받게 될 거야.

JSON 응답 예시:

{
  "data": {
    "name": "name",
    "live": "1",
    "last_loaded_config": "config",
    "last_loaded_config_date": "1632137029",
    "exchange": "kucoin",
    "api_key": "***",
    "api_secret": "***",
    "api_passphrase": "***",
    "extra_api_key": "***",
    "extra_api_secret": "***",
    "okex_version": "3",
    "ticker_type": "bidask",
    "allowed_coins": [
      "BTC",
      "ETH"
    ],
    "allow_all_coins": "1",
    "perc_buy_amount": "2.88",
    "min_buy_amount": "0.1",
    "min_buy_amount_force": "1",
    "strategy": "strategy",
    "num_targets_per_buy": "50",
    "advanced_ta_candle_size": "1800",
    "min_buy_score": "0.05",
    "min_sell_score": "-1",
    "rsi_candle_size": "1800",
    "bbands_candle_size": "60",
    "buy_order_type": "market",
    "bid_percentage": "0.2",
    "bid_percentage_type": "lower",
    "max_open_time_buy": "5",
    "max_open_positions": "500",
    "max_open_positions_per_coin": "0.1",
    "cooldown_when": "buys",
    "cooldown_count": "1",
    "cooldown_val": "days",
    "one_open_order": "1",
    "only_when_positive_time": "480",
    "stop_loss_trailing": "1",
    "stop_loss_trailing_percentage": "0.5",
    "stop_loss_trailing_arm": "2",
    "trailing_stop_loss_reset": "1",
    "trailing_stop_loss_profit": "1",
    "trailing_buy_percentage": "0.2",
    "short_stop_loss_trailing_percentage": "1",
    "short_stop_loss_trailing_arm": "3",
    "short_auto_close_positions_time": "-5 minutes",
    "short_auto_remove_positions_time": "-5 minutes",
    "short_remove_on_loss": "1",
    "hold_assets": "1",
    "auto_close_positions_time": "-7 days",
    "auto_dca": "1",
    "dca_order_type": "market",
    "auto_dca_time": "-5 minutes",
    "auto_dca_max": "1",
    "auto_dca_percentage": "4",
    "auto_dca_size": "custom",
    "auto_dca_size_custom": "100",
    "set_percentage": "1000",
    "sell_order_type": "market",
    "max_open_time": "5",
    "ask_percentage": "0.1",
    "ask_percentage_type": "higher",
    "send_trade_email": "1",
    "submit": "1",
    "walletscrubber_leftovers": "1",
    "collect_currency": "usdt",
    "output_live_feed": "1",
    "buy_btc_amount": "0.0005"
  }
} 

2단계: 트레이딩 봇의 기본 구성 업데이트하기

이제 트레이딩 봇의 기본 구성을 가져왔으니, 이전 단계에서 사용한 것과 동일한 엔드포인트에 PATCH 요청을 보내고 업데이트된 구성을 제공하여 트레이딩 봇의 기본 구성을 업데이트할 수 있어. 이 예에서는 stop_loss_trailing_percentage를 0.75로 변경할 거야.

API 엔드포인트:

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

JSON PATCH 요청 예시:

  {
    "config": {
      "name": "name",
      "live": "1",
      "last_loaded_config": "config",
      "last_loaded_config_date": "1632137029",
      "exchange": "kucoin",
      "api_key": "***",
      "api_secret": "***",
      "api_passphrase": "***",
      "extra_api_key": "***",
      "extra_api_secret": "***",
      "okex_version": "3",
      "ticker_type": "bidask",
      "allowed_coins": [
        "BTC",
        "ETH"
      ],
      "allow_all_coins": "1",
      "perc_buy_amount": "2.88",
      "min_buy_amount": "0.1",
      "min_buy_amount_force": "1",
      "strategy": "strategy",
      "num_targets_per_buy": "50",
      "advanced_ta_candle_size": "1800",
      "min_buy_score": "0.05",
      "min_sell_score": "-1",
      "rsi_candle_size": "1800",
      "bbands_candle_size": "60",
      "buy_order_type": "market",
      "bid_percentage": "0.2",
      "bid_percentage_type": "lower",
      "max_open_time_buy": "5",
      "max_open_positions": "500",
      "max_open_positions_per_coin": "0.1",
      "cooldown_when": "buys",
      "cooldown_count": "1",
      "cooldown_val": "days",
      "one_open_order": "1",
      "only_when_positive_time": "480",
      "stop_loss_trailing": "1",
      "stop_loss_trailing_percentage": "0.75",
      "stop_loss_trailing_arm": "2",
      "trailing_stop_loss_reset": "1",
      "trailing_stop_loss_profit": "1",
      "trailing_buy_percentage": "0.2",
      "short_stop_loss_trailing_percentage": "1",
      "short_stop_loss_trailing_arm": "3",
      "short_auto_close_positions_time": "-5 minutes",
      "short_auto_remove_positions_time": "-5 minutes",
      "short_remove_on_loss": "1",
      "hold_assets": "1",
      "auto_close_positions_time": "-7 days",
      "auto_dca": "1",
      "dca_order_type": "market",
      "auto_dca_time": "-5 minutes",
      "auto_dca_max": "1",
      "auto_dca_percentage": "4",
      "auto_dca_size": "custom",
      "auto_dca_size_custom": "100",
      "set_percentage": "1000",
      "sell_order_type": "market",
      "max_open_time": "5",
      "ask_percentage": "0.1",
      "ask_percentage_type": "higher",
      "send_trade_email": "1",
      "submit": "1",
      "walletscrubber_leftovers": "1",
      "collect_currency": "usdt",
      "output_live_feed": "1",
      "buy_btc_amount": "0.0005"
    }
  }  

API 요청이 성공하면 업데이트된 config 객체가 반환되고 "Config saved."라는 메시지가 포함된 200 응답을 받게 될 거야.

JSON 응답 예시:

  {
    "data": {
      "config": {
        "name": "name",
        "live": "1",
        "last_loaded_config": "config",
        "last_loaded_config_date": "1632137029",
        "paper_trading_account": "0",
        "exchange": "kucoin",
        "api_key": "***",
        "api_secret": "***",
        "api_passphrase": "***",
        "extra_api_key": "***",
        "extra_api_secret": "***",
        "okex_version": "3",
        "ticker_type": "bidask",
        "allowed_coins": [
          "BTC",
          "ETH"
        ],
        "allow_all_coins": "1",
        "perc_buy_amount": "2.88",
        "min_buy_amount": "0.1",
        "min_buy_amount_force": "1",
        "strategy": "strategy",
        "num_targets_per_buy": "50",
        "advanced_ta_candle_size": "1800",
        "advanced_ta_stoch_slow_k_matype": "0",
        "advanced_ta_stoch_slow_d_matype": "0",
        "advanced_ta_stochrsi_fast_d_matype": "0",
        "advanced_ta_bbands_matype": "0",
        "rsi_candle_size": "1800",
        "bbands_candle_size": "60",
        "bbands_deviation": "",
        "buy_order_type": "market",
        "bid_percentage": "0.2",
        "bid_percentage_type": "lower",
        "max_open_time_buy": "5",
        "max_open_positions": "500",
        "max_open_positions_per_coin": "0.1",
        "cooldown_when": "buys",
        "cooldown_count": "1",
        "cooldown_val": "days",
        "one_open_order": "1",
        "only_when_positive_time": "480",
        "arbitrage": "0",
        "stop_loss_trailing": "1",
        "stop_loss_trailing_percentage": "0.75",
        "stop_loss_trailing_arm": "2",
        "trailing_stop_loss_reset": "1",
        "trailing_stop_loss_profit": "1",
        "trailing_buy_percentage": "0.2",
        "short_stop_loss_trailing_percentage": "1",
        "short_stop_loss_trailing_arm": "3",
        "short_auto_close_positions_time": "-5 minutes",
        "short_auto_remove_positions_time": "-5 minutes",
        "short_remove_on_loss": "1",
        "hold_assets": "1",
        "auto_close_positions_time": "-7 days",
        "auto_dca": "1",
        "dca_order_type": "market",
        "auto_dca_time": "-5 minutes",
        "auto_dca_max": "1",
        "auto_dca_percentage": "4",
        "auto_dca_size": "custom",
        "auto_dca_size_custom": "100",
        "set_percentage": "1000",
        "sell_order_type": "market",
        "max_open_time": "5",
        "ask_percentage": "0.1",
        "ask_percentage_type": "higher",
        "send_trade_email": "1",
        "submit": "1",
        "stop_buying": "0",
        "stop_selling": "0",
        "walletscrubber_leftovers": "1",
        "walletscrubber_auto": "0",
        "walletscrubber_noopen": "0",
        "collect_currency": "usdt",
        "output_live_feed": "1",
        "output_errors_only": "0",
        "autosync": "0",
        "autosync_all_coins": "0",
        "send_trade_error_email": "0",
        "send_cancelled_email": "0",
        "buy_btc_amount": "0.0005",
        "max_amount_allocated": "",
        "advanced_ta_stoch_fast_k": "",
        "advanced_ta_stoch_slow_k": "",
        "advanced_ta_stoch_slow_d": "",
        "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_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": "",
        "rsi_period": "",
        "rsi_oversold": "",
        "bbands_days": "",
        "stop_loss_percentage": "",
        "max_open_short_positions": "",
        "short_percentage_profit": ""
      },
      "message": "Config saved."
    }
  }

이 튜토리얼을 읽고 나서 트레이딩 봇의 기본 구성을 업데이트할 수 있기를 바라!