メインコンテンツへスキップ
ターミナルから fcontext を使用して Financial Context 市場データを照会し、サインインを管理し、スクリプトや agent 向けに JSON を出力します。 CLI はデフォルトで Financial Context に接続します。
https://openapi.fcontext.com
コマンドは /api/market-data/* 配下の読み取り専用市場データエンドポイントを呼び出します。現在の CLI は US 株式データにフォーカスしており、シンボルは CODE.US 形式、market フィルターは US である必要があります。

コマンドの基本

どちらのコマンド名も使用できます。fctxfcontext の短いエイリアスで、同じサブコマンド、flag、出力形式、schema をサポートします。
fcontext quote AAPL.US MSFT.US --format json
fctx quote AAPL.US MSFT.US --format json

インストール

Aitaport tap から fcontext-terminal cask をインストールします。
brew install --cask aitaport/tap/fcontext-terminal
Release artifact は terminal プロジェクトの fcontext-terminal-* パッケージ名を使用します。 fcontext-terminal-darwin-amd64.tar.gzfcontext-terminal-darwin-arm64.tar.gzfcontext-terminal-linux-musl-amd64.tar.gzfcontext-terminal-linux-musl-arm64.tar.gzfcontext-terminal-windows-amd64.zip が含まれます。shell と PowerShell のインストーラーは対応するアーカイブをダウンロードし、 .sha256 checksum を検証して、fcontextfctx の両方をインストールします。

認証

CLI 認証を管理します。サインイン、サインアウト、ローカル token 状態の確認ができます。

OAuth 2.0 ログイン

OAuth 2.0 authorization-code flow でサインインします。CLI が認可 URL と次に実行するコマンドを表示するため、ローカルターミナル、SSH session、headless server で利用できます。
fcontext auth login
表示された認可 URL を任意のブラウザで開き、認可を完了して返された code をコピーし、次のように引き換えます。
fcontext auth login --auth-code YOUR_CODE
CLI は token をローカルの fcontext 設定ディレクトリに oauth-token.json として保存します。以降のコマンドはその token を自動的に再利用します。

Authorization Code

現在のマシンでブラウザを使えない場合は、Financial Context Connect から一回限りの authorization code を生成して直接引き換えます。
fcontext auth login --auth-code YOUR_CODE

ログアウト

ローカルに保存された OAuth token を削除します。次の認証済みコマンドでは再ログインが必要です。
fcontext auth logout

認証ステータス

現在の base URL とサインイン状態を確認します。
fcontext auth status
fcontext auth status --format json

チェック

アクティブな市場セッションに依存せず、サインインと Financial Context API 接続性を検証します。レポートには endpoint ステータスとレイテンシが含まれます。
fcontext check
fcontext check --format json
fctx check --format json

更新

公式インストーラースクリプトをダウンロードして実行し、現在の CLI binary を最新リリースに置き換えます。
fcontext update
fctx update

最初のコマンド

# リアルタイムクォート
fcontext quote AAPL.US MSFT.US

# 短いエイリアス
fctx quote AAPL.US MSFT.US

# スクリプトと agent 向け JSON 出力
fcontext quote AAPL.US MSFT.US --format json

# 静的な証券情報
fcontext static AAPL.US MSFT.US

# 日足ローソク足
fcontext kline AAPL.US --period day --count 100

# 日付範囲で過去ローソク足を取得
fcontext kline history AAPL.US --start 2024-01-01 --end 2024-12-31

市場データ

fcontext market-status
fcontext top-movers --market US --sort hot --count 20
fcontext market-temp US
fcontext market-temp US --history --start 2024-01-01 --end 2024-12-31
fcontext trading session
fcontext trading days US --start 2026-01-01 --end 2026-01-31
fcontext security-list US
fear-greed を使用すると Fear & Greed Index を確認できます。これは投資家のリスク選好を extreme fear から extreme greed までの尺度で要約する市場センチメント指標です。
fcontext fear-greed
fcontext fear-greed --history-count 90 --indicator-history-count 10 --format json

企業データ

fcontext company AAPL.US
fcontext fundamental-compare AAPL.US
fcontext compare AAPL.US MSFT.US NVDA.US --currency USD
fcontext consensus AAPL.US
fcontext dividend AAPL.US
fcontext forecast-eps AAPL.US
fcontext insider-trades AAPL.US --count 20
fcontext institution-rating AAPL.US
fcontext institution-rating detail AAPL.US
fcontext operating AAPL.US
fcontext shareholder AAPL.US
fcontext shareholder AAPL.US --top --periods 4
fcontext valuation AAPL.US
fcontext valuation AAPL.US --history

ニュースとイベント

fcontext news AAPL.US
fcontext filing AAPL.US
fcontext topic AAPL.US
fcontext finance-calendar report --market US
fcontext finance-calendar dividend --market US

取引アクティビティ

fcontext trades AAPL.US --count 50
fcontext trade-stats AAPL.US
fcontext short-positions AAPL.US
fcontext short-trades AAPL.US

スクリーナー

fcontext screener strategies --market US
fcontext screener mine --market US
fcontext screener strategy 19
fcontext screener run 19 --count 20
fcontext screener filter pettm:10:50 roe:5: --market US
fcontext screener indicators

エンドポイントへの直接アクセス

専用コマンドがまだないサポート済みの読み取り専用エンドポイントには、api get を使用します。
fcontext api get /api/market-data/market/status --format json
CLI はリクエスト送信前に、絶対 URL、streaming endpoint、US 以外の market フィルター、サポートされていないアカウントまたは取引パスを拒否します。

Agent 向け出力

すべてのコマンドは JSON 出力をサポートします。
fcontext company AAPL.US --format json
--schema で機械可読なレスポンス schema を出力します。
fcontext company --schema
fcontext quote --schema
fctx quote --schema
shell completions を生成します。
fcontext completion zsh > ~/.zfunc/_fcontext
fcontext completion bash > ~/.local/share/bash-completion/completions/fcontext
fcontext completion fish > ~/.config/fish/completions/fcontext.fish

トラブルシューティング

問題確認すること
Missing fcontext credentialsfcontext auth login を実行するか、fcontext auth login --auth-code YOUR_CODE で authorization code を引き換えます。
fcontext API error (401)fcontext auth status を実行し、ローカル token がない、または期限切れの場合は fcontext auth login で再度サインインします。
US 以外の symbol が拒否されるAAPL.US のような symbol を使用します。CLI は意図的に US 以外の市場を公開していません。
リクエスト詳細が必要--verbose を追加すると、リクエスト URL と経過時間が stderr に出力されます。