期权交易概述
机器翻译译自英文(docs.alpaca.markets)本页 98 段已全部译完
初始期权产品上线
支持
- 美国上市股票期权,全部为美式
- 级别1-3期权交易
- 完全披露的合作伙伴关系
- 通过API以及SSE事件自动账户审批流程
- 合作伙伴降级/禁用期权交易的能力
- 通过API行使期权的能力
- 通过API进行DNE(不行权)
- 新的期权特定活动
- 访问期权市场数据(收费)或推荐给市场数据合作伙伴
不支持
- LCT(本地货币交易)
- 碎股期权
- 盘前盘后交易
期权启用
在新账户上启用期权交易
根据FINRA规则2360,每个客户账户在进行首次期权交易前必须获得期权批准。一旦在代理上启用了期权交易,你就可以开始请求账户获得期权交易批准。对于现有账户,需要在账户上修补一些新数据点,以及客户需要签署的新期权协议。以下是特别为期权需要提供的新字段。
- 年收入
- 净资产
- 流动净资产
- 流动性需求
- 投资经验
- 投资风险承受能力
- 投资目标
- 投资时间范围
- 婚姻状况
- 受抚养人数
以下是启用期权的新账户开立请求示例。有关创建账户的更多详细信息,请参见此处。
{
"enabled_assets": [
"us_equity",
"crypto",
"us_option"
],
"contact": {
"email_address": "joe+smith+options+25@alpaca.markets",
"phone_number": "555-666-7788",
"street_address": [
"20 N San Mateo Dr"
],
"unit": "Apt 1A",
"city": "San Mateo",
"state": "CA",
"postal_code": "94401",
"country": "USA"
},
"identity": {
"given_name": "John",
"middle_name": "Smith",
"family_name": "Doe",
"date_of_birth": "1990-01-01",
"tax_id": "124-55-4321",
"tax_id_type": "USA_SSN",
"country_of_citizenship": "USA",
"country_of_birth": "USA",
"country_of_tax_residence": "USA",
"funding_source": [
"employment_income"
],
"annual_income_min": "10000",
"annual_income_max": "10000",
"total_net_worth_min": "10000",
"total_net_worth_max": "10000",
"liquid_net_worth_min": "10000",
"liquid_net_worth_max": "10000",
"liquidity_needs": "does_not_matter",
"investment_experience_with_stocks": "over_5_years",
"investment_experience_with_options": "over_5_years",
"risk_tolerance": "conservative",
"investment_objective": "market_speculation",
"investment_time_horizon": "more_than_10_years",
"marital_status":"MARRIED",
"number_of_dependents":5
},
"disclosures": {
"is_control_person": false,
"is_affiliated_exchange_or_finra": true,
"is_politically_exposed": false,
"immediate_family_exposed": false,
"context": [
{
"context_type": "AFFILIATE_FIRM",
"company_name": "Finra",
"company_street_address": [
"1735 K Street, NW"
],
"company_city": "Washington",
"company_state": "DC",
"company_country": "USA",
"company_compliance_email": "compliance@finra.org"
}
]
},
"agreements": [
{
"agreement": "margin_agreement",
"signed_at": "2020-09-11T18:09:33Z",
"ip_address": "185.13.21.99",
"revision": "16.2021.05"
},
{
"agreement": "account_agreement",
"signed_at": "2020-09-11T18:13:44Z",
"ip_address": "185.13.21.99",
"revision": "16.2021.05"
},
{
"agreement": "customer_agreement",
"signed_at": "2020-09-11T18:13:44Z",
"ip_address": "185.13.21.99",
"revision": "16.2021.05"
},
{
"agreement": "crypto_agreement",
"signed_at": "2020-09-11T18:13:44Z",
"ip_address": "185.13.21.99",
"revision": "04.2021.10"
},
{
"agreement": "options_agreement",
"signed_at": "2020-09-11T18:13:44Z",
"ip_address": "185.13.21.99"
}
],
"documents": [
{
"document_type": "identity_verification",
"document_sub_type": "passport",
"content": "/9j/Cg==",
"mime_type": "image/jpeg"
}
],
"trusted_contact": {
"given_name": "Jane",
"family_name": "Doe",
"email_address": "jane.doe@example.com"
}
}在现有账户上启用期权交易
以下是使用审批端点在现有账户上启用期权交易的示例请求和响应。
示例:符合级别1要求的账户请求级别1期权交易审批
{
"level": 1
}{
"id": "43c2f8a9-9e39-48b1-921c-e510dfeeff47",
"account_id": "492b6297-45fc-4435-abc7-08ab15480b1c",
"created_at": "2024-05-14T04:34:03.527165162-04:00",
"updated_at": "2024-05-14T04:34:03.527165162-04:00",
"requested_level": 1,
"status": "APPROVED"
}示例:符合级别1要求的账户请求级别2期权交易审批
{
"level": 2
}{
"id": "43c2f8a9-9e39-48b1-921c-e510dfeeff47",
"account_id": "492b6297-45fc-4435-abc7-08ab15480b1c",
"created_at": "2024-05-14T04:34:03.527165162-04:00",
"updated_at": "2024-05-14T04:34:03.527165162-04:00",
"requested_level": 2,
"status": "LOWER_LEVEL_APPROVED"
}期权审批状态
| 状态 | 描述 |
|---|---|
APPROVED | 用户已获批准请求的期权交易级别。 |
LOWER_LEVEL_APPROVED | 用户已获批准低于请求的期权交易级别。 |
PENDING | 待人工审核 |
REJECTED | 用户请求的期权交易级别被拒绝。 |
审批夹具
期权审批API支持沙盒环境中的审批夹具。你可以将所需的审批级别和审批状态传递给同一个审批端点,以测试期权审批流程的所有不同场景(已批准、较低级别批准、已拒绝)。
示例用例:
- 请求期权交易级别1的
APPROVED状态
{
"level": 1,
"fixtures": {
"status":"APPROVED"
}
}- 请求期权交易级别2的
REJECTED状态
{
"level": 2,
"fixtures": {
"status":"REJECTED"
}
}- 请求
LOWER_LEVEL_APPROVED状态(模拟请求级别2但用户反而被批准为级别2的流程)
{
"level": 2,
"fixtures": {
"status":"LOWER_LEVEL_APPROVED",
"level":1
}
}降级/禁用期权
一旦账户获得期权交易批准,客户可以降级期权级别或完全禁用它。这是通过交易账户配置端点设置max_options_trading_level来完成的。
一旦设置了最大期权交易级别,交易账户端点上的期权交易级别将升级为用户设置的值。注意,期权交易级别将始终等于或低于期权批准级别。以下是用户被批准为级别2但降级到级别1的示例。
{
...
"options_approved_level": 2,
"options_trading_level": 1,
...
}交易
交易概述
通过订单API为期权下单时,以下是支持和不支持的内容
支持
- 期权代码
- 订单有效期为day
- 市价单和限价单类型
- 替换和取消订单的能力
- 级别1-3期权策略
不支持
- 盘前盘后交易
- 碎股或名义金额订单支持
交易级别
Alpaca支持以下期权交易级别。
| 级别 | 支持的交易 | 验证 |
|---|---|---|
| 0 | • 期权交易被禁用 | • 不适用 |
| 1 | • 卖出备兑看涨期权 • 卖出现金担保看跌期权 | • 用户必须拥有足够的标的股票 • 用户必须有足够的期权购买力 |
| 2 | • 级别1策略 • 买入看涨期权 • 买入看跌期权 | • 用户必须有足够的期权购买力 |
| 3 | • 级别1和2策略 • 买入看涨期权价差 • 买入看跌期权价差 | 用户必须有足够的期权购买力 |
交易级别验证
如果用户尝试交易高于其级别的策略,将导致错误消息。以下是已批准级别1的用户尝试下达级别2期权交易的示例。
{
"code": 40310000,
"message": "account not eligible for level2 options trading"
}资产主数据
与证券和加密货币的资产主数据类似,有一个期权合约端点,它将返回标的代码的所有期权合约。以下是一个示例
{
"id": "1fb904df-961a-4a07-a924-53a437626db2",
"symbol": "AAPL240223C00095000",
"name": "AAPL Feb 23 2024 95 Call",
"status": "active",
"tradable": true,
"expiration_date": "2024-02-23",
"root_symbol": "AAPL",
"underlying_symbol": "AAPL",
"underlying_asset_id": "b0b6dd9d-8b9b-48a9-ba46-b9d54906e415",
"type": "call",
"style": "american",
"strike_price": "95",
"size": "100",
"open_interest": "12",
"open_interest_date": "2024-02-22",
"close_price": "89.35",
"close_price_date": "2024-02-22"
}订单示例
买入看涨期权
{
"symbol": "PTON240126C00000500",
"qty": "1",
"side":"buy",
"type": "market",
"time_in_force": "day"
}买入看跌期权
{
"symbol": "TSLA240126P00210000",
"qty": "1",
"side": "buy",
"type": "market",
"time_in_force": "day"
}卖出备兑看涨期权
{
"symbol": "AAPL240126C00050000",
"qty": "1",
"side": "sell",
"type": "market",
"time_in_force": "day"
}卖出现金担保看跌期权
{
"symbol": "QS240126P00006500",
"qty": "1",
"side": "sell",
"type": "market",
"time_in_force": "day"
}购买力检查
对于期权,我们在交易账户端点上引入了一个新字段options_buying_power,在尝试开立新的期权头寸时会评估该字段。
对于买入看涨期权或买入看跌期权,都需要足够的购买力来支付合约的权利金,否则将出现如下错误。
{
"options_buying_power": "7267.84",
"code": 40310000,
"cost_basis": "38000",
"message": "insufficient options buying power"
}对于卖出备兑看涨期权,你需要有足够的股票作为担保,否则订单将出错,如下所示。
{
"available_qty": "0",
"code": 40310000,
"message": "insufficient underlying qty available for covered call (required: 100, available: 0)",
"required_qty": "100",
"symbol": "AAPL240126C00050000",
"underlying_asset_id": "b0b6dd9d-8b9b-48a9-ba46-b9d54906e415"
}对于卖出现金担保看跌期权,你需要足够的购买力来支付标的股票减去将收到的权利金,否则订单将出错,如下所示
{
"buying_power": "9395",
"code": 40310000,
"message": "insufficient options buying power for cash-secured put (required: 20310, available: 9395)",
"required_options_buying_power": "20310"
}头寸
期权头寸将像头寸端点中的任何其他头寸一样显示。以下是期权头寸的示例。
{
"asset_id": "fe4f43e5-60a4-4269-ba4c-3d304444d58b",
"symbol": "PTON240126C00000500",
"exchange": "",
"asset_class": "us_option",
"asset_marginable": true,
"qty": "2",
"avg_entry_price": "6.05",
"side": "long",
"market_value": "1068",
"cost_basis": "1210",
"unrealized_pl": "-142",
"unrealized_plpc": "-0.1173553719008264",
"unrealized_intraday_pl": "-142",
"unrealized_intraday_plpc": "-0.1173553719008264",
"current_price": "5.34",
"lastday_price": "5.34",
"change_today": "0",
"qty_available": "2"
}交易后
行权
作为期权(看涨或看跌)的买方,持有人有权(但无义务)在未来的指定日期或之前以指定价格买入或卖出期权的标的证券。如果持有人决定行使这些权利,他们选择行权。可以通过行权端点行使期权,DNE(不行权)指令可以通过不行权端点提供。注意行权请求将立即处理,在市场时间之外发送的请求将被拒绝。行权时,每次行权将产生2个新活动,分别是:
- OPEXC - 因行权而移除期权头寸
- OPTRD - 与行权配对的交易活动
行权看涨期权
买入看涨期权行权导致以行权价买入标的股票。以下是示例。
{
"id": "20240227000000000::197118f0-afd8-4adb-b154-167f4a87b1f5",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPEXC",
"date": "2024-02-27",
"net_amount": "0",
"description": "Option Exercise",
"symbol": "QS240301C00006500",
"qty": "-1",
"status": "executed"
},
{
"id": "20240227000000000::aa97cbc4-5163-49ab-b832-682a3a3e85bb",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPTRD",
"date": "2024-02-27",
"net_amount": "-650",
"description": "Option Trade",
"symbol": "QS",
"qty": "100",
"price": "6.5",
"status": "executed"
}行权看跌期权
买入看跌期权行权导致以行权价卖出标的股票。以下是示例。
{
"id": "20240227000000000::f62ee8f5-0279-4e81-9bd1-4ef197c7b2f3",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPEXC",
"date": "2024-02-27",
"net_amount": "0",
"description": "Option Exercise",
"symbol": "QS240301P00006500",
"qty": "-1",
"status": "executed"
},
{
"id": "20240227000000000::74e1db8e-9316-4dcf-b69c-50f51427b7c1",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPTRD",
"date": "2024-02-27",
"net_amount": "650",
"description": "Option Trade",
"symbol": "QS",
"qty": "-100",
"price": "6.5",
"status": "executed"
}
指派
卖出期权合约(看涨或看跌)时,用户收取权利金,但反过来承担在指派时以约定行权价买入或卖出股票的义务。需要注意的是,OCC随机指派账户,合约卖方可能会在隔夜被指派。指派时,每次指派将产生2个新活动,分别是:
- OPASN - 因指派而移除期权头寸
- OPTRD - 与指派配对的交易活动
看涨期权指派
对于看涨期权,卖方承担以约定行权价卖出股票的义务。以下是看涨期权指派导致的活动示例
{
"id": "20240301000000000::001140db-3947-456b-aefc-253861fb65df",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPASN",
"date": "2024-03-01",
"net_amount": "0",
"description": "",
"symbol": "QS240301C00004500",
"qty": "1",
"status": "executed"
}
{
"id": "20240301000000000::a88c089f-a8c3-4672-9b68-2f6f2d05e914",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPTRD",
"date": "2024-03-01",
"net_amount": "450",
"description": "Option Trade",
"symbol": "QS",
"qty": "-100",
"price": "4.5",
"status": "executed"
}看跌期权指派
对于看跌期权,卖方承担以约定行权价买入股票的义务。以下是看跌期权指派导致的活动示例
{
"id": "20240301000000000::fcd92e5c-46e4-4c6e-8866-d56cd7d2bde2",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPASN",
"date": "2024-03-01",
"net_amount": "0",
"description": "",
"symbol": "QS240301P00009000",
"qty": "1",
"status": "executed"
}
{
"id": "20240301000000000::1e1c2804-ce68-4516-9fa4-62d49b14c334",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPTRD",
"date": "2024-03-01",
"net_amount": "-900",
"description": "Option Trade",
"symbol": "QS",
"qty": "100",
"price": "9",
"status": "executed"
}到期
与股票不同,期权合约有到期日。如果用户没有平仓或行权(如果有足够的购买力支持行权),Alpaca可能需要根据以下描述的标准出于风险管理目的对其采取行动。
- 在到期日美国东部时间下午3:30起,Alpaca会持续评估当日到期的任何未平仓头寸,并停止接受开仓/展期任何头寸的新订单。
- 如果买入看涨或看跌期权的头寸为价内(ITM) 0.01或以上,Alpaca会检查账户是否有足够的购买力来行权(看涨期权)或足够的股票(看跌期权)
- 如果有足够的购买力或股票,Alpaca不会平仓该期权,并会允许期权自动行权。
- 如果没有足够的购买力或股票,Alpaca将在其仍为价内时平仓
- 如果头寸为备兑看涨期权或现金担保看跌期权且为价内0.01或以上,Alpaca将在到期日收盘后自动指派
- 如果头寸不为价内,即平值(ATM)或价外(OTM),Alpaca可能会跳过,并将在收盘后到期,如下例所示。(注意,略微价外的头寸也可能根据市场和标的条件被平仓。Alpaca会考虑快速变化的市场和/或可能在一天中从价内变为价外的快速股票。有时价外头寸也会被平仓。)
看涨期权到期
{
"id": "20240301000000000::31ff5d4c-a608-43bb-8e59-678a96a4a42c",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPEXP",
"date": "2024-03-01",
"net_amount": "0",
"description": "Option Expiry",
"symbol": "QS240301C00010500",
"qty": "-1",
"status": "executed"
}看跌期权到期
{
"id": "20240301000000000::4bd8c683-0b2c-489f-9df9-1243ff621648",
"account_id": "21c36b57-2304-4e5b-8364-8effbcba853e",
"activity_type": "OPEXP",
"date": "2024-03-01",
"net_amount": "0",
"description": "Option Expiry",
"symbol": "QS240301P00000500",
"qty": "-1",
"status": "executed"
}市场数据
Alpaca以与股票和加密货币相同的用户友好格式提供期权市场数据(收费)。此外,如有必要,我们可以将合作伙伴推荐给与Alpaca有密切关系的外部数据供应商。
错误响应
期权订单操作(提交、取消、替换、行权和不行权)可以返回下面列出的错误。每个错误都以JSON正文形式提供,包含数字code和message,以及HTTP状态。示例:
{
"code": 40310000,
"message": "insufficient options buying power (required: 20310, available: 9395)"
}Note
📘 message字符串可能会在不通知的情况下更改。数字code和HTTP状态是稳定的契约。花括号中的占位符({symbol}、{required}、{available}、{status})在运行时替换。
以下表格是期权专用的。在使用/orders下记录的通用订单错误(购买力、市场关闭、JSON格式错误、速率限制等)也适用于期权。
提交:单腿
当有效载荷的symbol是期权合约时,由为账户创建订单返回。
| HTTP | 代码 | 消息 |
|---|---|---|
| 403 | 40310000 | account not authorized to trade options |
| 403 | 40310000 | account not eligible to trade long option contracts |
| 403 | 40310000 | account not eligible to trade options: {symbol} |
| 403 | 40310000 | account not eligible to trade spreads or uncovered contracts |
| 403 | 40310000 | account not eligible to trade uncovered option contracts |
| 403 | 40310000 | active assignment lock on {symbol}, cannot close all long options |
| 403 | 40310000 | commission not allowed for account |
| 403 | 40310000 | exceeded account limit for contracts expiring today (requested: {q}, held+open: {h}, limit: {l}) |
| 403 | 40310000 | insufficient options buying power (required: {required}, available: {available}) |
| 403 | 40310000 | negative commission is prohibited |
| 422 | 42210000 | complex orders not supported for options trading |
| 422 | 42210000 | contract "{symbol}" expires soon, unable to open new positions |
| 422 | 42210000 | contract "{symbol}" is expired |
| 422 | 42210000 | contract "{symbol}" is not active |
| 422 | 42210000 | contract "{symbol}" is not tradable |
| 422 | 42210000 | contract "{symbol}" not found |
| 422 | 42210000 | extended hours is not supported for options trading |
| 422 | 42210000 | invalid contract |
| 422 | 42210000 | invalid option order_type |
| 422 | 42210000 | invalid option time_in_force |
| 422 | 42210000 | invalid options order_type |
| 422 | 42210000 | invalid order type for options trading |
| 422 | 42210000 | notional orders are not supported for options trading |
| 422 | 42210000 | options market orders are only allowed during market hours |
| 422 | 42210000 | options order notional is {n} must be <= {limit} |
| 422 | 42210000 | options order qty must be <= {max} |
| 422 | 42210000 | order_time_in_force provided not supported for options trading |
| 422 | 42210000 | orders for morning-expiration index options cannot be placed after market close when expiration is the next trading day (contract "{symbol}") |
| 422 | 42210000 | orders for morning-expiration index options cannot be placed on expiration day (contract "{symbol}") |
| 422 | 42210000 | position intent mismatch, inferred: {inferred}, specified: {specified} |
| 422 | 42210000 | qty must be integer for options trading |
| 422 | 42210000 | swap_fee_bps is not allowed for options trading |
| 422 | 42210000 | underlying asset "{symbol}" not found |
| 422 | 42210000 | put sell limit price {limit} exceeds strike price {strike price} |
提交:多腿(MLeg)
当有效载荷包含order_class: "mleg"和一个或多个期权legs时,由POST /v2/orders返回。另请参见期权级别3交易。
| HTTP | 代码 | 消息 |
|---|---|---|
| 403 | 40310000 | submit mleg order is disabled |
| 422 | 42210000 | asset not found for {symbol} |
| 422 | 42210000 | equity legs are allowed only with a corresponding amount of call contracts |
| 422 | 42210000 | European-style option legs in a multi-leg order must have the same expiration date |
| 422 | 42210000 | invalid limit price |
| 422 | 42210000 | invalid time in force |
| 422 | 42210000 | leg.{i} position intent is required |
| 422 | 42210000 | limit price is only valid for limit orders |
| 422 | 42210000 | limit price is required for limit orders |
| 422 | 42210000 | rolling contracts ambiguity |
| 422 | 42210000 | underlying asset mismatch: {underlying} != {asset} |
取消
由DELETE /v2/orders/{order_id}返回。
| HTTP | 代码 | 消息 |
|---|---|---|
| 403 | 40310000 | cancel mleg order is disabled |
| 422 | 42210000 | leg order is already in {status} state |
替换
由PATCH /v2/orders/{order_id}返回。
| HTTP | 代码 | 消息 |
|---|---|---|
| 403 | 40310000 | replace mleg order is disabled |
| 422 | 42210000 | cannot replace order in {status} status |
| 422 | 42210000 | order already replaced |
| 422 | 42210000 | order chain not fully replaced |
| 422 | 42210000 | order parameters are not changed |
| 422 | 42210000 | qty must be > filled_qty |
行权
由期权行权端点返回。参见期权交易概述 → 行权。
| HTTP | 代码 | 消息 |
|---|---|---|
| 403 | 40310000 | cannot exercise position marked as do-not-exercise |
| 403 | 40310000 | cannot exercise position with dne_qty greater than or equal to position qty (dne_qty: {dne_qty}, position qty: {position_qty}) |
| 403 | 40310000 | early exercise is not allowed for European-style options |
| 403 | 40310000 | exercise requests are not accepted after market close until midnight |
| 403 | 40310000 | insufficient cash available (required: {required}, available: {available}) |
| 403 | 40310000 | insufficient cash available - margin call protection (required: {required}, available: {available}) |
| 403 | 40310000 | insufficient qty available (requested: {requested_qty}, available: {available_qty}) |
| 403 | 40310000 | insufficient qty available to exercise after accounting for partial do-not-exercise (requested: {requested_qty}, dne_qty: {dne_qty}, available: {available_qty}) |
| 403 | 40310000 | insufficient regt buying power (required: {required}, available: {available}) |
| 403 | 40310000 | insufficient underlying qty available for deliverable: {symbol} (requested: {requested_qty}, available: {available_qty}) |
| 403 | 40310000 | no qty available to exercise |
| 403 | 40310000 | you are attempting to exercise a non-standard option contract, please contact support@alpaca.markets to complete this request |
| 403 | 40310000 | you are attempting to exercise an out of the money option contract, please contact support@alpaca.markets to complete this request |
| 404 | 40410000 | long position not found: {symbol} |
| 422 | 42210000 | exercise commission not allowed for account |
| 422 | 42210000 | negative exercise commission is prohibited |
| 422 | 42210000 | qty must be > 0 |
| 422 | 42210000 | symbol missing |
不行权(DNE)
由不行权端点返回。参见期权交易概述 → 行权。
| HTTP | 代码 | 消息 |
|---|---|---|
| 403 | 40310000 | dne requests are not accepted after {time} |
| 403 | 40310000 | dne requests are only accepted on the expiration day of the option contract |
| 403 | 40310000 | do-not-exercise is not applicable for European-style options |
| 404 | 40410000 | long position not found: {symbol} |
| 422 | 42210000 | symbol missing |
Warning
⚠️ 期权交易因其固有的高风险而不适合所有投资者,可能导致重大损失。在投资期权之前,请阅读标准化期权的特征和风险。