Dear Community,
I'm trying to better understand this issue and solve it with the help of Alexandre Catarino
The goal is to record the price at the end of the session at the close and pass that to the custom option exercise model based on this example.
I'm unable to pass the fixing_price successfully.
Mia Alissi
Based on the provided code, it seems like the
MyOptionExerciseModel
class is not correctly implementing theoption_exercise
method. This method should return a list ofOrderEvent
objects that contain the order fill information. However, in the provided code, the method does not return anything.Here is how the
option_exercise
method should be implemented according to the QuantConnect documentation:Please note that you need to add your own logic to create
OrderEvent
objects and append them to theorder_events
list based on your specific requirements.Also, it seems like the
update_fixing_price
method in theMyOptionExerciseModel
class is updating thefixing_price_during_exercise
attribute, but this attribute is not used anywhere else in the code. You might want to check if this is the intended behavior.Lastly, the
initialize
method in theMySecurityInitializer
class is creating a new instance ofMyOptionExerciseModel
and updating itsfixing_price
every time a security is initialized. This might not be the intended behavior if you want to keep thefixing_price
consistent across different securities. You might want to consider updating thefixing_price
outside of theinitialize
method, perhaps in theon_data
method or in a scheduled event.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.
Marcellthoth
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!