bestnaf / ARS

ARS addon for Gunbot MM
https://gunbot.ru
10 stars 2 forks source link

Dynamic ROE: Margin Size Dividers #18

Open tr0lldermort opened 3 years ago

tr0lldermort commented 3 years ago

Description

When a position grows in size, the risk for that position also grows. This function will take the size of a position (preferably in margin), and reduce ROE and ROE_LIMIT automatically. This will help close out large, risky positions before & after they turn into bags. The risk of the position can integrated into the #LSP function, and can be evaluated by position size or LS, depending on whether POS_LIM = True (use pos size) or False (use LS). It is also possible to set a negative ROE for ROE_DIV_4 if the user is willing to take a loss for extremely risky positions.

As the margin or LS of the position grows, this function will have four levels to divide the ROE down:

It is worth mentioning that this function will work no matter whether Dynamic ROE is enabled. In other words, it does not matter if we're currently using BASE_ROE, BASE_ROE_LOW or simply ROE to calculate our actual ROE, this function will operate in all cases (when enabled).

Example (if integrated with LSP)

  1. Enable by setting ROE_DIV = True
  2. Enable POSLIM **(now we use position size instead of LL to set dividers)_**
  3. Set POS_LIMITPERC = 40 **(equivalent to 2% margin @ 20x lev)_**
  4. Configure ROE_DIV_1 to 1.5
  5. Configure ROE_DIV_2 to 2.5
  6. Configure ROE_DIV_3 to 4.5
  7. Configure ROE_DIV4 to -4.5 **(if negative divider is used, always set ROELIMIT to 0)**

<pair>.settings.ROE_DIV = True # Enable <pair>.settings.ROE_DIV_1 = 1.5 <pair>.settings.ROE_DIV_2 = 2.5 <pair>.settings.ROE_DIV_3 = 4.5
<pair>.settings.ROE_DIV_4 = -4.5 # The 4 divider settings as described above

If LS / POS_LIM aren't used, we will need a separate MAX_POS setting:

<pair>.settings.ROE_MAX_POS = 1 # Max pos allowed if not linked to LSP function

cryptokoala commented 3 years ago

Looks good, +1 !

tr0lldermort commented 3 years ago

@bestnaf I've modified this one to use position size as the control variable. Simpler now to code and will work just as well :)

tr0lldermort commented 3 years ago

Instead of this being its own function, it could be tied in with #LSP. Then as the load status increases for either LL or POS_SIZE (which ever the user has configured), we can divide our ROE by each level of very low, low, medium, high, very high and limit reached.