3

In the balanced configuration file the following explanation for MIN_AMOUNT_SPREAD and MAX_AMOUNT_SPREAD appears:

reduces the order size by this percentage (specified as a decimal number). if someone buys and sells the full order amount placed you will end up with a profit equaling this percentage multiplied by the full order amount, effectively making this a spread.

followed by the example values:

MIN_AMOUNT_SPREAD = 0.0005
MAX_AMOUNT_SPREAD = 0.0005

I'm not following why reducing the amount of a level order results in profit; how does this work?

1 Answer 1

1

The balanced strategy estimates a price for the two tokens relative to each other; that's the centerPrice. Anytime you place an order to sell with a spread, you are effectively selling at a better price (in the bot's favor) than what is estimated. Conversely, if you buy with a spread you are buying at a better price (in the bot's favor) than what is estimated.

However, when someone buys or sells to you it is an indicator of the market's relative demand for the two assets. Therefore, the act of having your order get converted to a trade reveals information by the market. The bot incorporates this new information by using the asset balances to estimate a new centerPrice.

The bot knows the maximum amount it can support to buy/sell w.r.t. it's knowledge of the current market demand. It does this by predicting the effect of a trade on the future centerPrice and factors that in to the maximum amount it can support. This is the amount at which if the market traded with the bot on both sides (buy followed by sell or sell followed by buy) then the bot would end up with a net 0 token gain (not accounting for negligible fees on the Stellar network).

Any amount lower than the maximum amount will result in a gain by the bot if the market were to both buy and sell. This gain comes from the SPREAD and the AMOUNT_SPREAD which allows you to define smaller amounts to trade compared to the maximum amount supported at each spread level. If the market were to consume a full order level placed by the bot then the bot has on average bought or sold at a price that is better by a percentage equal to AMOUNT_SPREAD compared to it's estimate of the centerPrice (in the bot's favor).

2
  • Thanks. How do MIN_AMOUNT_SPREAD and MAX_AMOUNT_SPREAD interact? Specifically, what is the difference between those values being identical vs. them being different, i.e. MIN and 0.0005 and MAX at 0.0007?
    – Rominus
    Nov 1, 2018 at 22:32
  • The bot picks a random value between min and max. so if min and max are the same then there is no randomness. The randomness makes your market look less jagged.
    – nikhils
    Nov 2, 2018 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.