IBKR Quant Blog


1 2 3 4 5 2 59


Quant

Intro To Hidden Markov Chains - Part I


The Hidden Markov model is a process consisting of two components: an observable component and an unobservable or ‘hidden’ component (van Handel, 2008). Nevertheless, from the observable process, we can extract information about the “hidden” processes. As such, our task is to determine the unobserved process from the observed one.

The Hidden Markov Models (HMM) have two defining properties. (i) It assumes that the observation at the time was generated by some process whose state is hidden from the observer and (ii) it assumes the state of this hidden process satisfies the Markov property. Complex as it may seem to some, one comes naturally to understand HMMs, once one understands what a Markov Model is. We will look into these two model components, then consider advanced techniques that help construct these HMMs.

Constructing A Hidden Markov Model

 

The “Hidden Process”

A process is said to have the Markov property if:

For any A S, any value n and for any time value t< t2 < … < tn < tn+1 it is true that

Quant

 

This means that to determine the next state of the process, one can just consider the current state the process is in and ignore everything that has occurred before, as this information is already included in the current state.

We need some properties and definitions that will allow us to help eventually grasp the concept of HMM

  1. Time Homogeneity: this occurs when the probability of moving from a to b is independent of time, i.e., it does not matter how far you are in the process; as long as the processes are going to move from a to b in one step, the probability will be the same throughout. When a process has this property, we say this process is Time Homogenous and if not, time non-homogenous
  2. Though possible to work with infinite states, in our financial context, it suffices to work with a finite amount of states, which are irreducible.
  3. Irreducible States: It is possible to move from any one state to another over a certain number of steps.

 

Quant

 

This probability matrix is such that:

Quant

 

n.b.: these emission probabilities are the main drivers of where next the process may go. From our time homogeneity assumption, we can calculate the probability that the process is in state j after t steps, given it started at I, we multiply the matrix P with itself t times then read off the ijth element of P

Example:

Let us consider two probability transition matrices each with two transition states, one that is Time-Homogeneous and one that is not.

The non-Time-Homogeneous case

Quant

 

Then       Quant   and

 

Quant

 

Here the probability of changing state depends on where you are in time. Contrary to this procedure, a time-homogenous matrix gives constant probabilities that are independent of time.

Quant   On this case  Quant

 

 

In the next post, Bonolo Molopyane will demonstrate a two-state time homogeneous probability matrix.

 

Learn more QuantInsti here https://www.quantinsti.com

To learn more about Python and R, visit QuantInsti website and their educational offerings at their Executive Programme in Algorithmic Trading (EPAT™).

Trading on margin is only for sophisticated investors with high risk tolerance. You may lose more than your initial investment.


This material is from QuantInsti and is being posted with QuantInsti’s permission. The views expressed in this material are solely those of the author and/or QuantInsti and IBKR is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.


23517




Quant

qplum - Comparing alpha extraction in ETFs vs individual stocks


In case you missed this presentation on Alpha Generation!, the webinar recording is available on IBKR’s YouTube Channel!

https://youtu.be/U-iL_S1L4ZA

 

Single stocks are often traded based on technical and fundamental analysis. ETFs, on the other hand, are often used for passively following an index. In this webinar, we explore how certain changes in the markets have led to a world where traditional conceptions of passive and active are being turned on their head. We challenge the assumption that ETFs are for passive followers and discuss how the grab for alpha in single stocks is getting more difficult for traditional players.

 

Sponsored by qplum

Speaker: Gaurav Chakravorty, Founder qplum

Trading on margin is only for sophisticated investors with high risk tolerance. You may lose more than your initial investment.

 

The analysis in this material is provided for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IBKR to buy, sell or hold such investments. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.


23496




Quant

Byte Academy - Introduction To Python For Data Analysis


Register for this free webinar!

Wednesday, May 8, 2019 12:00 PM EDT

 

Python

 

