Skip to content

Portfolio API - Gateway wallet tokens are missing from portfolio state #195

Description

@rapcmia

Describe the bug

While testing #193 and use a Solana mint-address swap, the wallet successfully received 0.156298 TRUMP. Gateway's direct POST /chains/solana/balances route returned SOL, USDC, and TRUMP with the correct positive balances, but Hummingbot API's refreshed POST /portfolio/state response returned only SOL and USDC. Restarting Gateway did not change the result. The token remained registered, and Gateway continued to detect both SPL token accounts.

Image

HAPI POST /portfolio/state ❌

curl -sS -u admin1:admin2 -H 'Content-Type: application/json' -X POST http://localhost:8000/portfolio/state -d '{
  "account_names": ["master_account"],
  "connector_names": ["solana-mainnet-beta"],
  "skip_gateway": false,
  "refresh": true
}' | jq

{
  "master_account": {
    "solana-mainnet-beta": [
      {
        "token": "SOL",
        "units": 0.35160510300000003,
        "price": 0.0,
        "value": 0.0,
        "available_units": 0.35160510300000003
      },
      {
        "token": "USDC",
        "units": 1.315996,
        "price": 1.0,
        "value": 1.315996,
        "available_units": 1.315996
      }
    ]
  }
}

Gateway POST /chains/solana/balances ✅

{
  "balances": {
    "SOL": 0.35160510300000003,
    "USDC": 1.315996,
    "TRUMP": 0.156298
  }
}

The expected result is for portfolio state to include every positive wallet balance returned by Gateway. The observed code path appears to store the complete Gateway wallet result and then overwrite the same master_account["solana-mainnet-beta"] entry with the narrower balance list from an initialized trading connector. This can make users or portfolio automation believe an asset is missing even though the wallet still holds it.

The affected code path is also present on the current main branch at ddcc11e87de1aea55446fb859f5babb1a940e937, but main was inspected rather than separately live-tested.

Steps to reproduce bug

  1. Start Hummingbot API and Gateway, then initialize solana-mainnet-beta with a pair such as SOL-USDC.
  2. Add a Solana token mint to Gateway and complete a swap so the default wallet holds a positive balance.
  3. Call Gateway’s POST /chains/solana/balances route and confirm the token is returned.
  4. Call Hummingbot API’s POST /portfolio/state with refresh: true, filtered to master_account and solana-mainnet-beta.
  5. Observe that portfolio state lists the connector’s tracked tokens but omits the additional Gateway wallet token.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions