Add framework for BollingerBandView

This commit is contained in:
2025-06-13 16:54:40 -04:00
parent b337170c39
commit 9d7a18df54
13 changed files with 916 additions and 67 deletions

View File

@@ -0,0 +1,79 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:PortfolioManager.ViewModels"
xmlns:vw="using:PortfolioManager.Views"
xmlns:md="using:PortfolioManager.Models"
xmlns:local="using:PortfolioManager.UIUtils"
xmlns:li="using:LoadingIndicators.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:mxc="https://schemas.eremexcontrols.net/avalonia/charts"
x:DataType="vm:BollingerBandViewModel"
x:Class="PortfolioManager.Views.BollingerBandView"
>
<UserControl.Resources>
<local:CurrencyValueConverter x:Key="CurrencyFormat"/>
<local:DoubleValueConverter x:Key="DoubleFormat"/>
<local:IntValueConverter x:Key="IntFormat"/>
<local:DateValueConverter x:Key="DateFormat"/>
<local:RMultipleValueConverter x:Key="RMultipleFormat"/>
<local:BoolValueConverter x:Key="BoolFormat"/>
</UserControl.Resources>
<Grid Background="LightGray">
<li:LoadingIndicator ZIndex="1" IsActive="{Binding IsBusy}" Mode="Arcs" SpeedRatio="1.2" Width="200" Height="200"/>
<DockPanel>
<Grid Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="6" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="3" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="89*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
<!-- Fields go here -->
<!-- <Label Content="Watch List" HorizontalAlignment="Left"></Label>
<ComboBox ItemsSource="{Binding Path=WatchListNames, Mode=OneTime}" SelectedItem="{Binding Path=SelectedWatchList}" ></ComboBox>
<Label Content="Symbol" HorizontalAlignment="Left"></Label>
<ComboBox Name="cbSymbols" ItemsSource="{Binding Path=Symbols, Mode=OneWay}" SelectedItem="{Binding Path=SelectedSymbol}" UseLayoutRounding="False" >
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>true
</ComboBox.ItemsPanel>
</ComboBox>
<Label Content="Day Count" HorizontalAlignment="Left" ></Label>
<ComboBox ItemsSource="{Binding Path=DayCounts, Mode=OneWay}" SelectedItem="{Binding Path=SelectedDayCount}" ></ComboBox>
<Button Margin="0,2" Content="Refresh" HorizontalAlignment="Left" Command="{Binding Path=RefreshCommand}"></Button> -->
</StackPanel>
<!-- <CheckBox Content="Sync Trade To Band" IsChecked="{Binding Mode=TwoWay,Path=SyncTradeToBand}" Grid.ColumnSpan="3" Grid.Row="3" Height="16" HorizontalAlignment="Left" Margin="5,6,0,0" VerticalAlignment="Top" />
<CheckBox Content="Show Trade Labels" IsChecked="{Binding Mode=TwoWay,Path=ShowTradeLabels}" Grid.ColumnSpan="3" Grid.Row="4" Height="16" HorizontalAlignment="Left" Margin="5,6,0,0" VerticalAlignment="Top" />
<CheckBox Content="Show Insider Transactions" IsChecked="{Binding Mode=TwoWay,Path=CheckBoxShowInsiderTransactions}" Grid.ColumnSpan="3" Grid.Row="5" Height="16" HorizontalAlignment="Left" Margin="5,6,0,0" VerticalAlignment="Top" />
<CheckBox Content="Legend Visible" IsChecked="{Binding Mode=TwoWay,Path=CheckBoxLegendVisible}" Grid.ColumnSpan="3" Grid.Row="6" Height="16" HorizontalAlignment="Left" Margin="5,6,0,0" VerticalAlignment="Top" />
<CheckBox Content="Least Squares Fit" IsChecked="{Binding Mode=TwoWay,Path=LeastSquaresFit}" Grid.ColumnSpan="3" Grid.Row="7" Height="16" HorizontalAlignment="Left" Margin="5,6,0,0" VerticalAlignment="Top" />
<CheckBox Content="Show Risk Free" IsChecked="{Binding Mode=TwoWay,Path=ShowRiskFree}" Grid.ColumnSpan="3" Grid.Row="8" Height="16" HorizontalAlignment="Left" Margin="5,6,0,0" VerticalAlignment="Top" /> -->
</Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="3*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- The Chart goes here at grid.row =0 -->
</Grid>
</DockPanel>
</Grid>
</UserControl>

View File

@@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace PortfolioManager.Views;
public partial class BollingerBandView : UserControl
{
public BollingerBandView()
{
InitializeComponent();
}
}

View File

@@ -29,7 +29,6 @@
</Style>
</UserControl.Styles>
<Grid Background="LightGray">
<li:LoadingIndicator ZIndex="1" IsActive="{Binding IsBusy}" Mode="Arcs" SpeedRatio="1.2" Width="200" Height="200"/>
<DockPanel>
@@ -70,8 +69,6 @@
<Label Content="Hedge Cash" HorizontalAlignment="Center" ></Label>
<TextBox Height="24" MinWidth="80" HorizontalAlignment="Stretch" IsReadOnly="true" Text="{Binding Path=HedgeCash, Mode=OneWay, DataType={x:Type vm:MGSHMomentumViewModel}}" />
<Button Content="Find Candidates" HorizontalAlignment="Stretch" Command="{Binding Path=RunCommand, DataType={x:Type vm:MGSHMomentumViewModel}}"></Button>
<Button Content="Load Trade File" HorizontalAlignment="Stretch" Command="{Binding Path=LoadFileCommand}"></Button>
<Button Content="Reload" HorizontalAlignment="Stretch" Command="{Binding Path=ReloadCommand}" IsEnabled="{Binding Path=ReloadEnabled}"></Button>

View File

@@ -34,6 +34,9 @@
<DataTemplate DataType="vm:GainLossViewModel">
<vw:GainLossView />
</DataTemplate>
<DataTemplate DataType="vm:BollingerBandViewModel">
<vw:BollingerBandView />
</DataTemplate>
</Window.DataTemplates>
<Window.Styles>