
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
oanda-adapter
Advanced tools
The
oanda-adaptorpackage (versions <= 2.1.6) is deprecated. If you are using that please migrate to the scoped@cloud9trader/oanda-adapterpackage (versions >= 2.3.0)
Node.js adapter for OANDA's v20 REST and streaming API, from Cloud9Trader.
Provides a single interface for requesting data and streaming prices and account updates.
Smooths over polling and streaming endpoints for account updates and pricing for consistent subscriber methods.
Handles streaming connection loss and heartbeat timeout and retires connection.
Manages multiple price subscriptions and changes to the subscribed instrument list over a single long polling request.
Rate limits REST requests according to OANDA limit with automatic queuing for delayed execution and warning logs.
Returns instances from OANDA's definitions library at https://github.com/oanda/v20-javascript for editor code hinting and content assist.
OANDA endpoints return data specific to your account. Retrieves default account ID so client does not need to specify.
See also OANDA's v20 REST API documentation for reference.
This is compatible with OANDA's v20 APIs. If your account ID contains only digits (eg. 2534253), you have a v1 account - please use version 1.0.0 of this module.
npm install @cloud9trader/oanda-adapter
const OANDAAdapter = require("@cloud9trader/oanda-adapter")
const client = new OANDAAdapter({
// 'live' or 'practice'
environment: "live",
// Generate your API access token in the 'Manage API Access' section of 'My Account' on OANDA's website
accessToken: "<token>"
})
Starts polling for account changes and subscribes for incoming updates.
client.subscribeUpdates(({changes: AccountChanges, state: AccountChangesState, lastTransactionID: string}) => {
// ...
})
List instruments available to an account. Pass null as accountId to use default. callback is called with the following arguments:
errorArray[Instrument] Array of available instrumentsSubscribes to rates stream for a single instrument. Use getInstruments() to retrieve list of available instruments. A single streaming request will be managed as you subscribe to various instruments. If null is passed as accountId, the default account will be fetched. Optionally pass a context for the listener to be bound to.
client.subscribePrice(null, "EUR_USD", (ClientPrice) => {
// ...
})
List accounts for a user. callback is called with the following arguments:
errorArray[AccountProperties] Array of accounts available under current accessGets the default account ID. callback is called with the following arguments:
erroraccountIdGet account information. callback is called with the following arguments:
errorAccount Object representing account informationGets the current price of an instrument. If null is passed as accountId, the default account will be fetched. instrument can be an array to retrieve multiple prices. callback is called with the following arguments:
errorClientPrice or Array[ClientPrice] Object representing current price, or array containing them.Get interval bars for instrument between time range. If null is passed as accountId, the default account will be fetched. interval is one of [S5, S10, S15, S30, M1, M2, M4, M5, M10, M15, M30, H1, H2, H3, H4, H6, H8, H12, D, W, M]. from and to can be dates or ISO strings. callback is called with the following arguments:
errorArray[Candlestick] Array of candles with bid, mid and ask ohlc and volume.Aborts any open events or rates streaming connections and removes all event listeners
client.kill()
Implementations for trading coming in next releases.
By Cloud9Trader. Simple, powerful platform for algorithmic trading.
FAQs
Node.js adapter for OANDA's v20 REST and streaming API.
We found that oanda-adapter 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.