Building Applications using Trading System API is not complicated. You include the tsa.h when you write your code and then you link to the library file. The 'dll' file, if used, will also have to be in the system path. Taking a look at the properties of the tutorial project is a good start.

TS-API Directory Structure

This is a description of the various directories found in the TS_API master directory (as found in the install directory).

 

Directory

Content

doc/

Contains the documentation:

User Guide

Reference Manual

inc/

Contains the header files.

lib/

Contains the library files to be used for linking

src/

Contains a selection of source code files (.cpp) to facilitate debugging. You must direct the debugger to this directory when it asks you for source code location. Not all source code is available here unless explicitly licensed, but enough for comfortable debugging.

tutorial/

This directory contains the Tutorial project and source code.

Inluding the Header Files

You only need to include the inc/tsa.h ( #include "tsa.h" ) as this will include all relevant other headers. You will have to tell Visual Studio where to find this header file by setting the corresponding path in the 'Project Properties Dialog' --> 'C/C++' --> 'All Options' --> 'Additional Include Directories'  field.

Linking

It is recommended to to use the library with the same version of Visual Studio as was used to compile it. While the library may work fine with earlier or later version of the Microsoft C++ run time, Microsoft does make the occasional changes, such as an update to the C++ Standard Template Libraries, which can cause incompatibilities. Since Microsoft periodically releases free versions of Microsoft Visual Studio no attempt is made to provide libraries for every legacy version.

Depending on your built type, you must link to the corresponding .lib file:

 

Link Type:

File To Link To:

Static Debug

<install-dir>/TS_API/lib/<visual-studio-version>/debug/TS_API.lib

Static Release

<install-dir>/TS_API/lib/<visual-studio-version>/release/TS_API.lib

DLL Debug

<install-dir>/TS_API/lib/<visual-studio-version>/debug_dll/TS_API.lib

DLL Release

<install-dir>/TS_API/lib/<visual-studio-version>/release_dll/TS_API.lib

 

Building on Windows


Preprocessor Directive for DLL Builds:

When building an application using the TS-API dynamic link library, you must define TSA_USING_DLL. You can do this in 'Project Properties Dialog' --> 'C/C++' --> 'Preprocessor' --> 'Preprocessor Definitions' .

 

Project Settings


Most project settings are kept at their default. The only non default setting is the activation of floating point exceptions to avoid any any 'overflow', 'underflow' and 'infinite' conditions from remaining undetected.

Project Property:

File To Link To:

Runtime Library

Multithreaded DLL

Enable C++ Exceptions

Yes (/Ehsc)

Floating Point Model

Precise

Enable Floating Point Exceptions

Yes (/fp:except)

Exception Handling


TS-API classes and functions throw exceptions. This means that TS-API based code needs to run within a try/catch statement. Any exception caught by this statement requires any strategy simulation or deployment to be terminated. It is technically possible to handle certain user generated exceptions in the strategy::on_exception() member, but in general, this member function should only be used to inspect the exception object and prepare strategy termination, such as writing to logs and notifying users.

The following is a basic skeleton for an application using :

 

Tutorial Project


The tutorial project is self contained and should run out of the box. Just open the TS_API_TUTORIAL.vcxproj and push the build button. Sample data is located in the data/ subdirectory and program output can be found in the output/ directory.

Please refer to Chapter XXXXXXXXXXXXXX for more information on working with the tutorial projects.