Monday, December 12, 2016

Project O5X

As regulators are giving higher and higher fines to prevent money laundering and market manipulations with benchmark values and fixing points, the need to establish a well defined analytical framework to prevent such malpractice is crucial. The problem is not as much the available technology, but data access and real time visualization of such practice done by an independent supervisory body that also has authority in stopping transactions and charging individuals that designed such algorithms or human involvement. The malpractice shall be stopped when it happened and the authority shall not have to wait to discover methods and obtain data with days and weeks of delay.

As fines were given for old periods (with years of delay) the case is either the inability of the regulators in understanding the malpractice done in real time or inadequate know how of the loopholes of the regulative framework that allows the players to conduct such scrutiny to their investors. If some practice has been done for years, it is a necessity that the post festum data starts to be analyzed in more debth to establish profits and methods of market manipulations.

For such reason, I propose once more a mobile device, that will capture market data in real time and visualize where and how the orders are coming to the trading platform. Being aware that the detailed, insight into the trading activity is mainly hidden from the analytical side, to increase transparency, it shall be necessary to capture and analyze trading patterns of the registered traders and to have a deeper look into their activity with the analysis of profit generated margins (who and how much is going in and what was the decision being set from the investor and the trader).

As this is the fxcycle blog, I am almost certain that there exists such a thing as the trading cycle and the cyclical pattern like behavior of individuals traders in the fx market. I hope I am wrong, but first, I will have to prove that. :)

Wednesday, June 1, 2016

Project extension

Past weeks have been intense in realizing how many tools are already available to devlop clever solutions in providing financial transparency to the analysts. Visualization capabilities of centralized market data can give an insight of every outragious order going into the game and flag the transaction as suspicious linking it to the source. So my question at the moment is: If we take into account all instruments that rely on a "fix" system placing real time visualization tool on incoming orders, it would fastly provide a clue wether or not market manipulation is taking place and spotting exactly the order sources. So, if manipulation was taking place on such important and prifine instruments as exchange rates, it is doubtful that other instruments relying on the fix system would not be a subject of such scrutiny. Would such monitoring bug be efficient in spotting machine manipulations as well?

Wednesday, December 2, 2015

Implied volatility cont. (my processor hates you!)

Question of the day: What to do when implied volatility from Yahoo! Finance is 0.00% or is repetitive for a too long period of time????

I decided that I will go the hard way in obtaining its value. I could use any build in functions that uses the BS formula and solve it , but I thought to myself, why using the black-box if I can program it myself. So, I made use of the Newton-Raphson Methond. It took some time to realize how to apply it to my specific data, but once I was done with implementation a monster came out that is killing my poor processor. And the worst it will be that at the end of the process, there will be something wrong with calculations and the process will have to be repeated. Noooo.... it has been going for 20 minutes already, and I am just goofing off in the meanwhile since the rest of the things work extremely slow.

Doing some calculations, if such a thing has to be repeated over and over again for about 300 * 15 times.. how long it would take to compute a simple Implied volatility for values that are 0??? So please, dear Yahoo! Finance, be so kind and evaluate the IV for me otherwise I will melt my processor to do this project! If somebody would like to give me some help, here is what I have been strugguling with in python:

http://stackoverflow.com/questions/33988048/inneficient-loop-accesing-option-types

Saturday, November 28, 2015

Implied volatility vs delta

The clasification of options between out-of-the-money, in-the-money, and at-the-money will be a determining factor in properly applying the extraction methodology and obtain meaningful results for different options monsters. After some python experimentation, the dataset is ready to be analyzed and available for calculations. My question today revolves around the the mening of the obtained graf in delta vs. volatility space.

The shape from the graph makes sense, since delta values for calls and puts are positive and negative. Volatility is positive since is the percent change and is provided by the courtesy of Yahoo! finance. On this note, I will spend some time in finding out two things:

1. How does yahoo! finance calculate implied volatility? (probably BS!)

