Add LastTradeDate NextTradeDate.
This commit is contained in:
@@ -41,10 +41,6 @@ namespace TradeBlotter.ViewModels
|
|||||||
private String initialPath=null;
|
private String initialPath=null;
|
||||||
private String pathFileName=null;
|
private String pathFileName=null;
|
||||||
|
|
||||||
// momentum candidate section
|
|
||||||
private String selectedDate = null;
|
|
||||||
private DateTime selectableDateStart=Utility.Epoch;
|
|
||||||
private DateTime selectableDateEnd=Utility.Epoch;
|
|
||||||
private ObservableCollection<MGSHMomentumCandidate> momentumCandidates=new ObservableCollection<MGSHMomentumCandidate>();
|
private ObservableCollection<MGSHMomentumCandidate> momentumCandidates=new ObservableCollection<MGSHMomentumCandidate>();
|
||||||
private MGSHMomentumCandidate selectedItem=null;
|
private MGSHMomentumCandidate selectedItem=null;
|
||||||
private RelayCommand runCommand;
|
private RelayCommand runCommand;
|
||||||
@@ -112,11 +108,6 @@ namespace TradeBlotter.ViewModels
|
|||||||
monitorIntervals.Add("90");
|
monitorIntervals.Add("90");
|
||||||
monitorIntervals.Add("120");
|
monitorIntervals.Add("120");
|
||||||
selectedMonitorInterval=monitorIntervals[0];
|
selectedMonitorInterval=monitorIntervals[0];
|
||||||
DateTime earliestPricingDate=PricingDA.GetEarliestDate();
|
|
||||||
earliestPricingDate+=new TimeSpan(252,0,0,0);
|
|
||||||
selectableDateStart=earliestPricingDate;
|
|
||||||
selectableDateEnd=PricingDA.GetLatestDate();
|
|
||||||
selectedDate=selectableDateEnd.ToShortDateString();
|
|
||||||
configuration=new MGSHConfiguration();
|
configuration=new MGSHConfiguration();
|
||||||
NVPCollection nvpCollection=configuration.ToNVPCollection();
|
NVPCollection nvpCollection=configuration.ToNVPCollection();
|
||||||
nvpDictionary=nvpCollection.ToDictionary();
|
nvpDictionary=nvpCollection.ToDictionary();
|
||||||
@@ -131,6 +122,8 @@ namespace TradeBlotter.ViewModels
|
|||||||
base.OnPropertyChanged("Parameters");
|
base.OnPropertyChanged("Parameters");
|
||||||
base.OnPropertyChanged("SelectedParameter");
|
base.OnPropertyChanged("SelectedParameter");
|
||||||
base.OnPropertyChanged("ParameterValue");
|
base.OnPropertyChanged("ParameterValue");
|
||||||
|
base.OnPropertyChanged("LastTradeDate");
|
||||||
|
base.OnPropertyChanged("NextTradeDate");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDispose()
|
protected override void OnDispose()
|
||||||
@@ -243,7 +236,6 @@ namespace TradeBlotter.ViewModels
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************************************************************************************
|
// ************************************************************************************************************************************************
|
||||||
// ************************************************************************************************************************************************
|
// ************************************************************************************************************************************************
|
||||||
// ************************************************************************************************************************************************
|
// ************************************************************************************************************************************************
|
||||||
@@ -265,23 +257,14 @@ namespace TradeBlotter.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime SelectableDateStart
|
|
||||||
{
|
|
||||||
get{return selectableDateStart;}
|
|
||||||
set{selectableDateStart=value;}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateTime SelectableDateEnd
|
|
||||||
{
|
|
||||||
get{return selectableDateEnd;}
|
|
||||||
set{selectableDateEnd=value;}
|
|
||||||
}
|
|
||||||
// ********************************************************************************************************************************************************************************
|
// ********************************************************************************************************************************************************************************
|
||||||
private void Run()
|
private void Run()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if(null==selectedDate)return;
|
if(null==sessionParams)return;
|
||||||
|
DateGenerator dateGenerator = new DateGenerator();
|
||||||
|
DateTime selectedDate = dateGenerator.FindPrevBusinessDay(sessionParams.TradeDate);
|
||||||
BusyIndicator = true;
|
BusyIndicator = true;
|
||||||
BusyContent="Running Momentum...";
|
BusyContent="Running Momentum...";
|
||||||
Task workerTask = Task.Factory.StartNew(() =>
|
Task workerTask = Task.Factory.StartNew(() =>
|
||||||
@@ -289,7 +272,7 @@ namespace TradeBlotter.ViewModels
|
|||||||
MGSHConfiguration localConfiguration=new MGSHConfiguration();
|
MGSHConfiguration localConfiguration=new MGSHConfiguration();
|
||||||
localConfiguration.MaxPositions = int.Parse(nvpDictionary["MaxPositions"].Value);
|
localConfiguration.MaxPositions = int.Parse(nvpDictionary["MaxPositions"].Value);
|
||||||
localConfiguration.HoldingPeriod = int.Parse(nvpDictionary["HoldingPeriod"].Value);
|
localConfiguration.HoldingPeriod = int.Parse(nvpDictionary["HoldingPeriod"].Value);
|
||||||
MGSHMomentumCandidates candidates = MGSHMomentumGenerator.GenerateMomentumWithFallback(Utility.ParseDate(selectedDate), configuration == null ? localConfiguration : configuration);
|
MGSHMomentumCandidates candidates = MGSHMomentumGenerator.GenerateMomentumWithFallback(selectedDate, configuration == null ? localConfiguration : configuration);
|
||||||
momentumCandidates=new ObservableCollection<MGSHMomentumCandidate>();
|
momentumCandidates=new ObservableCollection<MGSHMomentumCandidate>();
|
||||||
foreach(MGSHMomentumCandidate momentumCandidate in candidates)momentumCandidates.Add(momentumCandidate);
|
foreach(MGSHMomentumCandidate momentumCandidate in candidates)momentumCandidates.Add(momentumCandidate);
|
||||||
});
|
});
|
||||||
@@ -350,7 +333,6 @@ namespace TradeBlotter.ViewModels
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.Append(companyProfile.Sector).Append("/").Append(companyProfile.Industry).Append("\n").Append(companyProfile.Description);
|
sb.Append(companyProfile.Sector).Append("/").Append(companyProfile.Industry).Append("\n").Append(companyProfile.Description);
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
//return companyProfile.Description;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ****************************************************************************************************************************************************************
|
// ****************************************************************************************************************************************************************
|
||||||
@@ -376,13 +358,22 @@ namespace TradeBlotter.ViewModels
|
|||||||
set{selectedPosition=value;base.OnPropertyChanged("SelectedPosition");}
|
set{selectedPosition=value;base.OnPropertyChanged("SelectedPosition");}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String SelectedDate
|
public String LastTradeDate
|
||||||
{
|
{
|
||||||
get { return selectedDate; }
|
get
|
||||||
set
|
{
|
||||||
|
if(null == sessionParams)return Utility.DateTimeToStringMMSDDSYYYY(Utility.Epoch);
|
||||||
|
DateGenerator dateGenerator=new DateGenerator();
|
||||||
|
return Utility.DateTimeToStringMMSDDSYYYY(dateGenerator.FindPrevBusinessDay(sessionParams.TradeDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String NextTradeDate
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
selectedDate = value;
|
if(null == sessionParams)return Utility.DateTimeToStringMMSDDSYYYY(Utility.Epoch);
|
||||||
base.OnPropertyChanged("SelectedDate");
|
return Utility.DateTimeToStringMMSDDSYYYY(sessionParams.TradeDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1388,6 +1379,8 @@ namespace TradeBlotter.ViewModels
|
|||||||
base.OnPropertyChanged("ExpectationColor");
|
base.OnPropertyChanged("ExpectationColor");
|
||||||
base.OnPropertyChanged("ExpectationDescription");
|
base.OnPropertyChanged("ExpectationDescription");
|
||||||
base.OnPropertyChanged("ReloadEnabled");
|
base.OnPropertyChanged("ReloadEnabled");
|
||||||
|
base.OnPropertyChanged("LastTradeDate");
|
||||||
|
base.OnPropertyChanged("NextTradeDate");
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,15 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
|
<Label Grid.Row="0" Grid.Column="2" Grid.ColumnSpan="5" FontFamily="Arial" Content="{Binding Path=Title}" HorizontalAlignment="Center" FontSize="20"></Label>
|
||||||
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.RowSpan="3" Grid.Column="0" Margin="0,4.962,0.396,-5">
|
<StackPanel Orientation="Vertical" Grid.Row="2" Grid.RowSpan="3" Grid.Column="0" Margin="0,4.962,0.396,-5">
|
||||||
<Label Content="Date" HorizontalAlignment="Left" ></Label>
|
|
||||||
<telerik:RadDatePicker SelectableDateStart="{Binding Path=SelectableDateStart}" SelectableDateEnd="{Binding Path=SelectableDateEnd}" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedDate="{Binding Path=SelectedDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
|
||||||
|
|
||||||
|
<Label Content="Last Trade Date" HorizontalAlignment="Left" ></Label>
|
||||||
|
<TextBox Height="24" MinWidth="80" HorizontalAlignment="Stretch" IsReadOnly="true" Text="{Binding Path=LastTradeDate, Mode=OneWay}" />
|
||||||
|
<Label Content="Next Trade Date" HorizontalAlignment="Left" ></Label>
|
||||||
|
<TextBox Height="24" MinWidth="80" HorizontalAlignment="Stretch" IsReadOnly="true" Text="{Binding Path=NextTradeDate, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<!--<telerik:RadDatePicker SelectableDateStart="{Binding Path=SelectableDateStart}" SelectableDateEnd="{Binding Path=SelectableDateEnd}" VerticalAlignment="Top" HorizontalAlignment="Left" SelectedDate="{Binding Path=SelectedDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>-->
|
||||||
|
|
||||||
<Label Content="Parameters" HorizontalAlignment="Left" ></Label>
|
<Label Content="Parameters" HorizontalAlignment="Left" ></Label>
|
||||||
<ComboBox ItemsSource="{Binding Path=Parameters, Mode=OneWay}" SelectedItem="{Binding Path=SelectedParameter, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
|
<ComboBox ItemsSource="{Binding Path=Parameters, Mode=OneWay}" SelectedItem="{Binding Path=SelectedParameter, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
|
||||||
|
|||||||
Reference in New Issue
Block a user