Time Series API is a professional C++ class library for simulating (backtesting) and deploying financial trading strategies as well as general purpose time series modelling. The library is a stand-alone time series engine that can be extended via a component object model.

Models are defined using formula syntax and semantics made possible by a set of lightweight interface classes that supersede the component framework. The library supports the modelling of even the most complex ideas, is easily extended, and supports deployment in any timeframe (variable or fixed, with intervals as short as one millisecond). The library also benefits from a set of highly optimized database classes for reading and writing millions of records in seconds.

The following is an example of a concise but complete 'end of day' trading strategy:

 

Database db(...);

 

Strategy s("demo");

 

   Tuple rec = IRecord(db,"ibm.nyse.ohlcv.daily" ,

                                PRICE_MASTER | TIME_MASTER);  

 

   Double high  = rec("high");

   Double low   = rec("low");

   Double close = rec("close");

 

   Double ave120 = Ave( close, 120);                        

   Double ave3   = Ave( (high + low) / 2, 3);

 

   Bool buySignal  = CrossesAbove(ave3, ave120);    

   Bool exitSignal = CrossesBelow(ave3, ave120);  

 

   StopOrder( LONG, 100, buySignal, close + 0.1, NEXT_BAR ); 

   MarketOrder( EXIT_LONG, exitSignal, THIS_CLOSE );

 

s.Log( db, TRADES | ORDERS | TRANSACTIONS | BARS | DRAWDOWNS); 

 

s.Evaluate( D(1998, JAN, 1), D(2005, DEC, 31) );

 

 

see the reports produced by strategies.           Bookmark and Share

See the product's full feature list.

All memory management, synchronisation and scheduling related to model evaluation are performed by the framework itself. This frees users to focus on what matters most - model logic!

Although models are defined in C++, the API's framework extends language semantics into the time series domain. Due to the lightweight nature of the API's data classes, it is possible to directly implement new time series functions using formulas! Consider the following implementation of a function calculating 'annualized volatility' for a given period:

Double AnnualizedVolatility

           (  const DoubleVector& close, //array of closing prices

              size_t period,            

              size_t numberOfIntervalsInYear  )

{

    Double chg        = close / close[1];       

    Double lnChg      = LN(chg);                 

    Double stDevLnChg = StDev(lnChg, period);  

    return stDevLnChg / SqRt(1.0 / (Double)numberOfIntervalsInYear);

}

This function can now be used just like any other native API function!

Implementing this type of functionality using conventional methods would have been error prone and difficult to debug at best. Using formula syntax, the resulting code is concise and intuitive! As an additional bonus to using formula syntax, 'run time' errors are largely eliminiated, and are limited to 'division by zero' and 'floating point' errors! Click the following link to learn more about formula syntax.

The library also supports NIL values, a feature often required when working with fundamental company data, where gaps in data series are quite common!

Custom Components

Performance intensive logic can be implemented as low level C++ in the form of custom components. (See deriving from class Component). Custom components can also be used to 'wrap' legacy code, or access third party databases.

Applications:

As a general purpose tool for modelling time series, Time Series API has applications in many domains, such as:

Time Series API Library is not a tool for the static analysis of time series data involving regression analysis, curve fitting, fourrier transformations etc. The library was designed to evaluate models iteratively, one interval at a time, and to generate signals, trading orders, identify patterns and raise alerts. 

Time Series API is a stand-alone product, which means that it does not rely on any external platform, database, data-feed, component model or library to operate. Data can be exchanged freely between library objects and any other system, database or file.

This is important as trading strategies too complex to be evaluated in a linear fashion can be broken into manageable steps, allowing for various methods of pre-processing and normalization with interim data storage between steps. This is especially useful for strategies where trades overlap and an iterative approach is necessary, potentially analyzing each trade in isolation before aggregating results.

The library was written in standard C++ and releases will be made available for the major operating systems.

To learn more about the Time Series API's technology see: 

       Bookmark and Share


     Copyright (c) 2008 PERITECH. All Rights Reserved.