-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
FIX: [bitget] use the now - 90 days instead of return err if since is 90 days earlier #1419
Conversation
bailantaotao
commented
Nov 15, 2023
•
edited
Loading
edited
- use the now - 90 days instead of return err if since is 90 days earlier
- use GTC if time-in-force is empty
- fix the out-of-index
Welcome back! @bailantaotao, This pull request may get 302 BBG. |
c68f375
to
6d39c9a
Compare
Re-estimated karma: this pull request may get 319 BBG |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1419 +/- ##
==========================================
- Coverage 21.38% 21.37% -0.01%
==========================================
Files 581 581
Lines 42201 42218 +17
==========================================
Hits 9024 9024
- Misses 32526 32543 +17
Partials 651 651
Continue to review full report in Codecov by Sentry.
|
@@ -41,3 +41,10 @@ func (s *StrInt64) UnmarshalJSON(body []byte) error { | |||
|
|||
return nil | |||
} | |||
|
|||
func (s *StrInt64) String() string { |
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.
you can use value receiver here?
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.
No, I can't because we have a JSON marshaler on a pointer receiver. The combination of a pointer and value is not recommended by Golang
pkg/exchange/bitget/exchange.go
Outdated
@@ -289,7 +289,7 @@ func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (cr | |||
// 2. The query oepn/closed order does not including the `force` in SPOT. |
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.
"e"open
pkg/exchange/bitget/exchange.go
Outdated
@@ -289,7 +289,7 @@ func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (cr | |||
// 2. The query oepn/closed order does not including the `force` in SPOT. |
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.
and "does not include"
pkg/exchange/bitget/exchange.go
Outdated
@@ -289,7 +289,7 @@ func (e *Exchange) SubmitOrder(ctx context.Context, order types.SubmitOrder) (cr | |||
// 2. The query oepn/closed order does not including the `force` in SPOT. | |||
// If we support FOK/IOC, but you can't query them, that would be unreasonable. | |||
// The other case to consider is 'PostOnly', which is a trade-off because we want to support 'xmaker'. | |||
if order.TimeInForce != types.TimeInForceGTC { | |||
if order.TimeInForce != types.TimeInForceGTC && len(order.TimeInForce) != 0 { |
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.
put the length check before the gtc check?
pkg/exchange/bitget/exchange.go
Outdated
return nil, fmt.Errorf("start time from the last 90 days can be queried, got: %s", since) | ||
newSince := since | ||
|
||
if time.Since(newSince) > queryMaxDuration { |
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.
name it maxHistoricalDataQueryPeriod?
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.
and you should also modify the "until"?
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.
Are you suggesting changing 'until' to 'now'? I did consider it, but later on, I noticed that everyone else was using 'time.Now,' so I didn't make the change
pkg/types/exchange.go
Outdated
@@ -26,13 +26,13 @@ func (n *ExchangeName) UnmarshalJSON(data []byte) error { | |||
} | |||
|
|||
switch s { | |||
case "max", "binance", "okex", "kucoin": | |||
case "binance", "bitget", "bybit", "max", "okex", "kucoin": |
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.
How about using a slice for this list and checking for existence?
pkg/types/exchange.go
Outdated
*n = ExchangeName(s) | ||
return nil | ||
|
||
} | ||
|
||
return fmt.Errorf("unknown or unsupported exchange name: %s, valid names are: max, binance, okex, kucoin", s) | ||
return fmt.Errorf("unknown or unsupported exchange name: %s, valid names are: binance, bitget, bybit, max, okex, kucoin", s) |
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.
With a slice, you don't have to duplicate the list twice.
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.
that's done
e0e4170
to
f46ca57
Compare