Sunday, July 2, 2017

Bitcoin price with google trends

A long ago I want to experiment and deal with a question of how Google trends can be implemented to analyze the financial markets. Here the opportunity has just turned up.


The main idea consists in the following: As the price is functioning of supply and demand, increase in demand for an asset will cause the growth of the price. The decrease in demand, or increase in the supply, respectively attracts reduction of the price. The assumption which I will check in at research is that the statistics of search queries on "hot trends" can correlate and advance price dynamics of a relevant "hot" asset.


In the beginning, I have decided to observe BITCOIN cryptocurrency. Today he more than "hot" because of the media interest and big volatility in a price.


We will need the following tools:


1. Data from the Google trend.


Google trends tools - the excellent example of a BIG DATA implementation. It shows dynamics of the popularity of a particular search query in time. Also, service provides tools for the analysis changes in inquiry and allows to compare keywords among themselves.


2. Historical quotes of BTC/USD


For that end, it can be used the quotas export from the MT4 terminal which is provided by the BTCe exchange.


After export of all data and formatting, I applied both lines in one chart. Here is the following graph:




The blue line is BTC/USD price, orange - the frequency of "bitcoin" query in Google search engine.


Already at this stage it evident that there is the correlation between both lines and dependence can be calculated. Here are the outputs:




We see that the correlation is 80.74%. It is evident that there are connections.


Unfortunately, Google doesn't provide detailed statistics for the entire period, so it can’t be calculated more even. With this data, there is a high error of approximation. Most precisely the dependence is reflected by exponential and polynomial regression:






Unfortunately, no conclusions at this stage can be drawn. While the data volume is extremely deficient, it can’t be the forecasting tool. Of Course, I need to consider the broader array of factors. For example, the decision of the Central Bank of Japan about legalization cryptocurrency increased interest to Bitcoin, which affect the price of BTCUSD.


At the following stage, I will try to find the big database which can be applied to the analysis effectively. I’ll see if they're available open sources solution, such as Quandl, for example.


Thursday, June 15, 2017

Privacy is a new luxury

"Privacy is a new luxury" - It seems that quite so it is possible to characterize our century of information.
I have come across one scandal with Sberbank and one fast-food restraint. Briefly: Sberbank has been charged with sale of the history of transactions of users in order of targeting advertising on the internet. Actually, it is Violation of Bank secrecy. And it is only one of a set of the cases recorded in recent years.At the same time, the companies even aren't protected, being covered with the "depersonalized" data and full "confidentiality."
Recently I have attended the conference on BIG DATA organized by Beeline. The main agenda of this meeting was just monetization of the clients given to activity (the home Internet, television, geolocation, etc.).
All this works by one principle: on the client the detailed statistics of the fact that he watches what sites he visits what purchases he makes In WHAT PLACES he is and AS it is FREQUENT collects. Further, these data are profiled and on sale to the advertising companies.
As a result, we receive:
I went to McDonald's - Receive advertising of the burger in the browser!
You look series on TV much - Receive cashback at a subscription to ivi
Sounds, it seems, harmlessly. And is further what? And also - algorithmization and the predictive analysis of your activity. Already now many recruiting agencies with results of Big data research. Ethics questions fade into the background here.
Of course, there are both pluses and apparent benefits for society. Some will consider the interest that thanks to technologies the necessary goods will easier get to the most needing consumers.
Personally my opinion such: while there is no big button "right to oblivion" - it is possible to be covered with "good intentions" as much as long.


Saturday, June 10, 2017

Russan ruble and oil price

Everyone knows how the impact what oil has on the Russian economy. But how it can be explained in the context of math and how it changes in time? I calculated the regression equation and pairwise comparisons for BR futures and USDRUB. All data I took from FINAM open database.


The first thing I did was import data arrays over a period of the 2012-2017 year.After a simple transformation of data the following
the chart has turned out:




On a vertical axis is a price of USDRUB, on a horizontal axis - BRENT future price. Even on this step, we see high dependence.
Output calculations will be the following:




The regression equation is:




With the main coefficients:




Variable A in the red square is approximation error.We see it goes least at exponential regression. Hereafter we’ll use this particular kind of regression. Here are the output charts:




Blue line -  line regression, Red- exponential.


Chart also shows the exponential dependence between USDRUB and BRENT price over the five years distances.
During that period share of oil and gas incomes in Russian trade balance have been about 47,6% (statistic average).Currently, the percentage has been declined to the smaller amount.


The table below shows how oil and gas share have been changing during the last decade.




Let’s explore how the correlation between USDRUB and BRENT was changing at this period. Likely that dependence should decline with reduct considering the part of oil and gas share in the trade balance. Here what show statistical calculations:


We should keep in mind that Central Bank of Russia moved to floating rate policy towards national currency in November of 2017. It reflected in investigating dependence. Remind that Central Bank of Russia had controlled ruble’s price by сorridor rule.


It shows how correlation had changed after removal the corridor rule. Best seen displays 2013 and 2014 year chart. Since 2014 USDRUB/BRENT have begun to obey the power low and we can see how correlation increased compared to previous periods.




2013 year


2014 year


This kind of dependence is observing up to the 2017 year. In sum, this gives a high statistical significance for prediction power of this model. Here is the equal for 2016:




However, there is one question left: Why the correlation has been reminding at the high level during the 2012 year? I’ll gonna think about it in upcoming research.


If calculates the theoretical price of Russian ruble with this formula, the following value will be around $64.99 (BRENT = 48.99). Considering that USDRUB is equal 57.04, we get the 14% error.It’s more than enough to say that similar ceased to reflect the reality.Also, the chart for 2017 shows the same:


BR/USDRUB 2017


It is evident that power dependence disappeared utterly. The correlation falls to 37.89%, which is the lowest since 2012. Why does it happen? It’ll be more clear at the end of 2017 when I can calculate the total data.In any case, it’s clear that the Russian economy is changing, as reflected in the graphs.


The main conclusion I drow from this research is that in the long term period there is a high power dependence between the USDRUB and oil price. This instrument can become useful for macroeconomic forecast inside trading strategies.


In fact, I found more questions than answers, so the investigation keeps up.Next time I’ll take a more significant time period with other macroeconomic indicators.
For those purposes, I need the stronger tool than excel.I think about R. let's see.

Sunday, May 14, 2017

About oil price

Ooh, long ago here I added nothing. Alas, until recently there was at all no opportunity to be engaged in independent researchers. Now it became slightly simpler with it, and it means that I will shortly publish some practices. Plus still is an idea entirely to move to the independent website shortly. Amicably, it would be necessary to give some comment on the global markets from the equipment or macroeconomic, especially against the background of the arriving news. It is remarkable that the other day Google recorded a historical maximum by requests for World War III. News of this sort always pushes people to invest in the "protected" assets and commodity. On the one hand, it looks quite reasonable, at the conflicting demand for raw materials will increase. But there is one problem: historically the prices don't keep long at the high levels, and correction will take away finally all collected profit. I have shown to one client who has wanted to invest for a long time in oil I the following chart:

The schedule shows dynamics of the price of oil from 1861 to 2011. At the same time, the blue line  price in nominal dollars, and the red line - in brought on inflation since 2011.


What can draw a conclusion? And very simple: Adjusted for inflation, the average price of oil of the hysteric woman was always not more expensive than $40 for the barrel. Any "carrying out" above finally was corrected. It means that oil purchase - initially unprofitable investment. The cost of providing a position, inflation and percent finally will destroy all profit, even if the price of some time grows.


Unfortunately, not so many people adhere to similar logic. And most of my clients don't consider similar historical extrapolation a sufficient argument and continue to play "random walks."

Closed straddle strategy

Here also the expiration of my options portfolio came that is the completion of an experiment.
Now I can sum up the full result and analyze the effect.
The portfolio kept one and a half months and had 3 modifications:


  • Initial formation of a call spread in the form of "straddle."
  • At renewal of a trend closing of the left leg and transition to a long stake
  • Change to a bull call spread.


I described the first two points in the previous post (here the reference: https://vk.com/wall-103610476_242? w=page-103610476_53705610). I will dwell on the last a little:
After the closing of the left leg (sale of fetters options), I had a clean equivalent of Long. Considering that I work with options, but not with the primary market, a sin was not to seize all additional opportunities to maximize income. And I made decisions to begin to sell stakes "out of money," thereby forming "a bull call spread."
Eventually, at me the call spread 15000-17250 turned out. In such look, the position came to expiration.
I will tell at once, the sale of the option I well "cut off" to myself profit as sold a stake too close to money in the growing market. Of course, it was covered with other option, but the current variation took away a lot of money when the price of the option began to grow with a growth of the price (At the market in 17350, the option sold by me became "on money", so its price grew as much as possible. Here schedule of a teta.


Apparently, the market was closed to its maximum values. And it left to me in kopek.
Morals: it is impossible to underestimate the force of a trend and to form very narrow spreads.

Anyway, I consider that I the idea well worked myself. Both options were executed and made profit on "a long position."


As a result, the profitability of all portfolio in 1.5 months made 25.13% that in itself is quite good.

I think that about new year I will leave work with options so far, it is too much another matters, plus it will be necessary to analyze all mistakes once again. All best!

Negotiation methods

I here at work needed the skill of work with clients and ability to conduct negotiations. Up to this point, I was focused only on the financial analysis and did not take into account another part of this business at all - negotiations and process of the conclusion of transactions. The last experience showed that ability to communicate with clients not less valuable, than the ability to find the prospective company for investment. As well as always, I solved approach it from studying at the base. To be advised to read the book "It is possible to agree about everything! How to try to obtain a maximum in any negotiations" the author Gavin Kennedy. Here reference to profile: https://www.livelib.ru/book/1000686893-dogovoritsya-m. If to whom it is interesting, I can throw off the e-book.

Bought BANE in M&A anticipation (END)

Today, I closed my first M & A deal (Mergers and Acquisitions).
Owning shares in Bashneft, I put up an offer for the sale of Rosneft's securities.
The operation is quite simple, it is enough to apply through a broker:


Here are details about my investing :

  • Buy price: 3529

  • Offer price: 3706,4 

Total return is: 5,02%

I think the first experience is quite successful, but for further work in this area, it will be necessary to closely study all the features of working with M & A. For this I will look for relevant literature.

University Towns and Recession risk

The time has come for me to start looking for new apartments in the US. The logical question has appeared: What is the best area to re...