Skip to content

Commit

Permalink
3.0.13.1 Fix #81
Browse files Browse the repository at this point in the history
  • Loading branch information
DogsTailFarmer committed Aug 23, 2024
1 parent c6e77ec commit b513df1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.13 - 2024-08-xx
### Fix
* Sometimes get error from backtesting on Exit [#81](https://github.com/DogsTailFarmer/martin-binance/issues/81#issue-2465248437)

## 3.0.12 - 2024-08-13
### Fix
* Calculating`self.reverse_price` before immediately starting Reverse cycle also. It can be used later in
Expand Down
27 changes: 15 additions & 12 deletions martin_binance/strategy_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,19 +351,22 @@ async def backtest_control(self):
self.backtest_process = None
storage_name.replace(storage_name.with_name('study.db'))
if prm_best:
_prm_best = dict(prm_best)
self.message_log(
f"Updating parameters from backtest,"
f" predicted value {prm_best.pop('_value')} -> {prm_best.pop('new_value')}",
color=Style.B_WHITE,
tlg=True
)
for key, value in prm_best.items():
self.message_log(f"{key}: {getattr(prm, key)} -> {value}")
setattr(
prm, key,
value if isinstance(value, int) or key in PARAMS_FLOAT else Decimal(f"{value}")
if '_value' in prm_best:
_prm_best = dict(prm_best)
self.message_log(
f"Updating parameters from backtest,"
f" predicted value {prm_best.pop('_value')} -> {prm_best.pop('new_value')}",
color=Style.B_WHITE,
tlg=True
)
for key, value in prm_best.items():
self.message_log(f"{key}: {getattr(prm, key)} -> {value}")
setattr(
prm, key,
value if isinstance(value, int) or key in PARAMS_FLOAT else Decimal(f"{value}")
)
else:
break
l_m = str(
datetime.now(timezone.utc).replace(tzinfo=None) - _ts + timedelta(seconds=prm.SAVE_PERIOD)
).rsplit('.')[0]
Expand Down

0 comments on commit b513df1

Please sign in to comment.