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:
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.
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:
//array of closing prices
//array of closing prices
size_t numberOfIntervalsInYear )
= close / close;
Double stDevLnChg =
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!
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.
As a general purpose tool for modelling time series, Time Series API has applications in many domains, such as:
- Trading and investment strategy simulation and
- Individual market and inter-market models
- Iterative evaluations on baskets
- Evaluation on aggregates (e.g. custom indices)
- Fundamental company data models
- Economic modelling
- Time series normalization and processing:
- Normalizing neural training data
- Data transformations
- Timeframe conversions
- Data monitoring (e.g. financial, scientific):
- Event Notification
- Pattern recognition
- Filtering applications, (e.g. noise reduction)
- Computational modelling
- Genetic algorithms
- Brute force optimizations
- Monte carlo simulations
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:
- Formula Semantics
- Full Feature List
- Trading and Investment Strategies
- Frequently Asked Questions (FAQ)
- Time Series API - Documentation
Copyright (c) 2008 PERITECH. All Rights Reserved.