Conversation
- Add PlanTier enum (Starter, Pro, Expert) with corresponding rate limits - Starter: 5 req/min - Pro: 50 req/min - Expert: 120 req/min (default) - Replace ClientConfig struct with functional options pattern - WithAPIKey(), WithPrivatePEM(), WithThreeCommasBaseURL(), WithPlanTier() - Update WithThreeCommasRateLimits() to accept optional tier parameter - Modify rate limiter engine to use tier-based global limits - Update all tests to use new option pattern - Add comprehensive tests for plan tier functionality
- Replace ClientConfig struct example with functional options pattern - Add Configuration section documenting all available options - Add Rate Limiting section with tier comparison table - Document rate limiter features (token bucket, 429/418 handling) - Update Features list to include new capabilities
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds configurable rate limiting based on 3Commas subscription tiers and refactors client initialization to use functional options pattern instead of config structs.
Changes
Rate Limiting by Plan Tier
PlanTierenum with three tiers matching 3Commas API limits:WithThreeCommasRateLimits()to accept optional tier parameterFunctional Options Pattern
ClientConfigstruct with functional options for cleaner APIWithAPIKey(string)WithPrivatePEM([]byte)WithThreeCommasBaseURL(string)WithPlanTier(PlanTier)Testing & Documentation
Migration Guide
Before:
After:
Rationale
3Commas introduced tiered rate limits based on subscription plans. This change allows users to configure their tier to avoid unnecessary rate limiting while maintaining backward compatibility (defaults to Expert tier).