create account

🧪 PeakeCoin Bot Testing Suite by paulmoon410

View this thread on: hive.blogpeakd.comecency.com
· @paulmoon410 ·
$0.35
🧪 PeakeCoin Bot Testing Suite
<center>![Maryland's Mascots](https://images.ecency.com/DQmNh3fAXAujj6orqA8GD1HrVsauu5qqf3y5V7BMQF8zGeo/image.png)</center>



The **PeakeCoin trading bot ecosystem** is powerful—but like all serious automation tools, it needs proper stress testing before going live. To ensure smart trades execute as expected, I wrote a series of diagnostic scripts that target specific aspects of the bot’s lifecycle: from fetching market data to checking Hive Resource Credits.

This post documents what each script does, how to use it, and why it exists. These are essential for anyone testing or extending the bot infrastructure.

---

## ✅ 1. `test_market.py`: **Validate Market Top Bid/Ask**

**Purpose:** Confirms that the top-of-book market data is fetched accurately from Hive Engine for a given token.

🔗 [View script](https://geocities.ws/peakecoin/blog/test_market.py)

```python
from fetch_market import get_orderbook_top

market = get_orderbook_top("SWAP.LTC")
```

**Output:** Spread % and mid-price based on top 1000 orders.  
**Why:** Ensures you aren't placing orders based on stale or incomplete market info.  
**Reference:** [`test_market.py`](https://geocities.ws/peakecoin/blog/test_market.py) :contentReference[oaicite:0]{index=0}

---

## 📄 2. `test_order_finding.py`: **Inspect Open Orders**

**Purpose:** Displays all open orders for an account, grouped by token.

🔗 [View script](https://geocities.ws/peakecoin/blog/test_order_finding.py)

```python
from place_order import get_open_orders

orders = get_open_orders("paulmoon410", "SWAP.LTC")
all_orders = get_open_orders("paulmoon410")
```

**Output:** Order count per token and a preview of open orders.  
**Why:** Useful for debugging duplicate orders, stuck orders, or testing cancel logic.  
**Reference:** [`test_order_finding.py`](https://geocities.ws/peakecoin/blog/test_order_finding.py) :contentReference[oaicite:1]{index=1}

---

## 🌐 3. `test_orders.py`: **API Endpoint Cross-Test**

**Purpose:** Confirms that different Hive Engine RPC nodes return consistent open order data.

🔗 [View script](https://geocities.ws/peakecoin/blog/test_orders.py)

```python
"params": { "contract": "market", "table": "openOrders", "query": {"account": "paulmoon410"} }
```

**Output:** Lists open orders by symbol and counts them.  
**Why:** Node reliability can affect bot decisions—this helps pick the best source.  
**Reference:** [`test_orders.py`](https://geocities.ws/peakecoin/blog/test_orders.py) :contentReference[oaicite:2]{index=2}

---

## 🔋 4. `test_rc.py`: **Check RC Safety Before Trading**

**Purpose:** Shows current Hive Resource Credits (RC), simulates operation costs, and determines if trading is safe.

🔗 [View script](https://geocities.ws/peakecoin/blog/test_rc.py)

```python
from fetch_market import get_resource_credits, check_rc_safety, estimate_rc_cost
```

**Output:** RC percentage, estimated number of trades possible, and safety level recommendations.  
**Why:** Hive transactions require RC. Bots without enough RC can silently fail.  
**Reference:** [`test_rc.py`](https://geocities.ws/peakecoin/blog/test_rc.py) :contentReference[oaicite:3]{index=3}

---

## 🔁 5. `trade_loop.py` and `hive_trading_bot.py`: **Live Trading Bots**

These two are real bots meant to run continuously:

- `trade_loop.py`: Basic loop that trades every 60 seconds with a fixed spread:contentReference[oaicite:4]{index=4}
- `hive_trading_bot.py`: Full-featured bot with FTP logging and auto recovery:contentReference[oaicite:5]{index=5}

They both rely on:

```python
from fetch_market import get_market_data
from place_order import place_order
```

---

## 🧠 Why I Built These

- **Debug with confidence** — Every part of a live trading bot must be testable in isolation.
- **Rapid iteration** — I can swap in new modules or pricing logic without flying blind.
- **Reliability** — Market data, account orders, and RC are prone to API variation and failure. These scripts surface problems before money is at risk.

---

## 🛠️ Next Steps

1. Run `test_market.py` and `test_order_finding.py` before each live session.
2. Monitor `test_rc.py` output weekly or before high-frequency loops.
3. Use `test_orders.py` when RPC errors or discrepancies arise.

Stay safe out there, and test before you trade.


👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorpaulmoon410
permlinkpeakecoin-bot-testing-suite
categoryhive-186392
json_metadata"{"app":"ecency/4.2.1-vision","tags":["hive-186392","pimp","neoxian","waivio","proofofbrain","ctp","palnet","archon","creativecoin","bee"],"format":"markdown+html","image":["https://images.ecency.com/DQmNh3fAXAujj6orqA8GD1HrVsauu5qqf3y5V7BMQF8zGeo/image.png"],"thumbnails":["https://images.ecency.com/DQmNh3fAXAujj6orqA8GD1HrVsauu5qqf3y5V7BMQF8zGeo/image.png"],"description":"The PeakeCoin trading bot ecosystem is powerful—but like all serious automation tools, it needs proper stress testing before going live. To ensure smart trades execute as expected, I wrote a series of","image_ratios":["1.0000"]}"
created2025-07-13 03:01:12
last_update2025-07-13 03:01:12
depth0
children0
last_payout1969-12-31 23:59:59
cashout_time2025-07-20 03:01:12
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.345 HBD
promoted0.000 HBD
body_length4,270
author_reputation40,653,574,175,519
root_title"🧪 PeakeCoin Bot Testing Suite"
beneficiaries
0.
accountstrangedad
weight1,000
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id144,015,826
net_rshares1,034,397,373,098
author_curate_reward""
vote details (38)