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
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 trust levels you previously defined in the initial setup .
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, because they will be automatically added when initiating transactions in a certain crypto-currency for a customer. Nexus does not initiate on-chain crypto transactions in this model, therefore these accounts do not need a deposit or withdraw address like in the Broker one.
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 more 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) only used to calculate fees, not to carry out 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) only used to calculate fees, not to carry out 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 be set. Options: SellCompleted (if the previous was either ToPayout or PayoutConfirming ) or PayoutConfirming (if previous was ToPayout ). Check the Custodian - Sell for a more in-depth explanation on the statuses.
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, HotWallet and Coldstore
Request
Endpoint
GET
baseURL /reserves
Headers
Key
Value
api_version
(string) 1.2
Authorization
(string) "Bearer " + AUTH_TOKEN (see Authentication )