V dnešním příspěvku se podíváme na to, jak se z výstupů výzkumné činnosti stává uživatelská aplikace.
Aplikace je plánována jako modulární, kde každý modul bude pokrývat nějaký obchodní přístup. Každý modul bude mít formalizovaný výstup definovaný danou obchodní strategií: backtest a detailní analýzu (s grafy a metrikami). Uživatel si tak může vytvořit vlastní strategii volbou vstupních parametrů.
Jedním ze zmíněných obchodních přístupů je Relative value, který je založen na sázkách na konvergenci v případě, že se zvětší nesoulad mezi podobnými nebo stejnými akciemi. To znamená vyhledání příležitosti využít odchylek v ceně nebo poměru stejných nebo podobných cenných papírů. Předpokládá se, že rozdíly jsou pouze krátkodobé a že poměr cen se brzy vrátí zpět na původní (normální) míru. Fondy s relativní hodnotou jsou vnímány jako zajištěné fondy, jelikož neobchodují pouze cenu určitého cenného papíru samostatně a strategie, která využívá cenových nesrovnalostí, je koupit jeden cenný papír (považovaný za podhodnocený) a prodat druhý (považovaný za nadhodnocený) ve formě párového obchodování.
Uživatel (správce fondu) vytvoří tento druh obchodní strategie v několika základních krocích:
- výběr vhodných párů
- identifikace situací vedoucích k obchodním příkazům
Přijetím této univerzální metodiky vznikne řada otázek a aplikace by měla umožnit správci fondu je vyřešit.
Není pochyb o tom, že fáze výběru vhodných párů je rozhodující. Potenciální správce fondu musí najít dva cenné papíry, které jsou dostatečně podobné. Ve fázi přípravy dat pro tuto analýzu je nutné zabývat se problémy jako:
- jaké historické období je třeba brát v úvahu pro výběr párů
- jaké ukazatele (technické, fundamentální atd.) a jakou roli budou hrát při detekci podobnosti, např. najít aktiva, která se historicky pohybovala společně
- určit, co považovat za obvyklé rozdíly (podobnost)
- jak naložit s páry, kde jsou jednotlivá aktiva příliš podobná (téměř stejná) u zvažovaných ukazatelů (pravděpodobně nebudou generovat žádnou příležitost pro arbitráž)
- která aktiva podle některých (fundamentálních, technických a dalších) faktorů vzít nebo vyloučit z úvahy
Dalším krokem v procesu výběru párů je provést vlastní analýzu připravených dat. Zde jsou otázkami hlavně:
- jaký přístup nebo algoritmus použít pro výpočet podobnosti – široce známé a používané jsou kointegrace, korelace, regrese apod.
- vyhodnotit robustnost/sílu páru (celkovou, v různých obdobích)
- stanovit přísnost podmínek pro identifikaci páru
- kolik nejméně párů je vhodné mít v portfoliu
- jak naložit s aktivy, která se účastní více párů
- jakou roli mohou hrát nadcházející fundamentální události (fúze, bankrot apod.) ve stabilitě identifikovaného páru
Po rozhodujícím kroku výběru párů následuje obchodní část strategie. Jde o určení obchodních signálů, tj. definici pravidel řešících problémy, jako jsou:
- jak moc se aktiva v páru mají lišit pro vstup do obchodních pozic
- existují další relevantní ukazatele vyvracející vhodnost vstupu do plánované pozice (plánován nákup a RSI indikuje přehřáté aktivum atd.).
- určit poměr aktiv v otevíraných pozicích
- jak velká odlišnost aktiv by už měla vést k výstupu z pozic
- jak dlouho maximálně čekat na to, až se rozdíl vrátí do normálního stavu nebo se pozice uzavře bez ohledu na obchodní výsledek (zamezení možným vyšším ztrátám)
Naďa Chalupová
In today’s post, we are returning to the Relative Value Approach topic, where we have put a methodology for analyzing stocks, in particular stock couples that show co-movement. We will use this co-movement to create a market-neutral trading strategy (in this case pair trading).
In the last post we introduced the part of the application that searches in the given stock titles and selects those whose logarithmic price differences are mutually correlated. However, this result is static, valid for the moment we run the application. The user will also be interested in the stability of these pairs (or their correlation) over time. Therefore, the application is extended by a walk forward test, which is testing the development of correlated pairs over time.
Methodology
A non-anchored test is performed within the walk forward test. The beginning and the end are scrolling, ie the test window is not extended. As in the previous case, batching is calculated by linear correlation of logarithmic price differences.
Computation
For each pair of in / out-sample correlation thresholds, a walk-forward test was performed:
- Each walk forward test is a set of partial tests for different walk-window lengths (walk-windows ranging from 2 years to 20 years with a 1 year step)·
- Each walk-window has a different length of in / out-sample (1 – 20 years, with 1 year step)·
- The start of in-sample section has been shifted from the beginning of the data by the length of the out-sample section (eg, the 5-year test starts from 1997 to 2013, ie the end of 2018)·
- The “survival” of the pairs in each walk-window was monitored, ie the number and / the proportion of those in-sample pairs that were also identified in the out-sample section·
- For example, 80% means that 10 pairs were found in the in-sample, in out-sample were found 8 of these pairs.
Results
The heatmap summarizes the walk-forward test results for a pair of correlation thresholds (in-samle and out-of-sample data). Each stripe of numbers parallel to the main diagonal in the figure represents the results of a set of tests for a certain walk-window length (the sum of the numbers on X and Y is the window length).
The individual boxes show the results for each combination of in-sample and out-sample window lengths. The horizontal axis (X) shows the in-sample window lengths, the vertical (Y) out-sample windows. E.g. the values for the 5-year window test are the points with coordinates (X, Y): (1, 4), (2, 3), (3, 2), (4, 1). Missing fields below the main (or secondary – see above) diagonal mean that no pair in walk-window in the in-sample was found in any of tests. The shorter the walk-windows, the more times they can move over the full length of the data, ie the more partial tests take place, and thus the resulting aggregate value (average, median, etc.) is more robust.
The more favorable (desirable) results are darker, unfavorable lighter, each metric has its “color” (average – blue, median – green, test properties – red, range – purple).
Mean
In the first image, in the area of narrowing “1” line near the main diagonal, the survival of couples are extremely negative (0 or crossed out) as well as positive (100%). The area copied the narrowing line of “1” in the number of tests performed (the first red chart), ie the tests performed only once (due to long out-sample / sliding windows). The “XOM-CVX” pair is almost always the result, so it’s the strongest pair across different seasons.


Median
The figure below shows similar results as in the previous case, only the “survival rate with the highest frequency” is calculated instead of “average survival rate”. In other words, the average is replaced by median.

Conclusion
The output of this application function is robustness testing, or better stability of pairs over time. Let’s take an example when a user of the application selects to date a list of couples which are suitable for pair trading.
Then the user thinks about the list and thinks about how the list would change if the export was done yesterday or a year ago … The answer is just a walk forward test that tracks and evaluates changes in the list of pairs over time. By using this feature, the user recognize that XOM-CVX (Exxon Mobil Corporation and Chevron Corporation) is one of the pairs with the strongest interrelationship between the analyzed assets.



