fintool — Finanzhandels-Skill
Eine Sammlung von CLI-Tools für Marktintelligenz und Handel mit mehreren Börsen. Jede Börse hat ihre eigene Binärdatei.
Werkzeuge
| Binärdatei | Zweck | Pfad |
|---|---|---|
fintool | Marktintelligenz (Kurse, Nachrichten, SEC-Einreichungen) | {baseDir}/scripts/fintool |
hyperliquid | Hyperliquid-Handel (Spot, Perp, HIP-3, Einzahlungen) | {baseDir}/scripts/hyperliquid |
binance | Binance-Handel (Spot, Perp, Einzahlungen) | {baseDir}/scripts/binance |
coinbase | Coinbase-Handel (Spot, Einzahlungen) | {baseDir}/scripts/coinbase |
okx | OKX-Handel (Spot, Perp, Einzahlungen, Auszahlungen) | {baseDir}/scripts/okx |
polymarket | Polymarket-Vorhersagemärkte | {baseDir}/scripts/polymarket |
backtest | Historische Simulation + zukunftsgerichteter PnL (keine Schlüssel nötig) | {baseDir}/scripts/backtest |
- Konfiguration:
~/.fintool/config.toml - Modus: Verwende immer den JSON-Modus –
<binärdatei> --json '<JSON>'. Alle Ein- und Ausgaben sind strukturiertes JSON. - Kein
exchange-Feld: Jede Binärdatei behandelt eine Börse. Kein"exchange"-Parameter nötig.
Einrichtungsprüfung (VERPFLICHTEND – zuerst durchführen)
Überprüfe vor dem Ausführen eines Befehls die Konfiguration des Benutzers:
cat ~/.fintool/config.toml 2>/dev/null
Wenn die Datei nicht existiert, führe folgenden Befehl aus:
{baseDir}/scripts/fintool --json '{"command":"init"}'
Überprüfe diese Anforderungen:
-
OpenAI-API-Schlüssel – Erforderlich für angereicherte Kurse (Trend-/Momentum-Analyse).
- Suche nach:
openai_api_key = "sk-..."(auskommentiert) in[api_keys] - Fehlt er: Frage den Benutzer nach seinem OpenAI-API-Schlüssel oder teile ihm mit, dass er ihn unter
[api_keys]in~/.fintool/config.tomlhinzufügen muss.
- Suche nach:
-
Mindestens eine Börse – Erforderlich für Handelsbefehle.
- Hyperliquid:
private_keyoderwallet_json+wallet_passcodein[wallet](Spot + Perps) - Binance:
binance_api_key+binance_api_secretin[api_keys](Spot + Perps) - Coinbase:
coinbase_api_key+coinbase_api_secretin[api_keys](nur Spot) - OKX:
okx_api_key+okx_secret_key+okx_passphrasein[api_keys](Spot + Perps) - Polymarket: Verwendet
wallet.private_key(selbe wie Hyperliquid) für den Handel auf Vorhersagemärkten - Ist keine konfiguriert: Frage den Benutzer, welche Börse er verwenden möchte und fordere die entsprechenden Zugangsdaten an.
- Hyperliquid:
Ausnahme – backtest: Die Backtest-Binärdatei benötigt keine Konfiguration – keine API-Schlüssel, kein Wallet. Sie verwendet öffentliche Daten von Yahoo Finance und CoinGecko. Du kannst sie sofort nutzen.
Wenn der Benutzer Zugangsdaten bereitstellt, bearbeite ~/.fintool/config.toml direkt, um sie hinzuzufügen.
Fähigkeiten der Börsen
| Funktion | hyperliquid | binance | coinbase | okx | polymarket | backtest |
|---|---|---|---|---|---|---|
| Spot-Aufträge | kaufen, verkaufen | kaufen, verkaufen | kaufen, verkaufen | kaufen, verkaufen | — | simulierter Kauf/Verkauf |
| Perp-Aufträge | perp kaufen/verkaufen | perp kaufen/verkaufen | — | perp kaufen/verkaufen | — | simulierter perp Kauf/Verkauf |
| Vorhersagemärkte | — | — | — | — | kaufen, verkaufen, auflisten, bepreisen | — |
| Orderbuch | Spot + Perp | Spot + Perp | Spot | Spot + Perp | — | — |
| Einzahlung | Unit + Across | API | API | API | bridge | — |
| Auszahlung | Bridge2 + Unit + Across | API | API | API | bridge | — |
| Transfer | Spot ↔ Perp ↔ DEX | Spot ↔ Futures | — | Funding ↔ Trading | — | — |
| Guthaben | Guthaben | Guthaben | Guthaben | Guthaben | Guthaben | simuliert |
| Offene Aufträge | Aufträge | Aufträge | Aufträge | Aufträge | — | — |
| Stornieren | stornieren | stornieren | stornieren | stornieren | — | — |
| Positionen | Positionen | Positionen | — | Positionen | Positionen | simuliert |
| Funding-Rate | — | — | — | perp funding_rate | — | — |
| Historischer Kurs | — | — | — | — | — | Kurs |
| Zukunftsgerichteter PnL | — | — | — | — | — | +1d/+2d/+4d/+7d |
| SEC-Einreichungen (datiert) | — | — | — | — | — | Berichtsliste/jährlich/vierteljährlich |
Fehlerbehandlung
- Alle Fehler werden als
{"error": "..."}zurückgegeben. Überprüfe in jeder Antwort auf einenerror-Schlüssel. - Schlägt ein Befehl mit unzureichendem Guthaben oder ungültigem Symbol fehl, gib den Fehler klar weiter.
- Wenn die Börse nicht konfiguriert ist, teile dem Benutzer mit, welche Zugangsdaten benötigt werden und biete an, sie zur Konfiguration hinzuzufügen.
JSON-Befehlsreferenz
Marktdaten (fintool)
// fintool --json '<JSON>'
{"command": "quote", "symbol": "BTC"}
{"command": "news", "symbol": "AAPL"}
{"command": "report_list", "symbol": "AAPL", "limit": 5}
{"command": "report_annual", "symbol": "AAPL"}
{"command": "report_quarterly", "symbol": "AAPL"}
{"command": "report_get", "symbol": "AAPL", "accession": "0000320193-24-000123"}
Hyperliquid-Handel (hyperliquid)
// hyperliquid --json '<JSON>'
{"command": "address"}
{"command": "buy", "symbol": "ETH", "amount": 0.1, "price": 3800}
{"command": "sell", "symbol": "ETH", "amount": 0.1, "price": 4000}
{"command": "orderbook", "symbol": "HYPE"}
{"command": "orderbook", "symbol": "BTC", "levels": 10}
{"command": "quote", "symbol": "ETH"}
{"command": "perp_orderbook", "symbol": "BTC"}
{"command": "perp_buy", "symbol": "ETH", "amount": 0.5, "price": 3800}
{"command": "perp_sell", "symbol": "BTC", "amount": 0.01, "price": 100000}
{"command": "perp_buy", "symbol": "ETH", "amount": 0.5, "price": 3900, "close": true}
{"command": "perp_sell", "symbol": "BTC", "amount": 0.01, "price": 95000, "close": true}
{"command": "perp_leverage", "symbol": "ETH", "leverage": 5, "cross": true}
{"command": "perp_set_mode", "mode": "unified"}
{"command": "balance"}
{"command": "positions"}
{"command": "orders"}
{"command": "orders", "symbol": "BTC"}
{"command": "cancel", "order_id": "BTC:91490942"}
{"command": "deposit", "asset": "ETH", "amount": 0.01}
{"command": "deposit", "asset": "ETH", "amount": 0.05, "dry_run": true}
{"command": "deposit", "asset": "BTC", "amount": 0.001}
{"command": "deposit", "asset": "USDC", "amount": 100, "from": "base"}
{"command": "deposit", "asset": "USDC", "amount": 100, "from": "ethereum", "dry_run": true}
{"command": "withdraw", "asset": "USDC", "amount": 100}
{"command": "withdraw", "asset": "USDC", "amount": 100, "to": "base"}
{"command": "withdraw", "asset": "ETH", "amount": 0.5}
{"command": "transfer", "asset": "USDT0", "amount": 50, "from": "spot", "to": "cash"}
{"command": "transfer", "asset": "USDT0", "amount": 50, "from": "cash", "to": "spot"}
{"command": "bridge_status"}
Binance-Handel (binance)
// binance --json '<JSON>'
{"command": "buy", "symbol": "BTC", "amount": 0.01, "price": 95000}
{"command": "sell", "symbol": "BTC", "amount": 0.01, "price": 100000}
{"command": "orderbook", "symbol": "BTC"}
{"command": "perp_buy", "symbol": "ETH", "amount": 0.5, "price": 3800}
{"command": "perp_sell", "symbol": "ETH", "amount": 0.5, "price": 4000, "close": true}
{"command": "perp_leverage", "symbol": "ETH", "leverage": 5}
{"command": "balance"}
{"command": "positions"}
{"command": "orders"}
{"command": "cancel", "order_id": "binance_spot:BTCUSDT:123"}
{"command": "deposit", "asset": "USDC", "from": "ethereum"}
{"command": "withdraw", "asset": "USDC", "amount": 100, "to": "0x...", "network": "ethereum"}
OKX-Handel (okx)
// okx --json '<JSON>'
{"command": "quote", "symbol": "BTC"}
{"command": "buy", "symbol": "ETH", "amount": 0.01, "price": 2000}
{"command": "sell", "symbol": "ETH", "amount": 0.01, "price": 2100}
{"command": "orderbook", "symbol": "BTC"}
{"command": "perp_orderbook", "symbol": "ETH"}
{"command": "perp_buy", "symbol": "ETH", "amount": 0.1, "price": 2000}
{"command": "perp_sell", "symbol": "ETH", "amount": 0.1, "price": 2100, "close": true}
{"command": "perp_leverage", "symbol": "ETH", "leverage": 5, "cross": true}
{"command": "perp_funding_rate", "symbol": "BTC"}
{"command": "balance"}
{"command": "positions"}
{"command": "orders"}
{"command": "cancel", "inst_id": "BTC-USDT", "order_id": "12345"}
{"command": "deposit", "asset": "USDC", "network": "base"}
{"command": "deposit", "asset": "ETH", "network": "ethereum"}
{"command": "withdraw", "asset": "USDC", "amount": 100, "network": "base"}
{"command": "withdraw", "asset": "USDC", "amount": 100, "to": "0x...", "network": "ethereum"}
{"command": "transfer", "asset": "USDT", "amount": 100, "from": "funding", "to": "trading"}
{"command": "transfer", "asset": "USDT", "amount": 100, "from": "trading", "to": "funding"}
OKX-Hinweise:
quoteundorderbooksind öffentliche Endpunkte – keine API-Schlüssel nötig.- OKX verwendet Instrumenten-IDs: Spot =
BTC-USDT, Perp =BTC-USDT-SWAP. Die CLI formatiert automatisch aus dem Symbol. - OKX hat
funding-Konten (für Ein-/Auszahlungen) undtrading-Konten (vereinheitlicht). Verwendetransfer, um zwischen ihnen zu wechseln. - Die Auszahlungsgebühr wird automatisch abgerufen, wenn
--feenicht angegeben ist. - Stornieren erfordert sowohl
inst_id(z.B.BTC-USDT) als auchorder_id.
Coinbase-Handel (coinbase)
// coinbase --json '<JSON>'
{"command": "buy", "symbol": "ETH", "amount": 0.1, "price": 3800}
{"command": "sell", "symbol": "ETH", "amount": 0.1, "price": 4000}
{"command": "orderbook", "symbol": "BTC"}
{"command": "balance"}
{"command": "orders"}
{"command": "cancel", "order_id": "coinbase:uuid-here"}
{"command": "deposit", "asset": "ETH"}
{"command": "withdraw", "asset": "USDC", "amount": 100, "to": "0x..."}
Polymarket-Vorhersagemärkte (polymarket)
// polymarket --json '<JSON>'
{"command": "list", "query": "bitcoin"}
{"command": "list", "query": "election", "limit": 5}
{"command": "list", "query": "bitcoin", "min_end_days": 7}
{"command": "list", "query": "bitcoin", "min_end_days": 0}
{"command": "quote", "market": "will-bitcoin-hit-100k"}
{"command": "buy", "market": "will-bitcoin-hit-100k", "outcome": "yes", "amount": 10, "price": 0.65}
{"command": "sell", "market": "will-bitcoin-hit-100k", "outcome": "yes", "amount": 10, "price": 0.70}
{"command": "positions"}
{"command": "balance"}
{"command": "deposit", "amount": 100, "from": "base"}
{"command": "withdraw", "amount": 50}
Hinweise:
liststandardmäßig mitmin_end_days: 3, wodurch Märkte ausgefiltert werden, die innerhalb von 3 Tagen schließen (da diese oft Quoten nahe 1:0 haben). Setze auf0, um alle Märkte zu sehen.listundquotesind schreibgeschützt und erfordern keine Polymarket-Zugangsdaten.- Handelsbefehle (
buy,sell,deposit,withdraw) erfordernwallet.private_keyin der Konfiguration. - Verwende den Markt-Slug (aus
list) oder die Bedingungs-ID alsmarket-Wert.
Backtesting (backtest)
Wichtig: Die backtest-Binärdatei erfordert --at YYYY-MM-DD als CLI-Flag (nicht im JSON-Text). Keine API-Schlüssel oder Wallet nötig.
# backtest --at <DATUM> --json '<JSON>'
// Historischer Preis
{"command": "quote", "symbol": "BTC"}
{"command": "quote", "symbol": "AAPL"}
{"command": "quote", "symbol": "GOLD"}
// Simulierte Spot-Trades – gibt zukunftsgerichteten PnL bei +1/+2/+4/+7 Tagen zurück
{"command": "buy", "symbol": "ETH", "amount": 0.5}
{"command": "buy", "symbol": "AAPL", "amount": 10, "price": 237}
{"command": "sell", "symbol": "BTC", "amount": 0.01, "price": 105000}
// Simulierte Perp-Trades – gibt gehebelten zukunftsgerichteten PnL zurück
{"command": "perp_leverage", "symbol": "ETH", "leverage": 5}
{"command": "perp_buy", "symbol": "ETH", "amount": 0.5, "price": 3300}
{"command": "perp_sell", "symbol": "BTC", "amount": 0.01, "price": 100000}
// SEC-Einreichungen gefiltert nach Datum
{"command": "report_list", "symbol": "AAPL", "limit": 5}
{"command": "report_annual", "symbol": "TSLA"}
{"command": "report_quarterly", "symbol": "AAPL"}
// Portfolioverwaltung
{"command": "balance"}
{"command": "positions"}
{"command": "reset"}
// Nachrichten-Stub (historische Nachrichten nicht verfügbar)
{"command": "news", "symbol": "BTC"}
Hinweise:
- Wenn
pricebei Kauf/Verkauf weggelassen wird, wird automatisch der historische Schlusskurs zum--at-Datum verwendet. - Der Portfoliostatus bleibt in
~/.fintool/backtest_portfolio.jsonerhalten. Verwendereset, um ihn zu löschen. balancegibtcashBalance(nur Spot-Trades),positions,totalTrades,leverageSettingszurück.- Die Handelsausgabe enthält ein
pnl-Array mit zukunftsgerichteten Preisen, Dollar-PnL und prozentualem PnL zu jedem Offset. - Datenquellen: Yahoo Finance (Aktien, Kryptos, Rohstoffe, Indizes) mit CoinGecko als Fallback für Kryptos.
Workflows
Workflow 1: Spot-Handel
Ziel: Ein Symbol recherchieren und einen Spot-Trade platzieren.
Schritt 1 — Kurs mit Analyse abfragen:
{baseDir}/scripts/fintool --json '{"command":"quote","symbol":"BTC"}'
Gibt zurück: Preis, 24h/7d/30d-Änderungen, Trend (bullish/bearish/neutral), Momentum, Volumenanalyse, Zusammenfassung.
Schritt 1b — Orderbuchtiefe und Spread prüfen:
{baseDir}/scripts/hyperliquid --json '{"command":"orderbook","symbol":"BTC"}'
Gibt zurück: Gebote, Nachfragen, Spread, SpreadPct, MidPrice. Zur Beurteilung der Liquidität vor dem Handel.
Schritt 2 — Aktuelle Nachrichten prüfen:
{baseDir}/scripts/fintool --json '{"command":"news","symbol":"BTC"}'
Schritt 3 — Den Trade platzieren:
# 0,01 BTC zu einem Maximalpreis von 95000 $ auf Hyperliquid kaufen
{baseDir}/scripts/hyperliquid --json '{"command":"buy","symbol":"BTC","amount":0.01,"price":95000}'
# Oder auf Binance
{baseDir}/scripts/binance --json '{"command":"buy","symbol":"BTC","amount":0.01,"price":95000}'
# Oder auf Coinbase
{baseDir}/scripts/coinbase --json '{"command":"buy","symbol":"BTC","amount":0.01,"price":95000}'
# Oder auf OKX
{baseDir}/scripts/okx --json '{"command":"buy","symbol":"BTC","amount":0.01,"price":95000}'
Schritt 4 — Überprüfen:
{baseDir}/scripts/hyperliquid --json '{"command":"orders"}'
{baseDir}/scripts/hyperliquid --json '{"command":"balance"}'
Workflow 2: Perpetual Futures-Handel
Ziel: Recherchieren und eine gehebelte Position über Perpetual Futures eröffnen.
Schritt 1 — Kurs mit Funding/OI abfragen:
{baseDir}/scripts/hyperliquid --json '{"command":"quote","symbol":"ETH"}'
Schritt 1b — Perp-Orderbuchtiefe und Spread prüfen:
{baseDir}/scripts/hyperliquid --json '{"command":"perp_orderbook","symbol":"ETH"}'
Schritt 2 — Spotpreis für Kontext prüfen:
{baseDir}/scripts/fintool --json '{"command":"quote","symbol":"ETH"}'
Schritt 3 — Nachrichten prüfen:
…[im Original abgeschnitten für die Übersetzung]