Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including bitonic with all npm packages installed. Try it out:

const bitonic = require ('bitonic')(); // Get BTC price for 10.54 BTC bitonic.price.buy ('eur', 10.54, (err, data) => { if (err) { console.error (err); return; } console.log ('For 10.54 EUR you get ' + data.btc + ' BTC'); }); // Get EUR price for selling 2 BTC bitonic.price.sell ('btc', 2, (err, data) => { if (err) { console.error (err); return; } console.log ('Selling 2 BTC will earn you ' + data.eur + ' EUR'); });

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

bitonic v1.0.1

Bitonic API (unofficial)

bitonic

Unofficial API wrapper for Bitonic.nl

npm Build Status Coverage Status bitHound Dependencies bitHound Code

Example

const bitonic = require ('bitonic')();

bitonic.price.buy ('eur', 5, (err, data) => {
  if (err) {
    return console.error (err);
  }

  console.log ('5 euro gets you ' + data.btc + ' BTC');
});

Installation

npm i bitonic --save

Configuration

With the require you can define configuration options.

param.typedefaultdescription
timeoutnumber5000.Request timeout in ms

Example

// set timeout to 8 seconds
const bitonic = require ('bitonic') ({
  timeout: 8000
});

Methods

The examples below don't include error handling. See the code above for a working example.

price.buy

( from, amount, [method], callback )

Get pricing for buying BTC by providing either the BTC or EUR amount, including payment method fees.

paramtypedefaultdescription
fromstringCurrency to convert from. btc or eur
amountnumberAmount to convert
methodstringidealPayment method. ideal or bancontact
callbackfunction(err, data)

Example

bitonic.price.buy ('btc', 2, (err, data) => {
  console.log ('2 BTC costs %s EUR', data.eur);
});

bitonic.price.buy ('eur', 5.12, (err, data) => {
  console.log ('For 5.12 EUR you get %s BTC', data.btc);
});

price.sell

( from, amount, callback )

Get pricing for selling BTC by providing either the BTC or EUR amount.

paramtypedescription
fromstringCurrency to convert from. btc or eur
amountnumberAmount to convert
callbackfunction(err, data)

Example

bitonic.price.sell ('btc', 2, (err, data) => {
  console.log ('You get %s EUR for selling 2 BTC', data.eur);
});

bitonic.price.sell ('eur', 5.12, (err, data) => {
  console.log ('Sell %s BTC to get 5.12 EUR', data.btc);
});

price.average

( callback )

Get 24H average price in EUR and volume.

paramtypedescription
callbackfunction(err, data)

Example

bitonic.price.average ((err, data) => {
  console.log ('1 BTC is %s EUR', data.price);
  console.log ('24H volume is ', data.volume);
});

Unlicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to https://unlicense.org

Author

Franklin van de Meent

Do you like this project? Buying me a coffee keeps me motivated to maintain the code.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free