NDAX
  • Introduction
    • About NDAX
    • Purpose
  • General Information
  • FIX
    • FIX Straight Through Processing
    • Supported Message Type
    • Resources
    • Sequence Diagram
    • Header & Trailer
    • Administrative Message
      • Logon (35=A)
      • Heartbeat (35=0)
      • TestRequest (35=1)
      • ResendRequest (35=2)
      • Reject (35=3)
      • SequenceReset (35=4)
      • Logout (35=5)
    • Application Message
      • TradeCaptureReport (35=AE)
      • TradeCaptureReportAck (35=AR)
    • Message Component
      • RootParties
      • TrdCapRptSideGrp
      • Parties
  • Web API
    • Endpoints
    • Time
  • Private Endpoints
    • Authentication
    • Index
    • Trades
      • GET Trade
      • POST Trade
      • Batch Trades
    • Positions
      • GET Position
      • GET Platform Position
    • Accounts
      • GET Status
      • Delivery
      • Account
      • History
      • Movement
    • Deposits
      • GET
      • GET: Digital Asset Address
      • POST: Digital Asset Address
      • GET: Fiat Deposit
      • GET: Withdrawal
        • GET: Withdrawal by ID
        • GET: Digital Asset
        • Digital Asset by ID
        • Fiat
        • Fiat by ID
      • Gas Fees
      • POST: Withdrawal
      • Delete: Withdrawal
    • Transfers
      • POST: Transfer
      • GET: Transfer by ID
    • Participants
      • GET
      • GET by Email
      • POST New
      • Region
      • Patch
      • Relation
      • Documents
    • Liquidity
      • GET
      • POST
    • Convert
    • Withdraw
    • Payments
      • POST
      • GET
      • GET Status
    • Rewards & Loyalty
    • Awards
  • Private Socket Feed
    • Overiew
    • Authentication
    • Basic Setup
    • Balances
    • Prices
    • Subscription
  • Security
    • Don't
    • Bounty
  • Contact
Powered by GitBook
On this page
  1. Private Endpoints

Awards

PreviousRewards & LoyaltyNextPrivate Socket Feed

Last updated 2 years ago

Awards

These endpoints can be used to facilitate Awards payments as part of a promotional program, prize pool, bonus pool, giveaway, etc. See release notes for more information

POST /awards/fund

Specify the amount, quoted currency, and asset that you intend to ultimately distribute to your customers via the POST /awards/distribute endpoint.

const fundAwards = (asset: string, notional: string) => {
  const body = `{
    asset: ${asset},
    total: ${notional}
  }`
  const timestamp = Math.round(Date.now() / 1000)
  const payload = timestamp + 'POST' + '/awards' + body
  const decodedSecret = Buffer.from(apiSecret, 'base64')
  const hmac = crypto.createHmac('sha256', decodedSecret)
  const signedPayload = hmac.update(payload).digest('base64')

  // SET HEADERS
 const headers = {
    'X-NDAX-API-KEY': 'public_key',
    'X-NDAX-SIGNED': signedPayload,
    'X-NDAX-TIMESTAMP': timestamp,
    'X-NDAX-PASSPHRASE': 'passphrase'
  }
  const options = {
    headers,
    body,
    json: true
  }

  return request.post(`https://api.ndax.in/awards/fund`, options)
}

Sample Response

{
  "request_id": "14f8ebb8-7530-4aa4-bef9-9d73d56313f3",
  "quote": {
    "request_id": "ce819fe8-b1d7-43bb-961c-e09ede0988d3",
    "participant_code": "CUST01",
    "underlying_currency": "BTC",
    "quoted_currency": "e₹",
    "side": "BUY",
    "quantity": "1",
    "price": "11430.90",
    "quote_id": "5cd07738b861c31e3bd61467BTC1Buy1568311644602",
    "expire_ts": 1568311649602,
    "transaction_timestamp": 1568311649600
  },
  "trade_id": "ba97133e-ab15-4c86-86c1-86671b8420bc",
  "status": "Completed"
}

Body parameters include:

  • underlying (required) the underlying asset for to be awarded.

  • quoted_currency (required) the quoted asset for purchase of the reward

  • quantity (optional) the desired amount of the underlying for the quote (either quantity or total must be provided)

  • total (optional) the desired amount of the quoted_currency for the quote (either quantity or total must be provided)

Response:

Parameter
Description
Type

request_id

The identifier of the RFQ

string

quote

The quote object that was executed

quote

trade_id

The unique identifier assigned to the trade, which is the same trade_id as found in a GET /trades request Note: the quote_id will be saved as the client_trade_id

string

status

The status of the trade, e.g. Completed

string

POST /awards/distribute

Evenly distribute the purchased crypto among the specified customers.

const distributeAwards = (asset: string, quantity: string, customer_participant_codes: string[]) => {
  const body = `{
    asset: ${asset},
    quantity: ${quantity}
    participant_codes: ${customer_participant_codes}
  }`
  const timestamp = Math.round(Date.now() / 1000)
  const payload = timestamp + 'POST' + '/awards' + body
  const decodedSecret = Buffer.from(apiSecret, 'base64')
  const hmac = crypto.createHmac('sha256', decodedSecret)
  const signedPayload = hmac.update(payload).digest('base64')

  // SET HEADERS
  const headers = {
    'X-SCX-API-KEY': 'public_key',
    'X-SCX-SIGNED': signedPayload,
    'X-SCX-TIMESTAMP': timestamp,
    'X-SCX-PASSPHRASE': 'passphrase'
  }
  const options = {
    headers,
    body,
    json: true
  }

  return request.post(`https://api.zerohash.com/awards/distribute`, options)
}

Sample Response

{
  "request_id": "14f8ebb8-7530-4aa4-bef9-9d73d56313f3",
  "confirms": [
    {
      "participant_code": "CUST01",
      "trade_id": "ce819fe8-b1d7-43bb-961c-e09ede0988d3",
    },
    {
      "participant_code": "CUST02",
      "trade_id": "ba97133e-ab15-4c86-86c1-86671b8420bc",
    },
  ]
}

Body parameters include:

  • asset (required) the asset for to be awarded.

  • quantity (required) the desired amount of the asset for to be awarded to each customer in the request

  • participant_codes (required) the list of customers to receive quantity amount of reward

Response:

Parameter
Description
Type

request_id

The identifier of the request

string

confirms

A list of participant_code plus trade identifiers for the executed trades confirm

confirm

here