tiger-openapi-cli
v0.2.6
Published
CLI for the Tiger OpenAPI SDK.
Readme
tiger-openapi-cli
tiger-openapi-cli is a command-line tool built on top of the tiger-openapi SDK. It helps you quickly validate configuration and query account and market data (stocks, options, funds, crypto, futures, warrants, and more).
Installation
# npm
npm i -g tiger-openapi-cli
# pnpm
pnpm add -g tiger-openapi-cli
# yarn
yarn global add tiger-openapi-cliAfter installation, run:
tiger-openapi --helpCredentials Setup
The CLI requires the following credentials:
TIGER_ID(orTIGER_OPENAPI_TIGER_ID)TIGER_ACCOUNT(orTIGER_OPENAPI_ACCOUNT)TIGER_PRIVATE_KEY(orTIGER_OPENAPI_PRIVATE_KEY)
Optional:
TIGER_ENV(orTIGER_OPENAPI_ENV), available values:prod | us | sandbox, default isprod
Option 1: Use a .env file (recommended)
Create a .env file in your project root:
TIGER_ID=your_tiger_id
TIGER_ACCOUNT=your_account
TIGER_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
TIGER_ENV=prodOption 2: Use the CLI config file
Write config with the command below (saved to ~/.tiger-openapi-cli.json):
tiger-openapi config \
--tiger_id your_tiger_id \
--account your_account \
--private_key "your_private_key" \
--env prodShow current config:
tiger-openapi configConfiguration Priority
Command-line arguments > CLI config file > environment variables (including .env).
For example, --account xxx overrides account from both the config file and .env.
Check Configuration First
tiger-openapi checkThis command prints whether the current configuration is valid, along with environment info and SDK version.
Common Commands
Account
tiger-openapi accountStock
tiger-openapi stock --symbol AAPLOptions
# Query available expirations
tiger-openapi options --symbol AAPL
# Query option chain for a specific expiration
tiger-openapi options --symbol AAPL --expiry 2026-03-20
# Query option chain with market/right/strike and greek values
tiger-openapi options \
--symbol AAPL \
--expiry 2026-03-20 \
--market US \
--right CALL \
--strike 250 \
--return_greek_value trueFund
tiger-openapi fund --symbol 000001Crypto
tiger-openapi crypto --symbol BTCUSDFutures
tiger-openapi futures --symbol ESmainWarrants
tiger-openapi warrants --symbol 12345Market Scanner
tiger-openapi scanner --market US --page 1 --page_size 20Optional arguments:
--sec_type: for exampleSTK,OPT,FUT--page: page number, default1--page_size: page size, default20
Order Commands
The order command group maps to the SDK order APIs for order placement, query, modification, cancellation, preview, transactions, and contract lookup.
Place / Preview / Modify / Cancel
# Place order
tiger-openapi order place \
--action BUY \
--order_type LMT \
--symbol AAPL \
--sec_type STK \
--total_quantity 1 \
--limit_price 180
# Preview order
tiger-openapi order preview \
--action BUY \
--order_type LMT \
--symbol AAPL \
--sec_type STK \
--total_quantity 1 \
--limit_price 180
# Modify order
tiger-openapi order modify \
--id 123456 \
--order_type LMT \
--limit_price 181
# Cancel order
tiger-openapi order cancel --id 123456Query Orders
# Query one order by id/order_id
tiger-openapi order query --id 123456
# Query orders list
tiger-openapi order query \
--market US \
--symbol AAPL \
--states FILLED,CANCELLED \
--limit 20
# Query open / cancelled / filled orders
tiger-openapi order open --market US --symbol AAPL
tiger-openapi order cancelled --market US --symbol AAPL
tiger-openapi order filled --market US --symbol AAPLTransactions and Contracts
# Order transactions
tiger-openapi order transactions --order_id 100001 --limit 20
# Contract lookup (single or comma-separated symbols)
tiger-openapi order contract --symbol AAPL --sec_type STK
tiger-openapi order contract --symbol AAPL,TSLA --sec_type STK
# Contracts lookup
tiger-openapi order contracts --symbols AAPL,TSLA --sec_type STK
# Derivative contracts lookup
tiger-openapi order derivative-contracts \
--symbol AAPL \
--sec_type OPT \
--expiry 2026-03-20Common Override Flags
Most query commands support the following override flags (for temporary overrides):
--path <path>: specify a.envfile path--tiger_id <tiger_id>--private_key <private_key>--account <account>
Example:
tiger-openapi stock --symbol TSLA --path ./.env.prodDevelopment
Run these commands from the monorepo root:
pnpm --filter tiger-openapi-cli build
pnpm --filter tiger-openapi-cli dev
pnpm --filter tiger-openapi-cli typecheckLicense
GPL-3.0-only
