ClearBank.MultiCurrency.FxTrade (ClearBank v1.0.0)

Copy Markdown View Source

FX Spot Trade — execute real-time foreign exchange conversions between two ClearBank currency accounts at the live market rate.

Use when

  • You want to immediately convert at the current market rate.
  • You don't need to lock in a rate ahead of time.

For pre-agreed quotes, see ClearBank.MultiCurrency.FxTradeRfq.

Examples

{:ok, result} = ClearBank.MultiCurrency.FxTrade.execute(client, %{
  sell_account_id: "eur-acct-uuid",
  buy_account_id: "gbp-acct-uuid",
  sell_currency: "EUR",
  buy_currency: "GBP",
  sell_amount: "10000.00"
})

Summary

Functions

Executes a spot FX trade.

Functions

execute(client, params)

@spec execute(ClearBank.Client.t(), map()) :: ClearBank.HTTP.result()

Executes a spot FX trade.

Required params

  • :sell_account_id - account to debit (sell currency)
  • :buy_account_id - account to credit (buy currency)
  • :sell_currency - ISO 4217 sell currency
  • :buy_currency - ISO 4217 buy currency

Provide exactly one of:

  • :sell_amount - fixed sell amount
  • :buy_amount - fixed buy amount