View as Markdown
Alpaca icon

Alpaca ACTION

Place Order

Places a new order for the given account. An order request may be rejected if the account is not authorized for trading, or if the tradable balance is insufficient to fill the order, See the docs
  • Action
  • Writes data
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Alpaca account once, then configure and run Place Order from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "alpaca-place-order",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    alpaca: { authProvisionId: "apn_xxxxxxx" },
    isPaperAPI: true,
    symbol: "Symbol",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Place Order inputs
Property Type Description
isPaperAPI Paper API boolean
Set to true if Paper API is used. Default is false.
Optional
symbol Symbol string
Symbol, asset ID, or currency pair to identify the asset to trade (ex. AAPL, BTC/USD).
Required
qty Qty string
Number of shares to trade. Can be fractionable for only market and day order types.
Optional
notional Notional string
Dollar amount to trade. Cannot work with Qty. Can only work for market order types and day for time in force.
Optional
side Side string
buy or sell
Required
type Type string
Type
Required
timeInForce Time in Force string
Please see this doc for more info on what values are possible for what kind of orders.
Required
limitPrice Limit Price string
Required if type is limit or stop_limit
Optional
stopPrice Stop Price string
Required if type is stop or stop_limit
Optional
trailPrice Trail Price string
This or trail_percent is required if type is trailing_stop
Optional
trailPercent Trail Percent string
This or trail_price is required if type is trailing_stop
Optional
extendedHours Extended Hours boolean
If true, order will be eligible to execute in premarket/afterhours. Only works with Type Limit and Time in Force Day.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
alpaca-place-order
Version
0.1.2
App
Alpaca
Authentication
OAuth
Read-only
No
Destructive
No
Open world
Yes