Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Allow pricefeed inversions for more complex price derivations #148

Open
Reidmcc opened this issue Apr 5, 2019 · 3 comments
Open

Allow pricefeed inversions for more complex price derivations #148

Reidmcc opened this issue Apr 5, 2019 · 3 comments
Labels
feature request New feature or request
Milestone

Comments

@Reidmcc
Copy link
Contributor

Reidmcc commented Apr 5, 2019

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 return 1.0 / normally returned price.

Specification

Pull request incoming.

@nikhilsaraf nikhilsaraf added this to the v1.6.1 milestone Apr 8, 2019
@nikhilsaraf
Copy link
Contributor

@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 nikhilsaraf modified the milestones: v1.6.1, v1.7.0 Apr 10, 2019
@nikhilsaraf nikhilsaraf added the feature request New feature or request label Apr 10, 2019
@Reidmcc
Copy link
Contributor Author

Reidmcc commented Apr 13, 2019

@nikhilsaraf I think the formula feed type is the right approach. It could be expanded to accommodate multiple inversions, or whatever else, as needed.

@nikhilsaraf
Copy link
Contributor

@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?

@nikhilsaraf nikhilsaraf modified the milestones: v1.8.0, later Aug 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants