We want to do a full revamp of balances so we can clearly see when we are making profit and how much risk and how efficient we are taking risk given the volatility.
- Balances is the endpoint currently used for PnL and the "Portfolio benchmarking" chart http://localhost:8008/account/balance-series
- We have multiple balances tables and deprecated/obsolete tables like staging and staging balance.
id | timestamp | asset | quantity | consolidated_balances_id
-----------------------+-------------+------+----------+--------------------------
647c1356-8baf-4880-8cf2-5c059938c328 | 1759253566993 | BTC | 1.164e-05 | 1759253566993
0dc920b6-9092-4803-a8a1-62d5f6640694 | 1759253566993 | NEO | 4.121786 | 1759253566993
02a680f9-99f2-42b1-bafb-6a544e28b872 | 1759253566993 | BNB | 2.63e-06 | 1759253566993
consolidated balances
id | estimated_total_fiat
---------------+----------------------
1759253566993 | 189.4308
1753488064007 | 228.6742
1753574464054 | 227.4141
1753660864079 | 227.5513
Actions
- Current payload of /account/balance-series, "usdc" should be renamed to "fiat" since the capital used can vary depending on changing circumstances.
{
"message": "Successfully retrieved balance series.",
"error": 0,
"data": {
"usdc": [
19.4353,
17.7455,
....
],
"btc": [
65966.0,
68438.71
],
"dates": [
1773014399999,
1773100799999,
]
}
}
- this endpoint is effectively returning the benchmark and the balance, so should be renamed to /account/portfolio/benchmark-series
- Calculate Sharpe ratio. AI prompt
- given that this data is being/going to be used in multiple places, add a new endpoint /account/portfolio/stats
"stats": {
"last_pnl": float,
"last_sharpe": float,
}
this should offload most of the logic that is currently done in front-end.
We want to do a full revamp of balances so we can clearly see when we are making profit and how much risk and how efficient we are taking risk given the volatility.
consolidated balances
Actions
this should offload most of the logic that is currently done in front-end.