Exchanges

Exchange APIs swap crypto to fiat assets and vice versa. You need to have accounts for each of the asset types you are swapping.

We support market types of exchange orders today:

  • Market - In a market order, the order will get executed at the market price. This type of order is supported on the DEPOSIT_BASIC products today.

Not all supported assets are swappable with each other. Click here to see the full list of supported exchange pairs.

There are 2 steps to performing an exchange:

  1. Setup the exchange - using exchanges/quote endpoint .
  2. Execute the exchange - using exchanges/{exchange_id}/accept endpoint

You can get details of any executed Exchange using exchanges/{exchange_id} endpoint

Exchange Action

The action field is use to denote the type of exchange being performed.

FIX_SOURCE - This fixes the amount you want to debit from the SOURCE account, therefore the quote provided is for how much would be credited to the DESTINATION account. Think of this as 'selling' the source amount.

FIX_DESTINATION - This fixes the amount to credit to the DESTINATION account, therefore the quote provided is for how much to deduct from the SOURCE account. Think of this as 'buying' the destination amount.

FIX DESTINATION and MARKET ADJUSTMENT:

To account for normal asset price fluctuations and increase the likelihood that FIX_DESTINATION exchanges execute, an additional 100 bps is temporarily debited from the SOURCE account. After execution, the unused portion of this buffer is credited back to the SOURCE account as a MARKET_ADJUSTMENT transaction.

Exchange Lifecycle

Scenario 1 - Exchange Lifecycle - Happy Path

Scenario where the exchange lifecycle executes without issues.

path

© 2024 Rail. All Rights Reserved.