Quant.Explorer.RateLimiting.ProviderConfig (quant v0.1.0-alpha.1)

Provider-specific rate limiting configurations.

This module contains rate limiting configurations tailored to specific financial data providers, handling their unique requirements and patterns.

Summary

Functions

Calculates the appropriate weight for a Binance request based on parameters.

Gets the rate limiting configuration for a specific provider endpoint.

Gets adjusted limits for premium/pro tiers.

Gets the rate limiting configuration for a specific provider.

Determines if a request should use a higher tier configuration.

Functions

calculate_binance_weight(endpoint, params \\ [])

@spec calculate_binance_weight(
  atom(),
  keyword()
) :: pos_integer()

Calculates the appropriate weight for a Binance request based on parameters.

Different Binance endpoints have different weight calculations:

  • Single symbol requests: weight 1
  • All symbols requests: weight 40+
  • Depth with limit: weight based on limit parameter

get_endpoint_config(provider, endpoint)

@spec get_endpoint_config(atom(), atom() | String.t()) ::
  Quant.Explorer.RateLimiting.Behaviour.limit_config()

Gets the rate limiting configuration for a specific provider endpoint.

get_premium_config(provider)

@spec get_premium_config(atom()) :: [
  Quant.Explorer.RateLimiting.Behaviour.limit_config()
]

Gets adjusted limits for premium/pro tiers.

get_provider_config(provider)

@spec get_provider_config(atom()) :: [
  Quant.Explorer.RateLimiting.Behaviour.limit_config()
]

Gets the rate limiting configuration for a specific provider.

should_use_premium_limits?(provider, opts \\ [])

@spec should_use_premium_limits?(
  atom(),
  keyword()
) :: boolean()

Determines if a request should use a higher tier configuration.

This can be based on API key tier, user subscription, etc.