GAOYUANYUAN / VlPetrov

Risk management Tools based on Intrinsic Time and Scaling Laws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Risk Management Tools based on Scaling Laws and Directional-Change Intrinsic Time

This public GitHub repository has been prepared as part of the European research initiative BigDataFinance 2015–2019, an H2020 Marie Sklodowska-Curie Innovative Training Network “Training for Big Data in Financial Research and Risk Management”. The name of the corresponding project is "RP12: High-Frequency Trading Risk Management Tools Based on Scaling Laws".

The repository contains a set of risk management and data analysis tools build using the theory of scaling laws in finance extensively outlined in work "Patterns in high-frequency FX data: discovery of 12 empirical scaling laws" (available online) and the directional-change intrinsic time approach first time proposed in "A geographical model for the daily and weekly seasonal volatility in the foreign exchange market" (available online). Each folder contains classes and sets of methods written using the class-based and object-oriented computer-programming language Java. All files have self-explanatory names and are equipped by a detailed description of the main functionality as well as the references to the literature where these methods have first been described and validated.

All included tools have been tested using extensive sets of high-frequency data from the Forex and others high-frequency markets. Results of the tests are described in multiple research papers which are either submitted to peer-review journals or are at the final stage on the work and will be added to the description as soon as they reach any public resource. Among the submitted papers: "Instantaneous Volatility Seasonality of Bitcoin in Directional-Change Intrinsic Time" (at SSRN) and "Agent-Based Model in Directional-Change Intrinsic Time" (at SSRN).

The root directory contains several methods which can be directly employed for high-frequency real-time data analysis:

  • LiquidityIndicator_Analysis.java - computes liquidity of historical time series represented by tick-by-tick price data using the multiscale interpretation of liquidity based on the directional change and scaling laws. It is a wrapper for the "LiquidityIndicator" class from the "ievent" folder. To run the program one needs to specify the path to the analysed file and set up several parameters described at the header of the code.
  • InstantaneousVolatilityActivity_Analisys.java - this class is the extension of the "ievents/VolatilitySeasonality" class modifies to be applicable to the set of historical or real-time high-frequency price data.
  • VolatilityEstimatorMovingWindow_Analysis.java - this class is designed to perform the volatility analysis of high-frequency data computed in two ways: using the sum of squared return function which calculates the aggregated standard deviation of the time series over fixed and equal intervals and using the method based on the directional-change intrinsic time approach in detail described in the RealizedVolatility.java class.

The ievents folder contains classes and methods related to the directional-change intrinsic time concept proposed and described in work "A geographical model for the daily and weekly seasonal volatility in the foreign exchange market" (available online):

  • DcOS.java - Directional-Change dissection algorithm splits a historical price time series into a collection of directional-change and overshoot points defined as the sequence of alternating trend changes of selected size.
  • IE.java - is an auxiliary class to keep information on the properties of each observed intrinsic event such as time and price levels.
  • IntrinsicNetwork.java - is an example of the Intrinsic Network introduced in the "Multi-scale Representation of High Frequency Market Liquidity" paper (available online).
  • LiquidityIndicator.java - is a realization of the liquidity indicator proposed in the research work "Multi-scale Representation of High Frequency Market Liquidity" (available online).
  • InstantaneousVolatility.java - is the method used to translate the number of observed directional-change intrinsic events into the value of the instantaneous volatility. The approach is outlined in the research paper "Instantaneous Volatility Seasonality of Bitcoin in Directional-Change Intrinsic Time" (available online).
  • MovingWindowVolatilityEstimator.java - is the instantaneous volatility estimator based on the number of Directional Changes observed over given period of time (set as a parameter of the method) and described in the paper "Instantaneous Volatility Seasonality of Bitcoin in Directional-Change Intrinsic Time" (available online).
  • RealizedVolatility.java - is the class where the realized volatility is computed using the number of observed directional-change intrinsic events combined with the variability of overshoots proceeding each directional change. The main idea of the approach is in details described in the paper "Bridging the gap between physical and intrinsic time" (work in progress).
  • RealizedVolatilitySeasonality.java - based on the RealizedVolatility.java method this class provides a novel way of computing weekly seasonality of the realized volatility considering the evolution of the price curve from the point of view of directional-change intrinsic events.
  • InatantaneousVolatilitySeasonality.java - based on the InstantaneousVolatility.java method this class provides a novel way of computing weekly seasonality of the instantaneous volatility considering the evolution of the price curve from the point of view of directional-change intrinsic events.
  • DcOSmultiD.java - is the extension of the originally one-dimensional version of the directional-change intrinsic time algorithm (class DcOS.java) to the multidimensional space. The space is formed by orthogonally placed independent exchange rates. The description of the multidimensional approach is provided in the paper "Multidimensional Directional-Change Intrinsic Time" (work in progress).

Folder scalinglaws contains tools which allow extracting scaling laws based on the directional-change intrinsic time as described in the paper "Patterns in high-frequency FX data: Discovery of 12 empirical scaling laws" (available online). Numbers of scaling laws follow the same order selected in the paper. The code has been validated using high-frequency data from Forex and Bitcoin markets (work in progress):

Folder market contains a set of auxiliary tools nucessarily to perform the real application of risk management tools presented in the repository:

  • Price.java - is a simple class for elementary prices corresponding to some given moment of time. These are tick prices by default. Each class instance holds information on the bid and ask price levels as well as the time of when the new tick was registered.
  • SpreadInfo.java - this method, applied to a historical (or real-time streamed) time series, returns Median, Mean, Min and Max spread characteristics characterised some given period of time.
  • PriceMultiD.java - is the class to keep information on the multidimensional structure of prices used for the multidimensional version of the directional-change intrinsic time algorithm. Collections of bid and ask prices composing each instance of the class are formed by individual components of exchange rates used in an experiment.

Folder tools is a collection of some traditional data management tools employed to analyse historical and real-time streams of high-frequency data:

  • BM.java - is the class used to generate time series of given lengths properties of which coincide with properties of simple Brownian Motion process.
  • GBM.java - is the class used to generate time series of given lengths following Geometrical Brownian Motion process.
  • TraditionalVolatility.java - this class is traditional volatility estimator. Computes volatility of a given time series using the sum of squared returns.
  • MovingWindowVolatilityEstimator.java - is the classical volatility estimator which performs over a moving window the length of which is defined as a parameter of the code. The algorithm is based on the sum of squared returns computed over equal time intervals.
  • Tools.java - is a class containing a subset of simple methods used over the whole research work on the scaling laws and intrinsic time risk-management tools. The class is crucial for the stable work of almost all related experiments.
  • ThetaTime.java - is the class the idea of which is to perform as theta-time presented in work of "A geographical model for the daily and weekly seasonal volatility in the foreign exchange market" (available online).

The project leading to this collection of tools has received funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No 675044

About

Risk management Tools based on Intrinsic Time and Scaling Laws


Languages

Language:Java 100.0%