nautilus_trader
nautilus_trader copied to clipboard
Subaccount permissions error
Bug Report
Expected Behavior
I am attempting to run the simple subscriber strategy given in the nautilus_trader examples. I created new read only FTX API keys for a subaccount (name: nautilus_test). This should allow me to connect and simply subscribe to orderbook / trade data.
Actual Behavior
After feeding api_key, api_secret and subaccount to the FTXDataClientConfig, I am getting the error 'Only have permissions for subaccount nautilus_test'
. I have experienced this error in the past when not using nautilus, but it is usually caused by the api key / secret being mismatched to the subaccount name. Have double checked and this isn't the case.
Steps to Reproduce the Problem
from decimal import Decimal
from nautilus_trader.adapters.ftx.config import FTXDataClientConfig
from nautilus_trader.adapters.ftx.config import FTXExecClientConfig
from nautilus_trader.adapters.ftx.factories import FTXLiveDataClientFactory
from nautilus_trader.adapters.ftx.factories import FTXLiveExecClientFactory
from nautilus_trader.config import CacheDatabaseConfig
from nautilus_trader.config import InstrumentProviderConfig
from nautilus_trader.config import TradingNodeConfig
from nautilus_trader.live.node import TradingNode
from subscribe import SubscribeStrategy
from subscribe import SubscribeStrategyConfig
config_node = TradingNodeConfig(
trader_id="SUBSCRIBER-001",
log_level="INFO",
cache_database=CacheDatabaseConfig(type="in-memory"),
data_clients = {
"FTX": FTXDataClientConfig(
api_key='add your key here',
api_secret='add your secret here',
subaccount='nautilus_test',
us=False,
instrument_provider=InstrumentProviderConfig(load_all=True)
),
},
timeout_connection=5.0,
timeout_reconciliation=5.0,
timeout_portfolio=5.0,
timeout_disconnection=5.0,
timeout_post_stop=2.0,
)
node = TradingNode(config=config_node)
strat_config = SubscribeStrategyConfig(
instrument_id="ETH-PERP.FTX",
)
strategy = SubscribeStrategy(config=strat_config)
node.trader.add_strategy(strategy)
node.add_data_client_factory("FTX", FTXLiveDataClientFactory)
node.build()
if __name__ == "__main__":
try:
node.start()
finally:
node.dispose()
Specifications
- OS platform: Ubuntu 22.04
- Python version: 3.10.4
-
nautilus_trader
version: 1.146.0
I was able to reproduce the error, and had a look at this for a while.
Frustratingly the Nautilus implementation is exactly the same as the FTX example and as per the docs. https://blog.ftx.com/blog/api-authentication/
FTX example: https://github.com/ftexchange/ftx/blob/228dfd4e57e22e4c7b96b063094d40217209309e/rest/client.py#L45
Nautilus: https://github.com/nautechsystems/nautilus_trader/blob/develop/nautilus_trader/adapters/ftx/http/client.py#L113
Also, searching the issue on Google and GitHub only turned up the case where people were not inserting the subaccount header. I checked the header and it's indeed there.
Have you managed to get any further with this?
Have not had time to look into it again, but I will see if I can find a fix some time this week