HIP - Revamp Hedge Strategy

Hi all,

Previously I created a HIP to refactor and fix the Hedge Strategy under HIP-5 [DG] Fix and Improve Hedge Strategy

This HIP is to replace the previous HIP in order to further improve the use of this strategy.

I have prepared an initial version for (currently hedge by value only) which can be accessed at https://github.com/leastchaos/hummingbot-1/tree/new_hedge under hedge_v2

The main improvements in this hedge strategy over the existing hedge strategy are as follows

  1. Cython → Python; Simplified code for easier improvements in the future.
  2. One exchange → Multiple Exchange: Allow hedging of multiple assets at multiple exchanges at the same time
  3. Hedge by amount → Hedge by amount or value: Allow hedge based on the current asset value in quote asset.
  4. Remove restriction on spot/perp on both maker and taker: Able to select both spot and perpetual for both monitored market and hedge market
  • One potential use of the new hedge mode by value would be to perform proxy hedging for unshort-able assets by hedging the value of multiple different markets using a short-able market which may be correlated.

  • For E.g, there might be some correlation for some basket of tokens (FEAR, ODDZ, DAFI (random examples only)) with ETH prices. So you can choose to hedge the value of this basket token you hold with a short position on ETH to reduce the inventory risk on the basket of tokens. So when you are market making with this position, it will help you to automatically short a defined ratio on the perpetual market so that if the overall market goes down, part of the loss can be mitigated by the short position in ETH.

Existing features:

  1. Hedge Ratio
    Potential Use: this allows you to be able to hedge on multiple perp exchanges. e.g you can set hedge _ratio 0.5 for binance_perpetual market so only 50% of the value will be hedged on binance perpetual. and set up another bot with hedge_ratio 0.2 on bybit perpetual and the remaining will be hedged there. or if you want to hedge 2x the eth value for each long position you hold, you can set it as 2.0 also.

  2. min_trade_size
    Able to set a minimum trade amount so that a small change in the value would not result in trade each time to reduce trading fees

Remaining items to be completed on top of current working version:

  1. To include hedge by asset amount for multiple exchanges (same as an existing strategy but expanded for multiple exchanges)
  2. Addition of Logic for trading in hedge position mode
  3. Testing and Bug fixes and config UI improvement
  4. Prepare requirements for QA to be uploaded into the codebase e.g code coverage etc, docstrings, etc
3 Likes

Thanks for the update on the Hedge strategy and for following the new governance process! Personally, I support these improvements to Hedge since it’s a great utility strategy that is compatible with many others in Hummingbot, and making it more flexible should definitely help the community.

Since HBOT price has dropped in value since the first HIP (Snapshot) significantly, I would support increasing the dev grant above the initially approved 160K HBOT if needed.

2 Likes

I support this and could see great use for the hedge by amount function to allow previously hard to hedge altcoins to be traded with more security!

2 Likes

Huge & fantastic improvements for Hedge strategy v2!

Proxy hedging is something I definitely want to use. This may become the best solution for minimizing losses during market crashes.

There is an interesting idea from discord by Willstar44. Would like to know if this could be possible to implement.

He wanted to buy a token, and then withdraw it, and to stake it somewhere else.

So, he planned to use Hedge strategy to open short position, so essentially he will be delta neutral, and have the staking earnings as profit.

Is this use-case feasible for Hedge strategy to integrate?

The initiation of the trade would not be a good use for this strategy. A seperate script might be more applicable.

Maintaining the hedge is possible probably by adding a offset config but still it may not be the best strategy for it depending on the intention. staking should be relatively long holding period. if it is to hedge by amount, (e.g buy ETH on spot, sell ETH on perp, stake ETH on other exchange), just a simple script that buy and sell both at the same time is sufficient. there is no need to do so via this strategy as there is no change in amount so the bot will just do nothing all the time during the staking period.
If it is to hedge by value, (Buy BTC, short equivalent value in ETH, stake BTC on other place), probably some kind of config like fixed offset to the amount can be added to monitor the change in value and to update the hedge accordingly. but the initiation of the buy and sell also probably need to be done first separately and withdrawn before executing the hedge.

2 Likes

I see, and that makes a lot of sense, indeed.

Thank you for the clear explanation. :clinking_glasses:

The main functionality is more or less completed in the repo.
I have added an additional feature.
5. Added fixed offset : Allow maintaining of a fixed net amount of asset amount/value.
e.g, amount is withdrawn for staking and not in the exchange or you want to maintain a net position by a fix amount/value instead of entire position. the amount of the asset can be added in this config.

1 Like

@fengtality Can I check what are the next steps?

Since HIP-5 has already been approved, the Foundation has set aside 160K HBOT bounty for you when a PR addressing it has been merged to development. If that is sufficient, you should submit a PR to the repo and reference the approved HIP, and we’ll start reviewing it.

If you want to request more HBOT for this work, you can submit a new HIP asking for more HBOT.

Noted. If possible, I would like to request an additional amount as I added additional features than the original HIP. I was informed by carlito previously that the the plan was to let community decide for the ‘value’ of the proposal. so for the proposal, how would the value be decided? Do I set a range of options to vote or do I request the amount in the proposal?

Currently, there isn’t yet a formal process to allow the community to decide how much each HIP should request in terms of HBOT. We want to move away from the dev day-based system used in Epoch 1 (since that differs by developer) and instead allow devs to request a portion of that epoch’s dev grant budget, so that the community can approve/reject based on value generated.

For the time being, I suggest proposing a revised HBOT amount here in this thread and seeking community feedback on it for 1-2 days before submitting the HIP. For example, given the changes proposed above and the usefulness of hedge strategy, I think a 400-500k total HBOT would be appropriate.

Ok, thank you. I will proceed with 400k HBOT if there is no issue for 1-2days before raising the proposal.

1 Like