116 lines
3.7 KiB
YAML
116 lines
3.7 KiB
YAML
# Finance Briefing Workflow for Lobster
|
|
# Usage: lobster "workflows.run --file workflows/briefing.yaml --args-json '{\"time\":\"morning\",\"lang\":\"de\"}'"
|
|
#
|
|
# This workflow:
|
|
# 1. Generates a market briefing via Docker
|
|
# 2. Halts for approval before sending
|
|
# 3. Sends to messaging channel after approval
|
|
|
|
name: finance.briefing
|
|
description: Generate market briefing and send to WhatsApp/Telegram with approval gate
|
|
|
|
args:
|
|
time:
|
|
default: morning
|
|
description: "Briefing type: morning or evening"
|
|
lang:
|
|
default: de
|
|
description: "Language: en or de"
|
|
channel:
|
|
default: "${FINANCE_NEWS_CHANNEL:-whatsapp}"
|
|
description: "Delivery channel: whatsapp or telegram"
|
|
target:
|
|
default: "${FINANCE_NEWS_TARGET}"
|
|
description: "Target: group name, JID, phone number, or Telegram chat ID (requires FINANCE_NEWS_TARGET env var if not specified)"
|
|
fast:
|
|
default: "false"
|
|
description: "Use fast mode: true or false"
|
|
|
|
steps:
|
|
# Generate briefing and save to temp file
|
|
- id: generate
|
|
command: |
|
|
SKILL_DIR="${SKILL_DIR:-$HOME/projects/skills/personal/finance-news}"
|
|
FAST_FLAG=""
|
|
if [ "${fast}" = "true" ]; then FAST_FLAG="--fast"; fi
|
|
OUTFILE="/tmp/lobster-briefing-$$.json"
|
|
# Resolve openbb-quote symlink for Docker mount
|
|
OPENBB_BIN=$(realpath "$HOME/.local/bin/openbb-quote" 2>/dev/null || echo "")
|
|
OPENBB_MOUNT=""
|
|
if [ -f "$OPENBB_BIN" ]; then
|
|
OPENBB_MOUNT="-v $OPENBB_BIN:/usr/local/bin/openbb-quote:ro"
|
|
fi
|
|
docker run --rm \
|
|
-v "$SKILL_DIR/config:/app/config:ro" \
|
|
-v "$SKILL_DIR/scripts:/app/scripts:ro" \
|
|
$OPENBB_MOUNT \
|
|
finance-news-briefing python3 scripts/briefing.py \
|
|
--time "${time}" \
|
|
--lang "${lang}" \
|
|
--json \
|
|
$FAST_FLAG > "$OUTFILE"
|
|
# Output the file path for subsequent steps
|
|
echo "$OUTFILE"
|
|
description: Generate briefing via Docker
|
|
|
|
# Translate portfolio headlines (if German)
|
|
- id: translate
|
|
command: |
|
|
OUTFILE=$(cat)
|
|
OUTFILE=$(echo "$OUTFILE" | tr -d '\n')
|
|
SKILL_DIR="${SKILL_DIR:-$HOME/projects/skills/personal/finance-news}"
|
|
if [ "${lang}" = "de" ]; then
|
|
python3 "$SKILL_DIR/scripts/translate_portfolio.py" "$OUTFILE" --lang de || true
|
|
fi
|
|
echo "$OUTFILE"
|
|
stdin: $generate.stdout
|
|
description: Translate portfolio headlines via openclaw
|
|
|
|
# Approval gate - workflow halts here until user approves
|
|
- id: approve
|
|
approval: required
|
|
command: |
|
|
OUTFILE=$(cat)
|
|
echo "Briefing saved to: $OUTFILE"
|
|
echo "Target: ${target}"
|
|
echo "Channel: ${channel}"
|
|
cat "$OUTFILE" | jq -r '.macro_message' | head -20
|
|
echo "..."
|
|
echo "Review above. Approve to send."
|
|
stdin: $translate.stdout
|
|
description: Approval gate before message delivery
|
|
|
|
# Send macro briefing (market overview)
|
|
- id: send_macro
|
|
command: |
|
|
OUTFILE=$(cat)
|
|
OUTFILE=$(echo "$OUTFILE" | tr -d '\n')
|
|
MSG=$(jq -r '.macro_message // empty' "$OUTFILE")
|
|
if [ -n "$MSG" ]; then
|
|
openclaw message send \
|
|
--channel "${channel}" \
|
|
--target "${target}" \
|
|
--message "$MSG"
|
|
else
|
|
echo "No macro message to send"
|
|
fi
|
|
stdin: $translate.stdout
|
|
description: Send macro briefing
|
|
|
|
# Send portfolio briefing (stock movers)
|
|
- id: send_portfolio
|
|
command: |
|
|
OUTFILE=$(cat)
|
|
OUTFILE=$(echo "$OUTFILE" | tr -d '\n')
|
|
MSG=$(jq -r '.portfolio_message // empty' "$OUTFILE")
|
|
if [ -n "$MSG" ]; then
|
|
openclaw message send \
|
|
--channel "${channel}" \
|
|
--target "${target}" \
|
|
--message "$MSG"
|
|
else
|
|
echo "No portfolio message to send"
|
|
fi
|
|
stdin: $translate.stdout
|
|
description: Send portfolio briefing
|