Spaces:
Running
Running
Benjamin Consolvo
commited on
Commit
·
0f500af
1
Parent(s):
e77df83
show number of shares in table
Browse files
app.py
CHANGED
@@ -585,9 +585,16 @@ def main():
|
|
585 |
with st.expander("View Detailed Holdings"):
|
586 |
holdings = app.alpaca.getHoldings() # Use self.alpaca instead of app.alpaca
|
587 |
if holdings:
|
588 |
-
|
589 |
-
|
590 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
st.table(detailed_holdings)
|
592 |
else:
|
593 |
st.info("No holdings to display.")
|
|
|
585 |
with st.expander("View Detailed Holdings"):
|
586 |
holdings = app.alpaca.getHoldings() # Use self.alpaca instead of app.alpaca
|
587 |
if holdings:
|
588 |
+
# Get positions to access both market value and quantity
|
589 |
+
positions = app.alpaca.alpaca.list_positions()
|
590 |
+
positions_data = []
|
591 |
+
for position in positions:
|
592 |
+
positions_data.append({
|
593 |
+
"Ticker": position.symbol,
|
594 |
+
"Shares": float(position.qty),
|
595 |
+
"Amount (USD)": round(float(position.market_value))
|
596 |
+
})
|
597 |
+
detailed_holdings = pd.DataFrame(positions_data)
|
598 |
st.table(detailed_holdings)
|
599 |
else:
|
600 |
st.info("No holdings to display.")
|