1.0.5 • Published 9 years ago

fxtrade v1.0.5

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

OANDA fxTrade Node API

A simple API for interacting with OANDA's fxTrade platform.

Installtion

npm install fxtrade

Usage

All the fxTrade REST API's are supported except for the streaming API.

Basic Usage

var FxTrade = require("fxtrade");

var API_KEY = "<Your OANDA FxTrade API KEY>";

var fxTrade = new FxTrade('practice', API_KEY);

fxTrade.trades().list({
  accountId: "12345"
}).then(function(data) {
  console.log(data);
}).catch(function(error) {
  console.log("Error: ", error);
});

The API follows the syntax of fxTrade.<API Group>().<Action>(params). And each action returns a promise as outlined at https://www.promisejs.org. The parameters to each action are the parameters as outlined in the fxTrade documentation. All parameters are camelcased thus when the OANDA documentation lists as parameter using underscores (e.g. account_id) it should be passed as accountId in your code.

API Groups and Actions

Example Code

var FxTrade = require("fxtrade");

var API_KEY = "<Your OANDA FxTrade API KEY>";

// Available options are (live, practice, sandbox)
// Note: sandbox does not need an API key but many of the API's will not work
var fxTrade = new FxTrade('practice', API_KEY);

fxTrade.labs().calendar({
  period: 2592000,
  instrument: "EUR_USD"
}).then(function(data) {
  console.log(data);
}).catch(function(error) {
  console.log("Error: ", error);
});

fxTrade.accounts().info({
  accountId: "123456",
}).then(function(data) {
  console.log(data);
}).catch(function(error) {
  console.error("ERROR: ", error);
});

TODO

  • Streaming API
  • More Unit Testing

Disclaimer

IN NO EVENT SHALL THE AUTHOR OF THIS LIBRARY BE LIABLE FOR ANY LOSS OF MONEY, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago