oandapyV20.definitions.trades

Trades definitions.

class oandapyV20.definitions.trades.TradePL

Bases: object

Definition representation of TradePL

Definitions used in requests and responses. This class provides the ID and the description of the definitions.

>>> import oandapyV20.definitions.trades as deftrades
>>> print deftrades.TradePL.POSITIVE
POSITIVE
>>> c = deftrades.TradePL()
>>> print c[c.POSITIVE]
An open Trade currently has a positive (profitable) unrealized P/L, or a closed Trade realized a positive amount of P/L.
>>> # or
>>> print deftrades.TradePL().definitions[c.POSITIVE]
>>> # all keys
>>> print deftrades.TradePL().definitions.keys()
>>> ...
NEGATIVE = 'NEGATIVE'
POSITIVE = 'POSITIVE'
ZERO = 'ZERO'
__getitem__(definitionID)

return description for definitionID.

definitions

readonly property holding definition dict.

class oandapyV20.definitions.trades.TradeState

Bases: object

Definition representation of TradeState

Definitions used in requests and responses. This class provides the ID and the description of the definitions.

>>> import oandapyV20.definitions.trades as deftrades
>>> print deftrades.TradeState.CLOSE_WHEN_TRADABLE
CLOSE_WHEN_TRADABLE
>>> c = deftrades.TradeState()
>>> print c[c.CLOSE_WHEN_TRADABLE]
The Trade will be closed as soon as the trade’s instrument becomes tradeable
>>> # or
>>> print deftrades.TradeState().definitions[c.CLOSE_WHEN_TRADABLE]
>>> # all keys
>>> print deftrades.TradeState().definitions.keys()
>>> ...
CLOSED = 'CLOSED'
CLOSE_WHEN_TRADABLE = 'CLOSE_WHEN_TRADABLE'
OPEN = 'OPEN'
__getitem__(definitionID)

return description for definitionID.

definitions

readonly property holding definition dict.

class oandapyV20.definitions.trades.TradeStateFilter

Bases: object

Definition representation of TradeStateFilter

Definitions used in requests and responses. This class provides the ID and the description of the definitions.

>>> import oandapyV20.definitions.trades as deftrades
>>> print deftrades.TradeStateFilter.CLOSE_WHEN_TRADEABLE
CLOSE_WHEN_TRADEABLE
>>> c = deftrades.TradeStateFilter()
>>> print c[c.CLOSE_WHEN_TRADEABLE]
The Trades that will be closed as soon as the trades' instrument becomes tradeable
>>> # or
>>> print deftrades.TradeStateFilter().definitions[c.CLOSE_WHEN_TRADEABLE]
>>> # all keys
>>> print deftrades.TradeStateFilter().definitions.keys()
>>> ...
ALL = 'ALL'
CLOSED = 'CLOSED'
CLOSE_WHEN_TRADEABLE = 'CLOSE_WHEN_TRADEABLE'
OPEN = 'OPEN'
__getitem__(definitionID)

return description for definitionID.

definitions

readonly property holding definition dict.