'use strict'

const { RESTv2 } = require('bfx-api-node-rest')
const { args: { apiKey, apiSecret }, debug, debugTable } = require('../util/setup')

async function execute () {
  const rest = new RESTv2({
    apiKey,
    apiSecret,
    transform: true
  })
  debug('fetching symbol details...')

  const details = await rest.symbolDetails()

  debugTable({
    headers: [
      'Pair', 'Initial Margin', 'Min Margin', 'Max Order',
      'Min Order', 'Margin'
    ],

    rows: details.map(({
      pair, initialMargin, minimumMargin, // eslint-disable-line
      maximumOrderSize, minimumOrderSize, margin // eslint-disable-line
    }) => [
      pair.toUpperCase(), initialMargin, minimumMargin, // eslint-disable-line
      maximumOrderSize, minimumOrderSize, margin ? 'Y' : 'N' // eslint-disable-line
    ])
  })
}

execute()

'use strict'

const { RESTv2 } = require('bfx-api-node-rest')
const { debug, debugTable } = require('../util/setup')

async function execute () {
  const rest = new RESTv2({
    transform: true
  })
  debug('fetching symbol details...')

  const details = await rest.symbolDetails()

  debugTable({
    headers: [
      'Pair', 'Initial Margin', 'Min Margin', 'Max Order',
      'Min Order', 'Margin'
    ],

    rows: details.map(({
      pair, initialMargin, minimumMargin, // eslint-disable-line
      maximumOrderSize, minimumOrderSize, margin // eslint-disable-line
    }) => [
      pair.toUpperCase(), initialMargin, minimumMargin, // eslint-disable-line
      maximumOrderSize, minimumOrderSize, margin ? 'Y' : 'N' // eslint-disable-line
    ])
  })
}

execute()

remove api keys in 'symbol details' example