-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extended heat map to calculate excess return
Optionally, the user can choose a baseline to calculate the excess return against. Two methods are available: alpha excess return and relative excess return.
- Loading branch information
Showing
12 changed files
with
180 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...i/src/name/abuchen/portfolio/ui/views/dashboard/heatmap/ExcessReturnDataSeriesConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package name.abuchen.portfolio.ui.views.dashboard.heatmap; | ||
|
||
import name.abuchen.portfolio.model.Dashboard; | ||
import name.abuchen.portfolio.ui.Messages; | ||
import name.abuchen.portfolio.ui.views.dashboard.DataSeriesConfig; | ||
import name.abuchen.portfolio.ui.views.dashboard.WidgetDelegate; | ||
|
||
public class ExcessReturnDataSeriesConfig extends DataSeriesConfig | ||
{ | ||
public ExcessReturnDataSeriesConfig(WidgetDelegate<?> delegate) | ||
{ | ||
super(delegate, true, true, Messages.LabelExcessReturnBaselineDataSeries, Dashboard.Config.SECONDARY_DATA_SERIES); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
...tfolio.ui/src/name/abuchen/portfolio/ui/views/dashboard/heatmap/ExcessReturnOperator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package name.abuchen.portfolio.ui.views.dashboard.heatmap; | ||
|
||
import java.util.function.DoubleBinaryOperator; | ||
|
||
import name.abuchen.portfolio.ui.Messages; | ||
|
||
public enum ExcessReturnOperator | ||
{ | ||
ALPHA(Messages.LabelExcessReturnOperatorAlpha, (x, y) -> x - y), // | ||
RELATIVE(Messages.LabelExcessReturnOperatorRelative, (x, y) -> ((x + 1) / (y + 1)) - 1); | ||
|
||
private String label; | ||
private DoubleBinaryOperator operator; | ||
|
||
private ExcessReturnOperator(String label, DoubleBinaryOperator operator) | ||
{ | ||
this.label = label; | ||
this.operator = operator; | ||
} | ||
|
||
public DoubleBinaryOperator getOperator() | ||
{ | ||
return operator; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return label; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
....ui/src/name/abuchen/portfolio/ui/views/dashboard/heatmap/ExcessReturnOperatorConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package name.abuchen.portfolio.ui.views.dashboard.heatmap; | ||
|
||
import name.abuchen.portfolio.model.Dashboard; | ||
import name.abuchen.portfolio.ui.Messages; | ||
import name.abuchen.portfolio.ui.views.dashboard.EnumBasedConfig; | ||
import name.abuchen.portfolio.ui.views.dashboard.WidgetDelegate; | ||
|
||
class ExcessReturnOperatorConfig extends EnumBasedConfig<ExcessReturnOperator> | ||
{ | ||
public ExcessReturnOperatorConfig(WidgetDelegate<?> delegate) | ||
{ | ||
super(delegate, Messages.LabelExcessReturnOperator, ExcessReturnOperator.class, | ||
Dashboard.Config.CALCULATION_METHOD, Policy.EXACTLY_ONE, | ||
Dashboard.Config.SECONDARY_DATA_SERIES.name()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.