Skip to content

Fix threading.Thread target misuse in Alpaca paper trading (Issue #1399)#1400

Open
skyliquid22 wants to merge 2 commits intoAI4Finance-Foundation:masterfrom
skyliquid22:fix/thread-target-alpaca
Open

Fix threading.Thread target misuse in Alpaca paper trading (Issue #1399)#1400
skyliquid22 wants to merge 2 commits intoAI4Finance-Foundation:masterfrom
skyliquid22:fix/thread-target-alpaca

Conversation

@skyliquid22
Copy link

This PR fixes incorrect usage of threading.Thread where the result of
submitOrder(...) was passed as the thread target, causing immediate execution
instead of deferred execution inside the thread.

Changes:

  • Corrected thread initialization to use target=self.submitOrder
  • Passed arguments via args=(...)
  • Applied fix to both buy and sell order blocks
  • Added an AST-based regression test to ensure submitOrder is not called during thread construction and args are provided when used as a target.

Closes #1399

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.

Fix thread target invocation in paper_trading/alpaca.py (submitOrder called immediately)

1 participant