Skip to content

Fooeybar/oandav20

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OandaV20

Oanda npm license Made with linux

OandaV20 is a wrapper factory utilizing the Oanda V20 API


npm i oandav20

oandav20=require('oandav20')

wrappers=oandav20(api,host,datetime)


To generate an api token, log in to the Account Management Portal and select Manage Api Access:


By default the host is set for live accounts, 'api-fxtrade.oanda.com', and can be omitted
For practice accounts, input 'api-fxpractice.oanda.com' as the host.

Datime can either be 'RFC3339' or 'UNIX'; by default the datetime is set as 'RFC3339'.
Please see the Oanda reference: AcceptDatetimeFormat.





Accounts

Oanda reference: Account Endpoints

getAccounts

  • Get list of accounts
  • getAccounts(callback)
  • Callback data: array []

getAccountsMeta

  • Get summary details of a list of accounts
  • getAccountsMeta(callback)
  • Callback data: array []

getAccount

  • Get full details of a single account
  • getAccount(account,callback)
  • Callback data: object {}

getAccountSummary

  • Get summary details of a single account
  • getAccountSummary(account,callback)
  • Callback data: object {}

getAccountInstruments

  • Get a list of tradeable instruments
  • getAccountInstruments(account,callback,options)
  • Callback data: array []

getAccountChangesSinceTransaction

  • Get changes to account since a specific transaction id
  • getAccountChangesSinceTransaction(account,transactionID,callback)
  • Callback data: object {}

setAccountConfiguration

  • Set the client-configurable portions on an account
  • setAccountConfiguration(account,callback,options)
  • Callback data: object {}


Instrument

Oanda reference: Instrument Endpoints

getInstrument

  • Get candlestick data for an instrument
  • getInstrument(instrument,callback,options)
  • Callback data: array []

getOrderBook

  • Get order book data for an instrument
  • getOrderBook(instrument,callback,options)
  • Callback data: object {}

getPositionBook

  • Get position book data for an instrument
  • getPositionBook(instrument,callback,options)
  • Callback data: object {}


Positions

Oanda reference: Position Endpoints

getPositions

  • List positions for the lifetime of an account
  • getPositions(account,callback)
  • Callback data: array []

getPosition

  • Get details of an instrument position
  • getPosition(account,instrument,callback)
  • Callback data: object {}

getOpenPositions

  • List positions with open trades
  • getOpenPositions(account,callback)
  • Callback data: array []

closePosition

  • Fully or partially close an open position
  • closePosition(account,instrument,callback,options)
  • Callback data: object {}


Transactions

Oanda reference: Transaction Endpoints

getTransactions

  • Get a list of transaction pages
  • getTransactions(account,callback,options)
  • Callback data: object {}

getTransaction

  • Get details of a single transaction
  • getTransaction(account,transactionID,callback)
  • Callback data: object {}

getTransactionsByIdRange

  • Get a list of transactions by transaction id range
  • getTransactionsByIdRange(account,from,to,callback,options)
  • Callback data: array []

getTransactionsSinceId

  • Get a list of transactions starting after a specified transaction id
  • getTransactionsSinceId(account,id,callback,options)
  • Callback data: array []


Pricing

Oanda reference: Pricing Endpoints

getInstrumentsPricing

  • Get pricing details for a list of instruments
  • getInstrumentsPricing(account,instruments,callback,options)
  • Callback data: array []


Trades

Oanda reference: Trade Endpoints

getTrades

  • Get a list of trades by account
  • getTrades(account,callback,options)
  • Callback data: array []

getOpenTrades

  • Get a list of open trades by account
  • getOpenTrades(account,callback,options)
  • Callback data: array []

getClosedTrades

  • Get a list of closed trades by account
  • getClosedTrades(account,callback,options)
  • Callback data: array []

getCloseWhenTradeableTrades

  • Get a list of Close-when-tradeable trades by account
  • getCloseWhenTradeableTrades(account,callback,options)
  • Callback data: array []

getAllTrades

  • Get a list of all trades by account
  • getAllTrades(account,callback,options)
  • Callback data: array []

