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)curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
-H "Content-Type: application/json" \
-H "X-PD-Environment: production" \
-H "Authorization: Bearer {access_token}" \
-d '{
"external_user_id": "{external_user_id}",
"id": "alpaca-place-order",
"configured_props": {
"alpaca": { "authProvisionId": "apn_xxxxxxx" },
"isPaperAPI": true,
"symbol": "Symbol"
}
}'// accessToken: mint a short-lived token with the Connect SDK — see the MCP guide
const transport = new StreamableHTTPClientTransport(
new URL("https://remote.mcp.pipedream.net/v3"),
{
requestInit: {
headers: {
Authorization: `Bearer ${accessToken}`,
"x-pd-project-id": "{project_id}",
"x-pd-environment": "production",
"x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
"x-pd-app-slug": "alpaca",
},
},
},
)
const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)
const { tools } = await mcp.listTools()
// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
name: "alpaca-place-order",
arguments: {
isPaperAPI: true,
symbol: "Symbol",
},
})SCHEMA
Inputs
Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.
| 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
- Source
- View on GitHub ↗