tiger-openapi
v0.3.3
Published
Tiger OpenAPI SDK for Node.js and browsers.
Readme
tiger-openapi
TypeScript monorepo for building a Tiger OpenAPI SDK across multiple runtimes and deployment environments.
The repository currently exposes one public package with a browser subpath export:
tiger-openapitiger-openapi/browser
It also supports multiple runtime targets at the architecture level:
[!IMPORTANT]
This is not the official NodeJS SDK, and currently it's still under development.Before you start to use this api, ensure you have opened tiger api call. Or you can visit this page to start.
If any bug, please open an issue
Installation
# via pnpm
pnpm add tiger-openapi
# via npm
npm i tiger-openapi
# via yarn
yarn add tiger-openapiQuick Start
Node.js
import { TigerClient, createTigerClient } from 'tiger-openapi';
const tiger = new TigerClient({
tigerId: '...',
account: '...',
privateKey: '-...',
});
// or
const tiger = createTigerClient({
tigerId: '...',
account: '...',
privateKey: '-...',
});Browser
import { TigerClient, createTigerClient } from 'tiger-openapi/browser';
// apply in tiger openapi page
const tiger = new TigerClient({
tigerId: '...',
account: '...',
privateKey: '-...',
});
// or
const tiger = createTigerClient({
tigerId: '...',
account: '...',
privateKey: '-...',
});Example
Here is some example about how to call the quote / account / order api, you can visit the examples for more details.
Quote
Common
For more details please check the API document.
await tiger.quote.common.grabQuotePermission();
await tiger.quote.common.getQuotePermission();
await tiger.quote.common.getKlineQuote({
/* */
});Crypto
For more details please check the API document.
await tiger.quote.crypto.getSymbols();Funds
For more details please check the API document
await client.quote.funds.getFundSymbols();Futures
For more details please check the API document
await client.quote.futures.getFutureExchanges();Options
Please ensure you have permission to enable query options before you call the API.
await tiger.quote.options.getOptionExpirations({
/* */
});
await tiger.quote.options.getOptionBriefs({
/* */
});For more details about Options, please check the document.
Stock
Please ensure you have permission to enable query stock before you call the API.
await tiger.quote.stock.getMarketStatus({
/* */
});
await tiger.quote.stock.getTradingCalendar({
/* */
});For more details please check the API document about stock.
Warrants
For more details please check the API document about warrant.
await tiger.quote.warrants.getWarrantBriefs({
/* */
});Accounts
For more details please check the API document about warrant.
const accountInfo = await client.account.getAccountInfo();
console.log('accountInfo::', accountInfo);
const accountBalance = await client.account.getAccountBalance();
console.log('accountBalance::', accountBalance);Order
For more details please check the API document about warrant.
// 1. getContract
const contract = await client.order.getContract({ symbol: 'AAPL', sec_type: 'STK' });
logResult('getContract', contract);
// 2. getContracts
const contracts = await client.order.getContracts({ symbols: ['AAPL'], sec_type: 'STK' });
logResult('getContracts', contracts);Stream
This is still development.
References
License
Licensed under the GPL-3.0
