gocryptotrader icon indicating copy to clipboard operation
gocryptotrader copied to clipboard

exchanges: Add Deribit exchange support

Open samuael opened this issue 2 years ago • 7 comments

PR Description

This pull request Included a code implementation for the Deribit exchange version 2; with REST and web-socket support. All the Websocket and Wrapper functions are tested. My code follows the style guidelines of other exchanges of GCT. Fixed some errors with the help of golangci-lint. 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 item is complete.

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [x] 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

For testing the exchange with your own API Credentials you can use your own API key { } and passphrase fields in the unit test deribit_test.go file, or directly add credential information to the config file you will be using for running.

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

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] 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
  • [x] My changes generate no new warnings
  • [x] 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

samuael avatar Nov 11 '22 10:11 samuael

DM'd issues.

shazbert avatar Nov 18 '22 02:11 shazbert

Codecov Report

Attention: Patch coverage is 43.07410% with 2174 lines in your changes are missing coverage. Please review.

Project coverage is 37.99%. Comparing base (c37a115) to head (33c5a99).

:exclamation: Current head 33c5a99 differs from pull request most recent head e1497ba

Please upload reports for the commit e1497ba to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1082      +/-   ##
==========================================
+ Coverage   37.78%   37.99%   +0.20%     
==========================================
  Files         409      415       +6     
  Lines      147697   153263    +5566     
==========================================
+ Hits        55807    58228    +2421     
- Misses      84031    86946    +2915     
- Partials     7859     8089     +230     
Files Coverage Δ
cmd/gctcli/commands.go 0.00% <ø> (ø)
currency/code.go 89.17% <ø> (ø)
currency/code_types.go 0.00% <ø> (ø)
currency/currencies.go 87.50% <ø> (ø)
currency/pairs.go 98.46% <ø> (ø)
engine/helpers.go 82.23% <100.00%> (+0.05%) :arrow_up:
exchanges/asset/asset.go 96.69% <100.00%> (+2.09%) :arrow_up:
exchanges/deribit/deribit.go 45.76% <ø> (ø)
exchanges/kline/kline.go 91.76% <100.00%> (+0.04%) :arrow_up:
exchanges/support.go 100.00% <ø> (ø)
... and 8 more

... and 12 files with indirect coverage changes

codecov[bot] avatar Feb 09 '23 19:02 codecov[bot]

Thanks for making the contract changes! I've had a look at the candle issue. I've somewhat fixed it with this linked diff. Some issues were about the test design, the other is about how the candle alignment works/can't comprehend time offsets. The diff will work, but will generate log warnings, but much better than errors.

The time offset rarely comes up. So I'd say that is a seperate issue which can be worked on in its own pr

gloriousCode avatar Feb 27 '24 01:02 gloriousCode

Thank you diff file and your review of the change requests. I have applied the change and am pushing the update.

samuael avatar Feb 27 '24 20:02 samuael

Screenshot 2024-03-05 at 11 49 18 PM Couldn't test this **_TestGetOrderMarginsByID_** as I can not get the API Credentials of Deribit.

samuael avatar Mar 05 '24 21:03 samuael

Hello! I've made a diff here to allow you to use the testnet endpoints https://gist.github.com/gloriousCode/283ecc528898779b73b5701c880e31ec Also adds an extra field to prevent API key deletion on test runs... Can understand if it doesn't get added, but I want it 😆

You can easily access the testnet to place orders by registering here: https://test.deribit.com and then signing in and creating an API key. The testnet gives you fake funds

gloriousCode avatar Mar 07 '24 00:03 gloriousCode

Also unmarshal error in build logs: here

shazbert avatar May 13 '24 05:05 shazbert

also can you add these lines to fix codespell reference here. Your PR will be merged first.

shazbert avatar May 27 '24 00:05 shazbert