Skip to content

Commit 997b796

Browse files
committed
Added "Avg Buy" price to Positions
1 parent 59123b5 commit 997b796

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

ViewModels/PositionRowVm.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using CommunityToolkit.Mvvm.ComponentModel;
1+
using CommunityToolkit.Mvvm.ComponentModel;
22
using CryptoJournal.Wpf.Domain.Models;
33
using System.Windows.Media;
44

@@ -24,6 +24,10 @@ public PositionRowVm(PositionSnapshot snapshot)
2424
public decimal Quantity { get; } // position qty (base)
2525
public decimal CostBasisQuote { get; } // in quote currency (e.g., USDT)
2626

27+
/// <summary>Average buy price per unit (break-even price).</summary>
28+
public decimal? AvgBuyPrice =>
29+
Quantity > 0m ? CostBasisQuote / Quantity : null;
30+
2731
// Source value that changes over time
2832
[ObservableProperty]
2933
[NotifyPropertyChangedFor(nameof(MarketValueQuote))]

Views/PositionsView.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@
8888
</DataGridTemplateColumn.CellTemplate>
8989
</DataGridTemplateColumn>
9090
<DataGridTextColumn Header="CostBasis (quote)" Binding="{Binding CostBasisQuote, StringFormat={}{0:C2}}"/>
91+
<DataGridTextColumn Header="Avg Buy" Binding="{Binding AvgBuyPrice, StringFormat={}{0:C2}, TargetNullValue=—}"
92+
SortMemberPath="AvgBuyPrice"/>
9193
<DataGridTextColumn Header="Mark" Binding="{Binding MarkPriceQuote, StringFormat={}{0:C2}}"/>
9294
<DataGridTextColumn Header="Market Value" Binding="{Binding MarketValueQuote, StringFormat={}{0:C2}}"
9395
SortMemberPath="MarketValueQuote" SortDirection="Descending"/>

setupGenerateScript.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define MyAppName "CryptoJournal"
2-
#define MyAppVersion "1.0.2"
2+
#define MyAppVersion "1.0.3"
33
#define MyAppPublisher "ButterDevelop"
44
#define MyAppURL "https://github.com/ButterDevelop/CryptoJournal.Wpf"
55
#define MyAppExeName "CryptoJournal.Wpf.exe"

0 commit comments

Comments
 (0)