Skip to content

Conversation

@zhourunlai
Copy link
Contributor

The portfolio DataFrame has KeyError when states is empty

dashboard            | ────────────────────────── Traceback (most recent call last) ───────────────────────────
dashboard            |   /opt/conda/envs/dashboard/lib/python3.12/site-packages/streamlit/runtime/fragment.py
dashboard            |   :245 in wrapped_fragment
dashboard            |
dashboard            |   /home/dashboard/frontend/pages/orchestration/portfolio/app.py:190 in
dashboard            |   portfolio_overview
dashboard            |
dashboard            |     187 │
dashboard            |     188 │   # Convert to DataFrame
dashboard            |     189 │   portfolio_df = portfolio_state_to_df(filtered_portfolio_state)
dashboard            |   ❱ 190 │   total_balance_usd = round(portfolio_df["value"].sum(), 2)
dashboard            |     191 │
dashboard            |     192 │   # Display metrics
dashboard            |     193 │   col1, col2, col3, col4 = st.columns(4)
dashboard            |
dashboard            |   /opt/conda/envs/dashboard/lib/python3.12/site-packages/pandas/core/frame.py:4107 in
dashboard            |   __getitem__
dashboard            |
dashboard            |      4104 │   │   if is_single_key:
dashboard            |      4105 │   │   │   if self.columns.nlevels > 1:
dashboard            |      4106 │   │   │   │   return self._getitem_multilevel(key)
dashboard            |   ❱  4107 │   │   │   indexer = self.columns.get_loc(key)
dashboard            |      4108 │   │   │   if is_integer(indexer):
dashboard            |      4109 │   │   │   │   indexer = [indexer]
dashboard            |      4110 │   │   else:
dashboard            |
dashboard            |   /opt/conda/envs/dashboard/lib/python3.12/site-packages/pandas/core/indexes/range.py:
dashboard            |   417 in get_loc
dashboard            |
dashboard            |      414 │   │   │   except ValueError as err:
dashboard            |      415 │   │   │   │   raise KeyError(key) from err
dashboard            |      416 │   │   if isinstance(key, Hashable):
dashboard            |   ❱  417 │   │   │   raise KeyError(key)
dashboard            |      418 │   │   self._check_indexing_error(key)
dashboard            |      419 │   │   raise KeyError(key)
dashboard            |      420
dashboard            | ────────────────────────────────────────────────────────────────────────────────────────
dashboard            | KeyError: 'value'

@pleirb
Copy link

pleirb commented Jul 26, 2025

The portfolio DataFrame has KeyError when states is empty

dashboard            | ────────────────────────── Traceback (most recent call last) ───────────────────────────
dashboard            |   /opt/conda/envs/dashboard/lib/python3.12/site-packages/streamlit/runtime/fragment.py
dashboard            |   :245 in wrapped_fragment
dashboard            |
dashboard            |   /home/dashboard/frontend/pages/orchestration/portfolio/app.py:190 in
dashboard            |   portfolio_overview
dashboard            |
dashboard            |     187 │
dashboard            |     188 │   # Convert to DataFrame
dashboard            |     189 │   portfolio_df = portfolio_state_to_df(filtered_portfolio_state)
dashboard            |   ❱ 190 │   total_balance_usd = round(portfolio_df["value"].sum(), 2)
dashboard            |     191 │
dashboard            |     192 │   # Display metrics
dashboard            |     193 │   col1, col2, col3, col4 = st.columns(4)
dashboard            |
dashboard            |   /opt/conda/envs/dashboard/lib/python3.12/site-packages/pandas/core/frame.py:4107 in
dashboard            |   __getitem__
dashboard            |
dashboard            |      4104 │   │   if is_single_key:
dashboard            |      4105 │   │   │   if self.columns.nlevels > 1:
dashboard            |      4106 │   │   │   │   return self._getitem_multilevel(key)
dashboard            |   ❱  4107 │   │   │   indexer = self.columns.get_loc(key)
dashboard            |      4108 │   │   │   if is_integer(indexer):
dashboard            |      4109 │   │   │   │   indexer = [indexer]
dashboard            |      4110 │   │   else:
dashboard            |
dashboard            |   /opt/conda/envs/dashboard/lib/python3.12/site-packages/pandas/core/indexes/range.py:
dashboard            |   417 in get_loc
dashboard            |
dashboard            |      414 │   │   │   except ValueError as err:
dashboard            |      415 │   │   │   │   raise KeyError(key) from err
dashboard            |      416 │   │   if isinstance(key, Hashable):
dashboard            |   ❱  417 │   │   │   raise KeyError(key)
dashboard            |      418 │   │   self._check_indexing_error(key)
dashboard            |      419 │   │   raise KeyError(key)
dashboard            |      420
dashboard            | ────────────────────────────────────────────────────────────────────────────────────────
dashboard            | KeyError: 'value'

Thanks! I'm not getting the error with these changes, but why does it say I have 0 USD?
I have USDT and XRP in my Binance account. Why can't I see the status of these coins?
image
This is my setup on Binance:
image
Thanks!

@rapcmia rapcmia merged commit b85acea into hummingbot:main Jul 29, 2025
@rapcmia rapcmia moved this to Development 2.8.0 in Pull Request Board Jul 29, 2025
@pleirb
Copy link

pleirb commented Jul 29, 2025

I figured out what my mistake was, and I'm mentioning it in case it happened to anyone else. For those already familiar with this world, it might be a bit obvious, but for me, as a beginner, I didn't understand. It turns out my assets were in the "Funds" account when they really should have been in the "Spot" account. I simply made the transfer as shown in the image:

image

Now I can see my balances perfectly in the “Portfolio” Thank you!

@rapcmia rapcmia moved this from Development 2.8.0 to Release 2.8.0 in Pull Request Board Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants