Peake_Dad avatar

Hive Engine Trading Bot - Cycle Control - Part 2

strangedad

Published: 06 May 2026 β€Ί Updated: 06 May 2026Hive Engine Trading Bot - Cycle Control - Part 2

Hive Engine Trading Bot - Cycle Control - Part 2

Part 1 - @strangedad/hive-engine-trading-bot-unified

  • Checks Hive RC before the bot starts a trading cycle.
  • Calls evaluate_tx_window() to decide if the account can act.
  • Prints RC percent, mode, allowed status, and wait time.
  • Blocks the cycle if RC is too low.
  • Uses a 1-hour cooldown when RC fails.
  • If dynamic_delay is enabled, it returns a longer next-cycle delay instead of sleeping.
  • If no dynamic delay is used, it sleeps for the cooldown.
  • If RC is allowed but needs a short wait, it waits up to max_inline_wait.
  • Returns True when the bot can continue.
  • Returns False when the bot should skip the cycle.
bot_cycle_control.py
import time
from rc_intelligence import evaluate_tx_window

RC_FAIL_COOLDOWN_SECONDS = 3600


def run_cycle_preflight(
    bot_label,
    account_name,
    dynamic_delay=None,
    action="order",
    divider="==============================",
    desired_open_orders=None,
    current_open_orders=None,
    max_inline_wait=30,
):
    kwargs = {"account_name": account_name, "action": action}
    if desired_open_orders is not None:
        kwargs["desired_open_orders"] = desired_open_orders
    if current_open_orders is not None:
        kwargs["current_open_orders"] = current_open_orders

    rc_gate = evaluate_tx_window(**kwargs)
    rc_percent = rc_gate.get("rc_percent")
    rc_text = "n/a" if rc_percent is None else f"{rc_percent:.2f}%"

    print(
        f"{bot_label} RC preflight: rc={rc_text} mode={rc_gate.get('mode')} "
        f"allow={rc_gate.get('allow')} wait={rc_gate.get('wait_seconds')}s"
    )

    if not rc_gate.get("allow", True):
        wait_seconds = RC_FAIL_COOLDOWN_SECONDS
        next_delay = dynamic_delay
        if dynamic_delay is not None:
            next_delay = max(10, wait_seconds)
        print(f"{bot_label} RC preflight blocked cycle before strategy actions.")
        if next_delay is not None:
            print(f"{bot_label} Next cycle delayed to {next_delay}s based on RC policy.")
        else:
            print(f"{bot_label} RC preflight cooldown: sleeping {wait_seconds}s before next cycle check.")
            time.sleep(wait_seconds)
        print(f"{divider}\n")
        return False, next_delay

    wait_seconds = int(rc_gate.get("wait_seconds", 0) or 0)
    if wait_seconds > 0 and wait_seconds <= max_inline_wait:
        time.sleep(wait_seconds)

    return True, dynamic_delay



πŸ€– PeakeBot β€” Autonomous Trading System (RC-AWARE)

Independent multi-token trading bot featuring:
RC-aware execution, adaptive delay logic, and self-regulating trade cycles.

πŸ“Š Trading bot details:
πŸ‘‰ https://geocities.ws/p/e/peakecoin/trading-bot/peakebot_v0_01.html
πŸ’» Open-source repositories:
πŸ‘‰ https://github.com/paulmoon410


πŸ™ Acknowledgements

Thanks to and please follow:
enginewittyHive account@enginewitty ecoinstantHive account@ecoinstant neoxianHive account@neoxian txracerHive account@txracer thecrazygmHive account@thecrazygm holdoniaHive account@holdonia aggroedHive account@aggroed

For their continued support, guidance, and help expanding the PeakeCoin ecosystem.

Leave Hive Engine Trading Bot - Cycle Control - Part 2 to:

Written by

Surviving the American Dream, and a father of 2.

Read more #hive-167922 posts


Best Posts From Peake_Dad

We have not curated any of strangedad's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Peake_Dad