How to use the bfx-api-node-models.FundingOffer function in bfx-api-node-models

To help you get started, we’ve selected a few bfx-api-node-models examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitfinexcom / bitfinex-api-node / examples / rest2 / submit_funding_offer.js View on Github external
'use strict'

process.env.DEBUG = 'bfx:examples:*'

const debug = require('debug')('bfx:examples:submit_order')
const bfx = require('../bfx')
const { FundingOffer } = require('bfx-api-node-models')
const rest = bfx.rest(2, { transform: true })

debug('Submitting new order...')

// Build new order
const fo = new FundingOffer({
  type: 'LIMIT',
  symbol: 'fUSD',
  rate: 0.0120000,
  amount: 120,
  period: 2
}, rest)

fo.submit().then((fo) => {
  debug('Submitted funding offer', fo.id)
})
  .catch((err) => console.log(err))

// cancel offer

// setTimeout(() => {
//   fo.cancel()