forked from tslab-hub/handlers
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTradeStatisticsExtendedBarsHandler2.cs
More file actions
98 lines (78 loc) · 4.58 KB
/
TradeStatisticsExtendedBarsHandler2.cs
File metadata and controls
98 lines (78 loc) · 4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System.Collections.Generic;
namespace TSLab.Script.Handlers
{
// Не стоит навешивать на абстрактные классы атрибуты категорий и описания входов/выходов
public abstract class TradeStatisticsExtendedBarsHandler2 : TradeStatisticsBaseExtendedBarsHandler, ITradeStatisticsExtendedBarsHandler2
{
[HandlerParameter(true, NotOptimized = true)]
public bool UseTrimTradesCount { get; set; }
[HandlerParameter(true, "0", Min = "0", Max = "2147483647", Step = "1", EditorMin = "0")]
public int TrimTradesCount { get; set; }
[HandlerParameter(true, nameof(ComparisonMode.GreaterOrEqual))]
public ComparisonMode TrimTradesCountComparisonMode { get; set; }
[HandlerParameter(true, NotOptimized = true)]
public bool UseTrimQuantity { get; set; }
[HandlerParameter(true, "0", Min = "0", Max = "999999999999999", Step = "1", EditorMin = "0")]
public double TrimQuantity { get; set; }
[HandlerParameter(true, nameof(ComparisonMode.GreaterOrEqual))]
public ComparisonMode TrimQuantityComparisonMode { get; set; }
[HandlerParameter(true, NotOptimized = true)]
public bool UseTrimAskQuantity { get; set; }
[HandlerParameter(true, "0", Min = "0", Max = "999999999999999", Step = "1", EditorMin = "0")]
public double TrimAskQuantity { get; set; }
[HandlerParameter(true, nameof(ComparisonMode.GreaterOrEqual))]
public ComparisonMode TrimAskQuantityComparisonMode { get; set; }
[HandlerParameter(true, NotOptimized = true)]
public bool UseTrimBidQuantity { get; set; }
[HandlerParameter(true, "0", Min = "0", Max = "999999999999999", Step = "1", EditorMin = "0")]
public double TrimBidQuantity { get; set; }
[HandlerParameter(true, nameof(ComparisonMode.GreaterOrEqual))]
public ComparisonMode TrimBidQuantityComparisonMode { get; set; }
[HandlerParameter(true, NotOptimized = true)]
public bool UseTrimDeltaAskBidQuantity { get; set; }
[HandlerParameter(true, "0", Min = "-999999999999999", Max = "999999999999999", Step = "1")]
public double TrimDeltaAskBidQuantity { get; set; }
[HandlerParameter(true, nameof(ComparisonMode.GreaterOrEqual))]
public ComparisonMode TrimDeltaAskBidQuantityComparisonMode { get; set; }
[HandlerParameter(true, "false", NotOptimized = true)]
public bool UseTrimRelativeDeltaAskBidQuantityPercent { get; set; }
[HandlerParameter(true, "0", Min = "-100", Max = "100", Step = "1")]
public double TrimRelativeDeltaAskBidQuantityPercent { get; set; }
[HandlerParameter(true, nameof(ComparisonMode.GreaterOrEqual))]
public ComparisonMode TrimRelativeDeltaAskBidQuantityPercentComparisonMode { get; set; }
public IList<double> Execute(IBaseTradeStatisticsWithKind tradeStatistics)
{
return Execute(
tradeStatistics,
new TrimContext(UseTrimTradesCount, TrimTradesCount, TrimTradesCountComparisonMode),
new TrimContext(UseTrimQuantity, TrimQuantity, TrimQuantityComparisonMode),
new TrimContext(UseTrimAskQuantity, TrimAskQuantity, TrimAskQuantityComparisonMode),
new TrimContext(UseTrimBidQuantity, TrimBidQuantity, TrimBidQuantityComparisonMode),
new TrimContext(UseTrimDeltaAskBidQuantity, TrimDeltaAskBidQuantity, TrimDeltaAskBidQuantityComparisonMode),
new TrimContext(UseTrimRelativeDeltaAskBidQuantityPercent, TrimRelativeDeltaAskBidQuantityPercent, TrimRelativeDeltaAskBidQuantityPercentComparisonMode));
}
protected override string GetParametersStateId()
{
return string.Join(
".",
UseTrimTradesCount,
TrimTradesCount,
TrimTradesCountComparisonMode,
UseTrimQuantity,
TrimQuantity,
TrimQuantityComparisonMode,
UseTrimAskQuantity,
TrimAskQuantity,
TrimAskQuantityComparisonMode,
UseTrimBidQuantity,
TrimBidQuantity,
TrimBidQuantityComparisonMode,
UseTrimDeltaAskBidQuantity,
TrimDeltaAskBidQuantity,
TrimDeltaAskBidQuantityComparisonMode,
UseTrimRelativeDeltaAskBidQuantityPercent,
TrimRelativeDeltaAskBidQuantityPercent,
TrimRelativeDeltaAskBidQuantityPercentComparisonMode);
}
}
}