getAllOpenTrades

  • Get a list of all open trades by account
  • getAllOpenTrades(account,callback)
  • Callback data: array []

getTrade

  • Get details of a single trade
  • getTrade(account,tradeSpecifier,callback)
  • Callback data: object {}

closeTrade

  • Fully or partially close an open trade
  • closeTrade(account,tradeSpecifier,callback,options)
  • Callback data: object {}

setTradeClientExtensions

  • Set the client extensions for a trade
  • setTradeClientExtensions(account,tradeSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference:

setTradeOrders



Orders

Oanda reference: Order Endpoints

getOrders

  • Get a list of orders
  • getOrders(account,callback,options)
  • Callback data: array []

getPendingOrders

  • Get a list of pending orders
  • getPendingOrders(account,callback,options)
  • Callback data: array []

getFilledOrders

  • Get a list of filled orders
  • getFilledOrders(account,callback,options)
  • Callback data: array []

getTriggeredOrders

  • Get a list of triggered orders
  • getTriggeredOrders(account,callback,options)
  • Callback data: array []

getCancelledOrders

  • Get a list of cancelled orders
  • getCancelledOrders(account,callback,options)
  • Callback data: array []

getAllPendingOrders

  • Get a list of all pending orders
  • getAllPendingOrders(account,callback)
  • Callback data: array []

getAllOrders

  • Get a list of all orders
  • getAllOrders(account,callback,options)
  • Callback data: array []

getOrder

  • Get details of a single order
  • getOrder(account,orderSpecifier,callback)
  • Callback data: object {}

cancelOrder

  • Cancel a pending order
  • cancelOrder(account,orderSpecifier,callback)
  • Callback data: object {}

setOrderClientExtensions

  • Set the client extensions for an order
  • Set the client extensions for a trade when the order is filled
  • setOrderClientExtensions(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Client Extensions

createMarketOrder

  • Create a market order
  • createMarketOrder(account,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request

createLimitOrder

  • Create a limit order
  • createLimitOrder(account,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Limit Order Request

createStopOrder

  • Create a stop order
  • createStopOrder(account,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Stop Order Request

createMarketIfTouchedOrder

  • Create a market-if-touched order
  • createMarketIfTouchedOrder(account,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market If Touched Order Request

createTakeProfitOrder

  • Create a take profit order
  • createTakeProfitOrder(account,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Take Profit Order Request

createStopLossOrder

  • Create a stop loss order
  • createStopLossOrder(account,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Stop Loss Order Request

createGuaranteedStopLossOrder

  • Create a guaranteed stop loss order
  • createGuaranteedStopLossOrder(account,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Guaranteed Stop Loss Order Request

createTrailingStopLossOrder

  • Create a trailing stop loss order
  • createTrailingStopLossOrder(account,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Trailing Stop Loss Order Request

replaceWithMarketOrder

  • Cancel an order and replace with a market order
  • replaceWithMarketOrder(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request

replaceWithLimitOrder

  • Cancel an order and replace with a limit order
  • replaceWithLimitOrder(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request

replaceWithStopOrder

  • Cancel an order and replace with a stop order
  • replaceWithStopOrder(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request

replaceWithMarketIfTouchedOrder

  • Cancel an order and replace with a market-if-touched order
  • replaceWithMarketIfTouchedOrder(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request

replaceWithTakeProfitOrder

  • Cancel an order and replace with a take profit order
  • replaceWithTakeProfitOrder(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request

replaceWithStopLossOrder

  • Cancel an order and replace with a stop loss order
  • replaceWithStopLossOrder(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request

replaceWithGuaranteedStopLossOrder

  • Cancel an order and replace with a guaranteed stop loss order
  • replaceWithGuaranteedStopLossOrder(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request

replaceWithTrailingStopLossOrder

  • Cancel an order and replace with a trailing stop loss order
  • replaceWithTrailingStopLossOrder(account,orderSpecifier,callback,options)
  • Callback data: object {}
  • Do not set, modify, or delete client extensions if your account is associated with MT4
  • Oanda reference: Market Order Request