Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/02/13 17:04:43 (11 years ago)
Author:
gkronber
Message:

#1508: merged r9804:9805,r9808:9809,r9811:9812,r9822,r9824:9825,r9897,r9928,r9938:9941,r9964:9965,r9989,r9991:9992,r9995,r9997,r10004:10015 from trunk into stable branch.

Location:
stable
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/ProblemData.cs

    r9745 r10020  
    3333  [Item("TradingProblemData", "Represents an item containing all data defining a trading problem.")]
    3434  public sealed class ProblemData : DataAnalysisProblemData, IProblemData {
    35     private const string PriceVariableParameterName = "PriceVariable";
     35    private const string PriceChangeVariableParameterName = "PriceChangeVariable";
    3636    private const string TransactionCostsParameterName = "TransactionCosts";
    3737
     
    15891589
    15901590    static ProblemData() {
    1591       defaultDataset = new Dataset(new string[] { "AUD" }, audInUsdDiff);
     1591      defaultDataset = new Dataset(new string[] { "d(AUD/USD)/dt" }, audInUsdDiff);
    15921592      defaultDataset.Name = "AUD in USD";
    1593       defaultDataset.Description = "Price of Australian 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";
    15961596    }
    15971597    #endregion
    15981598
    1599     public IValueParameter<StringValue> PriceVariableParameter {
    1600       get { return (IValueParameter<StringValue>)Parameters[PriceVariableParameterName]; }
     1599    public IConstrainedValueParameter<StringValue> PriceChangeVariableParameter {
     1600      get { return (IConstrainedValueParameter<StringValue>)Parameters[PriceChangeVariableParameterName]; }
    16011601    }
    16021602    public IValueParameter<DoubleValue> TransactionCostsParameter {
    16031603      get { return (IValueParameter<DoubleValue>)Parameters[TransactionCostsParameterName]; }
    16041604    }
    1605     public string PriceVariable {
    1606       get { return PriceVariableParameter.Value.Value; }
     1605    public string PriceChangeVariable {
     1606      get { return PriceChangeVariableParameter.Value.Value; }
    16071607    }
    16081608    public double TransactionCosts {
     
    16301630      : base(dataset, allowedInputVariables) {
    16311631      var variables = InputVariables.Select(x => x.AsReadOnly()).ToList();
    1632       Parameters.Add(new ConstrainedValueParameter<StringValue>(PriceVariableParameterName, 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)));
    16331633      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
    16341637      RegisterParameterEvents();
    16351638    }
    16361639
    16371640    private void RegisterParameterEvents() {
    1638       PriceVariableParameter.ValueChanged += new EventHandler(PriceVariableParameter_ValueChanged);
     1641      PriceChangeVariableParameter.ValueChanged += new EventHandler(PriceVariableParameter_ValueChanged);
    16391642      TransactionCostsParameter.Value.ValueChanged += new EventHandler(TransactionCostsParameter_ValueChanged);
    16401643    }
     
    16441647    }
    16451648    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.");
    16461650      OnChanged();
    16471651    }
Note: See TracChangeset for help on using the changeset viewer.