- Timestamp:
- 09/19/13 10:16:25 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Trading/3.4/ProblemData.cs
r9812 r9989 33 33 [Item("TradingProblemData", "Represents an item containing all data defining a trading problem.")] 34 34 public sealed class ProblemData : DataAnalysisProblemData, IProblemData { 35 private const string Price VariableParameterName = "PriceVariable";35 private const string PriceChangeVariableParameterName = "PriceChangeVariable"; 36 36 private const string TransactionCostsParameterName = "TransactionCosts"; 37 37 … … 1589 1589 1590 1590 static ProblemData() { 1591 defaultDataset = new Dataset(new string[] { " AUD" }, audInUsdDiff);1591 defaultDataset = new Dataset(new string[] { "d(AUD/USD)/dt" }, audInUsdDiff); 1592 1592 defaultDataset.Name = "AUD in USD"; 1593 defaultDataset.Description = " Price ofAustralian dollar in US dollar.";1594 defaultAllowedInputVariables = new List<string>() { " AUD" };1595 defaultPriceVariable = " AUD";1593 defaultDataset.Description = "Australian dollar in US dollar."; 1594 defaultAllowedInputVariables = new List<string>() { "d(AUD/USD)/dt" }; 1595 defaultPriceVariable = "d(AUD/USD)/dt"; 1596 1596 } 1597 1597 #endregion 1598 1598 1599 public IConstrainedValueParameter<StringValue> Price VariableParameter {1600 get { return (IConstrainedValueParameter<StringValue>)Parameters[Price VariableParameterName]; }1599 public IConstrainedValueParameter<StringValue> PriceChangeVariableParameter { 1600 get { return (IConstrainedValueParameter<StringValue>)Parameters[PriceChangeVariableParameterName]; } 1601 1601 } 1602 1602 public IValueParameter<DoubleValue> TransactionCostsParameter { 1603 1603 get { return (IValueParameter<DoubleValue>)Parameters[TransactionCostsParameterName]; } 1604 1604 } 1605 public string Price Variable {1606 get { return Price VariableParameter.Value.Value; }1605 public string PriceChangeVariable { 1606 get { return PriceChangeVariableParameter.Value.Value; } 1607 1607 } 1608 1608 public double TransactionCosts { … … 1630 1630 : base(dataset, allowedInputVariables) { 1631 1631 var variables = InputVariables.Select(x => x.AsReadOnly()).ToList(); 1632 Parameters.Add(new ConstrainedValueParameter<StringValue>(Price VariableParameterName, new ItemSet<StringValue>(variables), variables.First(x => x.Value == targetVariable)));1632 Parameters.Add(new ConstrainedValueParameter<StringValue>(PriceChangeVariableParameterName, new ItemSet<StringValue>(variables), variables.First(x => x.Value == targetVariable))); 1633 1633 Parameters.Add(new FixedValueParameter<DoubleValue>(TransactionCostsParameterName, "The absolute cost of on buy/sell transaction (assumed to be constant and independent of transaction volume)", new DoubleValue(0.0002))); 1634 1635 if (dataset.GetReadOnlyDoubleValues(targetVariable).Min() >= 0) throw new ArgumentException("The target variable must contain changes (deltas) of the asset price over time."); 1636 1634 1637 RegisterParameterEvents(); 1635 1638 } 1636 1639 1637 1640 private void RegisterParameterEvents() { 1638 Price VariableParameter.ValueChanged += new EventHandler(PriceVariableParameter_ValueChanged);1641 PriceChangeVariableParameter.ValueChanged += new EventHandler(PriceVariableParameter_ValueChanged); 1639 1642 TransactionCostsParameter.Value.ValueChanged += new EventHandler(TransactionCostsParameter_ValueChanged); 1640 1643 } … … 1644 1647 } 1645 1648 private void PriceVariableParameter_ValueChanged(object sender, EventArgs e) { 1649 if (Dataset.GetReadOnlyDoubleValues(PriceChangeVariable).Min() >= 0) throw new ArgumentException("The target variable must contain changes (deltas) of the asset price over time."); 1646 1650 OnChanged(); 1647 1651 }
Note: See TracChangeset
for help on using the changeset viewer.