Skip to content
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

Merged
merged 8 commits into from
Nov 17, 2023

Conversation

bailantaotao
Copy link
Collaborator

@bailantaotao bailantaotao commented Nov 15, 2023

  1. use the now - 90 days instead of return err if since is 90 days earlier
  2. use GTC if time-in-force is empty
  3. fix the out-of-index

@bbgokarma-bot
Copy link

Welcome back! @bailantaotao, This pull request may get 302 BBG.

@bbgokarma-bot
Copy link

Re-estimated karma: this pull request may get 319 BBG

Copy link

codecov bot commented Nov 15, 2023

Codecov Report

Merging #1419 (f46ca57) into main (579e8b0) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            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              
Files Coverage Δ
.../bitget/bitgetapi/v2/get_history_orders_request.go 54.16% <ø> (ø)
...kg/exchange/bitget/bitgetapi/v2/get_trade_fills.go 0.00% <ø> (ø)
...bitget/bitgetapi/v2/get_unfilled_orders_request.go 0.00% <ø> (ø)
pkg/types/strint.go 0.00% <0.00%> (ø)
pkg/types/exchange.go 0.00% <0.00%> (ø)
pkg/exchange/bitget/exchange.go 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 579e8b0...f46ca57. Read the comment docs.

@@ -41,3 +41,10 @@ func (s *StrInt64) UnmarshalJSON(body []byte) error {

return nil
}

func (s *StrInt64) String() string {
Copy link
Owner

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?

Copy link
Collaborator Author

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

@@ -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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"e"open

@@ -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.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and "does not include"

@@ -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 {
Copy link
Owner

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?

return nil, fmt.Errorf("start time from the last 90 days can be queried, got: %s", since)
newSince := since

if time.Since(newSince) > queryMaxDuration {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name it maxHistoricalDataQueryPeriod?

Copy link
Owner

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"?

Copy link
Collaborator Author

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

@@ -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":
Copy link
Collaborator

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?

*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)
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's done

@bailantaotao bailantaotao merged commit afc864d into main Nov 17, 2023
2 of 4 checks passed
@bailantaotao bailantaotao deleted the edwin/bitget/fix-xmaker-error branch November 17, 2023 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants