View Source ExTwelveData.RealTimePrices.SubscriptionsManager (ExTwelveData v0.2.1)

High-level client to manage subscriptions to the real-time prices endpoint.

It avoids hitting the rate limits, and batches subscribe and unsubscribe requests. SubscriptionsManager expects a list of symbols, and creates a subscription for at least those symbols. It is implemented as a GenServer, which schedules a message every 600ms (100 events/minute), to subscribe/unsubscribe.

what-do-the-100-events-per-minute-limit-stand-for

What do the 100 events per minute limit stand for?

This does not affect how many price updates might be received from the server, but instead, it limits how many events (subscribe/unsubscribe/reset) could be sent to the server from the client side.

-- from https://support.twelvedata.com/en/articles/5194610-websocket-faq

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Runs every @clock_period_ms to honour the rate limit.

Callback implementation for GenServer.init/1.

Link to this section Types

@type option() ::
  GenServer.option()
  | {:pid, pid()}
  | {:provider, ExTwelveData.RealTimePrices.SubscriptionsManager.Provider}
  | {:max_subscriptions, integer()}
@type options() :: [option()]

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Runs every @clock_period_ms to honour the rate limit.

It checks with the configured {SubscriptionsManager.Provider} behaviour what to add/remove, and sends the corresponding subscribe/unsubscribe message to Twelve Data.

Callback implementation for GenServer.init/1.

@spec start_link(options()) :: {:error, any()} | {:ok, pid()}