Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DCA][Staggered] init health check #1114

Merged
merged 2 commits into from
Dec 9, 2023
Merged

[DCA][Staggered] init health check #1114

merged 2 commits into from
Dec 9, 2023

Conversation

GuillaumeDSM
Copy link
Member

@GuillaumeDSM GuillaumeDSM requested a review from Herklos December 8, 2023 14:25
@GuillaumeDSM GuillaumeDSM self-assigned this Dec 8, 2023
await producer.trigger_staggered_orders_creation()
return created_orders

async def _should_rebalance_orders(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -42,6 +42,7 @@ class GridTradingMode(staggered_orders_trading.StaggeredOrdersTradingMode):
USER_COMMAND_PAUSE_ORDER_MIRRORING = "pause orders mirroring"
USER_COMMAND_TRADING_PAIR = "trading pair"
USER_COMMAND_PAUSE_TIME = "pause length in seconds"
SUPPORTS_HEALTH_CHECK = False # WIP # set True when self.health_check is implemented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't it the same implementation as staggered?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

staggered have min and max prices boundaries, it makes orders "grid" translation much more complicated

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I see

Comment on lines +719 to +724
title="Health check: when enabled, OctoBot will automatically sell traded assets that are not associated "
"to a sell order and that represent at least the 'Health check threshold' part of the "
"portfolio. Health check can be useful to avoid inactive funds, for example if a buy order got "
"filled but no sell order was created. Requires a common quote market for each traded pair. "
"Warning: will sell any asset associated to a trading pair that is not covered by a sell order, "
"even if not bought by OctoBot or this trading mode.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +772 to +781
if (
self.exchange_manager.is_backtesting
or common_quote is None
or not (self.use_take_profit_exit_orders or self.use_stop_loss)
):
# skipped when:
# - backtesting
# - common_quote is unset
# - not using take profit or stop losses, health check should not be used
return []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we override should_trigger_health_check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should_trigger_health_check renamed in Drakkar-Software/OctoBot-Trading#1006

assert sell_order.origin_quantity == eth_holdings
assert portfolio["ETH"].total == trading_constants.ZERO
after_eth_usdt_portfolio = portfolio["USDT"].total
assert after_eth_usdt_portfolio > after_btc_usdt_portfolio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@GuillaumeDSM GuillaumeDSM enabled auto-merge (rebase) December 9, 2023 11:21
@GuillaumeDSM GuillaumeDSM merged commit b101dcd into dev Dec 9, 2023
7 checks passed
@GuillaumeDSM GuillaumeDSM deleted the health_check branch December 9, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants