Skip to content

exchanges: Add MEXC Exchange Support #1897

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

Open
wants to merge 186 commits into
base: master
Choose a base branch
from

Conversation

samuael
Copy link
Collaborator

@samuael samuael commented May 4, 2025

Shaloom 🕊️ team,

This pull request introduces support for the MEXC exchange, including both spot and futures assets. All stable (non-experimental) endpoints have been implemented. The codebase includes comprehensive unit tests, and all exported fields and methods are properly documented. The implementation supports both REST and WebSocket interfaces for real-time channel subscriptions and data retrieval.

Fixes # (issue)

Type of change

Please delete options that are not relevant and add an x in [] as item is complete.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and
also consider improving test coverage whilst working on a certain feature or package.

  • go test ./... -race
  • golangci-lint run
  • Test X

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation and regenerated documentation via the documentation tool
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally and on Github Actions with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link

@Copilot 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

This PR introduces support for the MEXC exchange while concurrently refactoring how order time‐in-force values are represented across various order types. In addition, the changes update multiple Binance-related order requests, tests, and documentation to use a consolidated string field for timeInForce.

  • Converted order request structures (e.g. NewOrderRequest) to use a string for TimeInForce instead of a custom type.
  • Updated tests and wrapper logic to reflect the new TimeInForce field, replacing ImmediateOrCancel/PostOnly usage.
  • Added MEXC exchange support in helpers, docs, and supported exchanges lists.

Reviewed Changes

Copilot reviewed 84 out of 87 changed files in this pull request and generated no comments.

Show a summary per file
File Description
exchanges/binanceus/binanceus_types.go Changed TimeInForce field from a custom type to string and removed deprecated constants.
exchanges/binanceus/binanceus_test.go Updated tests to retrieve TimeInForce via order.GoodTillCancel.String().
exchanges/binanceus/binanceus.go Updated parameter conversion for TimeInForce consistently.
exchanges/binance/cfutures_types.go Similar refactoring of TimeInForce field.
exchanges/binance/binance_wrapper.go Refactored TimeInForce handling in order submission.
exchanges/binance/binance_types.go Removed legacy TimeInForce type definitions and updated usage accordingly.
exchanges/binance/binance_test.go Updated tests to use string-based TimeInForce values.
exchanges/binance/binance_cfutures.go Adjusted TimeInForce collection logic to use strings directly.
exchange/websocket/connection.go Changed binary response parsing to skip flate decompression and check for empty responses.
engine/order_manager.go Consolidated order modification fields by replacing ImmediateOrCancel/PostOnly with TimeInForce.
engine/helpers.go Added MEXC exchange import for support.
docs/OHLCV.md, docs/ADD_NEW_EXCHANGE.md, README.md Added MEXC exchange support in documentation and lists.
cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go Updated test cases to pass TimeInForce as order.ImmediateOrCancel.
cmd/exchange_wrapper_issues/main.go Removed the case for order.ImmediateOrCancel in parseOrderType.
Files not reviewed (3)
  • cmd/documentation/exchanges_templates/exchanges_trade_readme.tmpl: Language not supported
  • cmd/documentation/root_templates/root_readme.tmpl: Language not supported
  • config_example.json: Language not supported

@samuael
Copy link
Collaborator Author

samuael commented May 5, 2025

Pull Request Overview

This PR introduces support for the MEXC exchange while concurrently refactoring how order time‐in-force values are represented across various order types. In addition, the changes update multiple Binance-related order requests, tests, and documentation to use a consolidated string field for timeInForce.

* Converted order request structures (e.g. NewOrderRequest) to use a string for TimeInForce instead of a custom type.

* Updated tests and wrapper logic to reflect the new TimeInForce field, replacing ImmediateOrCancel/PostOnly usage.

* Added MEXC exchange support in helpers, docs, and supported exchanges lists.

Reviewed Changes

Copilot reviewed 84 out of 87 changed files in this pull request and generated no comments.
Show a summary per file
File Description
exchanges/binanceus/binanceus_types.go Changed TimeInForce field from a custom type to string and removed deprecated constants.
exchanges/binanceus/binanceus_test.go Updated tests to retrieve TimeInForce via order.GoodTillCancel.String().
exchanges/binanceus/binanceus.go Updated parameter conversion for TimeInForce consistently.
exchanges/binance/cfutures_types.go Similar refactoring of TimeInForce field.
exchanges/binance/binance_wrapper.go Refactored TimeInForce handling in order submission.
exchanges/binance/binance_types.go Removed legacy TimeInForce type definitions and updated usage accordingly.
exchanges/binance/binance_test.go Updated tests to use string-based TimeInForce values.
exchanges/binance/binance_cfutures.go Adjusted TimeInForce collection logic to use strings directly.
exchange/websocket/connection.go Changed binary response parsing to skip flate decompression and check for empty responses.
engine/order_manager.go Consolidated order modification fields by replacing ImmediateOrCancel/PostOnly with TimeInForce.
engine/helpers.go Added MEXC exchange import for support.
docs/OHLCV.md, docs/ADD_NEW_EXCHANGE.md, README.md Added MEXC exchange support in documentation and lists.
cmd/exchange_wrapper_standards/exchange_wrapper_standards_test.go Updated test cases to pass TimeInForce as order.ImmediateOrCancel.
cmd/exchange_wrapper_issues/main.go Removed the case for order.ImmediateOrCancel in parseOrderType.
Files not reviewed (3)

Thank you, @Copilot, for the summary. Yours is much better than mine—I almost felt like you might take over my job!

@shazbert shazbert added the nomerge requires dependency This pull request is dependent on another, so it can't be merged until the dependent one is merged label May 6, 2025
samuael added 24 commits May 7, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nomerge requires dependency This pull request is dependent on another, so it can't be merged until the dependent one is merged review me This pull request is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants