-
Notifications
You must be signed in to change notification settings - Fork 263
Add multi price feed mode with weighted averages and fall-back on failed feed #94
Comments
@sacarlson
Here's a sample API that we could use for this: Response format from your price feed server (v1.0):
example response:
In the example above, we've used the function "averageDropErrors", which would return the average of the feeds by dropping any that had an error. The first option seems a lot quicker to develop for your specific use case. I'd recommend preparing your ruby price feed to serve data in the format specified in the first point. That way whenever we support HTTP price feeds (I'll create a separate github issue for that) you'll be able to use your custom ruby based price feed. @sacarlson let me know your thoughts on the proposal. |
idea for a possible (theoretical) workaround (credit to @sacarlson): implement a few endpoints to mock out the CCXT REST interface ( Host this web server at port 3000 at the appropriate URL endpoints. |
I have already written a prototype ccxt-rest-averager in ruby that acts as a middle restclient api server to another real ccxt-rest server that is also running on a different port on the same system. kelp can now interface to make use of it for a weight averaged price feed. the ruby ccxt-server has modes for customizable fallback feeds and weighted averages mode of a group of exchange feeds that are obtained from the real ccxt-server or some of the other built in feeds I also wrote in ruby. This can be hooked into kelp or most any other software that supports the ccxt feed format. Remind you this is just quick crap code I write to experiment with the concept idea. I expect you all to make something more production oriented. I think a golang version of something like this might be cool. or maybe just modify a branch of ccxt or ccxt-rest to add the features at that end. At this point the ruby code is the quickest solution I can deal with to get what I need now. I've now made the initial release of the ruby code I have been speaking of at: https://github.com/sacarlson/ccxt-rest-averager |
// see sample feature request here: #2
Desired Behavior
Would like to have a mode that uses more than one price feed from say cctx and combine the output to some effect.
Impact
Not sure how many others would like these features. maybe just the fall-back or diff failure spec
Feature Suggestion
I was thinking it would be nice if we could use multiple price feeds with just some new config file features added to control how it effects final kelp feed. Maybe add a multi feed mode with each added feed that you already support with cctx for having some multiple weight on how it effected the final output feed to kelp. Also could add some critical point that would make the feed fail at some point. The fail point could be as simple as they all must be within some max percent different from each other or maybe just one must be within the group averge output. many possibilities at that point of failure and what can be done in that case. Also might want to add if one fails that it's output would just not be included in the outcome on that trade run. It would be cool to have some redundancy with fall-back to this on failure of that.
my present ruby bot already supports dual feeds of kraken and polonix that just makes sure of close match with settable percent limit differences that just returns failure with disabled trade on that run if match out of spec.
My other idea on this same subject is to write a ruby cctx feed that does the above actions by reading a group of cctx or other feeds and have kelp read the ruby cctx server to perform the actions discussed above. We can try this and many other more complex ideas with trail in a ruby prototype
References
Additional context
// Add any additional context here including any alternative solutions you considered (if any) and why
Specification
// If this feature does not exist anywhere else then please provide additional details here.
// This can be as long and detailed as may be necessary.
...
The text was updated successfully, but these errors were encountered: