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

exchanges: Add V2 Crypto.com exchange support #1122

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

Conversation

samuael
Copy link
Collaborator

@samuael samuael commented Jan 29, 2023

PR Description

This pull request adds a code implementation for version 2 of the Crypto.com exchange. The implementation supports REST and web-socket functionalities. All the REST, WebSocket endpoints, and wrapper functions are tested. My code adheres to the GCT style standards used by other exchanges.
Fixed some errors with the help of linter(golangci-lint), and unit tests. REST and WebSocket endpoint methods that have no support from the GCT wrapper are also implemented for future use.

Fixes # (issue)

Type of change

Please delete options that are not relevant and add an x in [] as the 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 on 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/AppVeyor with my changes
  • Any dependent changes have been merged and published in downstream modules

@shazbert shazbert requested a review from a team January 29, 2023 21:00
@shazbert shazbert added the review me This pull request is ready for review label Jan 29, 2023
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.

Looks good! Just a basic look over. Well done.

exchanges/cryptodotcom/cryptodotcom.go Outdated Show resolved Hide resolved
exchanges/cryptodotcom/cryptodotcom.go Outdated Show resolved Hide resolved
Comment on lines 52 to 54
publicGetValuations = "public/get-valuations" // skipped
publicGetExpiredSettlementPrice = "public/get-expired-settlement-price" // skipped
publicGetInsurance = "public/get-insurance" // skipped
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why skipped?

exchanges/cryptodotcom/cryptodotcom.go Outdated Show resolved Hide resolved
exchanges/cryptodotcom/cryptodotcom.go Show resolved Hide resolved
exchanges/cryptodotcom/cryptodotcom_wrapper.go Outdated Show resolved Hide resolved
return nil, currency.ErrCurrencyPairEmpty
}
var notional float64
switch s.Type {
Copy link
Collaborator

Choose a reason for hiding this comment

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

NOTE: Test for when both s.Amount and notional are sent.

exchanges/cryptodotcom/cryptodotcom_wrapper.go Outdated Show resolved Hide resolved
exchanges/cryptodotcom/cryptodotcom_wrapper.go Outdated Show resolved Hide resolved
testdata/configtest.json Outdated Show resolved Hide resolved
@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 Jan 30, 2023
@shazbert shazbert 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 6, 2023
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.

Thanks for that, just a quick review of last changes. Once completed I will start doing end point tests.

exchanges/cryptodotcom/cryptodotcom.go Show resolved Hide resolved
exchanges/cryptodotcom/cryptodotcom.go Outdated Show resolved Hide resolved
exchanges/cryptodotcom/cryptodotcom_test.go Outdated Show resolved Hide resolved
exchanges/cryptodotcom/cryptodotcom_test.go Outdated Show resolved Hide resolved
@@ -320,6 +300,85 @@ type CreateOrderParam struct {
TriggerPrice float64 `json:"trigger_price"`
}

func (arg *CreateOrderParam) getCreateParamMap() (map[string]interface{}, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs full test coverage and utilizing if !errors.Is(err, errGlobalError) { }

exchanges/cryptodotcom/cryptodotcom_wrapper.go Outdated Show resolved Hide resolved
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.

3 participants