2. What Risk free rate do they use for calculations?

Literature and internet review showed that many people that deal with the BS formula omit the discussion about the risk free rate and its estimation or use. Given that IV is provided, one can extract the risk free rate from it. Once I compounded the BS formula with D-parameters, I came to find out that this will not be a simple task to do. The r parameter is found both in the original equation and in the proces of calculating the normal distribution. Have fun whomever will decide to figure this out!!! :)

Lastly.... from one paper where deltas and implied volatilities are plotted, only positive deltas are used for both calls and puts that are out-of-the-money. Were deltas put in absolute values to extract the estimation function?

Saturday, November 21, 2015

Python can keep you entertained all day!

It was about time. As the route in implementing probability density functions to option data is somewhat leghty, being as stubborn as I am, I continued with solving problems regarding data acquisition and preparation for further calculations and analysis.

Data from yahoo! finance is an excellent medium to observe options prices and doing simple quests and calculations for the unindexed parameters. The best part, that such data became freely available to the public (I do not know exactly where it comes from, but for studying and testing purposes is excellent). However, making use of the Black Scholes formula with the downloaded data is a total nightmare to obtain (yes, I can save you some time with my going around the bush script if you want to come up to speed with this development).

After a nice day with reading about python, I finally made a put-call graph that normally you do not see in any classes. I will polish it and make it more readable in the future.

Sunday, November 8, 2015

Life made simple

Learning new computer tools is always a challange and a new adventure to get your mind wrapped around a problem. With some useful links and online hints the desired algorithm may well one day come to life.

Automation of programming tasks using free data sources with simple calculations techiques and file exporting is made simple with python and no wonder why it is becoming a predominant laguage in the finance field. Just as an example, data from yahoo finance is downloaded with one simple command:

df = web.DataReader("SPY", 'yahoo', start, end)

as data is a time series of basic end of the day fields (High, Low, Open, Close, Volume), calculations are made extremelly simple since python interprets variables just like matlab. With one line of code a new column is added to the imported variable. And what is better yet, many stock indicators are already incorporated in different libraries, it is just a matter of finding the right one or all of them to incorporate them into the learning model. There are several hundred stocks published on yahoo and the end of the day approach can be easily transfered to other candle sticks with different time frames or windows. The found process on free resources has a great potential to become a state of the art trading tool its just a matter of focusing on the right set for troughtful analysis and back testing.

What is even cooler, is the simplicity of exporting manipulated data to a hard drive to use with other applications (not Excel tough). it is just a matter of one line of code:

df.to_csv('/home/t/Documents/Python/file.csv')

As an interesting observation of the day is a visualization of IBM and SPY stock once we plot for volume and price change between open and close prices. As noted, the volume on the IBM stock does not vary a lot, but the change in price does (vertical line) on the SPY stock instead, volume values are a complete big bang scattered on the plane meaning that given a high volume turnover, there will be equally likely that the price change between open and close will be high as well (be it positive or negative). I would like to know from a practical perspective, what does this means :)

Thursday, July 30, 2015

The normal approximation

So I ran into the problem of proper normal approximation. Since it is highly advised to stay away from generalized implementations of the normal distribution in some softwares, I decided to implement an algorithm by myself to continue with the analysis of volatility and spot prices data. Why am I stuck? I used the Hart algorithm (which is extremelly precise to all the decimal places) that I found in Haug book. Not giving much thought that the algo will not run properly, I ran into a negative option value. And how is this possible?

Well, certanly there were several studies done on the mentioned topic and I then I decided to copy paste the algorithm from a different author (West) and came to find out that I obtain the same wrong number as I have with the Haug version. I still do not know where is the problem, but having negative values extremely disturbs me because then the rest of calculations will definitelly be wrong. Anyhow, I wanted to share a paper that was a critique on normal approximations and an analysis of different approaches.

http://www.codeplanet.eu/files/download/accuratecumnorm.pdf