Skip to content

Comments

refactor: reduce code duplication in exchange clients#4

Open
pomadev wants to merge 1 commit intomainfrom
refactor/reduce-client-duplication
Open

refactor: reduce code duplication in exchange clients#4
pomadev wants to merge 1 commit intomainfrom
refactor/reduce-client-duplication

Conversation

@pomadev
Copy link
Owner

@pomadev pomadev commented Jun 4, 2025

Summary

  • Extract common functionality from exchange clients to reduce duplication
  • Create base client and shared utilities
  • Improve code organization and maintainability

Changes

  • client/base.go: New BaseClient with shared nonce generation logic
  • client/common/http.go: Common HTTP utilities for JSON requests
  • client/client.go: Add currency pair constants and rename interface
  • client/bitbank/bitbank.go: Use BaseClient and remove duplicate code
  • client/bitflyer/bitflyer.go: Use BaseClient and remove duplicate code

Benefits

  • DRY principle: No more duplicate nonce generation code
  • Easier to add new exchange clients
  • Common HTTP utilities reduce boilerplate
  • Better code organization with shared constants
  • Easier testing with reusable components

🤖 Generated with Claude Code

- Extract BaseClient with shared nonce logic
- Create common HTTP utilities for JSON requests
- Consolidate currency pair constants
- Remove duplicate getNonce implementations
- Simplify client creation with embedded BaseClient

This reduces code duplication and improves maintainability across exchange implementations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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