Trading¶
Trading Resource¶
composer.resources.trading.Trading
¶
Resource for trading-related endpoints.
Source code in composer/resources/trading.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
create_order_request(account_id, type, symbol, time_in_force, notional=None, quantity=None, position_intent=None, limit_price=None, stop_price=None, client_order_id=None)
¶
Create a new order request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
type
|
OrderType | str
|
Order type (MARKET, LIMIT, STOP, STOP_LIMIT, TRAILING_STOP) |
required |
symbol
|
str
|
Symbol to trade |
required |
time_in_force
|
TimeInForce | str
|
Time in force (GTC, DAY, IOC, FOK, OPG, CLS) |
required |
notional
|
float | None
|
Notional amount (required if quantity not provided) |
None
|
quantity
|
float | None
|
Quantity (required if notional not provided) |
None
|
position_intent
|
PositionIntent | str | None
|
Position intent for options (BUY_TO_OPEN, etc.) |
None
|
limit_price
|
float | None
|
Limit price for limit orders |
None
|
stop_price
|
float | None
|
Stop price for stop orders |
None
|
client_order_id
|
str | None
|
Optional client-generated order ID |
None
|
Returns¶
Created order details
Source code in composer/resources/trading.py
delete_order_request(account_id, order_request_id)
¶
Cancel an order request that has not executed yet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
order_request_id
|
str
|
Unique identifier for the order request |
required |
Source code in composer/resources/trading.py
exercise_option(account_id, symbol)
¶
Exercise an option contract position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
symbol
|
str
|
Option symbol (e.g., OPTIONS::AAPL1234567890PC20240119//USD) |
required |
Returns¶
Exercise result
Source code in composer/resources/trading.py
get_order_request(account_id, order_request_id)
¶
Get a single order request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
order_request_id
|
str
|
Unique identifier for the order request |
required |
Returns¶
Details of the specified order request
Source code in composer/resources/trading.py
get_order_requests(account_id, limit=None, status=None)
¶
Get order requests for an account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
limit
|
int | None
|
Maximum number of results |
None
|
status
|
str | None
|
Filter by status (e.g., 'QUEUED,OPEN,IN_PROGRESS') |
None
|
Returns¶
List of order requests
Source code in composer/resources/trading.py
get_trading_period()
¶
Get the trading period for the authenticated user.
Returns¶
Trading period information for CRYPTO, EQUITIES, and OPTIONS
Source code in composer/resources/trading.py
modify_order_request(account_id, order_request_id, client_order_id=None, limit_price=None, quantity=None)
¶
Modify an existing order request that has not executed yet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
order_request_id
|
str
|
Unique identifier for the order request |
required |
client_order_id
|
str | None
|
ID for replacement order (idempotency key) |
None
|
limit_price
|
float | None
|
New limit price |
None
|
quantity
|
float | None
|
New quantity |
None
|
Source code in composer/resources/trading.py
preview_exercise_option(account_id, symbol)
¶
Preview exercise of an option contract position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
symbol
|
str
|
Option symbol (e.g., OPTIONS::AAPL1234567890PC20240119//USD) |
required |
Returns¶
Exercise preview
Source code in composer/resources/trading.py
preview_order_request(account_id, type, symbol, time_in_force, notional=None, quantity=None, position_intent=None, limit_price=None, stop_price=None)
¶
Preview an order request before placing it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
type
|
str
|
Order type (MARKET, LIMIT, STOP, STOP_LIMIT, TRAILING_STOP) |
required |
symbol
|
str
|
Symbol to trade |
required |
time_in_force
|
str
|
Time in force (GTC, DAY, IOC, FOK, OPG, CLS) |
required |
notional
|
float | None
|
Notional amount (required if quantity not provided) |
None
|
quantity
|
float | None
|
Quantity (required if notional not provided) |
None
|
position_intent
|
str | None
|
Position intent for options (BUY_TO_OPEN, etc.) |
None
|
limit_price
|
float | None
|
Limit price for limit orders |
None
|
stop_price
|
float | None
|
Stop price for stop orders |
None
|
Returns¶
Order preview
Source code in composer/resources/trading.py
Deploy Resource¶
composer.resources.deploy.DeployResource
¶
Resource for deploy-related endpoints.
Source code in composer/resources/deploy.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
delete_deploy(account_id, deploy_id)
¶
Cancel a pending deploy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
deploy_id
|
str
|
Unique identifier for the deployment operation |
required |
Source code in composer/resources/deploy.py
get_deploy(account_id, deploy_id)
¶
Get a specific deploy's details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
deploy_id
|
str
|
Unique identifier for the deployment operation |
required |
Returns¶
Details of the specified deploy
Source code in composer/resources/deploy.py
get_deploy_symphonies(account_id, asset_class=None)
¶
Get metadata for symphonies which have new invests pending.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
asset_class
|
str | None
|
Deprecated. |
None
|
Returns¶
List of symphonies with pending invests
Source code in composer/resources/deploy.py
get_deploys(account_id, status=None, limit=None)
¶
Get all deploy details for an account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
status
|
str | None
|
Filter by status (QUEUED, CANCELED, SUCCEEDED, FAILED, REJECTED, EXPIRED) |
None
|
limit
|
int | None
|
Maximum number of results |
None
|
Returns¶
List of deploys for the account
Source code in composer/resources/deploy.py
get_market_hours()
¶
Get market hours schedule for the upcoming week.
Returns¶
Market hours schedule including open/close times for each day
Source code in composer/resources/deploy.py
go_to_cash(account_id, symphony_id)
¶
Sell all assets in a symphony, leaving proceeds in cash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
symphony_id
|
str
|
Unique identifier for the Symphony |
required |
Returns¶
Information about the deploy
Source code in composer/resources/deploy.py
invest(account_id, symphony_id, amount)
¶
Invest cash into a Symphony.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
symphony_id
|
str
|
Unique identifier for the Symphony |
required |
amount
|
float
|
Amount of cash to invest (in USD) |
required |
Returns¶
Information about the deploy
Source code in composer/resources/deploy.py
liquidate(account_id, symphony_id)
¶
Liquidate a symphony entirely.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
symphony_id
|
str
|
Unique identifier for the Symphony |
required |
Returns¶
Information about the deploy
Source code in composer/resources/deploy.py
rebalance(account_id, symphony_id, rebalance_request_uuid)
¶
Rebalance a symphony NOW.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
symphony_id
|
str
|
Unique identifier for the Symphony |
required |
rebalance_request_uuid
|
str
|
UUID for the rebalance request |
required |
Returns¶
Information about the deploy
Source code in composer/resources/deploy.py
skip_automated_rebalance(account_id, symphony_id, skip)
¶
Skip automated rebalancing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
symphony_id
|
str
|
Unique identifier for the Symphony |
required |
skip
|
bool
|
Whether to skip the next automated rebalance |
required |
Source code in composer/resources/deploy.py
withdraw(account_id, symphony_id, amount)
¶
Withdraw cash from a Symphony.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id
|
str
|
Unique identifier (UUID) of the account |
required |
symphony_id
|
str
|
Unique identifier for the Symphony |
required |
amount
|
float
|
Amount of cash to withdraw (in USD) |
required |
Returns¶
Information about the deploy
Source code in composer/resources/deploy.py
Dry Run Resource¶
composer.resources.dry_run.DryRun
¶
Resource for dry-run endpoints.
Source code in composer/resources/dry_run.py
create_dry_run(send_segment_event=False, account_uuids=None)
¶
Dry run rebalances for a specific user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
send_segment_event
|
bool
|
Whether to send segment events |
False
|
account_uuids
|
list[str] | None
|
Optional list of specific account UUIDs |
None
|
Returns¶
List of dry run results for each account
Source code in composer/resources/dry_run.py
create_trade_preview(symphony_id, amount=None, broker_account_uuid=None)
¶
Generate trade preview for a single symphony.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symphony_id
|
str
|
Unique identifier for the Symphony |
required |
amount
|
float | None
|
Optional amount to preview |
None
|
broker_account_uuid
|
str | None
|
Optional specific account UUID |
None
|
Returns¶
Trade preview result