Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
kraken-exchange
Advanced tools
This module fully implements the Kraken API. The full documentation for the API is available on the API help page.
It is written in Coffescript V2 using native Promises and its only dependencies are request and its wrapper, request-promise-native. You do not need Coffeescript to use the library; it is pre-compiled to Javascript ES6.
Kraken uses currency symbols preceded by an X
or a Z
to bring all
symbols to four characters. For example XXBT
, ZUSD
, XETH
but
DASH
with no preceding X
. This library uses the three-letter forms
thoughout, other than where the base symbol is four letters, e.g. DASH
.
Thus Euros are always referred to as EUR
and Bitcoin as XBT
.
There are a few extra methods that are not provided by the Kraken API.
These are utility methods which generally give a simplified view of
another method. Examples are kraken.profitloss()
and kraken.bidAsk()
.
npm install kraken-exchange
Get your API key and pivate key from here
Kraken = require('kraken-exchange');
const API_KEY = 'MlWItZtB4hqE2c2I9lg3DfnlYFvLQ9CR19Nmd373UEsJtpdAHQlk4NC3';
const PRIV_KEY = 'NZxR7Qyy7vf59fiomB0j1VFVL4J4BAVpKrHmf4hUUQefVFzhlw6as9CScA24cNNsmjb14nl65ZRyy13zlkWxzA';
const kraken = new Kraken(API_KEY, PRIV_KEY);
kraken.time()
.then response => console.log(response);
.catch err => console.err(err);
const kraken = new Kraken(API_KEY, PRIV_KEY);
For each method (other than the derived methods), please see the API documentation. Below I have simply documented the call; the response will generally be as documented by Kraken. Currency codes will have been converted and floating responses may be returned as floats rather than strings.
All methods return Promises and pass a single result object
to the .then()
. Optional parameters are shown within square
brakets: [
and ]
. It may be necessary to pass a null
for
some parameters in order to pass later ones.
N.B. The order of parameters in methods is as below which may differ from the Kraken documentation in order to put less used parameters twards the end of the list.
kraken.bidAsk(...pairs)
The parameters can be a list of pairs or a single array can be passed.
So kraken.bidAsk('XBTEUR', 'ETHEUR');
or
kraken.bidAsk(['XBTEUR', 'ETHEUR']);
, whichever is easier for the
application.
kraken.profitLoss()
This will return an object withe the current net profit or loss for each currency in open positions.
kraken.time()
kraken.assets(...assets)
The parameters can be a list of assets or a single array can be passed.
So kraken.assets('XBT', 'ETH');
or
kraken.assets(['XBT', 'ETH']);
, whichever is easier for the
application.
kraken.assetPairs(...pairs)
The parameters can be a list of pairs or a single array can be passed.
So kraken.assetPairs('XBTEUR', 'ETHEUR');
or
kraken.assetPairs(['XBTEUR', 'ETHEUR']);
, whichever is easier for the
application.
kraken.ticker(...pairs)
The parameters can be a list of pairs or a single array can be passed.
kraken.ohlc(pair[, interval[, last]])
kraken.depth(pair[, count])
kraken.trades(pair[, since])
kraken.spread(pair[, since])
kraken.balance()
kraken.tradeBalance([currency])
kraken.openOrders([trades[, userref]])
kraken.closedOrders([trades[, userref[, start[, end[, ofs[, closetime]]]]]])
kraken.queryOrders(txids[, trades[, userref]])
Note that txids
can be a single transaction id, an array of
transaction ids or a comma-separated list of transaction ids.
kraken.tradesHistory([type[, trades[, start[, end[, ofs]]]]])
kraken.queryTrades(txids[, trades])
Note that txids
can be a single transaction id, an array of
transaction ids or a comma-separated list of transaction ids.
kraken.openPositions([docalcs[, txids]]);
Note that txids
can be a single transaction id, an array of
transaction ids or a comma-separated list of transaction ids.
kraken.ledgers([assets[, type[, start[, end[, ofs]]]]])
kraken.queryLedgers(...ids)
The parameters can be a list of ledger ids or a single array can be passed.
kraken.tradeVolume(..pairs)
The parameters can be a list of currency pairs or a single array can be passed.
kraken.addOrder(pair, type, ordertype, volume[, price[, price2[, leverage[, closetype[, closeprice[, closeprice2]]]]]])
or
kraken.addOrder(params)
where params
is an object with the required keys and values from
the list above.
kraken.cancelOrder(txid)
kraken.depositMethods(asset)
kraken.depositAddress(asset, method[, newAddress])
kraken.depositStatus(asset, method)
kraken.withdrawInfo(asset, key, amount)
kraken.withdraw(asset, key, amount)
kraken.withdrawStatus(asset[, method])
kraken.withdrawCancel(asset, refid)
Please report any bugs or make any suggestions at the Github Issue page.
FAQs
Simple library to access the Kraken Exchange API
We found that kraken-exchange demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.