Dynami UI, Project startup

Dynami-UI 6

During last two months Dynami project has grown in silence. I worked mainly under the wood, with new features, minor improvements and a lot of bug fixing. With this pace within few months the first Alpha version will be released.

In summary:

  • Strategy settings can be saved and resumed;
  • PriceChart pane now has BarStick chart, which gives more information on prices than line chart;
  • Positions, Traces and Orders Panes have been improved and rearranged;
  • Financial exposition is measured on margins on open positions;
  • Different volatility estimators have been implemented (ref. measuring_historic_volatility):
    • Close To Close
    • Parkinson
    • Garman-Klass
    • Garman-Klass-Yang-Zhang
    • Rogers-Satchell
    • Yang-Zhang
  • PayoffChart now shows alternatively single legs or cumulative payoff;

DynamiDraft-2016-01-29-1

What are still missing or have to be improved for the Alpha Release:

  • Preferences Pane;
  • Bug Report;
  • Console Pane, to show additional information on internal errors;
  • Errors Pane, has to be strongly improved;
  • DataHandlers:
    • TextFileDataHandler, has still a lot hard coded settings;
    • DataBaseHandler to read data stored in databases;
    • OnlineDataHandler to get data from on-line sources such as Yahoo, Google, etc;

If you have some suggestions or do you want actively contribute to Dynami Project leave a comment.

Dynami Project is an open source project and is provided without warranties in accordance of www.apache.org/licenses/LICENSE-2.0.

Dynami Core, Dynami Runtime, Dynami UI, Project startup

Dynami-Runtime 3

In order to test strategies in options and futures, because I don’t have tons of historical data, I need to simulate prices for all of these instruments. Trying to make them as likely as possible. In this post I’m referring only to European Vanilla Options .

Option is a quite complex financial instrument, because its value is not linear as the stock value is. It is, basically, an insurance contract versus the underlying price movement. As well as, a car insurance premium depends on multiple factors: time, type of car, place where one lives, car-crash history of the driver, also the option price depends on multiple factors*:

  • Underlying spot price
  • Option strike
  • Time to maturity
  • Risk-free interest rate
  • Implied volatility

(*)Black-Scholes model

For simplicity I consider:

  • risk-free interest rate as a constant,
  • implied volatility is equals to the annualized historical volatility of the underlying price.

In real option trading a fundamental role is also played by bid ask spread. In fact the theoretical value is often far from option prices, especially for the OTMs and the ones far in time, while the ITMs have a ceiling in their intrinsic value.

To face this issue I use underlying bid-ask prices to calculate the value of the option’s bid-ask prices. As far as we go far from front-month ATM, the underlying bid-ask spread is multiplied for the distance in strikes and in expiring dates. In this way options’ bid-ask spread become wider and wider moving far from ATM. For example, front-month two strikes OTM is priced using the following underlying spot price:

