Use bracket notation to query results in hyperopt
This commit is contained in:
parent
0f373e6bb9
commit
68395d2745
@ -63,8 +63,8 @@ class SuperDuperHyperOptLoss(IHyperOptLoss):
|
|||||||
* 0.25: Avoiding trade loss
|
* 0.25: Avoiding trade loss
|
||||||
* 1.0 to total profit, compared to the expected value (`EXPECTED_MAX_PROFIT`) defined above
|
* 1.0 to total profit, compared to the expected value (`EXPECTED_MAX_PROFIT`) defined above
|
||||||
"""
|
"""
|
||||||
total_profit = results.profit_percent.sum()
|
total_profit = results['profit_percent'].sum()
|
||||||
trade_duration = results.trade_duration.mean()
|
trade_duration = results['trade_duration'].mean()
|
||||||
|
|
||||||
trade_loss = 1 - 0.25 * exp(-(trade_count - TARGET_TRADES) ** 2 / 10 ** 5.8)
|
trade_loss = 1 - 0.25 * exp(-(trade_count - TARGET_TRADES) ** 2 / 10 ** 5.8)
|
||||||
profit_loss = max(0, 1 - total_profit / EXPECTED_MAX_PROFIT)
|
profit_loss = max(0, 1 - total_profit / EXPECTED_MAX_PROFIT)
|
||||||
|
@ -42,8 +42,8 @@ class DefaultHyperOptLoss(IHyperOptLoss):
|
|||||||
* 0.25: Avoiding trade loss
|
* 0.25: Avoiding trade loss
|
||||||
* 1.0 to total profit, compared to the expected value (`EXPECTED_MAX_PROFIT`) defined above
|
* 1.0 to total profit, compared to the expected value (`EXPECTED_MAX_PROFIT`) defined above
|
||||||
"""
|
"""
|
||||||
total_profit = results.profit_percent.sum()
|
total_profit = results['profit_percent'].sum()
|
||||||
trade_duration = results.trade_duration.mean()
|
trade_duration = results['trade_duration'].mean()
|
||||||
|
|
||||||
trade_loss = 1 - 0.25 * exp(-(trade_count - TARGET_TRADES) ** 2 / 10 ** 5.8)
|
trade_loss = 1 - 0.25 * exp(-(trade_count - TARGET_TRADES) ** 2 / 10 ** 5.8)
|
||||||
profit_loss = max(0, 1 - total_profit / EXPECTED_MAX_PROFIT)
|
profit_loss = max(0, 1 - total_profit / EXPECTED_MAX_PROFIT)
|
||||||
|
@ -34,5 +34,5 @@ class OnlyProfitHyperOptLoss(IHyperOptLoss):
|
|||||||
"""
|
"""
|
||||||
Objective function, returns smaller number for better results.
|
Objective function, returns smaller number for better results.
|
||||||
"""
|
"""
|
||||||
total_profit = results.profit_percent.sum()
|
total_profit = results['profit_percent'].sum()
|
||||||
return 1 - total_profit / EXPECTED_MAX_PROFIT
|
return 1 - total_profit / EXPECTED_MAX_PROFIT
|
||||||
|
Loading…
Reference in New Issue
Block a user