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!
Alexandre Catarino
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:
Also, checkout the tutorials for other strategies.
Jenny S
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.
Alexandre Catarino
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.
Jenny S
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!
Jared Broad
At this time LEAN doesn't support routing to specific exchanges.
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.
Jenny S
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?
Photi G
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
Jenny S
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!