This "Learning Bytes" webinar, held in conjunction with Python, FinTech and Data Science coding school Byte Academy, headquartered in New York City, will provide an introduction to data science for finance.

After introducing data science, we’ll go into topics that are particularly relevant to the finance industry, including: machine learning, AI, data management, automation, modeling and analytics.  We’ll also touch on the Python programming language and its role in data analytics. If time allows, we’ll walk through some financial use cases and applications.

This webinar will be led by Rebecca Sealfon, formerly at Citi and Google, who leads Byte Academy’s Data Science Program. 

 

Sponsored by:   Byte Academy Byte Academy

Speaker: Rebecca Sealfon, Data Science Program, Byte Academy

 

The analysis in this material is provided for information only and is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad-based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation by IBKR to buy, sell or hold such investments. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.


23423




Quant

Can We Explain Abundance of Equity Factors Just by Data Mining? Surely Not.


This article discusses ‘p-hacking’ (a.k.a. data snooping, data-mining).


Author: Andrew Y. Chen, Federal Reserve Board

Title: The Limits of P-Hacking: A Thought Experiment

Link: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3358905

Academic research has documented several hundreds of factors that might explain expected stock returns. Now, the question is: Are all these factors products of data mining? A recent paper by Andrew Chen runs a numerical simulation that shows that it is implausible, that abundance of equity factors can be explained solely by p-hacking ...
 

Abstract:

Suppose that asset pricing factors are just p-hacked noise. How much p-hacking is required to produce the 300 factors documented by academics? I show that, if 10,000 academics generate 1 factor every minute, it takes 15 million years of p-hacking. This absurd conclusion comes from applying the p-hacking theory to published data. To fit the fat right tail of published t-stats, the p-hacking theory requires that the probability of publishing t-stats < 6.0 is infinitesimal. Thus, it takes a ridiculous amount of p-hacking to publish a single t-stat. These results show that p-hacking alone cannot explain the factor zoo.

Notable quotations from the academic research paper:

"Academics have documented more than 300 factors that explain expected stock returns. This enormous set of factors begs for an economic explanation, yet there is little consensus on their origin. A p-hacking (a.k.a. data snooping, data-mining) offers a neat and plausible solution. This cynical explanation begins by noting that the cross-sectional literature uses statistical tests that are only valid under the assumptions of classical single hypothesis testing. These assumptions are clearly violated in practice, as each published factor is drawn from multiple unpublished tests. In this well-known explanation, the factor zoo consists of factors that performed well by pure chance.

In this short paper, I follow the p-hacking explanation to its logical conclusion. To rigorously pursue the p-hacking theory, I write down a statistical model in which factors have no explanatory power, but published t-stats are large because the probability of publishing a t-stat ti follows an increasing function p(ti). I estimate p(ti) by fitting the model to the distribution of published t-stats in Harvey, Liu, and Zhu (2016) and Chen and Zimmermann (2018). The p-hacking story is powerful: The model fits either dataset very well.

 

 

To learn more about these papers, view the full article on Quantpedia website:

https://www.quantpedia.com/Blog/Details/can-we-explain-abudance-of-equity-factors-just-by-data-mining-surely-not

 

 

About Quantpedia

Quantpedia Mission is to process financial academic research into a more user-friendly form to help anyone who seeks new quantitative trading strategy ideas. Quantpedia team consists of members with strong financial and mathematical background (former quantitative portfolio managers and founders of Quantconferences.com) combined with members with outstanding IT and technical knowledge. Learn more about Quantpedia here: https://quantpedia.com

There is a substantial risk of loss in foreign exchange trading. The settlement date of foreign exchange trades can vary due to time zone differences and bank holidays. When trading across foreign exchange markets, this may necessitate borrowing funds to settle foreign exchange trades. The interest rate on borrowed funds must be considered when computing the cost of trades across multiple markets.

Futures are not suitable for all investors. The amount you may lose may be greater than your initial investment. Before trading futures, please read the CFTC Risk Disclosure. A copy and additional information are available at ibkr.com.

