Skip to main content

Trading API

Operations (57)

alpaca.trading.account — AccountsApi

Account details, balances, buying power and status.

alpaca.trading.account.getAccount

Account details, balances, buying power and status.

await alpaca.trading.account.getAccount();

alpaca.trading.accountActivities — AccountActivitiesApi

Account activity history (fills, fees, dividends, transfers).

alpaca.trading.accountActivities.getAccountActivities

List account activities (fills, fees, dividends, transfers), newest first.

await alpaca.trading.accountActivities.getAccountActivities({
activityTypes: ["FILL"],
pageSize: 50,
});
alpaca.trading.accountActivities.getAccountActivitiesByActivityType

List activities of a single type (e.g. only fills).

await alpaca.trading.accountActivities.getAccountActivitiesByActivityType({
activityType: "FILL",
});

alpaca.trading.accountConfigurations — AccountConfigurationsApi

Read and update trading account configuration.

alpaca.trading.accountConfigurations.getAccountConfig

Read the account's trading configuration.

await alpaca.trading.accountConfigurations.getAccountConfig();
alpaca.trading.accountConfigurations.patchAccountConfig

Update trading configuration (e.g. block short selling).

await alpaca.trading.accountConfigurations.patchAccountConfig({
accountConfigurations: { noShorting: true },
});

alpaca.trading.assets — AssetsApi

Tradable assets, option contracts and instrument reference data.

alpaca.trading.assets.getV2Assets

List tradable assets, filterable by class, status and exchange.

await alpaca.trading.assets.getV2Assets({
status: "active",
assetClass: "us_equity",
});
alpaca.trading.assets.getV2AssetsSymbolOrAssetId

Fetch a single asset by symbol or asset id.

await alpaca.trading.assets.getV2AssetsSymbolOrAssetId({
symbolOrAssetId: "AAPL",
});
alpaca.trading.assets.getOptionsContracts

List option contracts for underlying symbols (paginated).

await alpaca.trading.assets.getOptionsContracts({
underlyingSymbols: "AAPL",
limit: 100,
});
alpaca.trading.assets.getOptionContractSymbolOrId

Fetch a single option contract by symbol or id.

await alpaca.trading.assets.getOptionContractSymbolOrId({
symbolOrId: "AAPL250117C00150000",
});

alpaca.trading.calendar — CalendarApi

Market calendar (trading days, open/close sessions).

alpaca.trading.calendar.calendar

Market calendar (sessions) for a market and date range.

await alpaca.trading.calendar.calendar({
market: "us_equity",
start: new Date("2024-01-01"),
end: new Date("2024-01-31"),
});
alpaca.trading.calendar.legacyCalendar

Legacy market-calendar endpoint (prefer calendar).

await alpaca.trading.calendar.legacyCalendar({
start: new Date("2024-01-01"),
end: new Date("2024-01-31"),
});

alpaca.trading.clock — ClockApi

Market clock (current time, next open/close).

alpaca.trading.clock.clock

Current market clock: open/closed and next open/close.

await alpaca.trading.clock.clock();
alpaca.trading.clock.legacyClock

Legacy market-clock endpoint (prefer clock).

await alpaca.trading.clock.legacyClock();

alpaca.trading.corporateActions — CorporateActionsApi

Corporate-action announcements (splits, dividends, mergers).

alpaca.trading.corporateActions.getV2CorporateActionsAnnouncements

Deprecated: corporate-action announcements over a date range.

await alpaca.trading.corporateActions.getV2CorporateActionsAnnouncements({
caTypes: "dividend",
since: "2024-01-01",
until: "2024-01-31",
});
alpaca.trading.corporateActions.getV2CorporateActionsAnnouncementsId

Deprecated: a single corporate-action announcement by id.

await alpaca.trading.corporateActions.getV2CorporateActionsAnnouncementsId({
id: "be3c368a-4c7c-4384-808e-f02c9f5a8afe",
});

alpaca.trading.cryptoFunding — CryptoFundingApi

Crypto wallets, transfers and whitelisted withdrawal addresses.

alpaca.trading.cryptoFunding.createCryptoTransferForAccount

Initiate a crypto withdrawal/transfer for the account.

await alpaca.trading.cryptoFunding.createCryptoTransferForAccount({
createCryptoTransferRequest: {
amount: "0.5",
address: "0xabc...",
asset: "ETH",
},
});
alpaca.trading.cryptoFunding.getCryptoFundingTransfer

Fetch a single crypto transfer by id.

await alpaca.trading.cryptoFunding.getCryptoFundingTransfer({
transferId: "f1...e9",
});
alpaca.trading.cryptoFunding.listCryptoFundingTransfers

List crypto transfers for the account.

await alpaca.trading.cryptoFunding.listCryptoFundingTransfers();
alpaca.trading.cryptoFunding.getCryptoTransferEstimate

Estimate fees for a crypto transfer.

await alpaca.trading.cryptoFunding.getCryptoTransferEstimate({
asset: "ETH",
fromAddress: "0xabc...",
toAddress: "0xdef...",
amount: "0.5",
});
alpaca.trading.cryptoFunding.listCryptoFundingWallets

List the account's crypto wallets.

await alpaca.trading.cryptoFunding.listCryptoFundingWallets({
asset: "ETH",
});
alpaca.trading.cryptoFunding.createWhitelistedAddress

Whitelist a crypto withdrawal address.

await alpaca.trading.cryptoFunding.createWhitelistedAddress({
createWhitelistedAddressRequest: { address: "0xabc...", asset: "ETH" },
});
alpaca.trading.cryptoFunding.deleteWhitelistedAddress

Remove a whitelisted crypto address.

await alpaca.trading.cryptoFunding.deleteWhitelistedAddress({
whitelistedAddressId: "a1...c2",
});
alpaca.trading.cryptoFunding.listWhitelistedAddress

List whitelisted crypto withdrawal addresses.

await alpaca.trading.cryptoFunding.listWhitelistedAddress();

alpaca.trading.events — EventsApi

Server-sent event streams for account activity.

alpaca.trading.events.subscribeToActivitiesSSE

Server-sent event stream of account activities.

await alpaca.trading.events.subscribeToActivitiesSSE({
sinceId: "20240101000000000::...",
});

alpaca.trading.locates — LocatesApi

Easy-to-borrow locate requests, listings and quotes.

alpaca.trading.locates.createLocates

Create an easy-to-borrow locate request for a short sale.

await alpaca.trading.locates.createLocates({
createLocateRequest: { symbol: "AAPL", qty: 100 },
idempotencyKey: crypto.randomUUID(),
});
alpaca.trading.locates.getLocate

Fetch a single locate request by id.

await alpaca.trading.locates.getLocate({ locateId: "loc_123" });
alpaca.trading.locates.listLocateQuotes

Locate availability and pricing for one or more symbols.

await alpaca.trading.locates.listLocateQuotes({ symbols: "AAPL,TSLA" });
alpaca.trading.locates.listLocates

List locate requests, filtered by status, symbol or date range.

await alpaca.trading.locates.listLocates({ status: "active" });

alpaca.trading.orders — OrdersApi

Place, read, replace and cancel orders.

alpaca.trading.orders.getAllOrders

List orders, filterable by status, side and symbol.

await alpaca.trading.orders.getAllOrders({ status: "open", limit: 100 });
alpaca.trading.orders.postOrder

Place one order (raw); include a stable, unique client ID for audit and recovery.

const clientOrderId = crypto.randomUUID();
await alpaca.trading.orders.postOrder({ postOrderRequest: { symbol: "AAPL", qty: "1", side: "buy", type: "market", timeInForce: "day", clientOrderId } });
alpaca.trading.orders.getOrderByOrderID

Fetch a single order by its order id.

await alpaca.trading.orders.getOrderByOrderID({ orderId: "f1...e9" });
alpaca.trading.orders.getOrderByClientOrderId

Look up an order by its client ID, including to reconcile an ambiguous placement before submitting again.

const clientOrderId = "the-id-recorded-before-placement";
const order = await alpaca.trading.orders.getOrderByClientOrderId({ clientOrderId });
alpaca.trading.orders.patchOrderByOrderId

Replace (amend) an open order.

await alpaca.trading.orders.patchOrderByOrderId({
orderId: "f1...e9",
patchOrderRequest: { qty: "2" },
});
alpaca.trading.orders.deleteOrderByOrderID

Cancel a single open order.

await alpaca.trading.orders.deleteOrderByOrderID({ orderId: "f1...e9" });
alpaca.trading.orders.deleteAllOrders

Cancel all open orders.

await alpaca.trading.orders.deleteAllOrders();

alpaca.trading.portfolioHistory — PortfolioHistoryApi

Time series of account equity / P&L.

alpaca.trading.portfolioHistory.getAccountPortfolioHistory

Time series of account equity and profit/loss.

await alpaca.trading.portfolioHistory.getAccountPortfolioHistory({
period: "1M",
timeframe: "1D",
});

alpaca.trading.positions — PositionsApi

Open positions; close positions; exercise options.

alpaca.trading.positions.getAllOpenPositions

List all open positions.

await alpaca.trading.positions.getAllOpenPositions();
alpaca.trading.positions.getOpenPosition

Fetch a single open position by symbol or asset id.

await alpaca.trading.positions.getOpenPosition({ symbolOrAssetId: "AAPL" });
alpaca.trading.positions.deleteAllOpenPositions

Liquidate every open position (optionally cancel orders first).

await alpaca.trading.positions.deleteAllOpenPositions({
cancelOrders: true,
});
alpaca.trading.positions.deleteOpenPosition

Close a position: whole, partial qty, or a percentage.

await alpaca.trading.positions.deleteOpenPosition({
symbolOrAssetId: "AAPL",
percentage: 50,
});
alpaca.trading.positions.optionExercise

Exercise a held option position.

await alpaca.trading.positions.optionExercise({
symbolOrContractId: "AAPL250117C00150000",
});
alpaca.trading.positions.optionDoNotExercise

Submit a do-not-exercise instruction for an option position.

await alpaca.trading.positions.optionDoNotExercise({
symbolOrContractId: "AAPL250117C00150000",
});

alpaca.trading.tokenization — TokenizationApi

Tokenization requests and minting.

alpaca.trading.tokenization.getTokenizationRequest

Fetch a tokenization request by its Alpaca request id.

await alpaca.trading.tokenization.getTokenizationRequest({
tokenizationRequestId: "req_123",
});
alpaca.trading.tokenization.getTokenizationRequestByClientRequestID

Fetch the latest tokenization request carrying a client-supplied request id.

await alpaca.trading.tokenization.getTokenizationRequestByClientRequestID({
clientRequestId: "mint-2026-001",
});
alpaca.trading.tokenization.getTokenizationRequests

List tokenization (mint/redeem) requests.

await alpaca.trading.tokenization.getTokenizationRequests({
status: "completed",
});
alpaca.trading.tokenization.postTokenizationMint

Submit a tokenization mint request.

await alpaca.trading.tokenization.postTokenizationMint({
tokenizationMintRequest: { underlyingSymbol: "AAPL", quantity: "1" },
});

alpaca.trading.watchlists — WatchlistsApi

Create and manage watchlists and their assets.

alpaca.trading.watchlists.getWatchlists

List all watchlists.

await alpaca.trading.watchlists.getWatchlists();
alpaca.trading.watchlists.getWatchlistById

Fetch a single watchlist by id.

await alpaca.trading.watchlists.getWatchlistById({
watchlistId: "f1...e9",
});
alpaca.trading.watchlists.getWatchlistByName

Fetch a single watchlist by name.

await alpaca.trading.watchlists.getWatchlistByName({ name: "My List" });
alpaca.trading.watchlists.postWatchlist

Create a watchlist with an initial set of symbols.

await alpaca.trading.watchlists.postWatchlist({
createWatchlistRequest: { name: "Tech", symbols: ["AAPL", "MSFT"] },
});
alpaca.trading.watchlists.updateWatchlistById

Update a watchlist (name and/or symbols) by id.

await alpaca.trading.watchlists.updateWatchlistById({
watchlistId: "f1...e9",
updateWatchlistRequest: { name: "Renamed" },
});
alpaca.trading.watchlists.updateWatchlistByName

Update a watchlist (name and/or symbols) by name.

await alpaca.trading.watchlists.updateWatchlistByName({
name: "Tech",
updateWatchlistRequest: { symbols: ["AAPL"] },
});
alpaca.trading.watchlists.addAssetToWatchlist

Add an asset to a watchlist by id.

await alpaca.trading.watchlists.addAssetToWatchlist({
watchlistId: "f1...e9",
addAssetToWatchlistRequest: { symbol: "NVDA" },
});
alpaca.trading.watchlists.addAssetToWatchlistByName

Add an asset to a watchlist by name.

await alpaca.trading.watchlists.addAssetToWatchlistByName({
name: "Tech",
addAssetToWatchlistRequest: { symbol: "NVDA" },
});
alpaca.trading.watchlists.removeAssetFromWatchlist

Remove an asset from a watchlist by id.

await alpaca.trading.watchlists.removeAssetFromWatchlist({
watchlistId: "f1...e9",
symbol: "NVDA",
});
alpaca.trading.watchlists.deleteWatchlistById

Delete a watchlist by id.

await alpaca.trading.watchlists.deleteWatchlistById({
watchlistId: "f1...e9",
});
alpaca.trading.watchlists.deleteWatchlistByName

Delete a watchlist by name.

await alpaca.trading.watchlists.deleteWatchlistByName({ name: "Tech" });