gnosis / dex-liquidity-provision

GNU Lesser General Public License v3.0
12 stars 9 forks source link

Replace stableToken with relativeToken #231

Closed fedgiac closed 4 years ago

fedgiac commented 4 years ago

The term "stable token" can be misleading as it's not necessary for the stable token to be "stable" in any sense. The only difference between target token and stable token is that the price is always written in terms of amount of stable tokens against one target token. As proposed by Ben, we could use "relative token" instead.

josojo commented 4 years ago

I would vote for baseToken and quoteToken, as this is commonly used in finance: https://www.investopedia.com/terms/b/basecurrency.asp

bh2smith commented 4 years ago

Which one? base or quote? I'm going to go with base.

josojo commented 4 years ago

With my logic, targetToken would become the baseToken and stableToken the quoteToken, right? Since the price is currently given as: [ targetToken ] / [ stableToken ].

bh2smith commented 4 years ago

If I were to change both, then I imagine the opposite:

targetToken is the volatile one and subject to being "quoted" while stableToken is the baseToken.

Remember that these prices given as ratios are expressed exactly opposite of what you would imagine "[ targetToken ] / [ stableToken ]" means price of Stable Token in terms of Target Token.

So, when we see EUR / CAD is does not mean "how many EUR per CAD", but rather the opposite (i.e. "How many CAD per EUR" or EUR / CAD = 1.52) which says 1 EUR = 1.52 CAD.

Attached is a screenshot of my findings:

Screenshot 2020-05-12 at 11 49 55 AM
bh2smith commented 4 years ago

However, according to others that I have spoken with in my example above EUR is the "base token" and CAD is the "quote token", so I suppose your suggestion @josojo is correct. However, I find it very strange that ETH is going to become the base token and DAI will become the quote token.

bh2smith commented 4 years ago

I think this particular line in the code base is a reasonable argument/proof for converting target to quote and stable to base:

https://github.com/gnosis/dex-liquidity-provision/blob/37cf28e6440e7af0245675458f1e661a1ea9f2ad/scripts/utils/price_utils.js#L20

Since it will become:

all prices are of the form: 1 quote token = "price" base tokens

for example,

all prices are of the form: 1 ETH = "price of ETH" DAI
bh2smith commented 4 years ago

Here are some other comments in the code that would suggest target become quote and stable become base:

https://github.com/gnosis/dex-liquidity-provision/blob/37cf28e6440e7af0245675458f1e661a1ea9f2ad/scripts/utils/trading_strategy_helpers.js#L219-L220

fedgiac commented 4 years ago

My understanding from Wikipedia is that Alex is right and in our code "target"="base" and "stable"="quote". This is also considering your examples, since the price tells you by definition "1 base currency = price quote currency". Without any context I'd also have expected them to work the other way around however.

josojo commented 4 years ago

8500 XBT/USD => 8500 USD = 1 BTC. => 8500 [stableToken] = 1 [targetToken] 110 EUR/JPY => 100JPY = 1 EUR

Hence, xbt and eur should be the base token = target Token.

bh2smith commented 4 years ago

Ya ok. Not sure why I am so confused here.

anxolin commented 4 years ago

This is a conversation we periodically have every couple of weeks 😅

I agree with the comment of @josojo above, just I'm confused why we call it base and target. We usually refer to them as base and quote currencies.

Also understand why @bh2smith is confused, same reason I was confused, or @twalth3r was confused. This is the reverse logic to the mathematical way, where for example 25 Km/h means "25 Km = 1 h"

A/B is the same as A-B, and it’s a market where A is the base and B is the quote. Normally the quote is something the trader is comfortable on seeing price in —> like USD Is the currency the trader will use in the transaction.

When you say A-B price is 100, you mean A Costs 100 B , in other words 1 A = 100 B

Please @Rafanator correct if it's not right

Rafanator commented 4 years ago

@anxolin you are 100% correct:

A is the base currency, B is quote currency (You use B to quote the price of 1(A), hence the name)

Also, in trading A/B or A-B are fine, traders don't care.