com.oanda.fxtrade.api
Interface Account


public interface Account

An Account object represents an existing Oanda account. Accounts cannot be created through this API. Accounts are identified by a unique integer id (accountId). Current open trades, orders and transactions are maintained and kept up-to-date within the object.

See Also:
User

Method Summary
 void close(LimitOrder lo)
          Closes the specified LimitOrder.
 void close(MarketOrder mo)
          Closes the specified MarketOrder.
 void close(java.lang.String position)
           
 void closeAllLimitOrders()
          Closes all limit orders.
 void closeAllMarketOrders()
          Closes all market orders.
 void execute(LimitOrder lo)
          Executes the specified LimitOrder.
 void execute(MarketOrder mo)
          Executes the specified MarketOrder.
 int getAccountId()
          Returns the unique id number associated with this account.
 java.lang.String getAccountName()
          Returns the account name.
 double getBalance()
          Returns the most up-to-date account balance, querying the server if neccessary.
 long getCreateDate()
          Returns the creation date for this account expressed as a unix timestamp.
 int getEnteredMarginCallTime()
          Returns the time margin call was entered.
 FXEventManager getEventManager()
          Gets the eventManager for this Account
 java.lang.String getHomeCurrency()
          Returns the home currency for this account.
 double getMarginAvailable()
          Returns the most up-to-date margin available value, querying the server if neccessary.
 double getMarginCallRate()
          Returns the margin call rate.
 double getMarginRate()
          Returns the margin rate.
 double getMarginUsed()
          Returns the most up-to-date margin used value, querying the server if neccessary.
 java.util.Vector<? extends LimitOrder> getOrders()
          Returns the Vector of LimitOrders held by this account, querying the server if neccessary.
 LimitOrder getOrderWithId(long transactionNumber)
          Returns the LimitOrder with the given transaction number.
 Position getPosition(FXPair pair)
          Get the currently open market position for a given pair
 java.util.Vector<? extends Position> getPositions()
          Get all the currently open market positions
 double getPositionValue()
          Returns the most up-to-date values of all trades held by this account based in home currency, querying the server if neccessary.
 java.lang.String getProfile()
          Returns the profile string for this account
 double getRealizedPL()
          Returns the most up-to-date realized profit/loss value, querying the server if neccessary.
 java.util.Vector<? extends MarketOrder> getTrades()
          Returns the Vector of MarketOrders currently held by this account, querying the server if neccessary.
 MarketOrder getTradeWithId(long transactionNumber)
          Returns the MarketOrder with the given transaction number.
 TrailingStop getTrailingStop(MarketOrder trade)
          Returns the trailing stop for the given trade.
 java.util.Vector<? extends Transaction> getTransactions()
          Returns a Vector of Transactions that have recently occured on this account, querying the server if neccessary.
 Transaction getTransactionWithId(long transactionNumber)
          Returns the Transaction with the given transaction number.
 double getUnrealizedPL()
          Returns the most up-to-date unrealized profit/loss value, querying the server if neccessary.
 void modify(LimitOrder lo)
          Modifies the specified LimitOrder.
 void modify(MarketOrder mo)
          Modifies the specified MarketOrder.
 void setProfile(java.lang.String newprofile)
          Sends a profile string to be saved on the server and associated with this account.
 java.lang.String toString()
           
 

Method Detail

close

void close(LimitOrder lo)
           throws OAException
Closes the specified LimitOrder.

Parameters:
lo - the limit order to be closed
Throws:
OAException
See Also:
LimitOrder

close

void close(MarketOrder mo)
           throws OAException
Closes the specified MarketOrder.

Parameters:
mo - the MarketOrder to be closed
Throws:
OAException
See Also:
MarketOrder

close

void close(java.lang.String position)
           throws OAException
Throws:
OAException

closeAllMarketOrders

void closeAllMarketOrders()
                          throws OAException
Closes all market orders.

Throws:
OAException

closeAllLimitOrders

void closeAllLimitOrders()
                         throws OAException
Closes all limit orders.

Throws:
OAException

execute

void execute(LimitOrder lo)
             throws OAException
Executes the specified LimitOrder.

Parameters:
lo - the limit order to be opened
Throws:
OAException
See Also:
LimitOrder

execute

void execute(MarketOrder mo)
             throws OAException
Executes the specified MarketOrder. Executing a MarketOrder can result in trades being aggregated, modified or deleted.

Parameters:
mo - the market order to be executed
Throws:
OAException
See Also:
MarketOrder

getAccountId

int getAccountId()
Returns the unique id number associated with this account.

Returns:
the unique id number associated with this account.

getPositions

java.util.Vector<? extends Position> getPositions()
                                                  throws AccountException
Get all the currently open market positions

Returns:
A vector of Position objects
Throws:
AccountException

getPosition

Position getPosition(FXPair pair)
                     throws AccountException
Get the currently open market position for a given pair

Parameters:
pair - The pair to get the position of
Returns:
The currently open position for that pair, or null if no position is open
Throws:
AccountException

getAccountName

java.lang.String getAccountName()
Returns the account name.

Returns:
the account name.

getBalance

double getBalance()
                  throws AccountException
