Skip to content

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

@AshutoshKumar1007

Description

@AshutoshKumar1007

Issue description:
In finrl/meta/paper_trading/alpaca.py, the thread is created like this:
Current pattern (runs immediately):

tSubmitOrder = threading.Thread( target=self.submitOrder( qty, self.stockUniverse[index], "buy", respSO ) )

this calls self.submitOrder(...) immediately and passes its return value as target
so the work runs on the main thread and the new thread gets None as the target.

The expected usage is to pass the function and its args separately:

tSubmitOrder = threading.Thread( target=self.submitOrder, args=(qty, self.stockUniverse[index], "buy", respSO) )
This occurs in both buy and sell sections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions