Buy Flow ======== .. _BUY Get an internal client account: Get an internal client account ****************************** `GET /v1/accounts/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } Orders will be linked to this account. .. _BUY Add an external bank account: Add an external bank account **************************** `POST /v1/external-bank-accounts/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } .. code-block:: python data = { "name": "string", "iban": "string", "bank_code": "string", "bank_name": "string", "holder_name": "string" } **Or get the client's external bank account if it has already been added:** `GET /v1/external-bank-accounts/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } The deposit must be sent from this client account. .. _BUY Add an external crypto account: Add an external crypto account ****************************** Add a crypto account the withdrawal should be sent to. Confirm ownership ################# **Sandbox**: Confirmation is **not required** when adding an external crypto account in the sandbox. * Ethereum, Polygon: `POST /v1/external-crypto-accounts/ `_ Confirmation via WalletConnect is valid for **24 hours** only. The following JSON fields must be added to the request to add client external crypto account: .. code-block:: python data = { ..., "address": "string", "wallet_message": "string", "wallet_signature": "string" } * Algorand, Ripple, Xinfin, Stellar: Confirmation via Satoshi Test. Get the address for Satoshi Test: `GET /v1/external-crypto-accounts/satoshitest/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "network_type": "algorand" } Here you may need information about available network types: `GET /v1/references/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "type": ["network_types"] } Do add a crypto account ####################### `POST /v1/external-crypto-accounts/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } .. code-block:: python data = { "name": "string", "network_type": "ethereum", "address": "string" } **Or get the client's external crypto account if it has already been added:** `GET /v1/external-crypto-accounts/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } .. _BUY Get bank account info: Get bank account info ********************* Obtain information about the bank account into which the client will need to make a deposit. `GET /v1/sellbuy/bank-info/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } .. _BUY Get commissions: Get commissions *************** `GET /v1/sellbuy/orders/calculate-trade/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "bank_transfer_type": "sepa", "incoming_provider_type": "bank", "incoming_provider_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "incoming_amount": 100, "outgoing_provider_type": "crypto", "outgoing_provider_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } In step :ref:`BUY Get bank account info` you got ``bank_transfer_type`` and ``incoming_provider_uuid``. Make the following request to select an ``outgoing_provider_uuid``: `GET /v1/references/providers/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "type": "crypto" } .. _BUY Create an order: Create an order *************** `POST /v1/sellbuy/orders/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } .. code-block:: python data = { "account_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "incoming_transfer_type": "sepa", "incoming_provider_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "incoming_asset_code": "EUR", "incoming_amount": 100, "outgoing_provider_type": "crypto", "outgoing_provider_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "outgoing_asset_code": "EURS", "outgoing_client_account_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } * In step :ref:`BUY Get an internal client account` you got ``account_uuid``. * In step :ref:`BUY Add an external crypto account` you got ``outgoing_client_account_uuid``. * In step :ref:`BUY Get bank account info` you got ``incoming_transfer_type`` and ``incoming_provider_uuid``. Make the following request to select an ``outgoing_provider_uuid``: `GET /v1/references/providers/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "type": "crypto" } .. _BUY Make a deposit: Make a deposit ************** The client needs to make a fiat deposit from the account specified in step :ref:`BUY Add an external bank account` using the bank details received in step :ref:`BUY Get bank account info`. Please use ``reference`` field value from step :ref:`Create an order` as a purpose of bank transfer. Sandbox ####### There is no need to make a real bank deposit in the sandbox. Sandbox API provides an inject deposit endpoint. `POST /v1/deposits/inject/ `_ .. _BUY Track the status of client orders: Get order status **************** `GET /v1/sellbuy/orders/ `_ .. code-block:: python query = { "legal_entity_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "client_uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }