-
-
Notifications
You must be signed in to change notification settings - Fork 302
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
FEATURE: add get_all_fee_rate and supported_interval #1322
Conversation
Welcome back! @MengShue, This pull request may get 616 BBG. |
Codecov Report
@@ Coverage Diff @@
## main #1322 +/- ##
==========================================
- Coverage 20.86% 20.84% -0.02%
==========================================
Files 556 557 +1
Lines 39621 39672 +51
==========================================
+ Hits 8265 8269 +4
- Misses 30757 30803 +46
- Partials 599 600 +1
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
pkg/exchange/okex/exchange.go
Outdated
return ok | ||
} | ||
|
||
func (e *Exchange) GetAllFeeRates(ctx context.Context) (okexapi.FeeRateList, 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.
Why you need GetAllFeeRates?
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.
Bybit uses it because the stream event does not return the fee and the fee currency.
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.
ok, I will remove it, I found out 'order' websocket would return fee, so I don't need GetAllFeeRates
https://www.okx.com/docs-v5/en/?shell#order-book-trading-trade-ws-order-channel
return re.ReplaceAllStringFunc(src, func(w string) string { | ||
return strings.ToUpper(w) | ||
}) | ||
func toLocalInterval(interval types.Interval) (string, 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.
Can you add unit test?
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.
in Test_QueryKlines
, will add more unit test
…re supported interval unit test
Re-estimated karma: this pull request may get 412 BBG |
pkg/exchange/okex/convert.go
Outdated
}) | ||
func toLocalInterval(interval types.Interval) (string, error) { | ||
if _, ok := okexapi.SupportedIntervals[interval]; !ok { | ||
return "", fmt.Errorf("interval not supported: %s", interval) |
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.
"interval %s is not supported"
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.
updated
switch i := interval.String(); { | ||
case strings.HasSuffix(i, "h"), strings.HasSuffix(i, "d"), strings.HasSuffix(i, "w"): | ||
return strings.ToUpper(i), nil | ||
case strings.HasSuffix(i, "mo"): |
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.
this will result 4 calls to HasSuffix, is there a simpler way to convert this?
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.
updated
pkg/exchange/okex/okexapi/types.go
Outdated
|
||
import "github.com/c9s/bbgo/pkg/types" | ||
|
||
var ( |
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 move this definition to the parent level package
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.
ok ...... but I use pkg/exchange/okex/type.go
in #1321 I will relocate struct in that PR
Re-estimated karma: this pull request may get 452 BBG |
pkg/exchange/okex/convert.go
Outdated
case strings.HasSuffix(i, "mo"): | ||
return "1M", nil | ||
default: | ||
hdwRegex := regexp.MustCompile("h$|d$|w$") |
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 be written as:
\d+[hdw]$
Re-estimated karma: this pull request may get 497 BBG |
Re-estimated karma: this pull request may get 502 BBG |
Long time no response, so closed this PR. |
stream.SetBeforeConnect()
toLocalInterval()