Open Reidmcc opened 5 years ago
@Reidmcc Do we need the ability to invert every single price feed? Or could we get away by having a single INVERT_PRICE_FEED config that takes the final center price and inverts it?
I'd prefer that we partially implement the "formula" price feed from point #2 from this issue comment instead of adding price inversions as a separate and standalone operation. This would allow us to specify your desired feed as such to give you BTC/XLM
prices from an XLM/BTC
feed:
FEED_A_TYPE="formula"
FEED_A_URL="(fixed:1.0)/(exchange:ccxt-kraken/XXLM/XXBT)"
the "formula" type price feed can explicitly only support the inversion operation first where it expects this specific form of a price feed URL to keep things simple. Thoughts?
@nikhilsaraf I think the formula
feed type is the right approach. It could be expanded to accommodate multiple inversions, or whatever else, as needed.
@Reidmcc yeah that sounds good -- do you want to take a shot at it -- at first it should only support a feed division.
i.e. something like this should work:
FEED_A_TYPE="formula"
FEED_A_URL="(fixed:1.0)/(exchange:ccxt-kraken/XXLM/XXBT)"
You can assume that formula
will explicitly fail if it is not set up to be like this: (fixed:1.0)/(Y)
. we can expand to more use cases later.
what do you think?
Desired Behavior
I want to be able to derive the price for buysell using a wider variety of conversions. For example, if I want to derive the price of XLM/USD by checking XLM/BTC vs BTC/USD, neither pricefeed A vs B direction returns the correct price. When Kelp only worked on the sdex this was fine; you just swap your sdex assets and read the orderbook the other direction. If you're trading on centralized exchanges you can't do that.
Impact
This will allow me to trade more effectively on pairs that don't have good direct non-self-referential pricefeed options.
Feature Suggestion
We can enable this behavior by adding an
INVERT
option to the price feed config parameters. When set to true the pricefeed would return1.0 / normally returned price
.Specification
Pull request incoming.