6 công thức copy-paste chạy ngay: cron, GitHub Actions, Node.js, Python gọi x402 API của chúng tôi theo lịch. Tất cả chạy được ngay bằng free trial (không cần ví, không đăng ký). Khi hết quota trial, thêm header thanh toán X-PAYMENT/PAYMENT-SIGNATURE là thành paid mode — code không đổi.
PAYMENT-SIGNATURE (x402 v2). Chi tiết: Docs.~$0.72/tháng trial: 10 lượt/ngày · Endpoint: gastracker $0.001/call
#!/bin/bash
# crontab: 0 * * * * /root/gas-alert.sh
OUT=$(curl -s -X POST https://api.mekongtradeintel.com/gastracker/ \
-H 'Content-Type: application/json' -d '{}')
FAST=$(echo "$OUT" | python3 -c "import json,sys; print(json.load(sys.stdin)['tiers']['fast']['maxFeeGwei'])")
# Base thường dưới 1 cent — báo động khi fast > 0.05 gwei
python3 -c "exit(0 if float('$FAST') > 0.05 else 1)" \
&& echo "ALERT: Base gas fast = $FAST gwei" | mail -s "Gas alert" [email protected]
~$0.03/tháng trial: 10 lượt/ngày · Endpoint: fxrates $0.001/call
#!/bin/bash
# crontab: 0 7 * * * /root/vnd-rate.sh
curl -s -X POST https://api.mekongtradeintel.com/fxrates/ \
-H 'Content-Type: application/json' \
-d '{"pair":"USDVND"}' | python3 -c "
import json,sys
d = json.load(sys.stdin)
print('USD/VND:', d.get('rate') or d)
" | mail -s "Ty gia sang nay" [email protected]
~$0.06/tháng trial: 5 lượt/ngày · Endpoint: news $0.002/call
# .github/workflows/digest.yml
name: daily-crypto-digest
on:
schedule: [{cron: "0 1 * * *"}] # 08:00 giờ VN
jobs:
digest:
runs-on: ubuntu-latest
steps:
- run: |
curl -s -X POST https://api.mekongtradeintel.com/news/ \
-H 'Content-Type: application/json' \
-d '{"topic":"bitcoin","limit":10}' -o digest.json
python3 -c "
import json
for a in json.load(open('digest.json')).get('articles', [])[:10]:
print('-', a.get('title'), '|', a.get('source'))
"
~$1.44/tháng (mỗi 30 phút) trial: 10 lượt/ngày · Endpoint: perpfunding $0.001/call
// node funding-watch.mjs (chạy bằng pm2 hoặc systemd)
const SYMBOL = 'BTC';
setInterval(async () => {
const r = await fetch('https://api.mekongtradeintel.com/perpfunding/', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({symbol: SYMBOL}),
});
const j = await r.json();
// xem cấu trúc đầy đủ trong docs, ví dụ log rút gọn:
console.log(new Date().toISOString(), JSON.stringify(j).slice(0, 250));
// TODO: thêm điều kiện alert của bạn, ví dụ funding > ngưỡng
}, 30 * 60 * 1000);
~$0.12/tháng trial: 10 lượt/ngày · Endpoint: defiyield $0.001/call
# pip install requests
import requests, time
while True:
r = requests.post('https://api.mekongtradeintel.com/defiyield/',
json={'chain': 'Base', 'minTvlUsd': 1000000, 'limit': 5})
for p in r.json().get('pools', []):
if p.get('apy', 0) > 20:
print('HIGH APY:', p.get('symbol'), round(p['apy'], 1), '%')
time.sleep(6 * 3600)
~$2.70/tháng (3 từ khóa/ngày) trial: 2 lượt/ngày · Endpoint: sentiment $0.03/call
#!/bin/bash
# crontab: 30 7 * * * /root/sentiment.sh
for kw in bitcoin ethereum solana; do
curl -s -X POST https://api.mekongtradeintel.com/sentiment/ \
-H 'Content-Type: application/json' \
-d "{\"query\":\"$kw\"}" | python3 -c "
import json,sys
d = json.load(sys.stdin)
print(d['query'], '| score:', d['score'], '|', d['label'])
"
done
X-Free-Remaining), fund ví Base một ít USDC, ký 402 challenge và thêm header thanh toán — lịch chạy và code giữ nguyên. Mọi thanh toán đều on-chain, verify được.