Frequently Asked Questions

If you have a question not answered here, please send a mail to: TimeSeriesAPI@gmail.com



Q: Can I use the library to model non-financial data?

Yes, any type of time series model (industrial, scientific, medical, etc.) can be built using Time Series API. The library has many built in features to simulate financial trading strategies, but these feature can be ignored if they don't contribute in a given problem domain.

Q: Can I not simply build models using a spreadsheet application?

The advantage of Time Series API (TSA) over spreadsheet applications is that multiple data sources are automatically synchronized, and there is no need to deal with rows and columns when working on the model. Variables are reference by name directly rather than by 'column/row' index, and 'rows' are not even needed as models are evaluated one interval (row/bar) at a time, an approach which uses computer ressources more efficiently than do spreadsheets, which is why evaluating models over decades worth of data (even down to millisecond intervals) is not a problem. TSA is also a stand-alone simulation engine, which means that once a model has been defined, it can simply be 'plugged into' any C/C++ based system.

Q: Which platforms are supported by Time Series API?

Currently only MS-Windows, for both Win32 and Win64. A working version for Linux does exist but has not been released yet. The goal is to support all major UNIX and UNIX-like platforms (Solaris, AIX, HP UX etc.), including Apple's OSX. However, no release dates are available yet for any of these!

Q: Which compilers are supported?

Time Series API was written in standard C++, and so should work with any modern C++ compilers that supports Real Time Type Information (RTTI) and exception handling. The library code nonetheless makes use of almost all advanced feature of the C++ language, and deficiencies in some compiler systems may be highlighted. The library itself was developed using GNU's GCC and Microsoft's Visual C++ and the library works well with both compiler systems.

Q: Is source code available?

The library is not 'open source', although portions of it may one day become 'open source'. Commercial users who prefer to have a copy of the source code can purchase a source code release. Please contact tech support for source code licensing details.

Q: What are 'Formulas'?

Formulas are equations that usually assign an expression to a data object. Formula code is used to translate ideas into models. (For more see Modelling with Formulas)

Q: Can TSA library connect directly to external databases?

There is no support for formula code to read data from external database classes. Formula code does however communicate seamlessly with native database files which are managed by dedicated database classes. Importing and exporting data to and from commercial RDBMS's should be quick to set up, either via CSV files or a C/C++ API.

If the external database has a C/C++ API, it is also possible to implement a new component to read directly from an external database table, much like the IRecord() function reads from the native database.

Q: What are the 'native' database classes for?

The native database classes are used to read and write time series data to and from 'paged' files. These classes were optimized for speed and ease of use, and do not feature redo-logs, transactions, or two phase commits.

Q: How can Time Series API library be extended?

The library can be extended in two ways. First, new functions can be implemented directly as formula code (see implementing formula functions)

Second, new functionality can be implemented as a new component (see implementing new components)

Q: Are variable length intervals (e.g. Tick Bars, Volume Bars) supported?

Yes, 'volume bars' and 'tick bars' are supported. A strategy can be scheduled with any type of interval, as read from a given data table (also called the TIME_MASTER). These intervals can be fixed length intervals (e.g. 1-min, 5-min, daily etc) or variable length intervals (e.g. 100-tick, 500 volume etc).

Q: Are there limits to the complexity of the Models that can be implemented using Time Series API?

No, there are no limits to complexity as anything that can be expressed as C++ can be used as part of a Time Series API project. There are however limits to what can be expressed as formula code. To circumvent such limits, users have the option of implementing new components directly in low level C++. (See deriving from class Component)

Q: What are Sequences?

Sequences are self-referential vectors, where the relationship between subsequent values in a vector is defined by a formula expression. This is the mechanism by which formula code can retain 'state' between strategy intervals. Since such sequences are self-referential they need to have one or more 'seeds' for bootstrapping purposes. 

      DoubleVector seq(0.0);    //1  'var' is set to type T_DOUBLE
     
seq = seq[1] + 0.5;       //2  'var' is increment by 0.5 at each strategy interval

Operator=, as used in the code snippet above is only declared by vector types, and can only be invoked once on a given object, and only if the vector object was constructed with a 'seed'.

After a few iterations, the vector, as declared and defined above will contain the following sequence:

       0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, . . .  

Q: Are NIL values supported?

Yes, Time Series API supports NIL via a NIL flag found in data objects. In formula code, the IsNIL() flag can be used to determine if a data object has its NIL flag set, as in the following code snippet:

     Double revenue  = data("revenue");        //

     Double expenses = data("expenses");       //

     Double earnings = data("earnings");       // possibly NIL

     Double earnings_fixed

          = If( IsNIL(earnings), revenue - expenses, earnings);  //fixed

 The native database classes also support storage of NIL's. 

Q: Can a strategy read from multiple time series?

Yes. There are no restrictions on the number of time series that can be opened simultaneously by a single model. This makes it possible to calculate custom stock indices, intermarket spreads, or any other derived values. Data series are read from database tables using the IRecord() function. Consider the following code:

     Tuple ibm  = IRecord(db, "IBM.OHLCV.Daily");

     Tuple msft = IRecord(db, "MSFT.OHLCV.Daily");  

     Bool buySignal = MySmartSpreadAnalysis(ibm, msft);

     MarketOrder(LONG, 1000, buySignal);


This above code reads records from two different tables, one containing data for MSFT and the other for IBM.


Q: Does a simulation strain computer resources?

No! Only portions of a model's data are held in memory at any one time. Computer resource requirements are modest, even when running simulations on decades of 'tick by tick' data. Models are evaluated one bar at a time, and only the data currently required by the model is held in memory. 



     Copyright (c) 2008 PERITECH. All Rights Reserved.