nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
1.7k stars 400 forks source link

Betfair: Amend order qty support + a few minor fixes #1687

Closed imemo88 closed 4 days ago

imemo88 commented 1 month ago

Pull Request

Apologies for a somewhat large PR. I tried to keep it small.

Feature:

Fixes:

Type of change

How has this change been tested?

In prod, but I suspect I may need to submit a few modifyOrder fixes once I get more runtime

limx0 commented 1 month ago

LGTM - Thanks @imemo88

@cjdsellers this is good to go from my end

limx0 commented 1 month ago

This following is causing an infinite loop in test_account_statement

class BetfairExecutionClient(LiveExecutionClient):
    def __init__() -> None:
        .... # omitted 
        self._init_scheduled_tasks()    <---- causing infinite loop

    def _init_scheduled_tasks(self) -> None:
        self.create_task(self.account_state_updates())

Multiple execution.connect() calls will spawn multiple update_account_state() coros.

I think we're still going to want to start this in the connect method. If we're creating multiple instances we either need to skip if one exists already or better yet clean it up before we call connect again.

A better solution would probably be saving a reference to the running account state task and shutting it down in the _disconnect method - which gets called on reconnection.

imemo88 commented 1 month ago

Thanks @limx0, I'll have a look at the suggestions!

cjdsellers commented 4 days ago

Closed from #1751 and will also credit @imemo88 in the release notes.