Trading System API  3.0
Library for Simulating and Deploying Trading and Investment Strategies
Strategy

Group of classes for defining trading and investment strategies. More...

Namespaces

 tsa::fast
 namespace for native timeseries database.
 

Classes

class  tsa::in_stream
 Record stream class. Represents a standardised interface to all data sources. Instances rely on delegates to provide access to specific data sources. Delegates must derive from class in_stream_adaptor. More...
 
class  tsa::instrument
 Class instrument represents a tradeable security such as a stock, option, futures contract, currency, etc. Class instrument combines data-access with functionality for placing orders and managing positions. More...
 
class  tsa::manual_ohlcv
 Allows users to manually submit record data for the next bar. This is useful for testing new functionality. More...
 
class  tsa::mem_table
 Class mem_table represents a memory based table. mem_table objects can be used in strategies both for input and output. Note that memory requirements can grow rapidly. By default, the size of mem_table objects is limited to 2 million records. This limit can be reset via the size_limit(size_t) member. More...
 
class  tsa::metrics
 Strategy performance metrics. More...
 
struct  tsa::metrics::daily_record
 
class  tsa::order
 Class order is the library's internal order representation. Users are not intended to interact with this class directly and its member functions are not documented. Use class order_ref to interact with orders. More...
 
class  tsa::order_ref
 Represents a reference to an internally managed order object. Working with class order directly is not required as class order_ref exposes all necessary functionality for working with trading orders. Class order itself is undocumented. More...
 
class  tsa::out_stream
 Class out_stream is used to write strategy output to various targets such as files, charts and series_base tables. More...
 
class  tsa::random_walk_stream
 
struct  tsa::reject_info
 Structure containing informations about rejects. More...
 
class  tsa::strategy
 Class strategy represents a trading or investment strategy. More...
 
class  tsa::time_point_stream
 Parent class to classes generating a strategy scheduling sequences. (see strategy::schedule_with()) More...
 
class  tsa::time_point_stream__platform
 A platform time point stream. More...
 
class  tsa::time_point_stream_daily
 Class to dynamically generate daily intervals for strategy scheduling purposes. Instances should be declared as a strategy member and passed to strategy::schedule_with() as part of strategy::on_start(). More...
 
class  tsa::transaction
 Represents a transaction that occurred on an exchange or as part of a simulation when an order is filled or partially filled. More...
 

Macros

#define on_bar_close   on_next
 A macro that makes on_bar_close() a synonym for on_next().
 

Functions

 tsa::metrics::metrics (void)
 Constructor.
 
 tsa::metrics::metrics (const metrics &)
 Copy constructor. More...
 
 tsa::metrics::~metrics (void)
 Destructor.
 
std::vector< double > tsa::metrics::_daily_cash_flow_history (void) const
 
std::vector< double > tsa::metrics::_daily_equity_history () const
 
double tsa::metrics::average_daily_cash_flow (const std::vector< double > &daily_cash_flows) const
 
double tsa::metrics::average_trading_days_per_year (void) const
 
void tsa::metrics::calculate_equity_metrics (void)
 
virtual void tsa::metrics::daily_cash_flow (mem_table &mt) const
 Returns the daily cash flow as a mem_table. Intervals shorter than a day are aggregated into a daily cash flow value. Note such a daily value includes all intervals that 'started' on that date, but which can, for the last interval 'end' on the subsequent bar! More...
 
std::vector< daily_record > tsa::metrics::daily_cash_flow_history (void) const
 
std::vector< daily_record > tsa::metrics::daily_equity_history (void) const
 
template<typename T >
tsa::metrics::get (perf_metric_type metric_type, trade_grouping trade_aggr_type=all_trades) const
 
variant tsa::metrics::get_metric (perf_metric_type metric_type, trade_grouping group=all_trades) const
 Returns a value for a given metric-type and trade-aggregation-type. More...
 
date_time tsa::metrics::GetEndDateTime (void) const
 Returns the last strategy timestamp.
 
bool tsa::operator!= (const order_ref &lhs, const order_ref &rhs)
 comparison operator
 
std::ostream & tsa::operator<< (std::ostream &stream, const transaction &t)
 Writes human readable transaction information to stream. More...
 
bool tsa::operator== (const order_ref &lhs, const order_ref &rhs)
 comparison operator
 
void tsa::metrics::print_daily_cash_flow (std::ostream &, bool with_date=false) const
 

Detailed Description

Group of classes for defining trading and investment strategies.

Function Documentation

tsa::metrics::metrics ( const metrics _other)

Copy constructor.

Parameters
parameter1The first parameter.
void tsa::metrics::daily_cash_flow ( mem_table mt) const
virtual

Returns the daily cash flow as a mem_table. Intervals shorter than a day are aggregated into a daily cash flow value. Note such a daily value includes all intervals that 'started' on that date, but which can, for the last interval 'end' on the subsequent bar!

Parameters
[in,out]mtThe mt.
variant tsa::metrics::get_metric ( perf_metric_type  metric_type,
trade_grouping  group = all_trades 
) const

Returns a value for a given metric-type and trade-aggregation-type.

Parameters
metric_typeType of the metric.
trade_aggr_typeThe type of the trade aggregation.
Returns
The metric as a variant object.
std::ostream & tsa::operator<< ( std::ostream &  stream,
const transaction t 
)

Writes human readable transaction information to stream.

Parameters
[in,out]streamStream reference.
tThe transaction.
Returns
A stream reference.