Back

Arbitrage strategy

Hey,

Is there an example of a simple/basic arbitrage strategy ?

Meaning, if an equity's price traded on exchange A is lower than it's price on exchange B - buy it on A, and sell it on B.

How do I compare equity's price on different exchanges ?

How do I buy in A's price and, respectively, sell it on exchange B ?

I've searched documentation as well as in algorithm files, with no success finding such an example.

Thank you very much!

 

Update Backtest








We have some examples of statistical arbitrage in this forum. Please use the search feature.
Our team have been developing quantitative strategies and, fortunatelly, we have two examples of statistical arbitrage:

https://www.quantconnect.com/forum/discussion/2011/pairs-trading---copula-method-vs-cointegrationhttps://www.quantconnect.com/forum/discussion/2063/intraday-pairs-trading-based-on-correlation-and-cointegration

Also, checkout the tutorials for other strategies.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thank you Alexandre!

I've explored many of QC site's regions - docs, tutorials, forum, exmaples (downloaded the complete LEAN project) and search feature, in order to enrich and deepen my understanding, and it was very enlightening indeed.

I guess the point I'm missing is how to select which exchange to buy and sell a certain equity, and surprisingly did not find any reference to this issue, then probably I'm doing something wrong.

 

0

In tick resolution, there is information on the exchange:

public override void OnData(Slice data) {
foreach (var tick in data.Ticks["SPY"]) {
var exchange = tick.Exchange;
}
}

where Exchange is a string with that represents the exchange according to this mapping:

public static class MarketCodes
{
/// US Market Codes
public static Dictionary<string, string> US = new Dictionary<string, string>()
{
{"A", "American Stock Exchange"},
{"B", "Boston Stock Exchange"},
{"C", "National Stock Exchange"},
{"D", "FINRA ADF"},
{"I", "International Securities Exchange"},
{"J", "Direct Edge A"},
{"K", "Direct Edge X"},
{"M", "Chicago Stock Exchange"},
{"N", "New York Stock Exchange"},
{"P", "Nyse Arca Exchange"},
{"Q", "NASDAQ OMX"},
{"T", "NASDAQ OMX"},
{"U", "OTC Bulletin Board"},
{"u", "Over-the-Counter trade in Non-NASDAQ issue"},
{"W", "Chicago Board Options Exchange"},
{"X", "Philadelphia Stock Exchange"},
{"Y", "BATS Y-Exchange, Inc"},
{"Z", "BATS Exchange, Inc"},
{"IEX", "Investors Exchange"},
};

/// Canada Market Short Codes:
public static Dictionary<string, string> Canada = new Dictionary<string, string>()
{
{"T", "Toronto"},
{"V", "Venture"}
};
}

However, you cannot select the exchange your orders go to. The brokerage will find the best deal for you.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


I'm using tick's Exchange property (along with the above dictionaries) through Security.DataFilter property inside Initialize method (so OnData is already getting filtered ticks).

The missing piece of the puzzle is your ending, that I cannot select the exchange.

Thanks for clarifying this issue!

 

0

At this time LEAN doesn't support routing to specific exchanges.

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thank you Jared.

In this case, it's immpossible to execute the strategy "buy eBay if it's price on NASDAQ is between 35.3 and 35.4", because I cannot be sure that the equity will be bought on NASDAQ, and therefore buying price can be out of bounds.

And in a wider aspect, I cannot rely on an equity's price as a desicion criteria.

Is this correct, or is there a way to perform this?

0

Hi guys,

I have similar question as Jenny S. I am looking to figure out if there is a way to connect different exchanges via REST on the same algorithm and perform arbitrage.
So to clarify:

1. Is a statistical arbitrage strategy that the Universe contains both US & UK stocks feasible?
2. Is an arbitrage strategy of crypto-pairs across different Crypto-Exchanges feasible from a framework point of view?

Thanks

0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed