Ask us anything. We're here to help.

2022-08-17 Quote Execution and Separate Withdrawal Request

API Updates

 

Example Flow

GET /liquidity/rfq

Request:

  • participant_code: CUST01
  • underlying: ETH
  • quoted_currency: USD
  • quantity: 1
  • withdrawal_address: 0x4d2f8c3b4052aca0360a50ae9b47cfc084cd1e28

Response:

{
"message": {
"request_id": "07d81e73-6afa-43c6-b054-9ae8b7579794",
"participant_code": "CUST01",
"quoted_currency": "USD",
"side": "buy",
"quantity": "1",
"price": "1400",
"quote_id": "3fb9de3b-cc2e-4829-8135-c391d9f8f835",
"expire_ts": 1660240933628,
"account_group": "00SCXM",
"account_label": "general",
"obo_participant": {
"participant_code": "CUST01",
"account_group": "PLAT01",
"account_label": "general"
},
"network_fee_notional": "2.63",
"network_fee_quantity": "0.00139101",
"total_notional": "1402.63",
"underlying": "ETH",
"asset_cost_notional": "1400"
}
}

 

POST /liquidity/execute

Parameters:

{
"quote_id": "3fb9de3b-cc2e-4829-8135-c391d9f8f835"
}
 
Response:
 
{
"message": {
"request_id": "07d81e73-6afa-43c6-b054-9ae8b7579794",
"quote": {
"request_id": "3514c1be-3c14-4132-b336-03c99a74eb2b",
"participant_code": "CUST01",
"quoted_currency": "USD",
"side": "buy",
"quantity": "1",
"price": "1400.00",
"quote_id": "3fb9de3b-cc2e-4829-8135-c391d9f8f835",
"expire_ts": 1660749445632,
"account_group": "00SCXM",
"account_label": "general",
"obo_participant": {
"participant_code": "CUST01",
"account_group": "PLAT01",
"account_label": "general"
},
"network_fee_notional": "2.63",
"network_fee_quantity": "0.00139101",
"total_notional": "1402.63",
"underlying": "ETH",
"asset_cost_notional": "1400",
"transaction_timestamp": 1660749445984
},
"trade_id": "37b49576-b7f7-4261-9b8d-aa880476dee3",
"status": "Completed",
"trade_ids_list": [
"37b49576-b7f7-4261-9b8d-aa880476dee3"
]
}
 
 
After the quote has been executed, the customer will have a balance of the purchased crypto and then the network_fee_notional equivalent of fiat will also be in the customer account.

 

POST /withdrawals/requests

Parameters:

  • participant_code: CUST01
  • account_group: PLAT01
  • asset: ETH
  • amount: 1
  • withdrawal_address: 0x4d2f8c3b4052aca0360a50ae9b47cfc084cd1e28
  • trade_id: 37b49576-b7f7-4261-9b8d-aa880476dee3

Response:

{

"message": {
"id": 251913,
"withdrawal_account_id": 152327,
"participant_code": "CUST01",
"account_group": "PLAT01",
"account_label": null,
"requestor_participant_code": "PLAT01",
"asset": "ETH",
"requested_amount": "1",
"settled_amount": 1,
"gas_price": null,
"status": "APPROVED",
"on_chain_status": null,
"client_withdrawal_request_id": null,
"requested_timestamp": 1660781782762,
"transaction_id": null,
"input_data": null,
"fee_amount": null,
"quoted_fee_amount": null
}
}
 
You can then use GET /withdrawals/requests/:id to track the status of the withdrawal:
Response:
 
{
"message": [
{
"id": 251913,
"withdrawal_account_id": 152327,
"participant_code": "CUST01",
"account_group": "PLAT01",
"account_label": null,
"requestor_participant_code": "PLAT01",
"asset": "ETH",
"requested_amount": "1",
"settled_amount": "1",
"gas_price": null,
"status": "SETTLED", <-- check to see if the withdrawal has been settled on the ZH ledger
"on_chain_status": null, <-- check to see if the withdrawal has been confirmed on-chain
"client_withdrawal_request_id": null,
"requested_timestamp": 1660781789194,
"transaction_id": null, <-- monitor the transaction hash and present out to your client
"input_data": null,
"fee_amount": null,
"quoted_fee_amount": null
}
]
}

 

GET /accounts/:id/movements

You can use this endpoint to track the movements that are made out of your float account:

  • When your float account is being funded, you will see movements with movement_type = deposit
{

"run_id": "205864",
"movement_timestamp": 1658510170259,
"movement_id": "2b5d3adf-f999-4da1-9dc8-4b6b15f95cdc",
"movement_type": "deposit",
"trade_id": null,
"deposit_reference_id": example123,
"withdrawal_request_id": null,
"change": "2500000.00"
}
],
  • When a trade is executed, you will see 2 debits with movement_type = transfer
{
"run_id": "282732",
"movement_timestamp": 1661203233806,
"movement_id": "7a61571b-1d1c-49e0-ab7c-07db7d3863c3",
"movement_type": "transfer",
"trade_id": null,
"deposit_reference_id": null,
"withdrawal_request_id": null,
"change": "-200.17"
},

{
"run_id": "282731",
"movement_timestamp": 1661203233305,
"movement_id": "a9c34a92-90ca-4457-ac6f-182fddf8a633",
"movement_type": "transfer",
"trade_id": null,
"deposit_reference_id": null,
"withdrawal_request_id": null,
"change": "-200.00"
}

 

Performance Expectations

POST /liquidity/execute

  • CERT: A platform should expect latency response times of less than 800ms, at the 99th percentile, at a maximum of 8 requests per seconds

* Please note that certification performance at the stated rps may be impacted (i.e. higher latency and/or error rates) given LPs own cert environment. LPs tend to limit bandwidth in cert (reduce allocated resources) based on production trading needs.

 

  • PROD: A platform should expect latency response times of less than 800ms, at the 99th percentile, at a maximum of 100 requests per seconds

Upcoming Releases

  • Platforms will be able to execute quotes which lead to not only the execution of the Buy, but the automatic initiation of an on-chain withdrawal