Skip to content

Commit

Permalink
view portfolio by tax-type
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelyea committed Jun 22, 2023
1 parent a23b52e commit f9974c2
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 87 deletions.
204 changes: 120 additions & 84 deletions Pages/Portfolio.razor
Original file line number Diff line number Diff line change
Expand Up @@ -129,84 +129,36 @@ Portfolio@(stepPath==null?": review":": "+stepPath.Replace('-',' ')) - bogle.too
<Label>&nbsp;&nbsp;View:&nbsp;</Label><InputSelect @bind-Value=familyData.PortfolioView >
<option>All Investments by Account</option>
<option>Group Investments by Ticker</option>
<option>Group Investments by Tax Type</option>
</InputSelect>
}

@if(familyData.PortfolioView == "Group Investments by Ticker")
{
<table>
@if (familyData.Accounts.Count > 0) {
<tr style=vertical-align:bottom>
<th>Name</th>
<th style=padding-left:8px>Ticker</th>
<th style=padding-left:8px;text-align:center>
@if (!string.IsNullOrEmpty(familyData.EODHistoricalDataApiKey))
{
<button @onclick=@refreshPrices title=Refresh>🔃</button>
} else {
<a href="updated-quotes">Enable<br/>updates.</a>
}
<br/>
<span>Price</span>
</th>
<th style=padding-left:8px>Quantity</th>
<th style=padding-left:8px>Balance</th>
<th style=padding-left:8px>% change</th>
<th style=padding-left:8px>as of</th>
</tr>
}
@foreach (var investment in familyData.GroupedInvestments) {
<tr>
<td>@investment.Name</td>
<td style=padding-left:8px title=@investment.Name>@investment.Ticker</td>
<td style=text-align:right;padding-left:8px>@formatMoney(investment.Price)</td>
<td style=text-align:right;padding-left:8px>@formatDoubleFourDecimal(investment.Shares)</td>
<td style=text-align:right;padding-left:8px>@formatMoney(investment.Value)</td>
<td style=text-align:right;padding-left:8px>@formatPercent3(investment.PercentChange)</td>
<td style=text-align:right;padding-left:8px title=@investment.LastUpdated>@investment.LastUpdated?.ToShortTimeString()</td>
</tr>
}
<tr>
<td style=text-align:right;padding-left:8px colspan="5">
<hr/><b>@(formatMoney(familyData.Value))</b>
<br/>today's change: <i>@formatMoney(portfolioChange())</i>
</td>
<td></td>
<td></td>
</tr>
</table>
}
else
{
<table>
@if (familyData.Accounts.Count > 0) {
<tr style=vertical-align:bottom>
<th>Account</th>
<th style=padding-left:8px></th>
<th style=padding-left:8px>Type</th>
<th style=padding-left:8px>Ticker</th>
<th style=padding-left:8px;text-align:center>
@if (familyData.EODHistoricalDataApiKey != null)
{
<button @onclick=@refreshPrices title=Refresh>🔃</button>
} else {
<a href="updated-quotes">Enable<br/>updates.</a>
}
<br/>
<span>Price</span>
</th>
<th style=padding-left:8px>Quantity</th>
<th style=padding-left:8px>Balance</th>
<th style=padding-left:8px>% change</th>
<th style=padding-left:8px>as of</th>
</tr>
}
@foreach (var account in familyData.Accounts) {
@foreach (var investment in account.Investments) {
@switch (familyData.PortfolioView) {
case "Group Investments by Ticker":
<table>
@if (familyData.Accounts.Count > 0) {
<tr style=vertical-align:bottom>
<th>Name</th>
<th style=padding-left:8px>Ticker</th>
<th style=padding-left:8px;text-align:center>
@if (!string.IsNullOrEmpty(familyData.EODHistoricalDataApiKey))
{
<button @onclick=@refreshPrices title=Refresh>🔃</button>
} else {
<a href="updated-quotes">Enable<br/>updates.</a>
}
<br/>
<span>Price</span>
</th>
<th style=padding-left:8px>Quantity</th>
<th style=padding-left:8px>Balance</th>
<th style=text-align:right;padding-left:8px>% change<br/>today</th>
<th style=padding-left:8px>as of</th>
</tr>
}
@foreach (var investment in familyData.GroupedInvestments) {
<tr>
<td>@((account.Custodian != null ? account.Custodian + " ": "")+ account.Note)</td>
<td style=padding-left:8px>@account.Identifier</td>
<td style=padding-left:8px>@account.AccountType</td>
<td>@investment.Name</td>
<td style=padding-left:8px title=@investment.Name>@investment.Ticker</td>
<td style=text-align:right;padding-left:8px>@formatMoney(investment.Price)</td>
<td style=text-align:right;padding-left:8px>@formatDoubleFourDecimal(investment.Shares)</td>
Expand All @@ -215,16 +167,100 @@ Portfolio@(stepPath==null?": review":": "+stepPath.Replace('-',' ')) - bogle.too
<td style=text-align:right;padding-left:8px title=@investment.LastUpdated>@investment.LastUpdated?.ToShortTimeString()</td>
</tr>
}
}
<tr>
<td style=text-align:right;padding-left:8px colspan=7>
<hr/><b>@(formatMoney(familyData.Value))</b>
<br/>today's change: <i>@formatMoney(portfolioChange())</i>
</td>
<td></td>
<td></td>
</tr>
</table>
<tr>
<td style=text-align:right;padding-left:8px colspan="5">
<hr/><b>@(formatMoney(familyData.Value))</b>
<br/>today's change: <i>@formatMoney(portfolioChange())</i>
</td>
<td></td>
<td></td>
</tr>
</table>
break;
case "All Investments by Account":
<table>
@if (familyData.Accounts.Count > 0) {
<tr style=vertical-align:bottom>
<th>Account</th>
<th style=padding-left:8px></th>
<th style=padding-left:8px>Type</th>
<th style=padding-left:8px>Ticker</th>
<th style=padding-left:8px;text-align:center>
@if (familyData.EODHistoricalDataApiKey != null)
{
<button @onclick=@refreshPrices title=Refresh>🔃</button>
} else {
<a href="updated-quotes">Enable<br/>updates.</a>
}
<br/>
<span>Price</span>
</th>
<th style=padding-left:8px>Quantity</th>
<th style=padding-left:8px>Balance</th>
<th style=text-align:right;padding-left:8px>% change<br/>today</th>
<th style=padding-left:8px>as of</th>
</tr>
}
@foreach (var account in familyData.Accounts) {
@foreach (var investment in account.Investments) {
<tr>
<td>@((account.Custodian != null ? account.Custodian + " ": "")+ account.Note)</td>
<td style=padding-left:8px>@account.Identifier</td>
<td style=padding-left:8px>@account.AccountType</td>
<td style=padding-left:8px title=@investment.Name>@investment.Ticker</td>
<td style=text-align:right;padding-left:8px>@formatMoney(investment.Price)</td>
<td style=text-align:right;padding-left:8px>@formatDoubleFourDecimal(investment.Shares)</td>
<td style=text-align:right;padding-left:8px>@formatMoney(investment.Value)</td>
<td style=text-align:right;padding-left:8px>@formatPercent3(investment.PercentChange)</td>
<td style=text-align:right;padding-left:8px title=@investment.LastUpdated>@investment.LastUpdated?.ToShortTimeString()</td>
</tr>
}
}
<tr>
<td style=text-align:right;padding-left:8px colspan=7>
<hr/><b>@(formatMoney(familyData.Value))</b>
<br/>today's change: <i>@formatMoney(portfolioChange())</i>
</td>
<td></td>
<td></td>
</tr>
</table>
break;
case "Group Investments by Tax Type":
<table>
@if (familyData.Accounts.Count > 0) {
<tr style=vertical-align:bottom>
<th>Tax-Type</th>
<th style=padding-left:8px;text-align:center>
@if (!string.IsNullOrEmpty(familyData.EODHistoricalDataApiKey))
{
<button @onclick=@refreshPrices title=Refresh>🔃</button>
} else {
<a href="updated-quotes">Enable<br/>updates.</a>
}
<br/>
Balance
</th>
</tr>
}
@foreach (var investment in familyData.GroupedInvestmentsByTaxType) {
<tr>
<td>@investment.Name</td>
<td style=text-align:right;padding-left:8px>@formatMoney(investment.Value)</td>
</tr>
}
<tr>
<td style=text-align:right;padding-left:8px colspan="4">
<hr/><b>@(formatMoney(familyData.Value))</b>
<br/>today's change: <i>@formatMoney(portfolioChange())</i>
</td>
<td></td>
<td></td>
</tr>
</table>
break;
default:
break;
}
<br/>
<fieldset>
Expand Down
7 changes: 4 additions & 3 deletions Pages/Profiles.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

<h1>bogle.tools profiles</h1>

Click on profile name to make it the active profile, then navigate to which ever tool you'd like to use.<br/>

<ul>

@foreach(var profileName in appData.ProfileNames)
{
<li><a href=/portfolio @onclick="@(e=>gotoProfile(e,profileName))" @onclick:preventDefault>@profileName</a></li>
<li><a href=/portfolio @onclick="@(e=>makeProfileActive(e,profileName))" @onclick:preventDefault>@profileName</a> @if(profileName==appData.CurrentProfileName){<b>&nbsp;[active]</b>}</li>
}

</ul>
Expand All @@ -22,12 +23,12 @@
<InputText placeholder="name" @bind-Value="@newProfileName" /><button @onclick="createProfile">create</button>

@code {
private async Task gotoProfile(EventArgs e, string profileName)
private async Task makeProfileActive(EventArgs e, string profileName)
{
appData.CurrentProfileName = profileName;
await ProfileUtilities.Load(appData);
Navigation.NavigateTo("/portfolio");
}

private async Task createProfile()
{
if (!string.IsNullOrEmpty(newProfileName)) {
Expand Down
Loading

0 comments on commit f9974c2

Please sign in to comment.