UnderlyingPrice +/- (BidAskSpread*(1+2)/2

While ATM_Strike+2 @ Front-Month+1 is priced using the following formula:

UnderlyingPrice +/- (BidAskSpread*(1+2+1))/2

2 times more for strike distance and 1 time more for time distance.

Historical volatility is calculated using days left to expiration. With a limit of 10 days for front-month expiration. But volatility skew is currently taken into account.

The following figure, just to show a little progress in Dynami-UI with Payoff chart pane.

DynamiDraft-2015-12-07-1

Glossary:

  • Bid Ask Spread is the difference in price between the highest price that a buyer is willing to pay for an asset and the lowest price for which a seller is willing to sell it.
  • Intrinsic value: The intrinsic value (or “monetary value”) of an option is its value assuming it were exercised immediately.
  • ATM : An option is at the money (ATM) if the strike price is the same as the current spot price of the underlying security.
  • OTM : An out of the money (OTM) option has no intrinsic value.
  • ITM : An in the money (ITM) option has positive intrinsic value as well as time value.

You can find detailed explanation about option moneyness here.

Project startup

Dynami-UI 5

During last two weeks I have been involved in DataHandlerConfig pane re-factoring needed to handle different kinds of configuration parameters, its look and feel can be strongly improved, but now it runs properly. VolatilityChart pane has been completed and Dynami-Runtime can be extended with any kind of historical volatility evaluator. Currently only “Close to close” is available.

Dynami-Runtime project classpath dependencies are now managed by Maven. Dependencies will be progressively moved to Maven, to make them independent from IDE.

But in these days most of the work as has been done under the wood in the TextFileDataHandler class to handle and price option chains for multiple expiration dates.

DynamiDraft-2015-11-22-1

DynamiDraft-2015-11-22-2

Next steps are:

  • Payoff Chart pane
  • Strategy Config pane
  • Improvements in Configuration parameters panes

Dynami project is still far to be completed, but work is going on. If you want to contribute, also with some suggestions, don’t hesitate to leave a comment. Thanks.

Dynami Core, Dynami Runtime, Dynami UI, Project startup

Dynami-UI 4

During last weekend I worked on different fronts in back-end and front-end features. In particular, I deeply revised OptionsChain, Asset.Option classes and added Greeks.Engine and Greeks.ImpliedVolatility interfaces for supporting options greeks calculation, keeping core architecture independent from methods implementation.

Accordingly I have also modified Dynami-Runtime with default implementation for Greeks.Engine, Greeks.ImpliedVolatility. Both based on Black Scholes formula for European Options.

In Dynami-UI:

  • Completed OpenPositions Pane,
  • Completed Traces Pane,
  • Summary Pane is still in progress,
  • while DataHandlerConfig Pane will require more time than expected, because I need to extends some features of an used open-source library.

DynamiDraft-2015-11-07-1

DynamiDraft-2015-11-07-2

Next steps are:

  • VolatilityChart Pane;
  • PayoffChart Pane;
  • Adapt DataHandler for providing simulated option prices;

Disclaimer: BSEurOptionsUtils.java EuropeanBlackScholes.java contain third part code, I got it time ago and sincerely I don’t remember where, so I can’t give the right attribution to the authors. I’m sorry for this.

Dynami UI, Project startup

Dynami-UI 3

The work on Dynami-UI is going on, during this weekend I made some progress:

  • Closed Positions Pane has been completed;
  • Summary Pane is still in progress, but somehow usable;
  • DataHandlerConfig Pane is in progress;
  • Dynami-UI project has been shared on GitHub

Also Dynami-Core and Dynami-Runtime have been updated, new features and some adjustment were necessary to better fit Dynami-UI functionalities and new ones will come. The overall project is a “work in progress”, so if you cloned source code from GitHub remember to check for updates regularly for every project.

Dynami-UI Preferences are still hard coded, one for all: “strategies lib directory”. If you want to run Dynami remember to clone also Dynami-Sample-Strategy project and export it as a jar in its ./resources directory to make your changes effective.

Furthermore, in Dynami-UI ./resources directory is stored a txt file with FTSE MIB index one-minute data, used for simulation.

DynamiDraft-2015-10-31(1)

“Clock frequency” parameter sets the interval, expressed in milliseconds, between one price bar and another and gives the execution speed. If to zero (as shown below) the simulation runs at maximum speed, while UI panes are updated every second (this parameter will be configurable in Preferences).

DynamiDraft-2015-10-31(2)

Next tasks:

  • Completing pending tasks
  • StrategyConfig Pane
  • Open Positions Pane
  • Traces Pane
Dynami UI, Project startup

Dynami-UI 2

Just some updates on project activities. After prototyping stage, I started implementing user interface. As technology I’m using JavaFX for its modular architecture and the clear separation among ¬†models, views and controls. Each panel has its own controller and it can be easily moved without affecting its behaviour.

At the moment, with respect of prototype, I made two little changes:

  • Summary panel has been moved in the bottom right corner.
  • Filled empty space, aside equity line chart, with an undefined chart, suggestions are well accepted.

DynamiDraft-2015-10-24

I’ve just connected UI with Dynami-Runtime and executed Sample-Dynami-Strategy. To achieve alpha release still miss a lot of work, but let’s going on with little steps.

Next features are:

  • Summary panel
  • Closed positions panel
  • DataHandler config panel
Dynami UI, Project startup

Dynami-UI

UI/UX design is one of the most exciting part of software development. I’m not an expert in this field and my approach is based uniquely on my experience and on my feelings. So, if you have some suggestions, please don’t hesitate.

I’ve drawn a mockup, using an open source tool called Pencil – although it seems not actively supported, it is a very good tool, that I strongly recommend.

01.Main window is divided into different sections:

  • menu bar, classic menu, with File [Open, Save, Save as | Preferences | Close] functions, Edit (undefined…), Help (undefined);
  • tool bar, with quick access function to load, configure and execute strategy;
  • quick access for views, such as orders, traces, closed positions, etc;
  • centre pane, with some charts such as Price, Payoff, Equity line, Volatility, etc;
  • portfolio pane, with active positions;
  • strategy summary on the right pane;
  • status bar, for user notifications and error messages.

01.mainwindow

02.Strategy configuration pane to customize strategy parameters for each stage. Designing UI, I realized we need to define some mandatory strategy settings, one for all the main asset symbol. Why? Because if we want to plot asset prices we need to point a particular one.

02.StrategyConfig

03.DataHandler Conguration pane allows to set data handler configuration. Dynami is designed in a modular way, so we can use different data handlers (local data, yahoo data, real-time data, etc) and each handler could have own settings. The goal is keep strategy and data settings separated, to easily switch between test and real-time mode without affecting in any way strategy implementation.

03.datahandlerconfig

04.Orders pane shows orders requests with status.

04.orders

05.Traces pane shows user’s traces with informations directly from strategy.

05.traces

06.Closed positions pane shows closed position with their returns.

06.closed

Stay tuned and fork dynamis’ projects on https://github.com/Dynami

Dynami is an open source project and all source code will be released under http://www.apache.org/licenses/LICENSE-2.0

Glossary:

  • UI – User Interface
  • UX – User eXperience