gocryptotrader icon indicating copy to clipboard operation
gocryptotrader copied to clipboard

orderbook: Update naming convention and rm complexity.

Open shazbert opened this issue 2 years ago • 1 comments

PR Description

Update orderbook package. This is an initial update before I implement options books complimentary to #1082.

  • Renames orderbook.Item to orderbook.Tranche for improved clarity.
  • Renames orderbook.Items to orderbook.Tranches.
  • Removes the linked list implementation and associated handling due to complexity and overhead.
  • Renames linked_list.go to Tranches.go and removes linked list-specific manipulation functions.
  • Eliminates node.go and associated tests as they are no longer necessary.
  • Removes the byOBPrice type, as it can be inlined in functions using sort.Slice.
  • Eliminates the unsafe package due to redundancy and potential risks associated with its usage.

Initial benchmarks on my machine suggest a slight performance boost (when deleting it has performance hit 😭, but everything else is pretty schnappy) resulting from the changes introduced in this pull request.

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)
  • [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

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

shazbert avatar Feb 02 '24 00:02 shazbert

Codecov Report

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

Project coverage is 37.77%. Comparing base (b2d7bee) to head (d2c76cf).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1465      +/-   ##
==========================================
+ Coverage   36.00%   37.77%   +1.76%     
==========================================
  Files         412      409       -3     
  Lines      177779   147712   -30067     
==========================================
- Hits        64017    55794    -8223     
+ Misses     105902    84052   -21850     
- Partials     7860     7866       +6     
Files Coverage Δ
exchanges/binance/binance_websocket.go 60.34% <100.00%> (+2.40%) :arrow_up:
exchanges/binance/binance_wrapper.go 41.27% <100.00%> (+2.74%) :arrow_up:
exchanges/binanceus/binanceus_websocket.go 47.26% <100.00%> (+3.31%) :arrow_up:
exchanges/binanceus/binanceus_wrapper.go 44.89% <100.00%> (+3.99%) :arrow_up:
exchanges/bitfinex/bitfinex_websocket.go 36.30% <100.00%> (+3.57%) :arrow_up:
exchanges/bitmex/bitmex_websocket.go 24.41% <100.00%> (+2.05%) :arrow_up:
exchanges/btcmarkets/btcmarkets_websocket.go 43.38% <100.00%> (+3.75%) :arrow_up:
exchanges/btcmarkets/btcmarkets_wrapper.go 35.87% <100.00%> (+3.24%) :arrow_up:
exchanges/btse/btse_websocket.go 38.92% <100.00%> (+2.45%) :arrow_up:
exchanges/btse/btse_wrapper.go 48.29% <100.00%> (+3.74%) :arrow_up:
... and 47 more

... and 331 files with indirect coverage changes

codecov[bot] avatar Feb 02 '24 00:02 codecov[bot]