Hi all,
So back in the day, I used to be a research consultant for WorldQuant. During that time, I learned one style of StatArb. The gist of this style was that it was dollar-neutral and used a core alpha expression as its way to take long and short positions. And as noted in a paper I don't remember the title of, the set of dollar neutral strategies overlaps with the set of market neutral strategies well to the point that some will use the terms interchangeably. As shown in the attached backtest, dollar neutral strategies can produce betas closer to 0.
Anyways, before I digress further, let me get to the point of this post:
- I have followed a lot of what WorldQuant Virtual Research Center's backtesting platform did on top of LEAN. (See attached code)
- I used an alpha expression that I know worked in WebSim (WorldQuant's Backtester), but it only consistently loses money. (-8ish Sharpe)
- When this happened to me in WebSim I would simply put a negative sign in front of the alpha expression and it would flip the PnL graph over. But that doesn't work here.
So I would like to ask the community for both ideas and questions that will spur discussion. If we collectively get this system going, it could be another source of alphas for everyone.
I'm not so much worried about revealing this style of StatArb because the alphas that can be found with it are exceedingly plentiful.
If you would like to see some examples of the alpha expressions, see this paper:
Alexandre Catarino
Hi Dan Kim
The default fill model uses L1 data to fill the orders with higher-frequency data (e.g. minute). Thus, reversing the sign of order could still result in a losing trade because of the bid-ask spread. If you'd only wish to use only actual trading price, we suggest using a custom filling model. Please check this thread for technical details and the attached modified backtest as an example. Please note that in live trading, we cannot remove the effects of bid-ask spread.
Best regards,
Alex
Dan Kim
Hey Alex - thanks for your reply. I don't mind the effects of the bid-ask spread being baked into the backtest. In the long run, I will find more robust alphas because of it.
But perhaps I can write logic to make decisions based on the bid and ask price at the tick right before I call SetHoldings.
I found this post after some googling:
This, and Jared's reply, was back in 2015 though - have things changed? Can we get the exact bid and ask price for a tick of an equity nowadays?
Jared Broad
Now we have L1 tick quotes presented to the algorithm as well. See Derek's work here for examples with using tick quotes.
Best,
Jared
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.
Dan Kim
Well it's been a few months, and I've made some progress with regard to my knowledge. I read up on market microstructure and learned more about slippage, the bid-ask spread, and the limit order book.
So now I'm working toward liquidating using limit orders. For now, I'm doing market orders to take positions. Basically I know from my WorldQuant days that the prediction part of my algorithm is good with regard to price movement. At least to some degree. Now I need some way of keeping track of what prices my market orders are filled at so I can place limit orders at favorable prices.
So my question is: does the LEAN API have a way for me to see what prices the stocks in my portfolio were longed or shorted at with market orders? (I mean with self.SetHoldings)
Dan Kim
After thinking some more and skimming the docs some more, it seems like there isn't a one-liner to do this with. I think I will have to record market order prices in a data structure and apply a slippage model to get at a good liquidation limit order price.
.ekz.
Hi Dan Kim,
I'm following this thread, looking forward to learning from your work. Unfortunately i don't have the expertise (or bandwidth) to collaborate, but I will chime in when I can.
In terms of tracking the market prices at time of acquisition, this may meet your needs:SecurityHolding.HoldingsCost
“/// Acquisition cost of the security total holdings in units of the account's currency.”
Dan Kim
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!