Skip to content

Refactor/comprehensive api improvements#253

Open
wanth1997 wants to merge 9 commits intobitfinexcom:masterfrom
wanth1997:refactor/comprehensive-api-improvements
Open

Refactor/comprehensive api improvements#253
wanth1997 wants to merge 9 commits intobitfinexcom:masterfrom
wanth1997:refactor/comprehensive-api-improvements

Conversation

@wanth1997
Copy link
Copy Markdown

Description:

...

Breaking changes:

  • [ ]

New features:

  • [ ]

Fixes:

  • [ ]

PR status:

  • Version bumped
  • Change-log updated

- Fix nil pointer dereference in v2/rest/transport.go (error check order)
- Fix heartbeat causing loop exit in v1/websocket.go (return -> continue)
- Add safe type assertions (comma-ok) in v1/websocket.go, v2/rest/platform_status.go, v2/rest/status.go, v2/rest/tickers.go, v2/rest/derivatives.go
- Protect downstream channel send with select in v2/websocket/transport.go
- Add sync.Once to prevent double-close panic in v2/websocket/client.go
- Add read/write deadlines to v1 websocket (90s read, 10s write)
- Fix PermissionRead -> PermissionWrite in derivatives.go SetCollateral
- Add nil protection to v1 WebSocketService.Close()
- Fix sign() returning nil instead of err on failure
- Add fmt.Errorf %w wrapping to sign(), NewAuthenticatedRequestWithData()
- Register new services (Account, Movements, Alerts, etc.) in Client
- Update go.mod to Go 1.21
- Replace ioutil.ReadAll with io.ReadAll in v1/client.go
- Replace ioutil.NopCloser with io.NopCloser in all test files
- Run go mod tidy to clean up dependencies
- Replace time.Sleep loop with time.Ticker + select in control()
- Add sync.WaitGroup to track control goroutine
- Close() now waits for goroutine exit via wg.Wait()
- Fixes up to 7.5s delay on Close() caused by sleeping goroutine
Rename 37 exported functions across 18 v1 service files to include
V1 prefix for explicit version identification. Update all call sites
in tests, integration tests, and examples accordingly.
New services: Account (6 methods), Movements (2), Alerts (3),
Settings (3), Liquidations (1), Rankings (1).
Extended: Positions (+5), Funding (+4), Derivatives (+1),
Status (+1), Orders (+1). Coverage ~57% -> ~95%.
- transport_test.go: error check order, wrapping, invalid URL
- client_sign_test.go: sign function correctness
- client_close_test.go: double-close protection, connected socket close
- subscriptions_test.go: goroutine lifecycle, add/lookup, reset
- websocket_safety_test.go: malformed payload, unmapped channel, nil close
- docs/work-log.md: detailed changelog of all modifications
- docs/project-brief.md: project overview, architecture, current status
- Remove dead Travis CI badge
- Fix broken quickstart code (wrong variable name, missing imports)
- Add complete service table listing all 22 REST V2 services
- Add V1 API usage note explaining V1 prefix convention
- Update installation to modern Go modules style
- Fix typo "depreciated" -> legacy
- Simplify FAQ section
- Update contributing section with conventional commit format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant