com.oanda.fxtrade.api
Interface Transaction

All Superinterfaces:
java.lang.Cloneable

public interface Transaction
extends java.lang.Cloneable

The Transaction object contains all information related to transactions occurring on OANDA's servers.

A transaction can be fully described by the a combination of its type and its completion code. For example, a type of CloseTradeB is specifically a Stop Loss if the completion code is 102 where is it is a Take profit of the completion code is 103. The following table is a complete list of transactions.

#DescriptionTransaction TypeCompletion Code
1Fund DepositAddFunds109
2API FeeAPIFee109
3API License FeeAPILic109
4Buy OrderBuyEntry100
5Buy MarketBuyMarket100
6Buy Market FilledBuyMarket105
7Change MarginChangeMargin100
8Change OrderChangeOrder100
9Change TradeChangeTrade100
10Order CancelledCloseOrder100
11Order ExpiredCloseOrder101
12Order FilledCloseOrder105
13Order Cancelled (NSF)CloseOrder108
14Order Cancelled (BV)CloseOrder118
15Order Cancelled (BV:SL)CloseOrder714
16Order Cancelled (BV:TP)CloseOrder715
17Close PositionClosePositionB100
18Close PositionClosePositionS100
19Close TradeCloseTradeB100
20Stop LossCloseTradeB102
21Take ProfitCloseTradeB103
22Margin CallCloseTradeB104
23Close TradeCloseTradeS100
24Stop LossCloseTradeS102
25Take ProfitCloseTradeS103
26Margin CallCloseTradeS104
27Fund CreditCrFunds109
28Fund WithdrawalDelFunds109
29Wire FeeFee109
30InterestInterest107
31P&L ResetResetPL100
32Sell OrderSellEntry100
33Sell MarketSellMarket100
34Sell Market FilledSellMarket105
35Buy BoxBuyBox400
36Sell BoxSellBox400
37Box PayoutBoxPayout402
38Box CloseBoxClose403
39RevBoxPayoutRevBoxPayout404
40Box CancelBoxCancel406
41Balance CorrectionCSCorrection-110
42Interest CorrectionCSCorrection-111
43P/L CorrectionCSCorrection-113
44Trade CancelCSCorrection-117
45Trade CorrectionBuyMarket114
46Trade CorrectionSellMarket114
47Buy Market (Cancelled)BuyMarket-100
48Sell Market (Cancelled)SellMarket-100
49Close Trade (Cancelled)CloseTradeB-100
50Change Trade (Cancelled)ChangeTrade-100
51Close Position (Cancelled)ClosePositionB-100
52Close Position (Cancelled)ClosePositionS-100
53Close Trade (Cancelled)CloseTradeS-100
54Stop Loss (Cancelled)CloseTradeB-102
55Stop Loss (Cancelled)CloseTradeS-102
56Take Profit (Cancelled)CloseTradeS-103
57Take Profit (Cancelled)CloseTradeB-103
58Buy Market Filled (Cancelled)BuyMarket-105
59Sell Market Filled (Cancelled)SellMarket-105
63Buy Market (NT)BuyMarket119
64Sell Market (NT)SellMarket119

NT means new trade.
BV means bounds violation.


Field Summary
static int FX_CSBALACECORRECTION
           
static int FX_CSCLOSEWITHOUTPENALTY
           
static int FX_CSINTERESTCORRECTION
           
static int FX_CSINTERESTTODAYCORRECTION
           
static int FX_CSPLCORRECTION
           
static int FX_CSTRADECANCEL
           
static int FX_CSTRADECORRECTION
           
static int FX_DELFUNDS
           
static int FX_DURATION
           
static int FX_INTDEFERRED
           
static int FX_INTEREST
           
static int FX_MARGIN
           
static int FX_NSF
           
static int FX_ORDERCANCELBOUNDSVIOLATION
           
static int FX_ROLLOVER
           
static int FX_SL
           
static int FX_TP
           
static int FX_USER
           
static int FX_XFR_ORDER
           
 
Method Summary
 java.lang.Object clone()
          Returns a exact copy of this Transaction.
 boolean equals(java.lang.Object other)
           
 double getAmount()
          Returns the transaction amount in terms of home currency
 double getBalance()
          Returns the account balance at the time of the transaction
 int getCompletionCode()
          Returns the completion code.
 long getDiaspora()
           
 double getInterest()
          Returns the interest paid or earned.
 double getMargin()
          Returns the margin used by this transaction.
 long getOrderLink()
          Returns the transaction number of the limit order that resulted in this transaction (i.e the MarketOrder).
 FXPair getPair()
          Returns the currency pair
 double getPL()
          Returns the P&L of the transaction.
 double getPrice()
          Returns the execution price for this transaction
 double getStopLoss()
          Returns the stop loss value associated with this transaction.
 double getTakeProfit()
          Returns the take profit value associated with this transaction.
 long getTimestamp()
          Return the unix timestamp for when this transaction occured
 double getTrailingStopLoss()
          Returns the trailing stop value in PIPs
 long getTransactionLink()
          Returns the transaction number of the transaction that is related to this transaction.
 long getTransactionNumber()
          Returns the transaction number.
 java.lang.String getType()
          Returns the transaction type.
 long getUnits()
          Returns the number of units.
 boolean isBuy()
          Tests if this transaction is a buy
 boolean isSell()
          Tests if this transaction is a sell
 java.lang.String toString()
           
 

