satang-api
  • Introduction
  • Authentication
  • Sign Request Example
    • Javascript
    • Python
    • Golang
  • APIs
    • Public
      • Orders
    • Private
      • Deposits
      • Crypto Deposits
      • User/Wallet
      • Orders
    • Portal (Obsoleted)
  • APIs V3
    • General information
      • Kline Chart Interval
      • Authorization
        • Endpoint Security types
    • Public
      • Exchange Information
      • Depth
      • Kline/Candlestick data
      • Ticker
      • Aggregate trade
    • Private
      • Orders
      • Listen Key
    • Websockets
      • General WSS information
      • User Data Streams
      • Streams
        • Aggregate trade
        • Depth
        • Kline
        • Ticker
  • Satang.pro SDK
Powered by GitBook
On this page

Was this helpful?

  1. Sign Request Example

Javascript

Example Signing Code in Javascript

Signing request param with encrypt(apiSecret, str) function

const crypto = require("crypto")

let api_secret = '...'

let encrypt = (apiSecret, str) => {
    let hmac = crypto.createHmac("sha512", apiSecret);
    let signed = hmac.update(str).digest('hex');
    
    return signed;
}

let request_header = 'amount='+String(order.amount)+'&nonce='+String(order.nonce)+'&pair='+String(order.pair)+'&price='+String(order.price)+'&side='+String(order.side)+'&type='+String(order.type)

let signed = encrypt(api_secret, request_header)
PreviousSign Request ExampleNextPython

Last updated 3 years ago

Was this helpful?