Returns the most up-to-date account balance, querying the server if neccessary.

Returns:
the account balance
Throws:
AccountException

getCreateDate

long getCreateDate()
Returns the creation date for this account expressed as a unix timestamp.

Returns:
the account creation date

getHomeCurrency

java.lang.String getHomeCurrency()
Returns the home currency for this account.

Returns:
the home currency for this account.

getMarginAvailable

double getMarginAvailable()
                          throws AccountException
Returns the most up-to-date margin available value, querying the server if neccessary.

Returns:
margin available
Throws:
AccountException

getMarginCallRate

double getMarginCallRate()
Returns the margin call rate.

Returns:
the margin call rate.

getMarginRate

double getMarginRate()
Returns the margin rate.

Returns:
the margin rate as 1/accountLeverage

getMarginUsed

double getMarginUsed()
                     throws AccountException
Returns the most up-to-date margin used value, querying the server if neccessary.

Returns:
margin used
Throws:
AccountException

getOrders

java.util.Vector<? extends LimitOrder> getOrders()
                                                 throws AccountException
Returns the Vector of LimitOrders held by this account, querying the server if neccessary.

Returns:
a Vector of LimitOrders
Throws:
AccountException
See Also:
LimitOrder

getOrderWithId

LimitOrder getOrderWithId(long transactionNumber)
                          throws AccountException
Returns the LimitOrder with the given transaction number.

Parameters:
transactionNumber - the transaction number for the order
Returns:
the LimitOrder, or null if the order is not found, or does not belong to this account
Throws:
AccountException
See Also:
LimitOrder

getPositionValue

double getPositionValue()
                        throws AccountException
Returns the most up-to-date values of all trades held by this account based in home currency, querying the server if neccessary.

Returns:
total position value, in home currency
Throws:
AccountException

getProfile

java.lang.String getProfile()
Returns the profile string for this account

Returns:
the profile string for this account

getRealizedPL

double getRealizedPL()
                     throws AccountException
Returns the most up-to-date realized profit/loss value, querying the server if neccessary.

Returns:
profit/loss
Throws:
AccountException

getTrades

java.util.Vector<? extends MarketOrder> getTrades()
                                                  throws AccountException
Returns the Vector of MarketOrders currently held by this account, querying the server if neccessary.

Returns:
a Vector of MarketOrders
Throws:
AccountException
See Also:
MarketOrder

getTradeWithId

MarketOrder getTradeWithId(long transactionNumber)
                           throws AccountException
Returns the MarketOrder with the given transaction number.

Parameters:
transactionNumber - the transaction number for the order
Returns:
the MarketOrder, or null if the order is not found, or does not belong to this account
Throws:
AccountException
See Also:
MarketOrder

getTransactions

java.util.Vector<? extends Transaction> getTransactions()
                                                        throws AccountException
Returns a Vector of Transactions that have recently occured on this account, querying the server if neccessary.

Returns:
a Vector of Transactions
Throws:
AccountException
See Also:
Transaction

getTransactionWithId

Transaction getTransactionWithId(long transactionNumber)
                                 throws AccountException
Returns the Transaction with the given transaction number.

Parameters:
transactionNumber - the transaction number for the transaction
Returns:
the Transaction, or null if the transaction is not found, or does not belong to this account
Throws:
AccountException
See Also:
Transaction

getUnrealizedPL

double getUnrealizedPL()
                       throws AccountException
Returns the most up-to-date unrealized profit/loss value, querying the server if neccessary.

Returns:
unrealized profit/loss
Throws:
AccountException

modify

void modify(LimitOrder lo)
            throws OAException
Modifies the specified LimitOrder. All values may be modified (except currency pair).

Parameters:
lo - the LimitOrder to be modified
Throws:
OAException
See Also:
LimitOrder

modify

void modify(MarketOrder mo)
            throws OAException
Modifies the specified MarketOrder. Note that only the stoploss and takeprofit values can be changed.

Parameters:
mo - the MarketOrder to be modified
Throws:
OAException
See Also:
MarketOrder

getEventManager

FXEventManager getEventManager()
                               throws AccountException
Gets the eventManager for this Account

Returns:
the eventManager for this Account
Throws:
AccountException

setProfile

void setProfile(java.lang.String newprofile)
                throws AccountException
Sends a profile string to be saved on the server and associated with this account.

NOTE: The profile string is used by the fxTrade Platform GUI for saving Account preference information. Do not modify the profile string if you intent to continue using the fxTrade GUI.

Parameters:
newprofile - the new profile string to be saved on the server
Throws:
AccountException

toString

java.lang.String toString()
Overrides:
toString in class java.lang.Object

getTrailingStop

TrailingStop getTrailingStop(MarketOrder trade)
Returns the trailing stop for the given trade. If the trade does not have a trailing stop, a null value is returned.

Parameters:
trade - the trade with a trailing stop
Returns:
the trailing stop for the given trade

getEnteredMarginCallTime

int getEnteredMarginCallTime()
Returns the time margin call was entered. Will be 0 if the margin call was never entered or has been reset.

Returns:
the time margin call was entered


Copyright © 2005 OANDA Corporation. All Rights Reserved.