Peake_Dad avatar

Arbiter Bot Part 2 - Cancel Logic

strangedad

Published: 24 Apr 2026 β€Ί Updated: 24 Apr 2026Arbiter Bot Part 2 - Cancel Logic

Arbiter Bot Part 2 - Cancel Logic

First part @strangedad/arbiter-bot-for-all-hive is aribter_bot.py

This is the cancelling logic I've been working on for the arbiter systems.

I apologize I'm not putting a lot into writing of these individually but I will answer any questions.

I've been working on these bots for a long time, I just haven't had the time to upload all of these. So I definitely appreciate you folks hanging in there with me.

arbiter_cancel.py


import os
import json
import sys
import time

from place_order import cancel_oldest_order


def read_bot_info(path="bot_info.txt"):
    try:
        with open(path, "r", encoding="utf-8") as file:
            lines = [line.strip() for line in file if line.strip()]
            if len(lines) >= 2:
                return lines[0], lines[1]
    except Exception as exc:
        print(f"[ERROR] Failed to read credentials: {exc}")
    return None, None


def load_config(root):
    config_path = os.path.join(root, "bot_config.json")
    if os.path.exists(config_path):
        try:
            with open(config_path, "r", encoding="utf-8") as file:
                return json.load(file)
        except Exception as exc:
            print(f"[ERROR] Failed to read bot_config.json: {exc}")
            return None

    account, key = read_bot_info(os.path.join(root, "bot_info.txt"))
    if account and key:
        return {
            "account_name": account,
            "active_key": key,
            "token": "ARBITER",
            "hive_nodes": ["https://api.hive.blog", "https://anyx.io"],
        }

    return None


def cancel_one(account_name, active_key, token="ARBITER", nodes=None):
    return cancel_oldest_order(
        account_name,
        active_key=active_key,
        nodes=nodes or ["https://api.hive.blog", "https://anyx.io"],
        token=token,
    )


if __name__ == "__main__":
    root = os.path.dirname(__file__)
    config = load_config(root)

    if not config:
        print("[ERROR] Missing bot configuration. Run arbiter_bot.py first.")
        raise SystemExit(1)

    account = (config.get("account_name") or "").strip()
    key = (config.get("active_key") or "").strip()
    token = (config.get("token") or "ARBITER").strip()
    nodes = config.get("hive_nodes") or ["https://api.hive.blog", "https://anyx.io"]

    if not account or not key:
        print("[ERROR] bot_config.json must include account_name and active_key")
        raise SystemExit(1)

    run_once = len(sys.argv) > 1 and sys.argv[1] == "--once"
    if run_once:
        cancel_one(account, key, token=token, nodes=nodes)
    else:
        while True:
            cancel_one(account, key, token=token, nodes=nodes)
            time.sleep(300)


Arbiter Bot Part 1 - arbiter_bot.py


πŸ€– 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 Arbiter Bot Part 2 - Cancel Logic 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