Coinbase.getBuyPrice()

Total price to buy some amount of bitcoin.

The price is broken down as follows: >btc - this is the total amount of bitcoin you would receive >subtotal - this is the current market price to buy this quantity of bitcoin, we integrate with a number of exchanges on the backend to calculate this price >fees - an array of fees you will pay if you wish to purchase at this price through Coinbase >total - the sum of the subtotal and fees, this is the total price you will pay if you wish to buy this quantity on Coinbase.

Usage

Hover over inputs/exits for more info.

var Coinbase = require('machinepack-coinbase');


// Total price to buy some amount of bitcoin.

Coinbase.getBuyPrice({

quantity: '10',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

quantity

The quantity of bitcoin you would like to buy (default is 1).

'10'

Exits

error

An unexpected error occurred.

success

OK.

{ btc: { amount: '1.00000000', currency: 'BTC' },
  subtotal: { amount: '10.10', currency: 'USD' },
  fees: 
   [ { coinbase: { amount: '0.10', currency: 'USD' } },
     { bank: { amount: '0.15', currency: 'USD' } } ],
  total: { amount: '10.35', currency: 'USD' } }