Skip to content

Commit

Permalink
Merge pull request #24 from Pasta-fantasia/22-error-error-creating-st…
Browse files Browse the repository at this point in the history
…op-loss-binance-stop-price-would-trigger-immediately-review-exit

fix: [ERROR] Error creating stop loss: binance Stop price would trigg…
  • Loading branch information
fransimo committed Jul 18, 2024
2 parents 8194887 + 2f33545 commit fc09b29
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.1.7
- fix: [ERROR] Error creating stop loss: binance Stop price would trigger immediately. Review exit #22
- fix: [ERROR] Error canceling order: new_grouped_order. #23

# 0.1.6
- fix: [ERROR] Error creating stop loss: binance Stop price would trigger immediately.

Expand Down
7 changes: 7 additions & 0 deletions elena_basics/strategies/common_sl_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ def manage_trailing_stop_losses(self, data: pd.DataFrame, estimated_close_price:
else:
# TODO
self._logger.error("Can't create stop loss grouped_amount_canceled_orders_and_new_trades ")
# ensure trade.exit_order_id = "new_grouped_order" is overwritten when stop loss fails
for trade in self.status.active_trades:
if trade.exit_order_id in canceled_orders:
self._logger.warning(f"Setting exit_order_id to '0' on {trade.id}")
trade.exit_order_id = '0' # TODO exit_order_id
trade.exit_price = 0.0


def init(self, manager: StrategyManager, logger: Logger, metrics_manager: MetricsManager, notifications_manager: NotificationsManager, exchange_manager: ExchangeManager, bot_config: BotConfig, bot_status: BotStatus, ): # type: ignore
super().init(manager, logger, metrics_manager, notifications_manager, exchange_manager, bot_config, bot_status,)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = elena_basics
version = 0.1.6
version = 0.1.7
author = "L Software Foundation"
author_email = "fransimo@gmail.com, pjover@gmail.com"
description = Sample project to link L + CCTX + Backtesting.py
Expand Down

0 comments on commit fc09b29

Please sign in to comment.