View Source ExTwelveData.RealTimePrices (ExTwelveData v0.4.0)

WebSocket client to get real-time prices from Twelve Data.

Summary

Types

Symbols passed to subscribe/unsubscribe.

Functions

Reset the subscription to all price updates.

Specify a list of symbols you're interested to.

Send a list of symbols that you're no longer interested to.

Types

@type option() ::
  WebSockex.option()
  | {:api_key, binary()}
  | {:handler, ExTwelveData.RealTimePrices.Handler}
@type options() :: [option()]
@type symbols_list() :: String.t() | [ExTwelveData.Symbol.t()]

Symbols passed to subscribe/unsubscribe.

It can either be an array of objects (extended format), or a comma-delimited string with multiple symbols.

Functions

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

Reset the subscription to all price updates.

@spec start_link(options()) :: {:error, any()} | {:ok, pid()}
Link to this function

subscribe(client, symbols)

View Source
@spec subscribe(pid(), symbols_list()) :: {:error, any()} | {:ok}

Specify a list of symbols you're interested to.

Subsequent calls will append new symbols to the list. See unsubscribe/2 and reset/1 to remove

Link to this function

unsubscribe(client, symbols)

View Source
@spec unsubscribe(pid(), symbols_list()) :: {:error, any()} | {:ok}

Send a list of symbols that you're no longer interested to.

Twelve Data will stop sending updates.