FiMi - Financial Instrument Management Interface

Table of Content

1. Introduction
2. Installation
2.1 Database
2.1.1 Prerequirements
2.1.2 How To
2.2 Daemon
2.2.1 Prerequirements
2.1.1 How To
2.1.1 Configure the Daemon
3. libfimi (qt4)
3.1 Prerequirements
3.2 How To
3.3 libfimi Programs
4. Binding FiMi to your Application
4.1 SQL
4.2 libfimi (qt4)
5. Developing a Provider
5.1 Deploying a Provider
5.2 Installing a Provider
5.3 FiMi XML DDL
6. Developing a FiMi Indicator

Introduction

FiMi Digest

Installation

Database

Prerequirements

You need Postgres >= 8.0, Perl >=5.8.0 installed and the Perlmodules: Getopt::Std installed.

How To

Readme

Daemon

Prerequirements

You need Perl >=5.8.0 installed and the Perlmodules: http://fimi.cvs.sourceforge.net/*checkout*/fimi/perlfimi/fimid/modules.lst

How To

Readme

Configure the Deamon

Before you configure the Deamon it is good to know the logic how the set up works.

In fimid.conf you define the database connection, debug level log files and so on. See the comments in this file. In providers/~your provider~.conf you configure the scheduled script, parameters, historic support and the time in cron style. Historic support means that this script can load data from past events. For exaplme historic yahoo end of day data supports history, but the intraday quotes from yahoo does not. You can not load the tick from yesterday 10:30 from the yahoo page. See some examples in provider/yahoo.conf. In the file provider/~your provider~/~the script~.xml you have define in a FiMi-DDL (Data Description Language), which parameters your provider script needs. Some examples are Fi Symbols or last quote date. See FiMi XML DDL section in "Developing a Provider" for detailed info on this.

libfimi (qt4)

Prerequirements

You need build-essentials, libqt4-sql and libqt4-dev.

How To

Readme

libfimi Programs

Readme

Binding FiMi to your Application

SQL

To use all FiMi Indicators, the easiest way at the moment is you access FiMi via SQL (lipq++, ODBC, DBI, JDBC, …). To get plot able Data you can read the indicator Table to view which indicators are possible and what the needed parameters are (eodbar is standard bar data date/time/open/high/low/close/volume/open interest). To know the return type of each function you can read indicator_retype table. The primary and foreign keys are always tablename_id. So I think you can fugure out how to get the fi_id and market_id to receive quote data.

libfimi (qt4)

Take a look at qt4stalker in the CVS. (Note that the lib supports not all FiMi indicators yet - commin soon).

Developing a Provider

What is a Provider in FiMi terms. A provider looks for Financial Data (static Data, quote Date, ...), formats the Data into FiMi XML DDL and prints to stdout. Usually a provider gets some parameters ex. A stock symbol and loads quote data from the internet. So there are two things you have to do with xml.

1.) Define which parameters your script needs and
2.) what it returns

A provider can be written in the language you like, it simple must be executeable. Usually for a new provider some static Data is needed. The provider itself (stype table), markets oder market symbols, fis, underlyngs and so on. For this is a init.pl script needed but this script must be in Perl.

Deploying a Provider

Providers have to be deployed as .tgz. Lets say we make a provider named yahoo. The archive conatins the following files:

yahoo.tgz:
yahoo
|
+--init.pl
|
+--init.pl.xml
|
\--provider
   |
   +--yahoo.conf
   |
   \--yahoo
      |
      +--script1.pl
      |
      +--script1.pl.xml
      |
      +--script2.pl
      |
      +--script2.pl.xml

The archiv must contain at least a init.pl and a init.pl.xml File. See CVS for the real yahoo provider
NOTE: For the moment you must provide a .xml file. In future there will be no need for the .xml if your script does not need any call parameters.

Installing a Provider

1.) Copy your provider.tgz to the folder fimid/providerstgz/
2.) ./initProvider.sh yourprovider

The initProvider needs the provider name as the parameter (do not use the .tgz suffix as parameter!). The script extracts the archive to /tmp/ copies the provider files to their destination (/fimid/providers/) and calls a execTask.pl Handler which invokes the init.pl script.

FiMi XML DDL

The XML DDL is some kind of relational to object mapping. First we need a root node - we call it - surprise - fimi. The second node must be row. This defines one transaction (commit) and the end of an object description.

Lets make an Example

<fimi>

Root node

<row>

Transaction node 1

<fi action="select"
fields="fi_id">

Object of trasaction 1 there are some possible Attributes:

- action: select, insert, delete (default is select)

- fields: default object_id


NOTE: after a insert the Object still returns the _id or the fields you specified from this new instance.

<caption preoperator="lower"
operator = "like"
postopertor="like">

NOKIA INC.

</caption>

Attribute of Object, there are these possible Attributes:

- preoperator (default: null)

- operaror (default: =)

- postoperator (default: null)


This will result in a query like this:

... Where preoperator() operator postoperator() ...


ex: ... Where lower(caption) like lower(caption) ...

<ftype_id>

The Object Attribute ftype_id can be defined by value (ex. 3) or by a referencing object like this

<ftype action="select">

<caption>Index</caption>

</ftype>

enquiry a ftype object with the caption Index. If the "subobject" is not existent yet you could use action="insert" to reference a new yet creating object. Note, that this transaction do not commit undtil </row> is reached.

</ftype_id>


</fi>


</row>

Commits transaction 1

<row>

Start transaction 2

<.../>


</row>


</fimi>



NOTE: If you need a new table for your provider (for some reason), you can use the XML DDL as normaly no changes needed. Simply create the table under the schema fimi and the parser will recognize your new table as a possible object tag.

Developing a FiMi Indicator

A FiMi indicator is something special beside these indicators you know from ta-lib and other financial tools. A FiMi indicator can simply return bar data or do some complex calculations. This indicators can combine Fi data or combine different quote data (eod with layer2 for example). It is not a tool where you should make things like moving averages or bolinger bands or what ever. As I said it is a tool where you can combine different data. There are some indicators available now:

The Componend Counter (ccsimple): This indicator counts all positive underlyings from an instrument like a Index. 75 means that 75% of the index stocks had a positive trade day. This indicator is a good example for what you should use FiMi indicators. It is a tool to combine data from different Fis into one indicator.

The Scrambler: This is a simulation tool. Every time you call this function you get random bars made from real bars. If your trading strategy for example is based on the MA200 you can test the maximum drawdown on a random market situation. Your trading system should pass this test to be a good system.

So how to develop a FiMi indicator?
There is only one way: Prostgres Procedural Language (maybe plpqsql, plperl, ...). Deploy your Indicators as .sql file. You can install these files from terminal with psql -d database -U user < yourfunction.sql

Note these Naming and Coding conventions:
- Your indicators name must start with the prefix "my_"
- Your Indicator must have one of the return types defined in pg_type under the schema fimi (there are: bar, line, histogram, ...).

HOME
Documentation
Forums
Download
CVS