Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add the ComboLimitOrder execution code for testing and validation #17

Closed
wants to merge 0 commits into from

Conversation

Chocksy
Copy link
Owner

@Chocksy Chocksy commented Jun 28, 2024

Adds the ComboLimitOrder execution class that touches on this issue with #1 . It provides the code to showcase that this is an issue and potentially if Lean gets fixed we could use this code to execute limitOrders.

This PR should not be merged for now but it can eventually as it does not break anything as we are still using the existing Limit order class.

@Chocksy Chocksy self-assigned this Jun 28, 2024
@Chocksy Chocksy force-pushed the feat/limit_orders_combo branch from 642c58f to cf2a353 Compare July 12, 2024 13:18
Copy link
Collaborator

@ffahimi ffahimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I tried to run the code using the [LimitOrderHandlerWithCombo.py] I got an error that the module can not be called. Then I replaced the code in the original limitorderhandler to test the ComboLimitOrder. The ComboLimitOrder managed to place one order on the paper trading, but didn't work with my backtests and didn't produce any orders. Would be great to get this working, let me know if I can help.

@Chocksy
Copy link
Owner Author

Chocksy commented Jul 31, 2024

When I tried to run the code using the [LimitOrderHandlerWithCombo.py] I got an error that the module can not be called. Then I replaced the code in the original limitorderhandler to test the ComboLimitOrder. The ComboLimitOrder managed to place one order on the paper trading, but didn't work with my backtests and didn't produce any orders. Would be great to get this working, let me know if I can help.

Thanks for testing. Will get to it again and see. I might have a difference in code in my current algo. Will check

@Chocksy Chocksy force-pushed the feat/limit_orders_combo branch 2 times, most recently from 280bde4 to 150d4eb Compare August 5, 2024 21:16
Copy link
Collaborator

@ffahimi ffahimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't done live test yet, but in the backtests

(1) the ContractUtils class is missing the strikePrice and expiryDate

Returns the mid-price of an option contract

def strikePrice(self, contract):
    security = self.getSecurity(contract)
    return security.symbol.ID.StrikePrice

def expiryDate(self, contract):
    security = self.getSecurity(contract)
    return security.symbol.ID.Date

(2) the limitorderhandlerwithcombo is still causing an error when I use it in Execution/Base.py

During the algorithm initialization, the following exception has occurred: 'module' object is not callable
at init
self.limitOrderHandler = LimitOrderHandlerWithCombo(context, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
in Base.py: line 41
at init
super().init(context)
in SPXExecutionModel.py: line 33
at Initialize
self.SetExecution(SPXExecutionModel(self))
^^^^^^^^^^^^^^^^^^^^^^^
in main.py: line 88
'module' object is not callable

@Chocksy
Copy link
Owner Author

Chocksy commented Aug 6, 2024

@ffahimi i added the strikePrice and expiryDate methods to contractUtils

@Chocksy Chocksy requested a review from ffahimi August 6, 2024 17:15
@Chocksy Chocksy closed this Aug 13, 2024
@Chocksy Chocksy force-pushed the feat/limit_orders_combo branch from 508b433 to d4c2359 Compare August 13, 2024 21:14
@Chocksy Chocksy deleted the feat/limit_orders_combo branch August 13, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants