Add LastTradeDate NextTradeDate.
This commit is contained in:
@@ -41,10 +41,6 @@ namespace TradeBlotter.ViewModels
|
||||
private String initialPath=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 MGSHMomentumCandidate selectedItem=null;
|
||||
private RelayCommand runCommand;
|
||||
@@ -112,11 +108,6 @@ namespace TradeBlotter.ViewModels
|
||||
monitorIntervals.Add("90");
|
||||
monitorIntervals.Add("120");
|
||||
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();
|
||||
NVPCollection nvpCollection=configuration.ToNVPCollection();
|
||||
nvpDictionary=nvpCollection.ToDictionary();
|
||||
@@ -131,6 +122,8 @@ namespace TradeBlotter.ViewModels
|
||||
base.OnPropertyChanged("Parameters");
|
||||
base.OnPropertyChanged("SelectedParameter");
|
||||
base.OnPropertyChanged("ParameterValue");
|
||||
base.OnPropertyChanged("LastTradeDate");
|
||||
base.OnPropertyChanged("NextTradeDate");
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
try
|
||||
{
|
||||
if(null==selectedDate)return;
|
||||
if(null==sessionParams)return;
|
||||
DateGenerator dateGenerator = new DateGenerator();
|
||||
DateTime selectedDate = dateGenerator.FindPrevBusinessDay(sessionParams.TradeDate);
|
||||
BusyIndicator = true;
|
||||
BusyContent="Running Momentum...";
|
||||
Task workerTask = Task.Factory.StartNew(() =>
|
||||
@@ -289,7 +272,7 @@ namespace TradeBlotter.ViewModels
|
||||
MGSHConfiguration localConfiguration=new MGSHConfiguration();
|
||||
localConfiguration.MaxPositions = int.Parse(nvpDictionary["MaxPositions"].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>();
|
||||
foreach(MGSHMomentumCandidate momentumCandidate in candidates)momentumCandidates.Add(momentumCandidate);
|
||||
});
|
||||
@@ -350,7 +333,6 @@ namespace TradeBlotter.ViewModels
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(companyProfile.Sector).Append("/").Append(companyProfile.Industry).Append("\n").Append(companyProfile.Description);
|
||||
return sb.ToString();
|
||||
//return companyProfile.Description;
|
||||
}
|
||||
}
|
||||
// ****************************************************************************************************************************************************************
|
||||
@@ -376,13 +358,22 @@ namespace TradeBlotter.ViewModels
|
||||
set{selectedPosition=value;base.OnPropertyChanged("SelectedPosition");}
|
||||
}
|
||||
|
||||
public String SelectedDate
|
||||
public String LastTradeDate
|
||||
{
|
||||
get { return selectedDate; }
|
||||
set
|
||||
get
|
||||
{
|
||||
selectedDate = value;
|
||||
base.OnPropertyChanged("SelectedDate");
|
||||
if(null == sessionParams)return Utility.DateTimeToStringMMSDDSYYYY(Utility.Epoch);
|
||||
DateGenerator dateGenerator=new DateGenerator();
|
||||
return Utility.DateTimeToStringMMSDDSYYYY(dateGenerator.FindPrevBusinessDay(sessionParams.TradeDate));
|
||||
}
|
||||
}
|
||||
|
||||
public String NextTradeDate
|
||||
{
|
||||
get
|
||||
{
|
||||
if(null == sessionParams)return Utility.DateTimeToStringMMSDDSYYYY(Utility.Epoch);
|
||||
return Utility.DateTimeToStringMMSDDSYYYY(sessionParams.TradeDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1388,6 +1379,8 @@ namespace TradeBlotter.ViewModels
|
||||
base.OnPropertyChanged("ExpectationColor");
|
||||
base.OnPropertyChanged("ExpectationDescription");
|
||||
base.OnPropertyChanged("ReloadEnabled");
|
||||
base.OnPropertyChanged("LastTradeDate");
|
||||
base.OnPropertyChanged("NextTradeDate");
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,15 @@
|
||||
</Grid.RowDefinitions>
|
||||
<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">
|
||||
<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>
|
||||
<ComboBox ItemsSource="{Binding Path=Parameters, Mode=OneWay}" SelectedItem="{Binding Path=SelectedParameter, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}" >
|
||||
|
||||
Reference in New Issue
Block a user