Hummingbot学院

Advanced TWAP Strategy

Advanced TWAP (2) Strategy

https://github.com/CoinAlpha/hummingbot-rfox.git

Summary

The “twap_plus” strategy highly involves the Relative Strength Indicator (RSI) trend of a certain trading pair to execute trades. This way users can setup bots to match whenever the RSI levels are theoretically giving “Buy” signals or “Sell” signals and decide potential entry and exit points.

Brief overview of RSI

(RSI) is a momentum indicator that evaluates overbought or oversold conditions by measuring the magnitude of recent price changes for various assets. It is displayed as an oscillator (a line graph that moves between two extremes) and can have a reading from 0 to 100.

Traditional interpretation and usage of the RSI are:

  • 70 or above - (SELL) Indicates that an asset is becoming overbought or overvalued and may be primed for a trend reversal or corrective pullback in price.
  • 30 or below - (BUY) Indicates an oversold or undervalued condition and may be poised for a rebound.

For more info about RSI click the link below.

Relative Strength Index (RSI)

Where to find the RSI in the exchange?

The RSI Graph is available as a custom view in most exchanges. A view on how it looks like is seen below.

Untitled (6)

Strategy Config Map

The table below reflects the config settings that comes after strategy; connector and trading_pair setup.

KeyDefault ValueOther ValuesOn SelectOrderPrompt
price_sourcecurrent marketcurrent_marke external_market or custom_apiN/A1Which price source to use?
external_exchangeadd connector
external_trading_pairtrading pair
price_custom_api-
custom_api_intervalURLEnter external pricing API URL
price_type
price_indicatorsRSIEnter the indicator based on which order sizes are adjusted (RSI)
indicator_candle1m1s;1m;5m;10m;30m;1h;1d3Enter the size of candles used for indicator calculatio
rsi_length144What history length should be used in the RSI?
order_sidebuybuy/sell5What operation will be executed?
target_asset_amount16What is the total amount of "trading_pair" to be traded?
order_amount_min17What is the minimum amount of each individual order (denominated in the base as set)?
order_amount_max18What is the maximum amount of each individual order (denominated in the base as set)?
order_spreads-9What is the size of the limit orders from the price_type (denominated as a% of the asset price)?
order_level1
order_level_amount0
order_level_spread0
price_floorNone
price_ceilingNone
is_delayed_start_executionNoYes/No10Do you want to specify a start time for the execution?
is_time_span_execution(MM:DD:YYY - HH:MM:SS)
end_timeNoYes/No11Do you want to specify an end time for the execution?
order_delay_time(MM:DD:YYY - HH:MM:SS)
cancel_order_wait_time6012How long do you want to wait before cancelling your limit order (in seconds)?

Config Description

price_source - Gets where the price of the subject asset/token is from

  • current_market - Trades to where the initial exchange was set
  • external_exchange - Changes the exchange on which transactions will be made
    • external_trading_pair - Changes the token to trade
  • custom_api - Select custom API to where trade will take place
    • price_custom_api - Adds API and will prompt for the URL source of price
    • custom_api_interval - Set interval in seconds

price_indicator - RSI based trading

indicator_candle - Similar to the Timeframe of the desired trade view on an exchange trading block

rsi_length - RSI level of entry (14 as the default undervalued Buy signal)

order_side - Select which action to execute (buy/sell)

target_asset_amount - Amount of set asset/token to be traded.

order_amount_min - Set minimum base asset/token order.

order_amount_max - Set maximum base asset/token order.

is_delayed_start_execution - Activate the option of starting trade.

is_time_span_execution - Set time of start if is_delayed_start_execution = "yes"

end_time - Activate the option of ending trade.

order_delay_time - Set time of end if end_time = "yes”

cancel_order_wait_time - ****Activate the option of ending trade.

Sample Config

Untitled (3)

See details below:

  • target_asset_amount - The goal is to trade a total of 30 ADA.
  • order_amount_min - The minimum amount of ADA to bid is 6
  • order_amount_max - The maximum amount of ADA to bid is 8
  • rsi_length - The RSI Length to base orders to be placed is 14
  • indicator_candle_size - Orders will be placed every 1s based on the RSI 14 graph
  • order_side - The only action to be done is to “Buy”

When Started

Untitled (4)

With the configuration above:

  • 4 ADA bid orders were made on a indicator_candle_size (1s) which was based on the rsi_length (14)
  • The bot tried to fill orders until the target_asset_amount (30) was filled by the frequent orders indicated by order_amount_min (6) up to order_amount_max (8)

Untitled (5)

  • “twap_plus - Not possible to break the order into the desired number of segments”
    Message appeared. This means that the bot has stopped creating orders.
  • “twap_plus - [time stamp] is now greater than Previous time [time stamp]. Trying to place orders now. -Message appeared. This means that it will still try to place an order even if the bid order target_asset_amount (30) - At this point there will be no more orders reflecting in the exchange’s open orders.

Conclusion:

The twap_plus strategy’s ultimate goal is to fill the asset value indicated in the target_asset_amount. In order to do this, once the bot has started, it will create either a bid or an ask order based on the value assigned on the order_side which will be buying or selling. If buying, make sure to have enough Quote currency. On the other hand, to sell, make sure Base currency is available. The asset order volume to be placed will use the values indicated on the order_amount_min and order_amount_max. Remember that the bot uses the Base currency as the indicator on all order fields. And the frequency of the order will be depending on the graph of the rsi_length and selected timeframe in the indicator_candle_size. The bot will stop making orders when the target_asset_amount has been reached or if: (x + y) > target_asset_amount. Where:

  • x = Current asset amount
  • y= order_amount_min or order_amount_max

For more info about RFOX see link below:

RFOX

免责声明:位于https://hummingbot.io、https://docs.hummingbot.io、https://miners.hummingbot.io的网站(统称为“网站”)是属于CoinAlpha, Inc.(“公司”、“我们”和“我们的”)的受版权保护的作品。本网站的某些功能可能受附加指南、条款或规则的约束,这些指南、条款或规则将发布在与此类功能相关的网站上。所有此类附加条款、指南和规则均通过引用纳入本条款。这些使用条款(以下简称“条款”)规定了具有法律约束力的条款和条件,以规范您对本网站的使用。访问或使用本网站,即表示贵方接受这些条款(代表贵方自己或贵方所代表的实体),并且贵方声明并保证贵方有权利、权限和能力签订这些条款(代表贵方自己或贵方所代表的实体)。如果贵方未满18岁,则不得访问、使用本网站或接受这些条款。如果贵方不同意这些条款的所有规定,请勿访问和/或使用本网站。