Exchange funds internally

Exchange funds from one currency to another within a single budget.

How it works

The following diagram describes the different steps required to exchange funds internally with Equals Money. Click on the image to enlarge it.

Diagram showing the steps required to exchange funds internally

Exchange currencies within a budget

Post/v2/orders/trade

Before you start

To exchange currencies within a budget, you first need to create a quote where:

  • type.from and type.to are set to balance
  • at least one of sourceCurrency.amount or targetCurrency.amount is provided
  • sourceCurrency.currency.budgetId and targetCurrency.currency.budgetId are set to the ID of the parent budget

For example, to convert 10 GBP to USD:

Sample requestRequest structure
Copy
Copied
curl -i -X POST \
  'https://api.equalsmoney.com/v2/orders/quote?accountId=F12345' \
  -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "sourceCurrency": {
      "amount": 10,
      "currency": {
        "budgetId": "b489ea2c-0dd1-4fb1-b345-de5a596a5527",
        "currencyCode": "GBP"
      }
    },
    "targetCurrency": {
      "currency": {
        "budgetId": "b489ea2c-0dd1-4fb1-b345-de5a596a5527",
        "currencyCode": "USD"
      }
    },
    "settlementDate": "20231001",
    "type": {
      "from": "balance",
      "to": "balance"
    }
  }'
Copy
Copied
curl -i -X POST \
  'https://api.equalsmoney.com/v2/orders/quote?accountId={accountId}' \
  -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "sourceCurrency": {
      "amount": number,
      "currency": {
        "budgetId": string",
        "currencyCode": "string"
      }
    },
    "targetCurrency": {
      "currency": {
        "budgetId": "string",
        "currencyCode": "string"
      }
    },
    "settlementDate": "string",
    "type": {
      "from": "string",
      "to": "string"
    }
  }'

Request

Use this request to exchange currencies within a budget, using the orderId and quoteRequestId returned when you created a quote.

Sample requestRequest structure
Copy
Copied
curl -i -X POST \
  'https://api.equalsmoney.com/v2/orders/trade?accountId=F12345' \
  -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "orderId": "FPLZQVE5G2ZZKS",
    "quoteRequestId": "SLQMQKRV8NR32DA3T0GZ7OC1SNDKO7X1HH"
  }'
Copy
Copied
curl -i -X POST \
  'https://api.equalsmoney.com/v2/orders/trade?accountId={accountId}' \
  -H 'Authorization: ApiKey YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "orderId": "string",
    "quoteRequestId": "string"
  }'

Query parameters

Parameter Description
accountId
string
required
The ID of the account that you're creating an order for.

Allowable values:
An existing accountId

Request body schema

Parameter Description
orderId
string
required
The ID of the order.

Allowable values:
An existing orderId (<= 36 characters)
quoteRequestId
string
required
The ID of the quote request.

Allowable values:
An existing quoteRequestId (<= 36 characters)

Response

If your request is successful, you'll receive a 200 response.

Sample responseResponse structure
Copy
Copied
{
  "orderId": "FPLZQVE5G2ZZKS",
  "quoteRequestId": "SLQMQKRV8NR32DA3T0GZ7OC1SNDKO7X1HH",
  "settlement": {
    "date": "20230825",
    "price": {
      "amount": 10,
      "currency": "EUR"
    },
    "charges": {
      "fee": 0
    }
  },
  "quote": {
    "rate": 1,
    "inverseRate": 1,
    "fromGbpAmount": 10,
    "from": {
      "amount": 10,
      "currency": "GBP"
    },
    "to": {
      "amount": 10,
      "currency": "EUR"
    },
    "direction": "1"
  }
}
Copy
Copied
{
  "orderId": "string",
  "bank": "string",
  "settlement": {
    "date": "string",
    "price": {
      "amount": number,
      "currency": "string"
    },
    "charges": {
      "fee": number,
      "margin": number,
      "other": number
    }
  },
  "trade": {
    "rate": number,
    "inverseRate": number,
    "from": {
      "amount": number,
      "currency": "string"
    },
    "to": {
      "amount": number,
      "currency": "string"
    },
    "direction": "string"
  }
}

For more detailed information about this request and its response, see the API reference.