oanda-v3
v0.0.7
Published
Typescript wrapper for OANDA v3 REST API
Downloads
3
Readme
oanda-v3 module
This module is a wrapper for the OANDA v3 REST API. This module is still very much incomplete. The only operation that has been developed thus far is getPricing()
.
Quickstart - using the module
First install the package:
npm i oanda-v3 --save
From there, you can simply start using the module:
var OANDA = require('oanda-v3').OANDAAdapter;
var isProd = false;
var accountId = "<ACCOUNT ID>"; // ex: 123-123-1234567-123
var apiToken = "<API TOKEN>";
var oAdapter = new OANDA(isProd, accountId, apiToken);
var instruments = ["EUR_USD", "USD_CAD"];
oAdapter.getPricing(instruments, (err, prices)) => {
if (err) {
console.error(err);
}
else {
prices.foreach((price) => {
console.log(price);
}, this);
}
});
var instrument = "EUR_USD";
var from = 1505304000;
var to = 1505307600;
var granularity = "M1";
oAdapter.getCandles(instrument, from, to, granularity, (err, candles) => {
if (err) {
console.error(err);
}
else {
candles.foreach((candle) => {
console.log(candle);
}, this);
}
});