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

Improve sandbox by adding account settings to the SandboxExecutionCli… #1658

Closed davidsblom closed 1 month ago

davidsblom commented 1 month ago

…entConfig

Pull Request

Add account type, default leverage and oms type to the sandbox execution client config.

Type of change

Delete options that are not relevant.

How has this change been tested?

Locally running the sandbox with Bybit data

cjdsellers commented 1 month ago

Thanks @davidsblom

I haven't looked too closely here yet, but would this address https://github.com/nautechsystems/nautilus_trader/issues/1657 as well?

davidsblom commented 1 month ago

I think so. Haven't tested with cash account though.

cjdsellers commented 1 month ago

Something else I noticed is that the sandbox config is only really setup for a single currency account with one starting balance.

I think this should actually be changed to be closer to the BacktestVenueConfig and have starting_balances and base_currency:

    starting_balances: list[str]
    base_currency: str | None = None

Thoughts?

VeraLyu commented 1 month ago

Could we add multiple base currency support (like I have "BTC", "ETH" all in my margin account)as well? as some scenarios strategy may involve multiple currency arbitrary.

davidsblom commented 1 month ago

Yes indeed. It is probably just updating the config types (could be wrong).

cjdsellers commented 1 month ago

I'll make a breaking change for the config tomorrow to head more towards the backtest venue config, including multiple starting currencies.

davidsblom commented 1 month ago

Awesome! 👍

cjdsellers commented 1 month ago

Pushed up a bunch of changes to the config aligning more closely with the BacktestVenueConfig.

VeraLyu commented 1 month ago

Pushed up a bunch of changes to the config aligning more closely with the BacktestVenueConfig.

Hi Chris, May I ask on which branch do these changes go? Do they include multi-currency support?

Thanks

cjdsellers commented 1 month ago

Hey @VeraLyu

All changes will first go to develop branch. Here's the commit I was referring to above.

Multi-currency accounts with multiple starting balances are now supported for Sandbox too.