Skip to content

Commit

Permalink
portfolio tracking section with price updating
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelyea committed Jun 19, 2023
1 parent 23706ee commit 5dea594
Show file tree
Hide file tree
Showing 11 changed files with 1,411 additions and 255 deletions.
4 changes: 3 additions & 1 deletion Pages/About.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This site aims to provide useful tools to people interested in optimizing their
It provides tools to help you:
<ul>
<li>Organize your Portfolio</li>
<li>Portfolio Review via bogleheads.org</li>
<li>Plan Annual Saving</li>
<!--<li>Plan Retirement</li>-->
</ul>
Expand All @@ -18,6 +19,7 @@ It provides tools to help you:
<br/>
<p><b>Feedback Welcome:</b> via email to <a href="mailto:[email protected]">suggestions@bogle.tools</a> or via Private Message to Rob Relyea on bogleheads.org</p>
<br/>
<b>Privacy</b> - None of the answers you fill out on this site get sent to a server. All data and calculations are done on your device (PC/Phone/Tablet).<br/>
<b>Privacy</b> - None of your data leaves this device (PC/Phone/Tablet). If you save it, it will be saved to this browser's local storage only.<br/>
(if you set up stock price updating, requests for quotes contain ticker symbols only.)<br/>
<br/>
<b>Programmers</b> - This site is open source. See <a target=_blank href='https://github.com/bogle-tools/site'>github.com/bogle-tools/site</a> ↗️ for code and an issues list.<br/>
1 change: 1 addition & 0 deletions Pages/Home.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bogle.tools
</PageTitle>

<p><a href='portfolio'><span style="margin:3;font-Size:24pt">📈</span> Portfolio</a> - organize your portfolio</p>
<p><a href='portfolio-review'><span style="margin:3;font-Size:24pt">🤔</span> Portfolio Review</a> - gather background info and questions</p>
<p><a href='saving'><span style="margin:3;font-Size:24pt">💰</span> Saving Plan</a> - plan your annual savings</p>
<!--<p><a href='retirement'><span style="margin:3;font-Size:24pt">🎉</span> Retirement Plan</a> - plan your retirement</p>-->
<hr/>
Expand Down
1,251 changes: 1,251 additions & 0 deletions Pages/Portfolio-Review.razor

Large diffs are not rendered by default.

285 changes: 85 additions & 200 deletions Pages/Portfolio.razor

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions Pages/Updated-quotes.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@page "/updated-quotes"
@inject IAppData appData


<PageTitle>Updated Quotes</PageTitle>

<h1>Updated Stock/Fund Quotes</h1>

The <a href=/portfolio>portfolio tool</a> can have prices of stocks/funds updated, but you need a free account at EODHistoricalData.com<br/><br/>

Steps:
<ol>
<li><a href=https://eodhistoricaldata.com/register target=_new>Register</a> for free account for updated quotes at EODHistoricalData.com. They will email a free API key. You'll get 20 free quotes a day. (And can buy another 100,000 quotes for $5 from that site, which is 200 quotes per penny.)</li>
<li>Enter key into this tool. Then press Save button at top-right of page.</li>
<EditForm Model="familyData">
<label>EODHistoricalData.com free API key:</label><input type=text @bind-Value=familyData.EODHistoricalDataApiKey @bind-Value:event=oninput placeholder='apikey' />
</EditForm>
</ol>
<p></p>

@code{
private FamilyData familyData {
get {
return appData.FamilyData;
}
set {
appData.FamilyData = value;
}
}
}
7 changes: 5 additions & 2 deletions Shared/Models/FamilyData/Importer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public static async Task<List<Account>> ImportCSV(string[] lines, IList<Fund> fu

string? investmentName;
double value;
double? price = null;
double? shares = null;
double? costBasis = null;

Expand All @@ -193,6 +194,7 @@ public static async Task<List<Account>> ImportCSV(string[] lines, IList<Fund> fu
{
investmentName = chunks[3];
value = ParseDouble(chunks[7], allowCurrency:true);
price = ParseDouble(chunks[5], allowCurrency:true);
shares = ParseDouble(chunks[4]);
costBasis = ParseDouble(chunks[13], allowCurrency:true);
}
Expand All @@ -209,7 +211,7 @@ public static async Task<List<Account>> ImportCSV(string[] lines, IList<Fund> fu
lastAccountNumber = accountNumber;
}

Investment newInvestment = new () { funds = funds, Ticker = symbol, Name = investmentName, Value = value, Shares = shares, CostBasis = costBasis };
Investment newInvestment = new () { funds = funds, Ticker = symbol, Name = investmentName, Price = price, Value = value, Shares = shares, CostBasis = costBasis };
newAccount?.Investments.Add(newInvestment);
}

Expand All @@ -235,6 +237,7 @@ public static async Task<List<Account>> ImportCSV(string[] lines, IList<Fund> fu
var symbol = chunks[2];
var investmentName = chunks[1];
double shares = ParseDouble(chunks[3]);
double price = ParseDouble(chunks[4], allowCurrency:true);
double value = ParseDouble(chunks[5], allowCurrency:true);
// costBasis not available in CSV

Expand All @@ -247,7 +250,7 @@ public static async Task<List<Account>> ImportCSV(string[] lines, IList<Fund> fu
importedAccounts.Add(newAccount);
}

Investment newInvestment = new () { funds = funds, Ticker = symbol, Name = investmentName, Value = value, Shares = shares };
Investment newInvestment = new () { funds = funds, Ticker = symbol, Name = investmentName, Price = price, Value = value, Shares = shares };
newAccount?.Investments.Add(newInvestment);
}

Expand Down
5 changes: 5 additions & 0 deletions Shared/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<span style="margin:3;font-Size:24pt">📈</span>&nbsp;Portfolio
</NavLink>
</div>
<div class="nav-item px-2">
<NavLink class="nav-link" href="/portfolio-review">
<span style="margin:3;font-Size:24pt">🤔</span>&nbsp;Portfolio Review
</NavLink>
</div>
<div class="nav-item px-2">
<NavLink class="nav-link" href="/saving">
<span style="margin:3;font-Size:24pt">💰</span>&nbsp;Saving Plan
Expand Down
7 changes: 2 additions & 5 deletions Shared/TopLine.razor
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
@inject IJSRuntime JS

<div style=position:absolute;right:0px;padding:10px>
<EditForm Model="familyData">
<label>key:</label><input type=text @bind-Value=familyData.EODHistoricalDataApiKey @bind-Value:event=oninput placeholder='apikey' />
<button @onclick=@Save>Save</button>
<button @onclick=@Clear>Clear</button>
</EditForm>
Your data is <a style=margin-left:0px href=/about>kept private</a>: <button @onclick=@Save>Save</button> or
<button @onclick=@Clear>Erase</button>
</div>

@code{
Expand Down
47 changes: 0 additions & 47 deletions portfolio.json

This file was deleted.

29 changes: 29 additions & 0 deletions wwwroot/data/portfolio-assets-steps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
{
"step": "age",
"title": "Age",
"number": 1,
"summary": "",
"priority": "",
"returns": "",
"description": ""
},
{
"step": "asset-allocation",
"title": "Asset Allocation",
"number": 2,
"summary": "What is your desired [[Asset allocation|asset allocation]] (ratio of stocks to bonds)?",
"priority": "",
"returns": "",
"description": ""
},
{
"step": "retirement-assets",
"title": "Retirement Assets",
"number": 3,
"summary": "",
"priority": "",
"returns": "",
"description": ""
}
]
File renamed without changes.

0 comments on commit 5dea594

Please sign in to comment.