Market Data Perspective

Here is the first post in English, as its target is perhaps a bit wider than for my usual gibberish.

The nine month now work for Symagon GmBH (subsidiary of Nagler & Company) has its fruit. Or even a few. The first and what took the most effort is a Flex GUI for investment strategy backtesting and market data review. This was done with Rafał Sytek from Symagon. Backend is kdb+, a vector-oriented, fast database which I know little about ;) and a little Java/Blaze DS middleware. The second is a 3D visualisation tool for order book series. The 3D tool is only a little ‘Flexish’. The main 3D component is a pure Actionscript thing, with layers, 3D-2D and back transformations, etc. And here is what I find cool enough to show off.

This type of visualisation is simpler and closer to the common chart.

This type of visualisation is simpler and closer to the common chart.

The plane beneath the chosen order book helps you compare bid and ask sides.

The plane beneath the chosen order book helps you compare bid and ask sides.

Clicking on a order book strip gets you to the details of single orders.

Clicking on a order book strip gets you to the details of single orders.

Almost a hundred of order books visualised as 3d slope

Almost a hundred of order books in a row

An order book is a snapshot of a market, with (almost) all buy and sell offers for a single financial instrument. I pictured a series of order books as a sloped river bank, with the transaction at water’s level. The ground above is a cumulated size of ask orders beginning from the transaction. The green part is going deeper as the bid orders cumulate. Time axis is horizontal, and Y-axis shows price levels. I believe this visualisation gives a lot more information in a simple manner. Now looking forward to the expert opinion… see what is coming.

Backtesting GUI

This was a good lesson. Series renderers, chart extensions, live scrolling, zooming, syncing between the charts show the real flex guts. Sometimes I felt like writing it from the scratch myself… It was not anything about Flex itself, rather my understanding the complexity of its components. As it turned out, it was usually better to study a bit more the originals rather than implementing one’s own solutions. Some of the comps developed at the beginning look completely naive and weird now. The motto of future Flex chart works is:

ChartElement class is essential to almost all you.

And the big application for testing investment strategies looks like this:

Adobe AIR/Flex frontend of an application for testing investment strategies

Adobe AIR/Flex frontend of an application for testing investment strategies

set selectedItem w ComboBox Flexa

Kiedy z bazy danych pobieramy hm, dane, a któraś z kolumn przybiera wartości z pewnego niewielkiego zbioru (jak np. dla typu ENUM w MySQL), to w formularzu edycji rekordu chcielibyśmy zwykle użyć komponentu ComboBox do edycji tej kolumny. Problem polega na tym, że ComboBox nie ma prostej metody do ustawiania zadanej wartości. Można owszem ustawić selectedItem, ale tylko przekazując jeden z obiektów z dataProvidera Combo. Nie taki sam obiekt, ale ten sam. Tyle że wygodniej jest przekazać wartość, np. pobraną ze wspomnianej bazy. No i niech etykieta (label) Combo ustawi się sama. Oto rozszerzenie ComboBoksa, które robi co trzeba:

<?xml version="1.0" encoding="utf-8"?>
<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml">
    <!--
    komponent SmartComboBox z automatycznym ustawianiem selectedIndex
    na podaną wartość
    licencja: do swobodnego wykorzystania
    -->
    <mx:Script>
        <![CDATA[
            protected var _myDP:Object;
            [Bindable]
            public function set value(v:*):void
            {
                var found:Boolean = false;
                for(var i:int = 0; (i < dataProvider.length) && !found; i++) {
                    if(v == _myDP[i].data) {
                        selectedIndex = i;
                        found = true;
                    }
                }
                if(!found) throw(new Error("invalid value " + v + " for SmartComboBox.",99));
            }
            [Bindable]
            override public function set dataProvider(v:Object):void
            {
                _myDP = v;
                super.dataProvider = v;
            }
        ]]>
    </mx:Script>
</mx:ComboBox>

AMFPHP i błąd 403 – Forbidden

Długo szukałem rozwiązania problemu, jaki pojawił się po przeniesieniu aplikacji AMFPHP z Windows na Linuksa. Skrypt gateway.php wywoływany z ‘palca’, czyli z URLa http://serwer/gateway.php odpowiadał prawidłowo. Browser już gorzej – nie wyświetlał prawego panelu z listą metod, a FireBug poproszony o przedstawienie odpowiedzi serwera napisał o błędzie 403 – Forbidden. Ciekawe, że w Google nie znalazłem nic konkretnego, na jednym tylko forum wskazówkę, że chodzi o prawa dostępu. To akurat było łatwe do wydedukowania. Śledztwo wykazało winnego – w skrypcie /core/shared/util/MethodTable.php, w linii 164 wywoływana jest funkcja touch($sourcePath) , gdzie $sourcePath wskazuje na nazwę uruchamianej usługi. Wystarczy ustawić Apaczowi prawo do zapisu pliku usługi (np. /services/Usluga.php) i od razu jest lepiej.

Piszą o AMFPHP na flashzone.pl.

« Previous PageNext Page »