@page "/portfolio"
@attribute [Authorize]
@inject HttpClient Http
QuantEngine - 포트폴리오
포트폴리오
자산 구성 및 성과 분석
총 평가액
₩125.5M
+3.2% (이번 달)
보유 종목
12개
주식 및 펀드
수익률
+8.5%
연간 기준
위험도
중간
Moderate
자산 구성
종목/펀드명
수량
현재가
평가액
수익률
비율
@context.Name[0]
@context.Name
@context.Ticker
@context.Quantity.ToString("N0")
₩@context.CurrentPrice.ToString("N0")
₩@context.Value.ToString("N0")
@(context.ReturnRate >= 0 ? "+" : "")@context.ReturnRate.ToString("F1")%
@context.Ratio.ToString("F1")%
자산 분류
@foreach (var category in AssetCategories)
{
@category.Name
@category.Percentage%
}
거래 이력
@if (TradingHistory.Count == 0)
{
거래 이력이 없습니다.
}
else
{
일자
종목
구분
수량
단가
금액
수수료
@context.Date.ToString("yyyy-MM-dd")
@context.Ticker
@context.Type
@context.Quantity
₩@context.Price.ToString("N0")
₩@context.Amount.ToString("N0")
₩@context.Fee.ToString("N0")
}
@code {
private List Assets = new();
private List AssetCategories = new();
private List TradingHistory = new();
protected override async Task OnInitializedAsync()
{
await LoadAssets();
}
private async Task LoadAssets()
{
Assets = new List
{
new AssetModel { Name = "삼성전자", Ticker = "005930", Quantity = 50, CurrentPrice = 70000, Value = 3500000, ReturnRate = 5.2, Ratio = 28.0 },
new AssetModel { Name = "LG화학", Ticker = "051910", Quantity = 30, CurrentPrice = 820000, Value = 24600000, ReturnRate = -2.1, Ratio = 19.6 },
new AssetModel { Name = "현대차", Ticker = "005380", Quantity = 40, CurrentPrice = 245000, Value = 9800000, ReturnRate = 8.5, Ratio = 7.8 },
new AssetModel { Name = "SK하이닉스", Ticker = "000660", Quantity = 25, CurrentPrice = 105000, Value = 2625000, ReturnRate = 12.3, Ratio = 2.1 },
new AssetModel { Name = "삼성중공업", Ticker = "010140", Quantity = 60, CurrentPrice = 85000, Value = 5100000, ReturnRate = 3.7, Ratio = 4.1 },
new AssetModel { Name = "포스코", Ticker = "005490", Quantity = 20, CurrentPrice = 75000, Value = 1500000, ReturnRate = -5.2, Ratio = 1.2 },
};
AssetCategories = new List
{
new CategoryModel { Name = "대형주", Percentage = 45, Color = Color.Primary },
new CategoryModel { Name = "중형주", Percentage = 30, Color = Color.Secondary },
new CategoryModel { Name = "소형주", Percentage = 15, Color = Color.Info },
new CategoryModel { Name = "채권/현금", Percentage = 10, Color = Color.Success }
};
TradingHistory = new List
{
new TradeModel { Date = DateTime.Now.AddDays(-5), Ticker = "005930", Type = "매수", Quantity = 10, Price = 68000, Amount = 680000, Fee = 1360 },
new TradeModel { Date = DateTime.Now.AddDays(-10), Ticker = "051910", Type = "매도", Quantity = 5, Price = 850000, Amount = 4250000, Fee = 8500 },
new TradeModel { Date = DateTime.Now.AddDays(-15), Ticker = "005380", Type = "매수", Quantity = 20, Price = 240000, Amount = 4800000, Fee = 9600 },
};
await Task.CompletedTask;
}
private class AssetModel
{
public string Name { get; set; }
public string Ticker { get; set; }
public int Quantity { get; set; }
public decimal CurrentPrice { get; set; }
public decimal Value { get; set; }
public decimal ReturnRate { get; set; }
public decimal Ratio { get; set; }
}
private class CategoryModel
{
public string Name { get; set; }
public int Percentage { get; set; }
public Color Color { get; set; }
}
private class TradeModel
{
public DateTime Date { get; set; }
public string Ticker { get; set; }
public string Type { get; set; }
public int Quantity { get; set; }
public decimal Price { get; set; }
public decimal Amount { get; set; }
public decimal Fee { get; set; }
}
}