Custodian
Your goal is to implement a platform based on a Custodian model, correct? Good, because in Nexus we have everything you need to get started quickly! The following are the main topics we will go through to get a basic implementation done:
Create and activate a new Customer
Perform a Custodian Buy operation
Perform a Custodian Sell operation
For automated reserve management, see Tradebot overview and Tradebot — Custodian model .
Create a new customer
Request
Endpoint
POST
baseURL /customer
Headers
Key
Value
api_version
(string) 1.2
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )
Request body (JSON)
Key
Value
customerCode
(required) (string) unique identifier for this customer
portfolioCode
(string) grouping of customers (when using portfolios)
trustLevel
(required) (string) one of the trust levels previously defined in Trust levels .
status
(string) possible values: "NEW", "ACTIVE"
currencyCode
(string) example: "EUR"
Activate a new customer
NOTE
This step is required only if during the creation of a new customer the status option was set to NEW . If already set to ACTIVE you can skip this step.
Request
Endpoint
PUT
baseURL /customer/{customerCode}
Headers
Key
Value
api_version
(string) 1.2
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )
Route parameters
Key
Value
customerCode
(required) (string) unique identifier for this customer
Request body (JSON)
Key
Value
status
(required ) (string) "ACTIVE"
NOTE
Unlike in the Broker model, you do not need to manually create accounts for your customers. Accounts are automatically created when transactions are initiated for a given crypto-currency. Since Nexus does not initiate on-chain crypto transactions in this model, these accounts do not require deposit or withdraw addresses like in the Broker model.
Buy transaction
Request
Endpoint
POST
baseURL /buy/custodian
Headers
Key
Value
api_version
(string) 1.2
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )
Request body (JSON)
Key
Value
customerCode
(required) (string) unique identifier for this customer
accountCode
(string) unique identifier of the account or combination of crypto code and address
currencyCode
(required) (string) code for the currency to be used (refer to Fiat currencies for options)
cryptoCode
(required) (string) code for the crypto-currency to be used (refer to Crypto currencies for the comprehensive list of options)
fiatAmount
(required) (number<double >) amount of fiat used to buy crypto
requestedPrice
(number<double >) to force a different buy price
paymentMethodCode
(required) (string) used only to calculate fees, not to execute requests with the payment provider
data
(dictionary<string,string>) optional data
Sell transaction
Request
Endpoint
POST
baseURL /sell/custodian
Headers
Key
Value
api_version
(string) 1.2
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )
Request body (JSON)
Key
Value
customerCode
(required) (string) unique identifier for this customer
accountCode
(string) unique identifier of the account or combination of crypto code and address
cryptoCode
(required) (string) code for the crypto-currency to be used (refer to Crypto currencies for the comprehensive list of options)
cryptoAmount
(required) (number<double >) the amount of crypto being sold
currencyCode
(required) (string) Three letter code of the currency which the transaction is paid out in
requestedPrice
(number<double >) to force a different sell price
paymentMethodCode
(required) (string) used only to calculate fees, not to execute requests with the payment provider
data
(dictionary<string,string>) optional data
Update Sell transaction status
Request
Endpoint
PUT
baseURL /transaction/{transactionCode}
Headers
Key
Value
api_version
(string) 1.1
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )
Route parameters
Key
Value
transactionCode
(required) (string) code of the transaction to execute
Request body (JSON)
Key
Value
statusCode
(required ) new status to set. Options: SellCompleted (if previous status was ToPayout or PayoutConfirming ) or PayoutConfirming (if previous status was ToPayout ). See Custodian - Sell for details.
Get total custodian balances
Request
Endpoint
GET
baseURL /balances
Headers
Key
Value
api_version
(string) 1.2
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )
Additional useful endpoints
Retrieve buy/sell prices
Request
Endpoint
GET
baseURL /prices/{currency}
Headers
Key
Value
api_version
(string) 1.2
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )
Route parameters
Key
Value
currency
(required) (string) example: "EUR"
Get reserves of crypto and fiat currencies on exchanges, hot wallets, and cold stores
Request
Endpoint
GET
baseURL /reserves
Headers
Key
Value
api_version
(string) 1.2
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )