Panel3 - Accounts Widget
You are writing the code for this Accounts Summary widget. This widget shows your Total Account Balance, as well as the individual balances for each of your accounts. In addition, it will show a SubTotal for each brokerage.
You have access to an API that returns a non-sorted JSON-encoded list of individual account balances as follows:
[{
"brokerageName": "Fidelity",
"account": "XXXX1423",
"balance": 12000.50,
},
{
"brokerageName": "Fidelity",
"account": "XXXX5678",
"balance": 2350.42
},
{
"brokerageName":"Etrade",
"account": "XXXX1111",
"balance": 11350.11
},
{
"brokerageName":"Etrade",
"account": "XXXX2899",
"balance": 1212.23
},
{
"brokerageName": "Scottrade",
"account": "XXXX2222",
"balance": 230012.23
},
...
]
Given that API, provide the code to output a list displaying the Account Balances, SubTotals, and Total, like so:
Account Total: 255713.26
Fidelity: 14350.92
XXXX1423 12000.50
XXXX5678 2350.42
Etrade: 12562.34
XXXX1111 11350.11
XXXX2899 1212.23
Scottrade: 230012.23
XXXX2222 230012.23
...