Que fait fintool — Compétence de Trading Financier ?
Une suite d'outils CLI pour l'intelligence de marché et le trading sur plusieurs exchanges. Chaque exchange possède son propre binaire.
Outils
| Binaire | Objectif | Chemin |
|---|---|---|
fintool | Intelligence de marché (cotations, actualités, dépôts SEC) | {baseDir}/scripts/fintool |
hyperliquid | Trading Hyperliquid (spot, perp, HIP-3, dépôts) | {baseDir}/scripts/hyperliquid |
binance | Trading Binance (spot, perp, dépôts) | {baseDir}/scripts/binance |
coinbase | Trading Coinbase (spot, dépôts) | {baseDir}/scripts/coinbase |
okx | Trading OKX (spot, perp, dépôts, retraits) | {baseDir}/scripts/okx |
polymarket | Marchés de prédiction Polymarket | {baseDir}/scripts/polymarket |
backtest | Simulation historique + PnL forward (aucune clé nécessaire) | {baseDir}/scripts/backtest |
- Configuration :
~/.fintool/config.toml - Mode : Utilisez toujours le mode JSON —
<binaire> --json '<JSON>'. Toutes les entrées et sorties sont au format JSON structuré. - Pas de champ
exchange: Chaque binaire gère un seul exchange. Aucun paramètre"exchange"nécessaire.
Vérification de configuration (OBLIGATOIRE — faites ceci EN PREMIER)
Avant d'exécuter une commande, vérifiez la configuration de l'utilisateur :
cat ~/.fintool/config.toml 2>/dev/null
Si le fichier n'existe pas, exécutez :
{baseDir}/scripts/fintool --json '{"command":"init"}'
Vérifiez ces prérequis :
-
Clé API OpenAI — Obligatoire pour les cotations enrichies (analyse de tendance/momentum).
- Recherchez :
openai_api_key = "sk-..."(décommenté) dans[api_keys] - Si manquant : Demandez à l'utilisateur sa clé API OpenAI, ou dites-lui de l'ajouter dans
~/.fintool/config.tomlsous[api_keys]
- Recherchez :
-
Au moins un exchange — Obligatoire pour les commandes de trading.
- Hyperliquid :
private_keyouwallet_json+wallet_passcodedans[wallet](spot + perp) - Binance :
binance_api_key+binance_api_secretdans[api_keys](spot + perp) - Coinbase :
coinbase_api_key+coinbase_api_secretdans[api_keys](spot uniquement) - OKX :
okx_api_key+okx_secret_key+okx_passphrasedans[api_keys](spot + perp) - Polymarket : Utilise
wallet.private_key(identique à Hyperliquid) pour le trading sur marchés de prédiction - Si aucun configuré : Demandez à l'utilisateur quel exchange il souhaite utiliser et demandez les identifiants.
- Hyperliquid :
Exception — backtest : Le binaire backtest ne nécessite aucune configuration — pas de clés API, pas de portefeuille. Il utilise les données publiques Yahoo Finance et CoinGecko. Vous pouvez l'utiliser immédiatement.
Si l'utilisateur fournit des identifiants, modifiez directement ~/.fintool/config.toml pour les ajouter.
Capacités des Exchanges
| Fonctionnalité | hyperliquid | binance | coinbase | okx | polymarket | backtest |
|---|---|---|---|---|---|---|
| Ordres spot | achat, vente | achat, vente | achat, vente | achat, vente | — | achat/vente simulé |
| Ordres perp | achat/vente perp | achat/vente perp | — | achat/vente perp | — | achat/vente perp simulé |
| Marchés de prédiction | — | — | — | — | achat, vente, liste, devis | — |
| Carnet d'ordres | spot + perp | spot + perp | spot | spot + perp | — | — |
| Dépôt | Unit + Across | API | API | API | pont | — |
| Retrait | Bridge2 + Unit + Across | API | API | API | pont | — |
| Transfert | spot ↔ perp ↔ dex | spot ↔ futures | — | funding ↔ trading | — | — |
| Solde | solde | solde | solde | solde | solde | simulé |
| Ordres ouverts | ordres | ordres | ordres | ordres | — | — |
| Annulation | annuler | annuler | annuler | annuler | — | — |
| Positions | positions | positions | — | positions | positions | simulé |
| Taux de financement | — | — | — | perp funding_rate | — | — |
| Cours historique | — | — | — | — | — | devis |
| PnL forward | — | — | — | — | — | +1j/+2j/+4j/+7j |
| Dépôts SEC (datés) | — | — | — | — | — | liste rapports/annuel/trimestriel |
Gestion des erreurs
- Toutes les erreurs sont retournées sous forme de
{"error": "..."}. Vérifiez la présence d'une cléerrordans chaque réponse. - Si une commande échoue avec solde insuffisant ou symbole invalide, transmettez clairement l'erreur.
- Si l'exchange n'est pas configuré, dites à l'utilisateur quels identifiants sont nécessaires et proposez de les ajouter à la configuration.
Référence des commandes JSON
Données de marché (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"}
Trading Hyperliquid (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"}
Trading Binance (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"}
Trading OKX (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"}
Remarques OKX :
quoteetorderbooksont des points d'accès publics — aucune clé API nécessaire.- OKX utilise des identifiants d'instrument : spot =
BTC-USDT, perp =BTC-USDT-SWAP. Le CLI met automatiquement en forme à partir du symbole. - OKX a des comptes
funding(pour les dépôts/retraits) ettrading(unifié). Utiliseztransferpour transférer entre eux. - Les frais de retrait sont récupérés automatiquement si
--feen'est pas spécifié. cancelnécessite à la foisinst_id(ex.BTC-USDT) etorder_id.
Trading Coinbase (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..."}
Marchés de prédiction Polymarket (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}
Remarques :
listutilise par défautmin_end_days: 3, filtrant les marchés qui ferment sous 3 jours (qui ont souvent des cotes proches de 1:0). Mettez à0pour voir tous les marchés.listetquotesont en lecture seule et ne nécessitent pas d'identifiants Polymarket.- Les commandes de trading (
buy,sell,deposit,withdraw) nécessitentwallet.private_keydans la configuration. - Utilisez le slug du marché (depuis
list) ou l'ID de condition comme valeurmarket.
Backtesting (backtest)
Important : Le binaire backtest nécessite --at AAAA-MM-JJ comme indicateur CLI (pas dans le corps JSON). Aucune clé API ni portefeuille nécessaire.
# backtest --at <DATE> --json '<JSON>'
// Cours historique
{"command": "quote", "symbol": "BTC"}
{"command": "quote", "symbol": "AAPL"}
{"command": "quote", "symbol": "GOLD"}
// Transactions spot simulées — retourne le PnL forward à +1/+2/+4/+7 jours
{"command": "buy", "symbol": "ETH", "amount": 0.5}
{"command": "buy", "symbol": "AAPL", "amount": 10, "price": 237}
{"command": "sell", "symbol": "BTC", "amount": 0.01, "price": 105000}
// Transactions perp simulées — retourne le PnL forward avec effet de levier
{"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}
// Dépôts SEC filtrés par date
{"command": "report_list", "symbol": "AAPL", "limit": 5}
{"command": "report_annual", "symbol": "TSLA"}
{"command": "report_quarterly", "symbol": "AAPL"}
// Gestion de portefeuille
{"command": "balance"}
{"command": "positions"}
{"command": "reset"}
// Actualités factices (actualités historiques non disponibles)
{"command": "news", "symbol": "BTC"}
Remarques :
- Si
priceest omis dans buy/sell, le cours de clôture historique à la date--atest utilisé automatiquement. - L'état du portefeuille persiste dans
~/.fintool/backtest_portfolio.json. Utilisezresetpour effacer. balanceretournecashBalance(transactions spot uniquement),positions,totalTrades,leverageSettings.- La sortie de transaction inclut un tableau
pnlavec le prix forward, le PnL en dollars et le PnL en pourcentage à chaque décalage. - Sources de données : Yahoo Finance (actions, crypto, matières premières, indices) avec fallback CoinGecko pour la crypto.
Workflows
Workflow 1 : Trading Spot
Objectif : Rechercher un symbole et placer une transaction spot.
Étape 1 — Devis de prix avec analyse :
{baseDir}/scripts/fintool --json '{"command":"quote","symbol":"BTC"}'
Retourne : prix, variations 24h/7j/30j, tendance (haussière/baissière/neutre), momentum, analyse de volume, résumé.
Étape 1b — Vérifier la profondeur du carnet d'ordres et le spread :
{baseDir}/scripts/hyperliquid --json '{"command":"orderbook","symbol":"BTC"}'
Retourne : offres, demandes, spread, spreadPct, midPrice. Utilisez pour évaluer la liquidité avant de trader.
Étape 2 — Vérifier les actualités récentes :
{baseDir}/scripts/fintool --json '{"command":"news","symbol":"BTC"}'
Étape 3 — Placer la transaction :
# Acheter 0,01 BTC au prix maximum de 95000$ sur Hyperliquid
{baseDir}/scripts/hyperliquid --json '{"command":"buy","symbol":"BTC","amount":0.01,"price":95000}'
# Ou sur Binance
{baseDir}/scripts/binance --json '{"command":"buy","symbol":"BTC","amount":0.01,"price":95000}'
# Ou sur Coinbase
{baseDir}/scripts/coinbase --json '{"command":"buy","symbol":"BTC","amount":0.01,"price":95000}'
# Ou sur OKX
{baseDir}/scripts/okx --json '{"command":"buy","symbol":"BTC","amount":0.01,"price":95000}'
Étape 4 — Vérifier :
{baseDir}/scripts/hyperliquid --json '{"command":"orders"}'
{baseDir}/scripts/hyperliquid --json '{"command":"balance"}'
Workflow 2 : Trading de Futures Perpétuels
Objectif : Rechercher et prendre une position à effet de levier via des futures perpétuels.
Étape 1 — Obtenir le devis avec funding/OI :
{baseDir}/scripts/hyperliquid --json '{"command":"quote","symbol":"ETH"}'
Étape 1b — Vérifier la profondeur du carnet d'ordres perp et le spread :
{baseDir}/scripts/hyperliquid --json '{"command":"perp_orderbook","symbol":"ETH"}'
Étape 2 — Vérifier le cours spot pour contexte :
{baseDir}/scripts/fintool --json '{"command":"quote","symbol":"ETH"}'
Étape 3 — Vérifier les actualités :