Skip to content

gateio: add empty pair support for GetOrderHistory#2164

Open
gloriousCode wants to merge 15 commits intothrasher-corp:masterfrom
gloriousCode:gate-uh-oh
Open

gateio: add empty pair support for GetOrderHistory#2164
gloriousCode wants to merge 15 commits intothrasher-corp:masterfrom
gloriousCode:gate-uh-oh

Conversation

@gloriousCode
Copy link
Collaborator

@gloriousCode gloriousCode commented Feb 4, 2026

PR Description

Gateio doesn't require a pair for the API request for spot/futures, but our wrapper does. This does minimal line changes to allow for empty pair request.

  • New feature (non-breaking change which adds functionality)

@gloriousCode gloriousCode requested a review from a team February 4, 2026 05:26
@gloriousCode gloriousCode self-assigned this Feb 4, 2026
Copilot AI review requested due to automatic review settings February 4, 2026 05:26
@gloriousCode gloriousCode added the review me This pull request is ready for review label Feb 4, 2026
@thrasher-
Copy link
Collaborator

@codex please review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for fetching order history without specifying a currency pair. The implementation correctly handles this by modifying GetOrderHistory to loop over an EMPTYPAIR when no pairs are provided, and it also correctly parses the pair from the API response when fetching for all pairs. However, a regression was introduced in the process. The logic to specify the account type (e.g., cross_margin) when fetching spot trading history was removed, causing this functionality to break. I've provided a suggestion to fix this. The rest of the changes, including test updates, look good.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0fc6b797b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for calling Gateio GetOrderHistory without providing explicit pairs (interpreting an empty pair list as “all”), aligning wrapper behavior with Gateio’s API capabilities.

Changes:

  • Default req.Pairs to currency.EMPTYPAIR in GetOrderHistory when none are provided, enabling “all pairs” requests.
  • Update GetMySpotTradingHistory to accept an account string parameter instead of a crossMargin boolean.
  • Extend tests to exercise GetOrderHistory with Pairs=nil and update the spot trading history test for the new signature.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
exchanges/gateio/gateio_wrapper.go Implements empty-pair behavior for GetOrderHistory and maps returned symbols back to currency.Pair.
exchanges/gateio/gateio_test.go Updates spot trading history test signature and adds coverage for GetOrderHistory with empty pairs.
exchanges/gateio/gateio.go Changes GetMySpotTradingHistory signature to use an explicit account query parameter.


multiOrderRequest.Pairs = nil
_, err = e.GetOrderHistory(t.Context(), &multiOrderRequest)
assert.NoErrorf(t, err, "GetOrderHistory should not error for %s", a)
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

This test now asserts that GetOrderHistory with Pairs=nil should not error for every asset type. With the current wrapper changes, the asset.Options path will call GetMyOptionsTradingHistory with an empty underlying and return errInvalidUnderlying, so this assertion will fail when credentials are provided.

Suggestion: either adjust the wrapper to support empty-pair order history for options (e.g., iterate enabled underlyings), or make this sub-assert conditional (expect an error for options / require at least one underlying).

Suggested change
assert.NoErrorf(t, err, "GetOrderHistory should not error for %s", a)
if a == asset.Options {
assert.Error(t, err, "GetOrderHistory should error for options when Pairs is nil")
} else {
assert.NoErrorf(t, err, "GetOrderHistory should not error for %s", a)
}

Copilot uses AI. Check for mistakes.
@gloriousCode gloriousCode removed the review me This pull request is ready for review label Feb 4, 2026
@gloriousCode gloriousCode added the review me This pull request is ready for review label Feb 4, 2026
Copy link
Collaborator

@shazbert shazbert left a comment

Choose a reason for hiding this comment

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

Lovely looks good, only minor things.

gloriousCode and others added 2 commits February 5, 2026 13:48
TY SHAZ

Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
TY SHAZ

Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
@shazbert shazbert added reconstructing Based on PR feedback, this is currently being reworked and is not to be merged and removed review me This pull request is ready for review labels Feb 11, 2026
gloriousCode and others added 2 commits February 12, 2026 14:44
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
Co-authored-by: Ryan O'Hara-Reid <oharareid.ryan@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

@gloriousCode gloriousCode added review me This pull request is ready for review and removed reconstructing Based on PR feedback, this is currently being reworked and is not to be merged labels Feb 13, 2026
Copy link
Collaborator

@shazbert shazbert left a comment

Choose a reason for hiding this comment

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

ALMOST THERE! 👯

@thrasher- thrasher- requested review from gbjk and removed request for gbjk February 25, 2026 05:26
Copy link
Collaborator

@shazbert shazbert left a comment

Choose a reason for hiding this comment

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

minor thingo

@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 0% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 42.93%. Comparing base (6f0d5d7) to head (28513b8).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
exchanges/gateio/gateio_wrapper.go 0.00% 59 Missing ⚠️
exchanges/gateio/gateio.go 0.00% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2164      +/-   ##
==========================================
- Coverage   42.94%   42.93%   -0.01%     
==========================================
  Files         454      454              
  Lines      144599   144611      +12     
==========================================
- Hits        62098    62093       -5     
- Misses      75364    75380      +16     
- Partials     7137     7138       +1     
Files with missing lines Coverage Δ
exchanges/gateio/gateio_types.go 91.30% <ø> (ø)
exchanges/gateio/gateio.go 17.94% <0.00%> (+<0.01%) ⬆️
exchanges/gateio/gateio_wrapper.go 50.63% <0.00%> (-0.34%) ⬇️

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thrasher- thrasher- added nomerge requires dependency This pull request is dependent on another, so it can't be merged until the dependent one is merged rebase/merge of master required and removed nomerge requires dependency This pull request is dependent on another, so it can't be merged until the dependent one is merged labels Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review me This pull request is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants