-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: gate provider implementation #611
Conversation
price-feeder/oracle/provider/gate.go
Outdated
// subscribeCandles subscribes to the candle channels for all pairs one-by-one. | ||
// The gate API currently only supports subscribing to one kline market at a time. | ||
// | ||
// REF: https://www.gate.io/docs/websocket/#kline-subscription | ||
func (p *GateProvider) subscribeCandles(cps ...types.CurrencyPair) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to highlight this. Per gate's docs :
Can only subscribe to one market at the same time, market list is not supported currently.
For multiple subscriptions, only the last one takes effect.
tldr; we can only use gate for one currency pair (which will have to be umee) until they support multiple.
We could do some strict config validation for this, but seems like we should just add a log warning. wdyt @alexanderbez ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol what a shitty API. My proposal to actually add a (temporary) error to the config validation where an error is thrown if gate is used for more than one pair. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! Agreed
Codecov Report
@@ Coverage Diff @@
## main #611 +/- ##
==========================================
- Coverage 48.44% 48.02% -0.43%
==========================================
Files 63 64 +1
Lines 7932 8810 +878
==========================================
+ Hits 3843 4231 +388
- Misses 3831 4321 +490
Partials 258 258
|
cp := types.CurrencyPair{Base: "ATOM", Quote: "USDT"} | ||
GateSymbol := currencyPairToGatePair(cp) | ||
require.Equal(t, GateSymbol, "ATOM_USDT") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should definitely add tests for GetCandlePrices in a separate pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Let's get that config change in.
Done at ed837f4 @RafilxTenfen do you want to check this out before it gets merged in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The only change actually needed is the mutex lock and unlock at reconnect
cp := types.CurrencyPair{Base: "ATOM", Quote: "USDT"} | ||
GateSymbol := currencyPairToGatePair(cp) | ||
require.Equal(t, GateSymbol, "ATOM_USDT") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
## Description Adds gate.io as a provider to support [umee/usdt](https://www.gate.io/trade/UMEE_USDT) closes: #604 ---- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added appropriate labels to the PR - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) (cherry picked from commit 9e4b1aa)
Description
Adds gate.io as a provider to support umee/usdt
closes: #604
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change