ExOanda.Pricing (ExOanda v0.2.3)

Copy Markdown View Source

Interface for Oanda pricing.

Docs

Summary

Functions

Get pricing information for a list of instruments.

Get pricing information for a list of instruments, raising an exception on error.

Fetch candlestick data for an instrument.

Fetch candlestick data for an instrument, raising an exception on error.

Get most recently completed candles within an account for specified combinations of instrument, granularity and price component.

Get most recently completed candles within an account for specified combinations of instrument, granularity and price component, raising an exception on error.

Functions

list(conn, account_id, params \\ [])

Get pricing information for a list of instruments.

Examples

iex> {:ok, res} = ExOanda.Pricing.list(conn, account_id)

Supported parameters

  • :include_home_conversion (boolean/0) - Flag that enables the inclusion of the homeConversions field in the returned response.

  • :include_units_available (boolean/0) - Flag that enables the inclusion of the unitsAvailable field in the returned Price objects.

  • :since (String.t/0) - The time of the snapshot to fetch using either RFC 3339 or Unix format. If not specified, then the most recent snapshot is fetched.

  • :instruments (String.t/0) - Required. A comma separated list of instrument names.

Docs

list!(conn, account_id, params \\ [])

Get pricing information for a list of instruments, raising an exception on error.

Examples

iex> res = ExOanda.Pricing.list!(conn, account_id)

Supported parameters

  • :include_home_conversion (boolean/0) - Flag that enables the inclusion of the homeConversions field in the returned response.

  • :include_units_available (boolean/0) - Flag that enables the inclusion of the unitsAvailable field in the returned Price objects.

  • :since (String.t/0) - The time of the snapshot to fetch using either RFC 3339 or Unix format. If not specified, then the most recent snapshot is fetched.

  • :instruments (String.t/0) - Required. A comma separated list of instrument names.

Docs

list_candles(conn, account_id, instrument, params \\ [])

Fetch candlestick data for an instrument.

Examples

iex> {:ok, res} = ExOanda.Pricing.list_candles(conn, account_id, instrument)

Supported parameters

  • :units (String.t/0) - The number of units used to calculate the volume-weighted average bid and ask prices.

  • :weekly_alignment (String.t/0) - The day of the week used for granularities that have weekly alignment. The default value is "Friday".

  • :alignment_timezone (String.t/0) - The timezone to use for the dailyAlignment parameter, note that the returned times will still be represented in UTC. The default value is "America/New_York".

  • :daily_alignment (non_neg_integer/0) - The hour of the day (in the specified timezone) to use for granularities that have daily alignments, minimum 0, maximum 23.

  • :include_first (boolean/0) - A flag that controls whether the candlestick that is covered by the from time should be included in the results.

  • :smooth (boolean/0) - A flag that controls whether the candlestick is smoothed or not.

  • :to (String.t/0) - The end of the time range to fetch candlesticks for using either RFC 3339 or Unix format.

  • :from (String.t/0) - The start of the time range to fetch candlesticks for using either RFC 3339 or Unix format.

  • :count (non_neg_integer/0) - The number of candles to return, maximum 5000.

  • :granularity (String.t/0) - The granularity of the candlesticks to fetch. The default value is "S5".

  • :price (String.t/0) - The Price component(s) to get candlestick data for. The default value is "M".

Docs

list_candles!(conn, account_id, instrument, params \\ [])

Fetch candlestick data for an instrument, raising an exception on error.

Examples

iex> res = ExOanda.Pricing.list_candles!(conn, account_id, instrument)

Supported parameters

  • :units (String.t/0) - The number of units used to calculate the volume-weighted average bid and ask prices.

  • :weekly_alignment (String.t/0) - The day of the week used for granularities that have weekly alignment. The default value is "Friday".

  • :alignment_timezone (String.t/0) - The timezone to use for the dailyAlignment parameter, note that the returned times will still be represented in UTC. The default value is "America/New_York".

  • :daily_alignment (non_neg_integer/0) - The hour of the day (in the specified timezone) to use for granularities that have daily alignments, minimum 0, maximum 23.

  • :include_first (boolean/0) - A flag that controls whether the candlestick that is covered by the from time should be included in the results.

  • :smooth (boolean/0) - A flag that controls whether the candlestick is smoothed or not.

  • :to (String.t/0) - The end of the time range to fetch candlesticks for using either RFC 3339 or Unix format.

  • :from (String.t/0) - The start of the time range to fetch candlesticks for using either RFC 3339 or Unix format.

  • :count (non_neg_integer/0) - The number of candles to return, maximum 5000.

  • :granularity (String.t/0) - The granularity of the candlesticks to fetch. The default value is "S5".

  • :price (String.t/0) - The Price component(s) to get candlestick data for. The default value is "M".

Docs

list_latest(conn, account_id, params \\ [])

Get most recently completed candles within an account for specified combinations of instrument, granularity and price component.

Examples

iex> {:ok, res} = ExOanda.Pricing.list_latest(conn, account_id)

Supported parameters

  • :weekly_alignment (String.t/0) - The day of the week used for granularities that have weekly alignment. The default value is "Friday".

  • :alignment_timezone (String.t/0) - The timezone to use for the dailyAlignment parameter, note that the returned times will still be represented in UTC. The default value is "America/New_York".

  • :daily_alignment (non_neg_integer/0) - The hour of the day (in the specified timezone) to use for granularities that have daily alignments, minimum 0, maximum 23.

  • :smooth (boolean/0) - A flag that controls whether the candlestick is smoothed or not.

  • :units (String.t/0) - The number of units used to calculate the volume-weighted average bid and ask prices.

  • :candle_specifications (String.t/0) - Required. The specification of the candles to fetch.

Docs

list_latest!(conn, account_id, params \\ [])

Get most recently completed candles within an account for specified combinations of instrument, granularity and price component, raising an exception on error.

Examples

iex> res = ExOanda.Pricing.list_latest!(conn, account_id)

Supported parameters

  • :weekly_alignment (String.t/0) - The day of the week used for granularities that have weekly alignment. The default value is "Friday".

  • :alignment_timezone (String.t/0) - The timezone to use for the dailyAlignment parameter, note that the returned times will still be represented in UTC. The default value is "America/New_York".

  • :daily_alignment (non_neg_integer/0) - The hour of the day (in the specified timezone) to use for granularities that have daily alignments, minimum 0, maximum 23.

  • :smooth (boolean/0) - A flag that controls whether the candlestick is smoothed or not.

  • :units (String.t/0) - The number of units used to calculate the volume-weighted average bid and ask prices.

  • :candle_specifications (String.t/0) - Required. The specification of the candles to fetch.

Docs