Skip to content

Instantly share code, notes, and snippets.

@koliadych
Created May 10, 2026 22:17
Show Gist options
  • Select an option

  • Save koliadych/20fc73fccb693603c4cc9b1ab04050bf to your computer and use it in GitHub Desktop.

Select an option

Save koliadych/20fc73fccb693603c4cc9b1ab04050bf to your computer and use it in GitHub Desktop.
fintechner audit v2 correct schemas
#!/bin/bash
set -euo pipefail
export AWS_PAGER=""
REGION=ap-northeast-1
INSTANCE_ID=i-089ad4a6b76132ba2
CMD_ID=$(aws --region "$REGION" ssm send-command \
--instance-ids "$INSTANCE_ID" \
--document-name AWS-RunShellScript \
--parameters '{"commands":[
"echo === hl_credentials (env is PK) ===",
"sudo docker exec timescale psql -U fintechner -d fintechner -c \"SELECT env, account_addr, agent_addr, instruments, last_auth_ok, last_auth_err FROM hl_credentials;\" 2>&1 | head -10",
"echo",
"echo === strategy_configs (uses status not state) ===",
"sudo docker exec timescale psql -U fintechner -d fintechner -c \"SELECT id, name, type, status, created_at FROM strategy_configs;\" 2>&1 | head -15",
"echo",
"echo === recent strategy_decisions ===",
"sudo docker exec timescale psql -U fintechner -d fintechner -c \"SELECT ts, strategy_id, coin, side, price, size, reason, state FROM strategy_decisions ORDER BY ts DESC LIMIT 10;\" 2>&1 | head -25",
"echo",
"echo === orders ===",
"sudo docker exec timescale psql -U fintechner -d fintechner -c \"SELECT cloid, origin, owner_id, coin, side, status, error_msg FROM orders ORDER BY submitted_at DESC LIMIT 10;\" 2>&1 | head -20",
"echo",
"echo === connector logs about strategy/intent/risk/halt ===",
"sudo journalctl -u fintechner-connector --since \"20 min ago\" --no-pager 2>&1 | grep -iE \"strategy|intent|risk|halted|reject|kill\" | tail -30"
]}' \
--query Command.CommandId --output text)
for i in $(seq 1 25); do
sleep 4
STATUS=$(aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query Status --output text 2>/dev/null || echo Pending)
case "$STATUS" in Success|Failed|Cancelled|TimedOut) echo " $STATUS"; break ;; *) echo " $STATUS";; esac
done
echo
aws --region "$REGION" ssm get-command-invocation --command-id "$CMD_ID" --instance-id "$INSTANCE_ID" --query StandardOutputContent --output text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment