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

Add trackSDEX strategy #39

Closed
wants to merge 5 commits into from

Conversation

Reidmcc
Copy link
Contributor

@Reidmcc Reidmcc commented Oct 30, 2018

Strategy description

This strategy allows Kelp to track the SDEX orderbook price as the midpoint for setting levels, and allows the user to manually set the amount per level. It dynamically adjusts level amount to maintain asset balance close to value parity.

The strategy assumes that the SDEX price is correct and is thus is most appropriate for native SDEX tokens.

I'll write up a walkthrough and add to the README once the code is finalized.

New files

The added files follow the convention of the existing strategies:

  • Base strategy plugin: trackSDEXStrategy.go
  • Level provider plugin: trackSDEXLevelProvider.go
  • Price feed plugin: sdexFeed.go
  • Configuration file example: sample_trackSDEX.cfg

Modifications to existing files

Functions necessary to enable the strategy were added to two files:

Added the strategy's StrategyContainer to factory.go
Added a function to pull SDEX orderbooks to functions.go

@Reidmcc Reidmcc requested a review from nikhilsaraf as a code owner October 30, 2018 02:46
This function is taken care of by allowedSpend now
Fixes an issue with the provider having negative allow spend amount. 
Changes asset to price dynamic adjustment to be more aggressive. Ensures 
that levels are always placed, with amounts approaching zero.
@nikhilsaraf
Copy link
Contributor

@Reidmcc the strategy in this PR seems more targeted. It may be better to keep it in your own fork for now.


I will be adding better support for custom, pluggable, and shareable strategies hopefully by end of year. These will be run in a REST wrapper that Kelp can interact with, similar to how we interact with CCXT via the ccxt-rest process.

I’m thinking of the best way to share these strategies that are created by the community with the community (reddit, keybase, slack, website, registry file in the kelp repo, etc.). If you have any suggestions please let me know. Maybe your strategy can be the first one?


The sdex price feed seems generalizable — could you include that in the list of price feeds by extending the current set of tags (crypto, fixed, exchange, etc.) to include one called “sdex”? The URL format can be like ”code1:issuer1/code2:issuer2” where we can leave an empty issuer for XLM markets: ”XLM:/BTC:GA....END”.

@Reidmcc
Copy link
Contributor Author

Reidmcc commented Nov 4, 2018

@nikhilsaraf Ok, I'll add SDEX to the price feeds.

As for sharing community strategies, my first thought is a separate Github repo, something like kelp-codeshare, which could be managed by a group of community maintainers, while keeping the core code clean and in your custody. Kelp strategies are, at least for now, fairly involved code, and Github is great for community development projects. Strategies could be added by PRs, which would let maintainers help authors QC their code, and avoid having a bunch of buggy strategies floating around among working strategies.

I'd be happy to post mine to get whatever sharing format started, and help maintain a repo if we went that route.

It would probably be good to have a more interactive space too, like Slack, since Github isn't great for talking.

@Reidmcc
Copy link
Contributor Author

Reidmcc commented Nov 17, 2018

@nikhilsaraf I'm having trouble getting the SDEX feed integrated with the existing FeedPair type. In order to get the SDEX orderbook I need to pass in the *SDEX client construct from makeBuySellStrategy, but MakeFeedPair only accommodates text.

I'd just have makeBuySellStrategy grab the SDEX price from the bot's trading assets (like I did in my strategy), but staticSpreadLevelProvider expects *api.FeedPair. I'm not finding a way around it.

Alternately we could implement this as a separate SDEX tracking strategy, with the buysell logic instead of the custom logic I have in this pull request.

@Reidmcc Reidmcc mentioned this pull request Jan 11, 2019
@Reidmcc
Copy link
Contributor Author

Reidmcc commented Jan 11, 2019

Closing this; the code is too old to merge reasonably and the custom strategy stuff isn't going in. A clean sdex price feed PR is at #90

@Reidmcc Reidmcc closed this Jan 11, 2019
@Reidmcc Reidmcc deleted the trackSDEX_st branch January 11, 2019 01:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants