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

Deribit: Add subscription configuration #1636

Merged
merged 6 commits into from
Jan 2, 2025

Conversation

gbjk
Copy link
Collaborator

@gbjk gbjk commented Aug 30, 2024

Deribit

  • Add subscription configuration
  • Consolidate subscription requests
  • Fix error on authenticated subscription for orderbook

Misc

  • Fix kline.Raw marshalling

Stacked Dependencies

Type of change

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

@gbjk gbjk self-assigned this Aug 30, 2024
Copy link

codecov bot commented Aug 30, 2024

Codecov Report

Attention: Patch coverage is 54.25532% with 43 lines in your changes missing coverage. Please review.

Project coverage is 37.40%. Comparing base (b209b0e) to head (a427d9a).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
exchanges/deribit/deribit_websocket.go 45.56% 43 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1636      +/-   ##
==========================================
+ Coverage   37.35%   37.40%   +0.05%     
==========================================
  Files         415      415              
  Lines      178627   178351     -276     
==========================================
- Hits        66731    66719      -12     
+ Misses     104112   103857     -255     
+ Partials     7784     7775       -9     
Files with missing lines Coverage Δ
exchanges/deribit/deribit.go 46.17% <100.00%> (+0.11%) ⬆️
exchanges/deribit/deribit_wrapper.go 42.15% <100.00%> (+0.81%) ⬆️
exchanges/deribit/deribit_ws_endpoints.go 45.38% <ø> (ø)
exchanges/kline/kline.go 90.96% <100.00%> (+0.12%) ⬆️
exchanges/deribit/deribit_websocket.go 46.74% <45.56%> (+7.93%) ⬆️

... and 12 files with indirect coverage changes

@gbjk gbjk force-pushed the feature/deribit_sub_conf branch 4 times, most recently from 7a6cee6 to 3bb37fe Compare August 30, 2024 07:19
@gbjk gbjk added the review me This pull request is ready for review label Aug 30, 2024
@gbjk gbjk force-pushed the feature/deribit_sub_conf branch from 04871d1 to fa3520b Compare September 18, 2024 06:46
@gbjk gbjk force-pushed the feature/deribit_sub_conf branch from fa3520b to a6e200f Compare December 4, 2024 07:31
Copy link
Collaborator

@gloriousCode gloriousCode left a comment

Choose a reason for hiding this comment

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

tACK! That's a paddlin' good culling

@gloriousCode gloriousCode added the gcrc GloriousCode Review Complete label Dec 5, 2024
@gbjk gbjk force-pushed the feature/deribit_sub_conf branch from a196533 to 4fa7bc3 Compare December 12, 2024 02:48
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 just one nit. 🚀

exchanges/deribit/deribit_test.go Show resolved Hide resolved
@gbjk gbjk requested a review from shazbert December 13, 2024 08:15
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.

Pretty much tACK. Just one suggestion.

exchanges/deribit/deribit.go Outdated Show resolved Hide resolved
@gbjk gbjk requested a review from shazbert December 17, 2024 01:57
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.

Changes ACK. Thanks!

@shazbert shazbert added the szrc shazbert review complete label Dec 19, 2024
Copy link
Collaborator

@thrasher- thrasher- left a comment

Choose a reason for hiding this comment

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

One minor nit

// optionPairToString formats an options pair as: SYMBOL-EXPIRE-STRIKE-TYPE
// SYMBOL may be a currency (BTC) or a pair (XRP_USDC)
// EXPIRE is DDMMMYY
// STRIKE make include a d for decimal point in linear options
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// STRIKE make include a d for decimal point in linear options
// STRIKE may include a d for decimal point in linear options

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

gbjk added 2 commits January 2, 2025 12:17
Calling Setup twice would race on the assignment to this package var.

There was an option to just move the assignment to the package var declaration, but this
change improves the performance and allocations:
```
BenchmarkOptionPairToString-8            1000000              1239 ns/op             485 B/op         10 allocs/op
BenchmarkOptionPairToString2-8           3473804               656.2 ns/op           348 B/op          7 allocs/op
```

I've also removed the t.Run because even success the -v output from
tests would be very noisy, and I don't think we were getting any benefit
from it at all:
```
=== RUN   TestOptionPairToString
=== PAUSE TestOptionPairToString
=== CONT  TestOptionPairToString
=== RUN   TestOptionPairToString/BTC-30MAY24-61000-C
=== PAUSE TestOptionPairToString/BTC-30MAY24-61000-C
=== RUN   TestOptionPairToString/ETH-1JUN24-3200-P
=== PAUSE TestOptionPairToString/ETH-1JUN24-3200-P
=== RUN   TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== PAUSE TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== RUN   TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
=== PAUSE TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
=== CONT  TestOptionPairToString/BTC-30MAY24-61000-C
=== CONT  TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== CONT  TestOptionPairToString/ETH-1JUN24-3200-P
=== CONT  TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
--- PASS: TestOptionPairToString (0.00s)
    --- PASS: TestOptionPairToString/BTC-30MAY24-61000-C (0.00s)
    --- PASS: TestOptionPairToString/ETH-1JUN24-3200-P (0.00s)
    --- PASS: TestOptionPairToString/SOL_USDC-31MAY24-162-P (0.00s)
    --- PASS: TestOptionPairToString/MATIC_USDC-6APR24-0d98-P (0.00s)
```

( And that got worse with me adding more tests )
@gbjk gbjk force-pushed the feature/deribit_sub_conf branch from adad84b to a427d9a Compare January 2, 2025 05:17
@gbjk
Copy link
Collaborator Author

gbjk commented Jan 2, 2025

Rebase squashed :)

@gbjk gbjk requested a review from thrasher- January 2, 2025 05:18
Copy link
Collaborator

@thrasher- thrasher- left a comment

Choose a reason for hiding this comment

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

tACK pub subs. Great stuff @gbjk !

@thrasher- thrasher- changed the title Deribit: Add Subscription Configuration Deribit: Add subscription configuration Jan 2, 2025
@thrasher- thrasher- merged commit 4fcee84 into thrasher-corp:master Jan 2, 2025
10 of 13 checks passed
thrasher- pushed a commit that referenced this pull request Jan 2, 2025
* Kline: Fix Raw Short, Marshal and Unmarshal

* Deribit: Rename GenerateDefaultSubs

* Deribit: Remove custom GetDefaultConfig

Moved to exchange base by #1472

* Deribit: Straight Rename of eps to endpoints

Since I had to ask what this abbreviation meant, I think we should
abandon it

* Deribit: Add Subscription configuration

* Deribit: Fix race on Setup with optionsRegex

Calling Setup twice would race on the assignment to this package var.

There was an option to just move the assignment to the package var declaration, but this
change improves the performance and allocations:
```
BenchmarkOptionPairToString-8            1000000              1239 ns/op             485 B/op         10 allocs/op
BenchmarkOptionPairToString2-8           3473804               656.2 ns/op           348 B/op          7 allocs/op
```

I've also removed the t.Run because even success the -v output from
tests would be very noisy, and I don't think we were getting any benefit
from it at all:
```
=== RUN   TestOptionPairToString
=== PAUSE TestOptionPairToString
=== CONT  TestOptionPairToString
=== RUN   TestOptionPairToString/BTC-30MAY24-61000-C
=== PAUSE TestOptionPairToString/BTC-30MAY24-61000-C
=== RUN   TestOptionPairToString/ETH-1JUN24-3200-P
=== PAUSE TestOptionPairToString/ETH-1JUN24-3200-P
=== RUN   TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== PAUSE TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== RUN   TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
=== PAUSE TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
=== CONT  TestOptionPairToString/BTC-30MAY24-61000-C
=== CONT  TestOptionPairToString/SOL_USDC-31MAY24-162-P
=== CONT  TestOptionPairToString/ETH-1JUN24-3200-P
=== CONT  TestOptionPairToString/MATIC_USDC-6APR24-0d98-P
--- PASS: TestOptionPairToString (0.00s)
    --- PASS: TestOptionPairToString/BTC-30MAY24-61000-C (0.00s)
    --- PASS: TestOptionPairToString/ETH-1JUN24-3200-P (0.00s)
    --- PASS: TestOptionPairToString/SOL_USDC-31MAY24-162-P (0.00s)
    --- PASS: TestOptionPairToString/MATIC_USDC-6APR24-0d98-P (0.00s)
```

( And that got worse with me adding more tests )
@gbjk gbjk deleted the feature/deribit_sub_conf branch January 3, 2025 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gcrc GloriousCode Review Complete medium priority review me This pull request is ready for review szrc shazbert review complete
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants