Hi,
The attached algo buys an ATM put or a call 3 minutes after the open, depending on the price action. I can print/debug the ask price for the ATM contract at this time and it matches with the fill price. But once I reach my exit criteria, I try to print the new current option bid/ask price, but it keeps giving me the price information of when the trade was entered. If you look at the logs, the first trade enters at 5.2, when the exit criterias are met, the price printed is still ask= 5.2 while the fill price is 8.4
My question is: how can I refresh the bid/ask price of an option and print it every minute, considering the option symbol is known, since the algo bought it during the entry signal.
The goal is to track these latest prices to setup my exits criteria, i.e: if I bought at 5.2, I wanna exit at 0.5*entry or 1.5*entry. You will notice that currently then entry/exits are based on the stock movement and not the option value.
Any help will be greatly appreciated.
Rahul Chowdhury
Hey Julien,
You should access your Option securities using self.Securities. The properties of the contracts in the list of securities will automatically be updated as new data comes in.
For example,
callBid = self.Securities[self.call.Symbol].BidPrice
will give you the current bid price of that call, and
putUnderlying = self.Securities[self.put.Symbol].Underlying.Close
will give you the last close price of the underlying security.
I updated your code with the change.
Julien Pilon
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!