Ignore:
Timestamp:
10/02/13 17:04:43 (9 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:
1 deleted
20 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Calculators/OnlineProfitCalculator.cs

    r9744 r10020  
    2828  public class OnlineProfitCalculator : IOnlineCalculator {
    2929
    30     private int p;
     30    private int position; // currently held position: -1: short, 0: out of market, 1: long
    3131    private readonly double transactionCost;
    32     private int c;
    33     private double sum;
     32    private int count; // only necessary to reset position and total profit on the first data point
     33    private double totalProfit;
    3434    public double Profit {
    35       get { return sum; }
     35      get { return totalProfit; }
    3636    }
    3737
     
    4949    }
    5050    public void Reset() {
    51       p = 0;
    52       c = 0;
    53       sum = 0.0;
     51      position = 0;
     52      count = 0;
     53      totalProfit = 0.0;
    5454    }
    5555
    5656    public void Add(double actualReturn, double signal) {
    57       double iterationReturn = 0.0;
    58       if (c == 0) {
    59         p = (int)signal;
    60         iterationReturn = 0;
    61         c++;
     57      double profit = 0.0;
     58      if (count == 0) {
     59        position = (int)signal;
     60        profit = 0;
     61        count++;
    6262      } else {
    63         if (p == 0 && signal.IsAlmost(0)) {
    64         } else if (p == 0 && signal.IsAlmost(1)) {
    65           p = 1;
    66           iterationReturn = -transactionCost;
    67         } else if (p == 0 && signal.IsAlmost(-1)) {
    68           p = -1;
    69           iterationReturn = -transactionCost;
    70         } else if (p == 1 && signal.IsAlmost(1)) {
    71           iterationReturn = actualReturn;
    72         } else if (p == 1 && signal.IsAlmost(0)) {
    73           iterationReturn = actualReturn - transactionCost;
    74           p = 0;
    75         } else if (p == 1 && signal.IsAlmost(-1)) {
    76           iterationReturn = actualReturn - transactionCost;
    77           p = -1;
    78         } else if (p == -1 && signal.IsAlmost(-1)) {
    79           iterationReturn = -actualReturn;
    80         } else if (p == -1 && signal.IsAlmost(0)) {
    81           iterationReturn = -actualReturn - transactionCost;
    82           p = 0;
    83         } else if (p == -1 && signal.IsAlmost(1)) {
    84           iterationReturn = -actualReturn - transactionCost;
    85           p = 1;
     63        if (position == 0 && signal.IsAlmost(0)) {
     64        } else if (position == 0 && signal.IsAlmost(1)) {
     65          position = 1;
     66          profit = -transactionCost;
     67        } else if (position == 0 && signal.IsAlmost(-1)) {
     68          position = -1;
     69          profit = -transactionCost;
     70        } else if (position == 1 && signal.IsAlmost(1)) {
     71          profit = actualReturn;
     72        } else if (position == 1 && signal.IsAlmost(0)) {
     73          profit = actualReturn - transactionCost;
     74          position = 0;
     75        } else if (position == 1 && signal.IsAlmost(-1)) {
     76          profit = actualReturn - transactionCost;
     77          position = -1;
     78        } else if (position == -1 && signal.IsAlmost(-1)) {
     79          profit = -actualReturn;
     80        } else if (position == -1 && signal.IsAlmost(0)) {
     81          profit = -actualReturn - transactionCost;
     82          position = 0;
     83        } else if (position == -1 && signal.IsAlmost(1)) {
     84          profit = -actualReturn - transactionCost;
     85          position = 1;
    8686        }
    87         c++;
     87        count++;
    8888      }
    89       sum += iterationReturn;
     89      totalProfit += profit;
    9090    }
    9191    #endregion
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/HeuristicLab.Problems.DataAnalysis.Trading-3.4.csproj

    r9799 r10020  
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     43    <OutputPath>..\..\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
     
    5050    <DebugType>pdbonly</DebugType>
    5151    <Optimize>true</Optimize>
    52     <OutputPath>bin\Release\</OutputPath>
     52    <OutputPath>..\..\bin\</OutputPath>
    5353    <DefineConstants>TRACE</DefineConstants>
    5454    <ErrorReport>prompt</ErrorReport>
     
    5858  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    5959    <DebugSymbols>true</DebugSymbols>
    60     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     60    <OutputPath>..\..\bin\</OutputPath>
    6161    <DefineConstants>DEBUG;TRACE</DefineConstants>
    6262    <DebugType>full</DebugType>
     
    6666  </PropertyGroup>
    6767  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    68     <OutputPath>bin\x64\Release\</OutputPath>
     68    <OutputPath>..\..\bin\</OutputPath>
    6969    <DefineConstants>TRACE</DefineConstants>
    7070    <Optimize>true</Optimize>
     
    7676  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    7777    <DebugSymbols>true</DebugSymbols>
    78     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     78    <OutputPath>..\..\bin\</OutputPath>
    7979    <DefineConstants>DEBUG;TRACE</DefineConstants>
    8080    <DebugType>full</DebugType>
     
    8484  </PropertyGroup>
    8585  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    86     <OutputPath>bin\x86\Release\</OutputPath>
     86    <OutputPath>..\..\bin\</OutputPath>
    8787    <DefineConstants>TRACE</DefineConstants>
    8888    <Optimize>true</Optimize>
     
    9393  </PropertyGroup>
    9494  <ItemGroup>
    95     <Reference Include="HeuristicLab.Collections-3.3">
    96       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
    97     </Reference>
    98     <Reference Include="HeuristicLab.Common-3.3">
    99       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>
    100     </Reference>
    101     <Reference Include="HeuristicLab.Core-3.3">
    102       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath>
    103     </Reference>
    104     <Reference Include="HeuristicLab.Data-3.3">
    105       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath>
    106     </Reference>
    107     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
    108       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
    109     </Reference>
    110     <Reference Include="HeuristicLab.Operators-3.3">
    111       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Operators-3.3.dll</HintPath>
    112     </Reference>
    113     <Reference Include="HeuristicLab.Optimization-3.3">
    114       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath>
    115     </Reference>
    116     <Reference Include="HeuristicLab.Parameters-3.3">
    117       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Parameters-3.3.dll</HintPath>
    118     </Reference>
    119     <Reference Include="HeuristicLab.Persistence-3.3">
    120       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>
    121     </Reference>
    122     <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
    123       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    124     </Reference>
    125     <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
    126       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
    127     </Reference>
    128     <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4">
    129       <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
    130     </Reference>
    131     <Reference Include="HeuristicLab.Problems.Instances-3.3">
    132       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
    133     </Reference>
    13495    <Reference Include="System" />
    13596    <Reference Include="System.Core">
     
    13798    </Reference>
    13899    <Reference Include="System.Drawing" />
     100    <Reference Include="System.Xml" />
    139101  </ItemGroup>
    140102  <ItemGroup>
    141103    <Compile Include="Calculators\OnlineProfitCalculator.cs" />
    142104    <Compile Include="Calculators\OnlineSharpeRatioCalculator.cs" />
     105    <Compile Include="InstanceProviders\CsvProblemInstanceProvider.cs" />
     106    <Compile Include="InstanceProviders\EcbProblemInstanceProvider.cs" />
    143107    <Compile Include="Interfaces\IModel.cs" />
    144108    <Compile Include="Interfaces\IProblem.cs" />
     
    146110    <Compile Include="Interfaces\ISolution.cs" />
    147111    <Compile Include="Plugin.cs" />
    148     <Compile Include="Problem.cs" />
    149112    <Compile Include="ProblemData.cs" />
    150113    <Compile Include="Solution.cs" />
     
    183146    </BootstrapperPackage>
    184147  </ItemGroup>
    185   <ItemGroup />
     148  <ItemGroup>
     149    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
     150      <Project>{958b43bc-cc5c-4fa2-8628-2b3b01d890b6}</Project>
     151      <Name>HeuristicLab.Collections-3.3</Name>
     152      <Private>False</Private>
     153    </ProjectReference>
     154    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
     155      <Project>{a9ad58b9-3ef9-4cc1-97e5-8d909039ff5c}</Project>
     156      <Name>HeuristicLab.Common-3.3</Name>
     157      <Private>False</Private>
     158    </ProjectReference>
     159    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
     160      <Project>{c36bd924-a541-4a00-afa8-41701378ddc5}</Project>
     161      <Name>HeuristicLab.Core-3.3</Name>
     162      <Private>False</Private>
     163    </ProjectReference>
     164    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
     165      <Project>{bbab9df5-5ef3-4ba8-ade9-b36e82114937}</Project>
     166      <Name>HeuristicLab.Data-3.3</Name>
     167      <Private>False</Private>
     168    </ProjectReference>
     169    <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
     170      <Project>{06d4a186-9319-48a0-bade-a2058d462eea}</Project>
     171      <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name>
     172      <Private>False</Private>
     173    </ProjectReference>
     174    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
     175      <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project>
     176      <Name>HeuristicLab.Operators-3.3</Name>
     177      <Private>False</Private>
     178    </ProjectReference>
     179    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     180      <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
     181      <Name>HeuristicLab.Optimization-3.3</Name>
     182      <Private>False</Private>
     183    </ProjectReference>
     184    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
     185      <Project>{56f9106a-079f-4c61-92f6-86a84c2d84b7}</Project>
     186      <Name>HeuristicLab.Parameters-3.3</Name>
     187      <Private>False</Private>
     188    </ProjectReference>
     189    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     190      <Project>{102bc7d3-0ef9-439c-8f6d-96ff0fdb8e1b}</Project>
     191      <Name>HeuristicLab.Persistence-3.3</Name>
     192      <Private>False</Private>
     193    </ProjectReference>
     194    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
     195      <Project>{94186a6a-5176-4402-ae83-886557b53cca}</Project>
     196      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
     197      <Private>False</Private>
     198    </ProjectReference>
     199    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
     200      <Project>{3d28463f-ec96-4d82-afee-38be91a0ca00}</Project>
     201      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
     202      <Private>False</Private>
     203    </ProjectReference>
     204    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj">
     205      <Project>{df87c13e-a889-46ff-8153-66dcaa8c5674}</Project>
     206      <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name>
     207      <Private>False</Private>
     208    </ProjectReference>
     209    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances.DataAnalysis\3.3\HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj">
     210      <Project>{94C7714E-29D4-4D6D-B213-2C18D627AB75}</Project>
     211      <Name>HeuristicLab.Problems.Instances.DataAnalysis-3.3</Name>
     212    </ProjectReference>
     213    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
     214      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
     215      <Name>HeuristicLab.Problems.Instances-3.3</Name>
     216      <Private>False</Private>
     217    </ProjectReference>
     218  </ItemGroup>
    186219  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    187220  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
     
    193226  -->
    194227  <PropertyGroup>
    195     <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    196 set ProjectDir=$(ProjectDir)
    197 set SolutionDir=$(SolutionDir)
    198 set Outdir=$(Outdir)
     228    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
     229      set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     230      set ProjectDir=$(ProjectDir)
     231      set SolutionDir=$(SolutionDir)
     232      set Outdir=$(Outdir)
    199233
    200 call PreBuildEvent.cmd
    201 </PreBuildEvent>
     234      call PreBuildEvent.cmd
     235    </PreBuildEvent>
     236    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     237      export ProjectDir=$(ProjectDir)
     238      export SolutionDir=$(SolutionDir)
     239
     240      $SolutionDir/PreBuildEvent.sh
     241    </PreBuildEvent>
    202242  </PropertyGroup>
    203243</Project>
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/InstanceProviders/EcbProblemInstanceProvider.cs

    r9997 r10020  
    110110          }
    111111      }
     112      // keep only the rows with data for this exchange rate
     113      if (tList.Count > dList.Count)
     114        tList.RemoveRange(dList.Count, tList.Count - dList.Count);
     115      else if (dList.Count > tList.Count)
     116        dList.RemoveRange(tList.Count, dList.Count - tList.Count);
     117
    112118      // entries in ECB XML are ordered most recent first => reverse lists
    113119      tList.Reverse();
    114120      dList.Reverse();
     121
    115122      // calculate exchange rate deltas
    116123      var changes = new[] { 0.0 } // first element
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Interfaces/IProblemData.cs

    r9745 r10020  
    2222namespace HeuristicLab.Problems.DataAnalysis.Trading {
    2323  public interface IProblemData : IDataAnalysisProblemData {
    24     string PriceVariable { get; }
     24    string PriceChangeVariable { get; }
    2525    double TransactionCosts { get; }
    2626  }
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Plugin.cs.frame

    r9799 r10020  
    3838  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
    3939  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
     40  [PluginDependency("HeuristicLab.Problems.Instances.DataAnalysis", "3.3")]
    4041  public class Plugin : PluginBase {
    4142  }
  • 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    }
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Solution.cs

    r9745 r10020  
    8080    }
    8181
    82 
    83     protected override void OnModelChanged() {
    84       base.OnModelChanged();
    85       RecalculateResults();
    86     }
    87 
    88     protected override void OnProblemDataChanged() {
    89       base.OnProblemDataChanged();
    90       RecalculateResults();
    91     }
    92 
    9382    protected override void RecalculateResults() {
    9483      CalculateTradingResults();
     
    9786    protected void CalculateTradingResults() {
    9887      double[] trainingSignals = TrainingSignals.ToArray(); // cache values
    99       IEnumerable<double> trainingReturns = ProblemData.Dataset.GetDoubleValues(ProblemData.PriceVariable, ProblemData.TrainingIndices);
     88      IEnumerable<double> trainingReturns = ProblemData.Dataset.GetDoubleValues(ProblemData.PriceChangeVariable, ProblemData.TrainingIndices);
    10089      double[] testSignals = TestSignals.ToArray(); // cache values
    101       IEnumerable<double> testReturns = ProblemData.Dataset.GetDoubleValues(ProblemData.PriceVariable, ProblemData.TestIndices);
     90      IEnumerable<double> testReturns = ProblemData.Dataset.GetDoubleValues(ProblemData.PriceChangeVariable, ProblemData.TestIndices);
    10291
    10392      OnlineCalculatorError errorState;
     
    115104
    116105    public virtual IEnumerable<double> Signals {
    117       get {
    118         return GetSignals(Enumerable.Range(0, ProblemData.Dataset.Rows));
    119       }
     106      get { return GetSignals(Enumerable.Range(0, ProblemData.Dataset.Rows)); }
    120107    }
    121 
    122108    public virtual IEnumerable<double> TrainingSignals {
    123       get {
    124         return GetSignals(ProblemData.TrainingIndices);
    125       }
     109      get { return GetSignals(ProblemData.TrainingIndices); }
    126110    }
    127 
    128111    public virtual IEnumerable<double> TestSignals {
    129       get {
    130         return GetSignals(ProblemData.TestIndices);
    131       }
     112      get { return GetSignals(ProblemData.TestIndices); }
    132113    }
    133 
    134114    public virtual IEnumerable<double> GetSignals(IEnumerable<int> rows) {
    135115      return Model.GetSignals(ProblemData.Dataset, rows);
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/Interfaces/IEvaluator.cs

    r9745 r10020  
    2020#endregion
    2121
    22 using HeuristicLab.Problems.DataAnalysis.Trading;
     22using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2323
    24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     24namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    2525  public interface IEvaluator : ISymbolicDataAnalysisEvaluator<IProblemData> {
    2626  }
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/Interfaces/IModel.cs

    r9745 r10020  
    2020#endregion
    2121
    22 using HeuristicLab.Problems.DataAnalysis.Trading;
     22using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2323
    24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
    25   public interface IModel : DataAnalysis.Trading.IModel, ISymbolicDataAnalysisModel {
     24namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
     25  public interface IModel : Trading.IModel, ISymbolicDataAnalysisModel {
    2626  }
    2727}
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/Interfaces/ISingleObjectiveEvaluator.cs

    r9745 r10020  
    2020#endregion
    2121
    22 using HeuristicLab.Problems.DataAnalysis.Trading;
     22using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2323
    24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     24namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    2525  public interface ISingleObjectiveEvaluator : IEvaluator, ISymbolicDataAnalysisSingleObjectiveEvaluator<IProblemData> {
    2626  }
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/Interfaces/ISolution.cs

    r9745 r10020  
    2020#endregion
    2121
     22using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2223
    23 using HeuristicLab.Problems.DataAnalysis.Trading;
    24 
    25 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
    26   public interface ISolution : DataAnalysis.Trading.ISolution, ISymbolicDataAnalysisSolution {
     24namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
     25  public interface ISolution : Trading.ISolution, ISymbolicDataAnalysisSolution {
    2726    new IModel Model { get; }
    2827  }
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/Model.cs

    r9745 r10020  
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2829
    29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     30namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    3031  /// <summary>
    3132  /// Represents a symbolic trading model
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/Evaluator.cs

    r9745 r10020  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    25 using HeuristicLab.Problems.DataAnalysis.Trading;
     25using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2626
    27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     27namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    2828  public abstract class SingleObjectiveEvaluator : SymbolicDataAnalysisSingleObjectiveEvaluator<IProblemData>, ISingleObjectiveEvaluator {
    2929    [StorableConstructor]
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/Problem.cs

    r9745 r10020  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    25 using HeuristicLab.Problems.DataAnalysis.Trading;
     25using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2626
    27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     27namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    2828  [Item("Symbolic Trading Problem (single objective)", "Represents a single objective symbolic trading problem.")]
    2929  [StorableClass]
     
    4545
    4646      InitializeOperators();
     47      ConfigureGrammarSymbols();
     48    }
     49
     50    private void ConfigureGrammarSymbols() {
     51      var grammar = SymbolicExpressionTreeGrammar as TypeCoherentExpressionGrammar;
     52      if (grammar != null) grammar.ConfigureAsDefaultTimeSeriesPrognosisGrammar();
    4753    }
    4854
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/ProfitEvaluator.cs

    r9745 r10020  
    2121
    2222using System.Collections.Generic;
    23 using System.Linq;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
     
    2726using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Problems.DataAnalysis.Trading;
     28using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3029
    31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     30namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    3231  [Item("Profit Evaluator", "")]
    3332  [StorableClass]
     
    6059    public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, IProblemData problemData, IEnumerable<int> rows) {
    6160      IEnumerable<double> signals = GetSignals(interpreter, solution, problemData.Dataset, rows);
    62       IEnumerable<double> returns = problemData.Dataset.GetDoubleValues(problemData.PriceVariable, rows);
     61      IEnumerable<double> returns = problemData.Dataset.GetDoubleValues(problemData.PriceChangeVariable, rows);
    6362      OnlineCalculatorError errorState;
    6463      double profit = OnlineProfitCalculator.Calculate(returns, signals, problemData.TransactionCosts, out errorState);
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/SharpeRatioEvaluator.cs

    r9745 r10020  
    2121
    2222using System.Collections.Generic;
    23 using System.Linq;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
     
    2726using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    29 using HeuristicLab.Problems.DataAnalysis.Trading;
     28using HeuristicLab.Problems.DataAnalysis.Symbolic;
    3029
    31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     30namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    3231  [Item("Sharpe Ratio Evaluator", "")]
    3332  [StorableClass]
     
    6059    public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, IProblemData problemData, IEnumerable<int> rows) {
    6160      IEnumerable<double> signals = GetSignals(interpreter, solution, problemData.Dataset, rows);
    62       IEnumerable<double> returns = problemData.Dataset.GetDoubleValues(problemData.PriceVariable, rows);
     61      IEnumerable<double> returns = problemData.Dataset.GetDoubleValues(problemData.PriceChangeVariable, rows);
    6362      OnlineCalculatorError errorState;
    6463      double sharpRatio = OnlineSharpeRatioCalculator.Calculate(returns, signals, problemData.TransactionCosts, out errorState);
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/TrainingBestSolutionAnalyzer.cs

    r9745 r10020  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    27 using HeuristicLab.Problems.DataAnalysis.Trading;
     27using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2828
    29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     29namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    3030  /// <summary>
    3131  /// An operator that analyzes the training best symbolic trading solution for single objective symbolic trading problems.
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/SingleObjective/ValidationBestSolutionAnalyzer.cs

    r9745 r10020  
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    26 using HeuristicLab.Problems.DataAnalysis.Trading;
     26using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2727
    28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     28namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    2929  /// <summary>
    3030  /// An operator that analyzes the validation best symbolic trading solution for single objective symbolic trading problems.
  • stable/HeuristicLab.Problems.DataAnalysis.Trading/3.4/Symbolic/Solution.cs

    r9745 r10020  
    2525using HeuristicLab.Optimization;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    27 using HeuristicLab.Problems.DataAnalysis.Trading;
     27using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2828
    29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Trading {
     29namespace HeuristicLab.Problems.DataAnalysis.Trading.Symbolic {
    3030  /// <summary>
    3131  /// Represents a symbolic trading solution (model + data) and attributes of the solution like accuracy and complexity
Note: See TracChangeset for help on using the changeset viewer.