Field Detail

FX_USER

static final int FX_USER
See Also:
Constant Field Values

FX_DURATION

static final int FX_DURATION
See Also:
Constant Field Values

FX_SL

static final int FX_SL
See Also:
Constant Field Values

FX_TP

static final int FX_TP
See Also:
Constant Field Values

FX_MARGIN

static final int FX_MARGIN
See Also:
Constant Field Values

FX_XFR_ORDER

static final int FX_XFR_ORDER
See Also:
Constant Field Values

FX_ROLLOVER

static final int FX_ROLLOVER
See Also:
Constant Field Values

FX_INTEREST

static final int FX_INTEREST
See Also:
Constant Field Values

FX_NSF

static final int FX_NSF
See Also:
Constant Field Values

FX_DELFUNDS

static final int FX_DELFUNDS
See Also:
Constant Field Values

FX_CSBALACECORRECTION

static final int FX_CSBALACECORRECTION
See Also:
Constant Field Values

FX_CSINTERESTCORRECTION

static final int FX_CSINTERESTCORRECTION
See Also:
Constant Field Values

FX_CSINTERESTTODAYCORRECTION

static final int FX_CSINTERESTTODAYCORRECTION
See Also:
Constant Field Values

FX_CSPLCORRECTION

static final int FX_CSPLCORRECTION
See Also:
Constant Field Values

FX_CSTRADECORRECTION

static final int FX_CSTRADECORRECTION
See Also:
Constant Field Values

FX_CSCLOSEWITHOUTPENALTY

static final int FX_CSCLOSEWITHOUTPENALTY
See Also:
Constant Field Values

FX_INTDEFERRED

static final int FX_INTDEFERRED
See Also:
Constant Field Values

FX_CSTRADECANCEL

static final int FX_CSTRADECANCEL
See Also:
Constant Field Values

FX_ORDERCANCELBOUNDSVIOLATION

static final int FX_ORDERCANCELBOUNDSVIOLATION
See Also:
Constant Field Values
Method Detail

clone

java.lang.Object clone()
Returns a exact copy of this Transaction.


equals

boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

getAmount

double getAmount()
Returns the transaction amount in terms of home currency

Returns:
the transaction amount in terms of home currency

getBalance

double getBalance()
Returns the account balance at the time of the transaction

Returns:
the account balance at the time of the transaction

getCompletionCode

int getCompletionCode()
Returns the completion code.

Returns:
the completion code.

getDiaspora

long getDiaspora()

getInterest

double getInterest()
Returns the interest paid or earned.

Returns:
the the interest paid or earned.

getMargin

double getMargin()
Returns the margin used by this transaction.

Returns:
the margin used by this transaction.

getPair

FXPair getPair()
Returns the currency pair

Returns:
the currency pair
See Also:
FXPair

getPrice

double getPrice()
Returns the execution price for this transaction

Returns:
the execution price for this transaction

getStopLoss

double getStopLoss()
Returns the stop loss value associated with this transaction.

Returns:
the stop loss value associated with this transaction.

getTakeProfit

double getTakeProfit()
Returns the take profit value associated with this transaction.

Returns:
the take profit value associated with this transaction.

getTimestamp

long getTimestamp()
Return the unix timestamp for when this transaction occured

Returns:
the unix timestamp for when this transaction occured

getTransactionLink

long getTransactionLink()
Returns the transaction number of the transaction that is related to this transaction. For example, if this Transaction described a Close Trade transaction, calling getTransactionLink() would return the transaction number of the MarketOrder Transaction that was closed.

Returns:
the transaction link

getTransactionNumber

long getTransactionNumber()
Returns the transaction number.

Returns:
the transaction number

getType

java.lang.String getType()
Returns the transaction type. The type is represented by a short String such as "BuyMarket", "CloseTradeB", etc.

The following is a list of the transaction types:

AddFunds
APIFee
APILic
BoxCancel
BoxClose
BoxPayout
BuyBox
BuyEntry
BuyMarket
ChangeMargin
ChangeOrder
ChangeTrade
CloseOrder
ClosePositionB
ClosePositionS
CloseTradeB
CloseTradeS
CrFunds
CSCorrection
DelFunds
Fee
Interest
ResetPL
RevBoxPayout
SellBox
SellEntry
SellMarket

Returns:
the transaction type
See Also:
Transaction, getCompletionCode()

getUnits

long getUnits()
Returns the number of units.

Returns:
the number of units

isBuy

boolean isBuy()
Tests if this transaction is a buy

Returns:
true if the transaction is a buy, false otherwise

isSell

boolean isSell()
Tests if this transaction is a sell

Returns:
true if the transaction is a sell, false otherwise

getTrailingStopLoss

double getTrailingStopLoss()
Returns the trailing stop value in PIPs

Returns:
the trailing stop loss value

toString

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

getPL

double getPL()
Returns the P&L of the transaction.

Returns:
the P&L of the transaction

getOrderLink

long getOrderLink()
Returns the transaction number of the limit order that resulted in this transaction (i.e the MarketOrder).

Returns:


Copyright © 2005 OANDA Corporation. All Rights Reserved.