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.
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
andtype.to
are set tobalance
-
at least one of
sourceCurrency.amount
ortargetCurrency.amount
is provided -
sourceCurrency.currency.budgetId
andtargetCurrency.currency.budgetId
are set to the ID of the parent budget
For example, to convert 10 GBP
to USD
:
Sample requestRequest structure
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"
}
}'
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
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"
}'
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
{
"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"
}
}
{
"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.