This material is from Quantpedia and is being posted with Quantpedia’s permission. The views expressed in this material are solely those of the author and/or Quantpedia and IBKR is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.


23536




Quant

Five Indicators To Build A Trend Following Strategy - Part V


In the final installment of this series, Rekhit will demonstrate OBV (On Balance Volume). To learn more about the other four indicators, see the links below:

  1. Moving Averages
  2. Bollinger Bands
  3. MACD (Moving Average Convergence Divergence)
  4. RSI (Relative Strength Index)

 

OBV (On Balance Volume)

OBV is a momentum-based indicator, which measures volume flow to gauge the direction of the trend. Volume and price rise are directly proportional. A rising price is depicted by a rising OBV, and a falling OBV stands for a falling price. If OBV depicts a rise in the same pattern as the prices, this is a positive indicator, while a contrast with the pattern depicts a negative indicator.

How to use OBV in trend following strategies:

OBV is used as a confirmation tool concerning price trends. If the OBV increases with respect to the increasing price trend, it can be inferred that the price trend is sustainable. If, however, the OBV shows a decline with respect to the increasing price trend, then it could signal a price trend reversal.

Plotting OBV in python for trend following strategies:

The Python code is given below:

# OBV
data['OBV'] = ta.OBV(data.close, data.volume)/10**6

data.close.plot()
plt.ylabel('close')
plt.show()

data.OBV.plot()
plt.ylabel('On Balance Volume (in millions)')
plt.show()

 

The graph plotted is shown below:

Quant

 

Learn more QuantInsti here https://www.quantinsti.com

To learn more about Python and R, visit QuantInsti website and their educational offerings at their Executive Programme in Algorithmic Trading (EPAT™).

Trading on margin is only for sophisticated investors with high risk tolerance. You may lose more than your initial investment.


This material is from QuantInsti and is being posted with QuantInsti’s permission. The views expressed in this material are solely those of the author and/or QuantInsti and IBKR is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to sell or the solicitation of an offer to buy any security. To the extent that this material discusses general market activity, industry or sector trends or other broad based economic or political conditions, it should not be construed as research or investment advice. To the extent that it includes references to specific securities, commodities, currencies, or other instruments, those references do not constitute a recommendation to buy, sell or hold such security. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.


23424




1 2 3 4 5 2 59

Disclosures

We appreciate your feedback. If you have any questions or comments about IBKR Quant Blog please contact ibkrquant@ibkr.com.

The material (including articles and commentary) provided on IBKR Quant Blog is offered for informational purposes only. The posted material is NOT a recommendation by Interactive Brokers (IB) that you or your clients should contract for the services of or invest with any of the independent advisors or hedge funds or others who may post on IBKR Quant Blog or invest with any advisors or hedge funds. The advisors, hedge funds and other analysts who may post on IBKR Quant Blog are independent of IB and IB does not make any representations or warranties concerning the past or future performance of these advisors, hedge funds and others or the accuracy of the information they provide. Interactive Brokers does not conduct a "suitability review" to make sure the trading of any advisor or hedge fund or other party is suitable for you.

Securities or other financial instruments mentioned in the material posted are not suitable for all investors. The material posted does not take into account your particular investment objectives, financial situations or needs and is not intended as a recommendation to you of any particular securities, financial instruments or strategies. Before making any investment or trade, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice. Past performance is no guarantee of future results.

Any information provided by third parties has been obtained from sources believed to be reliable and accurate; however, IB does not warrant its accuracy and assumes no responsibility for any errors or omissions.

Any information posted by employees of IB or an affiliated company is based upon information that is believed to be reliable. However, neither IB nor its affiliates warrant its completeness, accuracy or adequacy. IB does not make any representations or warranties concerning the past or future performance of any financial instrument. By posting material on IB Quant Blog, IB is not representing that any particular financial instrument or trading strategy is appropriate for you.