cassiopagnoncelli / clarity

R framework for quickly and professionally R&D trading strategies.
MIT License
4 stars 3 forks source link
arbitrage derivative equities instrument position-sizing simulation trade trading-strategies

Clarity is a framework for quickly and professionally R&D new strategies for equities and derivatives.

It is built on top of the powerful R programming language, providing bindings to C, C++ as well as the most popular databases.

Beyond R's standard functionalities (basic statistics, time series, statistical mechanics, chaos, etc), Clarity proposal offers a handful of possibilities to leverage algotraders from portfolio theory to arbitrage to high frequency trading.

ETL equities and derivatives

Indicators and instruments are available for pre-loading and pre-calculation. Simulations can involve multiple instruments, either equities or derivatives, as well as multiple indicators, either pre-calculated or calculated on-the-fly.

Extract-Transform-Load

Event profiler

Track position evolution throughout the trades and diagnose what are their behaviour.

Event profiler

Reporting and journaling

Equity growth

Returns distribution

Win vs Loss distribution

All backend events are tracked in journaling. Journaling is a simplex channel to the frontend serving as a communication tool informing different notification levels, from warnings to errors.

Journaling

Further applications include abnormality detection and error correction & recovery.

Position sizing

Position sizing is an important part in scaling the trading strategy and there are optimal ways to calculate the right amount for each strategy. Widely known position sizing methods are Kelly criteria and Optimal/Fractional/Secure F.

Positions and position sizing

Position management

Act according to the position evolution using the basic or more elaborate techniques to cap risks.

Links to other technologies

Further links will include S-plus, Mathematica, and Q (Kdb).

Arbitrage spot

Comes with an extended triangular arbitrage module to spot latent arbitrage opportunities.

Arbitrage spot

Impact aggregator

Facing either same or opposite directions, an one-axis view over events at different impact levels plays in important role on strategy's success.

Pulse continuous impact aggregator

Vector- and Iteration-based simulation at same environment

Alike MetaTrader, the well known tool for retail traders, Clarity bundles the standard iteration loop begin()-start()-end(), specially useful in HFT, and the traditional vector-based simulation, as in Matlab, in one single environment enabling both approaches to be used simultaneously.

begin-tick-end loop

Parameter optimisation can be performed using genetic algorithms, simulated annealing, and a few others depending on parameters restrictions.

Installation

Run

./setup

and follow the given instructions.