{"id":18843287,"url":"https://github.com/alpacahq/typescript-sdk","last_synced_at":"2025-04-14T07:32:17.021Z","repository":{"id":229097557,"uuid":"774288599","full_name":"alpacahq/typescript-sdk","owner":"alpacahq","description":"A TypeScript SDK for the https://alpaca.markets REST API and WebSocket streams.","archived":false,"fork":false,"pushed_at":"2024-06-19T21:56:35.000Z","size":105,"stargazers_count":44,"open_issues_count":11,"forks_count":10,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-27T21:38:37.201Z","etag":null,"topics":["api","rest","trading","websocket"],"latest_commit_sha":null,"homepage":"https://docs.alpaca.markets","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alpacahq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-19T09:33:29.000Z","updated_at":"2025-03-27T17:02:40.000Z","dependencies_parsed_at":"2024-06-09T19:23:48.197Z","dependency_job_id":"5a761bfa-d990-449c-a740-746cfb818280","html_url":"https://github.com/alpacahq/typescript-sdk","commit_stats":null,"previous_names":["alpacahq/typescript-sdk"],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Ftypescript-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Ftypescript-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Ftypescript-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alpacahq%2Ftypescript-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alpacahq","download_url":"https://codeload.github.com/alpacahq/typescript-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248839503,"owners_count":21169822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","rest","trading","websocket"],"created_at":"2024-11-08T02:57:25.248Z","updated_at":"2025-04-14T07:32:16.734Z","avatar_url":"https://github.com/alpacahq.png","language":"TypeScript","readme":"\u003e 🚧 **WARNING** 🚧  \n\u003e This SDK is currently in development and not yet stable. The API may change. Please report any issues you find. Thank you! 🙏 When the version number loses the `-preview` suffix, the SDK is ready for production use. You can track progress and join the discussion [here](https://github.com/alpacahq/typescript-sdk/issues/1) 😃.\n\n# typescript-sdk\n\n![version](https://img.shields.io/badge/dynamic/json?label=version\u0026query=$[0].name\u0026url=https://api.github.com/repos/alpacahq/typescript-sdk/tags\u0026style=flat\u0026color=FF33A0)\n![code](https://img.shields.io/github/languages/code-size/alpacahq/typescript-sdk?style=flat\u0026color=196DFF\u0026label=code)\n![test](https://img.shields.io/github/actions/workflow/status/alpacahq/typescript-sdk/deno_test.yml?style=flat\u0026label=test)\n![coverage](https://img.shields.io/github/actions/workflow/status/alpacahq/typescript-sdk/deno_test_coverage.yml?style=flat\u0026label=coverage)\n![build](https://img.shields.io/github/actions/workflow/status/alpacahq/typescript-sdk/deno_deploy.yml?style=flat\u0026label=deploy)\n\nA TypeScript SDK for the https://alpaca.markets REST API and WebSocket streams.\n\n- [Features](#features)\n- [Install](#install)\n- [Usage](#getting-started)\n  - [Create a Client](#create-a-client)\n  - [Configuration](#configuration)\n    - [Environment Variables](#environment-variables)\n    - [Rate Limiting](#rate-limiting)\n  - [Methods](#methods)\n    - [Trading API](#trading-api)\n    - [Market Data API](#market-data-api)\n  - [WebSocket](#websocket)\n    - [How It Works](#how-it-works)\n    - [Channels](#channels)\n    - [Examples](#examples)\n      - [Subscribe](#subscribe)\n      - [Unsubscribe](#unsubscribe)\n      - [Handle Messages](#handle-messages)\n- [Need Help?](#need-help)\n\n## Features\n\n- [x] REST API\n- [x] WebSocket Streams\n- [x] Built-in Rate Limiting (Token Bucket)\n- [x] TypeScript\n- [x] Deno\n- [x] Node (ESM)\n- [x] \u003e 35% Test Coverage (and growing)\n- [x] Tree-shakable\n- [x] Both ESM and CJS Support\n- [x] Zero Dependencies 🤯 (you read that right)\n- [x] Community Driven 🚀\n\nFeel free to contribute and PR to your 💖's content.\n\n## Install\n\nFrom NPM:\n\n```terminal\nnpm install @alpacahq/typescript-sdk\n```\n\nFrom Skypack (or any CDN that supports ESM):\n\n```ts\nimport { createClient } from \"https://cdn.skypack.dev/@alpacahq/typescript-sdk\";\n```\n\n## Usage\n\n### Create a Client\n\nFirst, you'll need to create an API key on the Alpaca website. You can do that [here](https://app.alpaca.markets). Once you have an API key, you can use it to create a client.\n\n```ts\nimport { createClient } from \"@alpacahq/typescript-sdk\";\n\nconst client = createClient({\n  key: \"YOUR_API_KEY_ID\",\n  secret: \"YOUR_API_SECRET_KEY\",\n  // Or, provide an access token if you're using OAuth.\n  // accessToken: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',\n});\n```\n\nBy default, the client will make requests to the paper trading environment (`https://paper-api.alpaca.markets`). This is a safety measure to prevent accidental trades.\n\n### Configuration\n\n#### Environment Variables\n\nYou can set the following environment variables to configure the client:\n\n- `APCA_KEY_ID`: Your API key.\n- `APCA_KEY_SECRET`: Your API secret.\n- `APCA_ACCESS_TOKEN`: Your access token (if using OAuth).\n- `APCA_DEBUG`: Enables debug logging.\n\nThe client will automatically use these values if they are set. They will not override any credentials explicitly passed to `createClient`.\n\n#### Rate Limiting\n\nYou can customize the rate limiting by passing a `tokenBucket` object to the `createClient` function. This object should contain the `capacity` and `fillRate` for the rate limiter.\n\n```ts\ntokenBucket: {\n  // Maximum number of tokens that can be stored\n  capacity: 200,\n  // Number of tokens refilled per second\n  fillRate: 60,\n}\n```\n\nBursting is allowed, but the client will block requests if the token bucket is empty. The token bucket is shared across all requests. If you have multiple clients they will not share the same bucket.\n\n### Methods\n\n#### Trading API\n\n- [`getAccount`](#getaccount)\n- [`createOrder`](#createorder)\n- [`getOrder`](#getorder)\n- [`getOrders`](#getorders)\n- [`replaceOrder`](#replaceorder)\n- [`cancelOrder`](#cancelorder)\n- [`cancelOrders`](#cancelorders)\n- [`getPosition`](#getposition)\n- [`getPositions`](#getpositions)\n- [`closePosition`](#closeposition)\n- [`closePositions`](#closepositions)\n- [`exerciseOption`](#exerciseoption)\n- [`getCalendar`](#getcalendar)\n- [`getClock`](#getclock)\n- [`getAsset`](#getasset)\n- [`getAssets`](#getassets)\n- [`getWatchlist`](#getwatchlist)\n- [`getWatchlists`](#getwatchlists)\n- [`createWatchlist`](#createwatchlist)\n- [`updateWatchlist`](#updatewatchlist)\n- [`deleteWatchlist`](#deletewatchlist)\n- [`getPortfolioHistory`](#getportfoliohistory)\n- [`getConfigurations`](#getconfigurations)\n- [`updateConfigurations`](#updateconfigurations)\n- [`getActivity`](#getactivity)\n- [`getActivities`](#getactivities)\n- [`getOptionsContract`](#getoptionscontract)\n- [`getOptionsContracts`](#getoptionscontracts)\n- [`getCorporateAction`](#getcorporateaction)\n- [`getCorporateActions`](#getcorporateactions)\n- [`getCryptoWallet`](#getcryptowallet)\n- [`getCryptoWallets`](#getcryptowallets)\n- [`getFeeEstimate`](#getfeeestimate)\n- [`getCryptoTransfer`](#getcryptotransfer)\n- [`getCryptoTransfers`](#getcryptotransfers)\n- [`createCryptoTransfer`](#createcryptotransfer)\n- [`getCryptoWhitelistedAddress`](#getcryptowhitelistedaddress)\n- [`getCryptoWhitelistedAddresses`](#getcryptowhitelistedaddresses)\n- [`requestCryptoWhitelistedAddress`](#requestcryptowhitelistedaddress)\n- [`removeCryptoWhitelistedAddress`](#removecryptowhitelistedaddress)\n\n#### Market Data API\n\n- [`getStocksCorporateActions`](#getstockscorporateactions)\n- [`getLogo`](#getlogo)\n- [`getNews`](#getnews)\n- [`getStocksMostActives`](#getstocksmostactives)\n- [`getStocksMarketMovers`](#getstocksmarketmovers)\n- [`getStocksQuotes`](#getstocksquotes)\n- [`getStocksQuotesLatest`](#getstocksquoteslatest)\n- [`getStocksBars`](#getstocksbars)\n- [`getStocksBarsLatest`](#getstocksbarslatest)\n- [`getForexRates`](#getforexrates)\n- [`getLatestForexRates`](#getlatestforexrates)\n- [`getStocksSnapshots`](#getstockssnapshots)\n- [`getStocksAuctions`](#getstocksauctions)\n- [`getStocksConditions`](#getstocksconditions)\n- [`getStocksExchangeCodes`](#getstocksexchangecodes)\n- [`getStocksTrades`](#getstockstrades)\n- [`getStocksTradesLatest`](#getstockstradeslatest)\n- [`getOptionsBars`](#getoptionsbars)\n- [`getOptionsExchanges`](#getoptionsexchanges)\n- [`getOptionsSnapshots`](#getoptionssnapshots)\n- [`getOptionsTrades`](#getoptionstrades)\n- [`getOptionsTradesLatest`](#getoptionstradeslatest)\n- [`getCryptoBars`](#getcryptobars)\n- [`getLatestCryptoBars`](#getlatestcryptobars)\n- [`getCryptoQuotes`](#getcryptoquotes)\n- [`getCryptoQuotesLatest`](#getcryptoquoteslatest)\n- [`getCryptoSnapshots`](#getcryptosnapshots)\n- [`getCryptoTrades`](#getcryptotrades)\n- [`getCryptoTradesLatest`](#getcryptotradeslatest)\n- [`getLatestCryptoOrderbooks`](#getlatestcryptoorderbooks)\n\n#### `getAccount`\n\nRetrieves the account information.\n\n```typescript\nclient.getAccount().then(console.log);\n```\n\n#### `createOrder`\n\nCreates a new order.\n\n```typescript\nclient\n  .createOrder({\n    symbol: \"AAPL\",\n    qty: 1,\n    side: \"buy\",\n    type: \"market\",\n    time_in_force: \"day\",\n  })\n  .then(console.log);\n```\n\n#### `getOrder`\n\nRetrieves a specific order by its ID.\n\n```typescript\nclient\n  .getOrder({ order_id: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" })\n  .then(console.log);\n```\n\n#### `getOrders`\n\nRetrieves a list of orders based on the specified parameters.\n\n```typescript\nclient\n  .getOrders({\n    status: \"open\",\n    limit: 10,\n    direction: \"desc\",\n  })\n  .then(console.log);\n```\n\n#### `replaceOrder`\n\nReplaces an existing order with updated parameters.\n\n```typescript\nclient\n  .replaceOrder({\n    qty: 2,\n    limit_price: 150.0,\n    order_id: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  })\n  .then(console.log);\n```\n\n#### `cancelOrder`\n\nCancels a specific order by its ID.\n\n```typescript\nclient\n  .cancelOrder({ order_id: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\" })\n  .then(console.log);\n```\n\n#### `cancelOrders`\n\nCancels all open orders.\n\n```typescript\nclient.cancelOrders().then(console.log);\n```\n\n#### `getPosition`\n\nRetrieves a specific position by symbol or asset ID.\n\n```typescript\nclient\n  .getPosition({\n    symbol_or_asset_id: \"AAPL\",\n  })\n  .then(console.log);\n```\n\n#### `getPositions`\n\nRetrieves all positions.\n\n```typescript\nclient.getPositions().then(console.log);\n```\n\n#### `closePosition`\n\nCloses a specific position by symbol or asset ID.\n\n```typescript\nclient\n  .closePosition({\n    symbol_or_asset_id: \"AAPL\",\n  })\n  .then(console.log);\n```\n\n#### `closePositions`\n\nCloses all positions.\n\n```typescript\nclient.closePositions().then(console.log);\n```\n\n#### `exerciseOption`\n\nExercises an options contract.\n\n```typescript\nclient\n  .exerciseOption({\n    symbol_or_contract_id: \"xxxxxxxx\",\n  })\n  .then(console.log);\n```\n\n#### `getCalendar`\n\nRetrieves the market calendar.\n\n```typescript\nclient\n  .getCalendar({\n    start: \"2023-01-01\",\n    end: \"2023-12-31\",\n  })\n  .then(console.log);\n```\n\n#### `getClock`\n\nRetrieves the current market clock.\n\n```typescript\nclient.getClock().then(console.log);\n```\n\n#### `getAsset`\n\nRetrieves a specific asset by symbol or asset ID.\n\n```typescript\nclient\n  .getAsset({\n    symbol_or_asset_id: \"AAPL\",\n  })\n  .then(console.log);\n```\n\n#### `getAssets`\n\nRetrieves a list of assets based on the specified parameters.\n\n```typescript\nclient\n  .getAssets({\n    status: \"active\",\n    asset_class: \"us_equity\",\n  })\n  .then(console.log);\n```\n\n#### `getWatchlist`\n\nRetrieves a specific watchlist by ID.\n\n```typescript\nclient\n  .getWatchlist({\n    watchlist_id: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  })\n  .then(console.log);\n```\n\n#### `getWatchlists`\n\nRetrieves all watchlists.\n\n```typescript\nclient.getWatchlists().then(console.log);\n```\n\n#### `createWatchlist`\n\nCreates a new watchlist.\n\n```typescript\nclient\n  .createWatchlist({\n    name: \"My Watchlist\",\n    symbols: [\"AAPL\", \"GOOGL\", \"AMZN\"],\n  })\n  .then(console.log);\n```\n\n#### `updateWatchlist`\n\nUpdates an existing watchlist.\n\n```typescript\nclient\n  .updateWatchlist({\n    name: \"Updated Watchlist\",\n    symbols: [\"AAPL\", \"GOOGL\", \"MSFT\"],\n    watchlist_id: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  })\n  .then(console.log);\n```\n\n#### `deleteWatchlist`\n\nDeletes a specific watchlist by ID.\n\n```typescript\nclient\n  .deleteWatchlist({\n    watchlist_id: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  })\n  .then(console.log);\n```\n\n#### `getPortfolioHistory`\n\nRetrieves the portfolio history.\n\n```typescript\nclient\n  .getPortfolioHistory({\n    period: \"1M\",\n    timeframe: \"1D\",\n  })\n  .then(console.log);\n```\n\n#### `getConfigurations`\n\nRetrieves the account configurations.\n\n```typescript\nclient.getConfigurations().then(console.log);\n```\n\n#### `updateConfigurations`\n\nUpdates the account configurations.\n\n```typescript\nclient\n  .updateConfigurations({\n    trade_confirm_email: \"all\",\n    suspend_trade: false,\n  })\n  .then(console.log);\n```\n\n#### `getActivity`\n\nRetrieves a specific activity type.\n\n```typescript\nclient\n  .getActivity({\n    activity_type: \"FILL\",\n  })\n  .then(console.log);\n```\n\n#### `getActivities`\n\nRetrieves all activities.\n\n```typescript\nclient.getActivities().then(console.log);\n```\n\n#### `getOptionsContract`\n\nRetrieves a specific options contract by symbol or contract ID.\n\n```typescript\nclient\n  .getOptionsContract({\n    symbol_or_contract_id: \"AAPL230616C00150000\",\n  })\n  .then(console.log);\n```\n\n#### `getOptionsContracts`\n\nRetrieves a list of options contracts based on the specified parameters.\n\n```typescript\nclient\n  .getOptionsContracts({\n    underlying_symbols: \"AAPL\",\n    expiration_date: \"2023-06-16\",\n  })\n  .then(console.log);\n```\n\n#### `getCorporateAction`\n\nRetrieves a specific corporate action by ID.\n\n```typescript\nclient\n  .getCorporateAction({\n    id: \"xxxxxxxx\",\n  })\n  .then(console.log);\n```\n\n#### `getCorporateActions`\n\nRetrieves a list of corporate actions based on the specified parameters.\n\n```typescript\nclient\n  .getCorporateActions({\n    ca_types: \"MERGER\",\n    since: \"2023-01-01\",\n    until: \"2023-12-31\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoWallet`\n\nRetrieves a specific crypto wallet by asset.\n\n```typescript\nclient\n  .getCryptoWallet({\n    asset: \"BTCUSD\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoWallets`\n\nRetrieves all crypto wallets.\n\n```typescript\nclient.getCryptoWallets().then(console.log);\n```\n\n#### `getFeeEstimate`\n\nRetrieves the fee estimate for a crypto withdrawal.\n\n```typescript\nclient\n  .getFeeEstimate({\n    asset: \"BTCUSD\",\n    from_address: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    to_address: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    amount: \"0.1\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoTransfer`\n\nRetrieves a specific crypto transfer by ID.\n\n```typescript\nclient\n  .getCryptoTransfer({\n    transfer_id: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoTransfers`\n\nRetrieves a list of crypto transfers based on the specified parameters.\n\n```typescript\nclient\n  .getCryptoTransfers({\n    asset: \"BTCUSD\",\n  })\n  .then(console.log);\n```\n\n#### `createCryptoTransfer`\n\nCreates a new crypto withdrawal.\n\n```typescript\nclient\n  .createCryptoTransfer({\n    amount: \"0.1\",\n    address: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    asset: \"BTCUSD\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoWhitelistedAddress`\n\nRetrieves a specific whitelisted crypto address.\n\n```typescript\nclient\n  .getCryptoWhitelistedAddress({\n    address: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    asset: \"BTCUSD\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoWhitelistedAddresses`\n\nRetrieves all whitelisted crypto addresses.\n\n```typescript\nclient.getCryptoWhitelistedAddresses().then(console.log);\n```\n\n#### `requestCryptoWhitelistedAddress`\n\nRequests a new whitelisted crypto address.\n\n```typescript\nclient\n  .requestCryptoWhitelistedAddress({\n    address: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n    asset: \"BTCUSD\",\n  })\n  .then(console.log);\n```\n\n#### `removeCryptoWhitelistedAddress`\n\nRemoves a specific whitelisted crypto address.\n\n```typescript\nclient\n  .removeCryptoWhitelistedAddress({\n    whitelisted_address_id: \"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\",\n  })\n  .then(console.log);\n```\n\n#### `getStocksCorporateActions`\n\nRetrieves a list of corporate actions based on the specified parameters.\n\n```typescript\nclient\n  .getStocksCorporateActions({\n    symbols: \"AAPL\",\n    types: \"cash_dividends\",\n  })\n  .then(console.log);\n```\n\n#### `getLogo`\n\nRetrieves the logo for a specific symbol.\n\n```typescript\nclient\n  .getLogo({\n    symbol: \"AAPL\",\n  })\n  .then(console.log);\n```\n\n#### `getNews`\n\nRetrieves the latest news.\n\n```typescript\nclient\n  .getNews({\n    symbols: \"AAPL,TSLA\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getStocksMostActives`\n\nRetrieves a list of the most active stocks.\n\n```typescript\nclient\n  .getStocksMostActives({\n    by: \"volume\",\n    top: 10,\n  })\n  .then(console.log);\n```\n\n#### `getStocksMarketMovers`\n\nRetrieves a list of the top market movers.\n\n```typescript\nclient\n  .getStocksMarketMovers({\n    by: \"change\",\n    top: 10,\n  })\n  .then(console.log);\n```\n\n#### `getStocksQuotes`\n\nRetrieves a list of stock quotes.\n\n```typescript\nclient\n  .getStocksQuotes({\n    symbols: \"AAPL,TSLA\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getStocksQuotesLatest`\n\nRetrieves the latest stock quotes.\n\n```typescript\nclient\n  .getStocksQuotesLatest({\n    symbols: \"AAPL,TSLA\",\n  })\n  .then(console.log);\n```\n\n#### `getStocksBars`\n\nRetrieves a list of stock bars.\n\n```typescript\nclient\n  .getStocksBars({\n    symbols: \"AAPL,TSLA\",\n    timeframe: \"1Day\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getStocksBarsLatest`\n\nRetrieves the latest stock bars.\n\n```typescript\nclient\n  .getStocksBarsLatest({\n    symbols: \"AAPL,TSLA\",\n  })\n  .then(console.log);\n```\n\n#### `getForexRates`\n\nRetrieves a list of forex rates.\n\n```typescript\nclient\n  .getForexRates({\n    currency_pairs: \"EURUSD,GBPUSD\",\n    timeframe: \"1Min\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getLatestForexRates`\n\nRetrieves the latest forex rates.\n\n```typescript\nclient\n  .getLatestForexRates({\n    currency_pairs: \"EURUSD,GBPUSD\",\n  })\n  .then(console.log);\n```\n\n#### `getStocksSnapshots`\n\nRetrieves a list of stock snapshots.\n\n```typescript\nclient\n  .getStocksSnapshots({\n    symbols: \"AAPL,TSLA\",\n  })\n  .then(console.log);\n```\n\n#### `getStocksAuctions`\n\nRetrieves a list of stock auctions.\n\n```typescript\nclient\n  .getStocksAuctions({\n    symbols: \"AAPL,TSLA\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getStocksConditions`\n\nRetrieves a list of stock conditions.\n\n```typescript\nclient\n  .getStocksConditions({\n    tickType: \"trades\",\n    tape: \"xxx\",\n  })\n  .then(console.log);\n```\n\n#### `getStocksExchangeCodes`\n\nRetrieves a list of stock exchange codes.\n\n```typescript\nclient.getStocksExchangeCodes().then(console.log);\n```\n\n#### `getStocksTrades`\n\nRetrieves a list of stock trades.\n\n```typescript\nclient\n  .getStocksTrades({\n    symbols: \"AAPL,TSLA\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getStocksTradesLatest`\n\nRetrieves the latest stock trades.\n\n```typescript\nclient\n  .getStocksTradesLatest({\n    symbols: \"AAPL,TSLA\",\n  })\n  .then(console.log);\n```\n\n#### `getOptionsBars`\n\nRetrieves a list of options bars.\n\n```typescript\nclient\n  .getOptionsBars({\n    symbols: \"AAPL220617C00270000,TSLA220617C01000000\",\n    timeframe: \"1Day\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getOptionsExchanges`\n\nRetrieves a list of options exchanges.\n\n```typescript\nclient.getOptionsExchanges().then(console.log);\n```\n\n#### `getOptionsSnapshots`\n\nRetrieves a list of options snapshots.\n\n```typescript\nclient\n  .getOptionsSnapshots({\n    symbols: \"AAPL220617C00270000,TSLA220617C01000000\",\n  })\n  .then(console.log);\n```\n\n#### `getOptionsTrades`\n\nRetrieves a list of options trades.\n\n```typescript\nclient\n  .getOptionsTrades({\n    symbols: \"AAPL220617C00270000,TSLA220617C01000000\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getOptionsTradesLatest`\n\nRetrieves the latest options trades.\n\n```typescript\nclient\n  .getOptionsTradesLatest({\n    symbols: \"AAPL220617C00270000,TSLA220617C01000000\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoBars`\n\nRetrieves a list of crypto bars.\n\n```typescript\nclient\n  .getCryptoBars({\n    symbols: \"BTCUSD,ETHUSD\",\n    timeframe: \"1Min\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getLatestCryptoBars`\n\nRetrieves the latest crypto bars.\n\n```typescript\nclient\n  .getLatestCryptoBars({\n    loc: \"US\",\n    symbols: \"BTCUSD,ETHUSD\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoQuotes`\n\nRetrieves a list of crypto quotes.\n\n```typescript\nclient\n  .getCryptoQuotes({\n    symbols: \"BTCUSD,ETHUSD\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getCryptoQuotesLatest`\n\nRetrieves the latest crypto quotes.\n\n```typescript\nclient\n  .getCryptoQuotesLatest({\n    loc: \"US\",\n    symbols: \"BTCUSD,ETHUSD\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoSnapshots`\n\nRetrieves a list of crypto snapshots.\n\n```typescript\nclient\n  .getCryptoSnapshots({\n    loc: \"US\",\n    symbols: \"BTCUSD,ETHUSD\",\n  })\n  .then(console.log);\n```\n\n#### `getCryptoTrades`\n\nRetrieves a list of crypto trades.\n\n```typescript\nclient\n  .getCryptoTrades({\n    loc: \"US\",\n    symbols: \"BTCUSD,ETHUSD\",\n    limit: 10,\n  })\n  .then(console.log);\n```\n\n#### `getCryptoTradesLatest`\n\nRetrieves the latest crypto trades.\n\n```typescript\nclient\n  .getCryptoTradesLatest({\n    loc: \"US\",\n    symbols: \"BTCUSD,ETHUSD\",\n  })\n  .then(console.log);\n```\n\n#### `getLatestCryptoOrderbooks`\n\nRetrieves the latest crypto orderbooks.\n\n```typescript\nclient\n  .getLatestCryptoOrderbooks({\n    loc: \"US\",\n    symbols: \"BTCUSD,ETHUSD\",\n  })\n  .then(console.log);\n```\n\n### WebSocket\n\n#### How It Works\n\ntodo\n\n#### Channels\n\ntodo\n\n#### Examples\n\ntodo\n\n## Need Help?\n\nThe primary maintainer of this project is [@117](https://github.com/117). Feel free to reach out on [Slack](https://alpaca-community.slack.com/join/shared_invite/zt-2ebgo7i1f-HbNoBjPWZ_bX72IVQTkcwg) 👋 or by opening an issue on this repo. I'm happy to help with any questions or issues you may have.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpacahq%2Ftypescript-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falpacahq%2Ftypescript-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falpacahq%2Ftypescript-sdk/lists"}