Describe the bug
This issue was noticed while checking the portfolio API routes during #178 tests. The expected behavior was that /portfolio/history would return only the connector requested in connector_names, just like /portfolio/state and /portfolio/distribution already do. Instead, the history route accepted the filter, echoed it back in the pagination metadata, but still returned balances from other connectors in the same account snapshot.
curl -s -u XXX:XXX -X POST http://localhost:8000/portfolio/history \
-H "Content-Type: application/json" \
-d '
{
"account_names": ["master_account"],
"connector_names": ["gate_io"],
"limit": 1,
"interval": "5m"
}' | jq
{
"data": [
{
"state": {
"master_account": {
"gate_io": ["GT", "BTC", "SOL", "NOT", "HYPE", "GRAM", "XRP", "ETH", "USDT", "POLIS", "TLOS"],
"hyperliquid": ["USDC", "LQNA", "HYPE"],
"hyperliquid_perpetual": ["USD"]
}
}
}
],
"pagination": {
"filters": {
"connector_names": ["gate_io"]
}
}
}
It also appears to exist in the main branch when compared. In routers/portfolio.py, the history route tries to filter a nested connectors field, but the actual returned history structure stores connector names directly under each account inside state. That mismatch likely causes the connector filter to be ignored for the returned history data.
Steps to reproduce bug
Assuming you have added multiple connectors including gate_io
- Call
POST /portfolio/history with a real account name and a single connector in connector_names, such as ["gate_io"].
- Check the returned
data[] object for that account.
- Confirm that the response still includes other connectors even though the pagination filters echo back only the requested connector.
Describe the bug
This issue was noticed while checking the portfolio API routes during #178 tests. The expected behavior was that
/portfolio/historywould return only the connector requested inconnector_names, just like/portfolio/stateand/portfolio/distributionalready do. Instead, the history route accepted the filter, echoed it back in the pagination metadata, but still returned balances from other connectors in the same account snapshot.It also appears to exist in the
mainbranch when compared. Inrouters/portfolio.py, the history route tries to filter a nestedconnectorsfield, but the actual returned history structure stores connector names directly under each account insidestate. That mismatch likely causes the connector filter to be ignored for the returned history data.Steps to reproduce bug
Assuming you have added multiple connectors including gate_io
POST /portfolio/historywith a real account name and a single connector inconnector_names, such as["gate_io"].data[]object for that account.