Trading System API  3.0
Library for Simulating and Deploying Trading and Investment Strategies
tsa::transaction Class Reference

Represents a transaction that occurred on an exchange or as part of a simulation when an order is filled or partially filled. More...

#include <TSATransaction.h>

Inheritance diagram for tsa::transaction:
tsa::object

Public Member Functions

 transaction (void)
 Constructor.
 
virtual ~transaction (void)
 Destructor.
 
void clear (void)
 Returns the object to an 'undefined' state where defined() returns false.
 
bool defined (void) const
 Returns true if the object has been initialized. More...
 
bool fills (const order_ref &order_ref) const
 Returns true if the transaction fills, in its entirety, a given order. Note: This member function returns false, but does not throw an exception, if the order object is not defined (see order::defined())! More...
 
identifier_t id (void) const
 Returns the transaction ID. More...
 
identifier_t instrument_id (void) const
 Returns the ID of the instrument that originated the transaction. More...
 
instrumentinstrument_ptr (void) const
 Returns a pointer to the instrument that originated the transaction. More...
 
bool is_equal (const transaction &other) const
 Returns true if self is identical to other. More...
 
order::action order_action (void) const
 Returns the originating order's action type (buy or sell). More...
 
order::exec_interval order_execution_interval (void) const
 Returns the originating order's 'execution interval'. More...
 
identifier_t order_id (void) const
 Returns the originating order's ID. More...
 
const std::stringorder_tag (void) const
 Returns the originating order's 'tag' which is a user defined string intended to describe an order. More...
 
order::type order_type (void) const
 Returns the originating order's type. More...
 
bool partially_fills (const order_ref &order) const
 Returns true if the transaction partially fills order. Note: This member function returns false if the order object is not defined but does not throw an exception. More...
 
double price (void) const
 Returns the price at which the transaction occurred. More...
 
void print (std::ostream &stream) const
 Prints transaction properties to the given stream. More...
 
quantity_t quantity (void) const
 Returns the quantity of securities that changed ownership during the transaction. More...
 
bool relates (const order_ref &order_ref) const
 Returns true if the transaction fills, either partially or in its entirety, a given order. Note: This member function returns false, but does not throw an exception, if the order object is not defined (see order::defined())! More...
 
quantity_t size (void) const
 Returns the quantity of securities that changed ownership during the transaction. Returns the same value as quantity(). More...
 
const date_timetimestamp () const
 Returns the transaction timestamp. More...
 
- Public Member Functions inherited from tsa::object
 object (void)
 Constructor.
 
virtual ~object (void)
 Destructor.
 
const char * class_name (void) const
 Returns the class name as returned by the 'Real Time Type Information' (RTTI) mechanism. More...
 
bool has_same_class_as (const object &other) const
 Returns true if self has the same type as other object. More...
 

Detailed Description

Represents a transaction that occurred on an exchange or as part of a simulation when an order is filled or partially filled.

Member Function Documentation

bool tsa::transaction::defined ( void  ) const

Returns true if the object has been initialized.

Returns
bool.
bool tsa::transaction::fills ( const order_ref order_ref) const

Returns true if the transaction fills, in its entirety, a given order. Note: This member function returns false, but does not throw an exception, if the order object is not defined (see order::defined())!

Parameters
order_refAn order_ref object.
Returns
bool.
identifier_t tsa::transaction::id ( void  ) const

Returns the transaction ID.

Returns
An identifier_t.
identifier_t tsa::transaction::instrument_id ( void  ) const

Returns the ID of the instrument that originated the transaction.

Returns
An identifier_t.
instrument * tsa::transaction::instrument_ptr ( void  ) const

Returns a pointer to the instrument that originated the transaction.

Returns
instrument pointer.
bool tsa::transaction::is_equal ( const transaction other) const

Returns true if self is identical to other.

Parameters
otherThe other transaction.
Returns
bool.
order::action tsa::transaction::order_action ( void  ) const

Returns the originating order's action type (buy or sell).

Returns
An order::action.
order::exec_interval tsa::transaction::order_execution_interval ( void  ) const

Returns the originating order's 'execution interval'.

Returns
An order::exec_interval.
identifier_t tsa::transaction::order_id ( void  ) const

Returns the originating order's ID.

Returns
An identifier_t.
const std::string & tsa::transaction::order_tag ( void  ) const

Returns the originating order's 'tag' which is a user defined string intended to describe an order.

Returns
A std::string&.
order::type tsa::transaction::order_type ( void  ) const

Returns the originating order's type.

Returns
An order::type.
bool tsa::transaction::partially_fills ( const order_ref order) const

Returns true if the transaction partially fills order. Note: This member function returns false if the order object is not defined but does not throw an exception.

Parameters
order_refAn order_ref instance.
Returns
bool.
double tsa::transaction::price ( void  ) const

Returns the price at which the transaction occurred.

Returns
A double.
void tsa::transaction::print ( std::ostream &  stream) const

Prints transaction properties to the given stream.

Parameters
[in,out]streamThe stream.
quantity_t tsa::transaction::quantity ( void  ) const

Returns the quantity of securities that changed ownership during the transaction.

Returns
A quantity_t.
bool tsa::transaction::relates ( const order_ref order_ref) const

Returns true if the transaction fills, either partially or in its entirety, a given order. Note: This member function returns false, but does not throw an exception, if the order object is not defined (see order::defined())!

Parameters
order_refAn order_ref instance.
Returns
bool.
quantity_t tsa::transaction::size ( void  ) const

Returns the quantity of securities that changed ownership during the transaction. Returns the same value as quantity().

Returns
A quantity_t.
const date_time & tsa::transaction::timestamp ( void  ) const

Returns the transaction timestamp.

Returns
A date_time&.