Requests#
AccountCreationRequest#
- class alpaca.broker.requests.CreateAccountRequest(*, contact: Contact, identity: Identity, disclosures: Disclosures, agreements: List[Agreement], documents: Optional[List[Union[AccountDocument, UploadW8BenDocumentRequest]]] = None, trusted_contact: Optional[TrustedContact] = None, currency: Optional[SupportedCurrencies] = None, enabled_assets: Optional[List[AssetClass]] = None)#
Class used to format data necessary for making a request to create a brokerage account
- disclosures#
The account holder’s political disclosures
- Type:
- documents#
The documents the account holder has submitted
- Type:
List[Union[AccountDocument, UploadW8BenDocumentRequest]]
- trusted_contact#
The account holder’s trusted contact details
- Type:
UpdateAccountRequest#
- class alpaca.broker.requests.UpdateAccountRequest(*, contact: Optional[UpdatableContact] = None, identity: Optional[UpdatableIdentity] = None, disclosures: Optional[UpdatableDisclosures] = None, trusted_contact: Optional[UpdatableTrustedContact] = None)#
Represents the data allowed in a request to update an Account. Note not all fields of an account are currently modifiable so this model uses models that represent the subset of modifiable fields.
- contact#
Contact details to update to
- Type:
Optional[UpdatableContact]
- identity#
Identity details to update to
- Type:
Optional[UpdatableIdentity]
- disclosures#
Disclosure details to update to
- Type:
Optional[UpdatableDisclosures]
- trusted_contact#
TrustedContact details to update to
- Type:
Optional[UpdatableTrustedContact]
UpdatableContact#
- class alpaca.broker.requests.UpdatableContact(*, email_address: Optional[str] = None, phone_number: Optional[str] = None, street_address: Optional[List[str]] = None, unit: Optional[str] = None, city: Optional[str] = None, state: Optional[str] = None, postal_code: Optional[str] = None, country: Optional[str] = None)#
An extended version of Contact that has all fields as optional, so you don’t need to specify all fields if you only want to update a subset of them.
- email_address#
The user’s email address
- Type:
Optional[str]
- phone_number#
The user’s phone number. It should include the country code.
- Type:
Optional[str]
- street_address#
The user’s street address lines.
- Type:
Optional[List[str]]
- unit#
The user’s apartment unit, if any.
- Type:
Optional[str]
- city#
The city the user resides in.
- Type:
Optional[str]
- state#
The state the user resides in. This is required if country is ‘USA’.
- Type:
Optional[str]
- postal_code#
The user’s postal
- Type:
Optional[str]
- country#
The country the user resides in. 3 letter country code is permissible.
- Type:
Optional[str]
UpdatableIdentity#
- class alpaca.broker.requests.UpdatableIdentity(*, given_name: Optional[str] = None, middle_name: Optional[str] = None, family_name: Optional[str] = None, visa_type: Optional[VisaType] = None, visa_expiration_date: Optional[str] = None, date_of_departure_from_usa: Optional[str] = None, permanent_resident: Optional[bool] = None, funding_source: Optional[List[FundingSource]] = None, annual_income_min: Optional[float] = None, annual_income_max: Optional[float] = None, liquid_net_worth_min: Optional[float] = None, liquid_net_worth_max: Optional[float] = None, total_net_worth_min: Optional[float] = None, total_net_worth_max: Optional[float] = None)#
This class is a subset version of Identity. Currently, not all fields on accounts are modifiable so this class represents which ones are modifiable on the identity field of an account when making an BrokerClient::update_account call.
Also has all fields as optional, so you don’t need to specify all fields if you only want to update a subset
- given_name#
The user’s first name
- Type:
Optional[str]
- middle_name#
The user’s middle name, if any
- Type:
Optional[str]
- family_name#
The user’s last name
- Type:
Optional[str]
- tax_id#
The user’s country specific tax id, required if tax_id_type is provided
- Type:
Optional[str]
- tax_id_type#
The tax_id_type for the tax_id provided, required if tax_id provided
- Type:
Optional[TaxIdType]
- country_of_citizenship#
The country the user is a citizen
- Type:
Optional[str]
- country_of_birth#
The country the user was born
- Type:
Optional[str]
- country_of_tax_residence#
The country the user files taxes
- Type:
Optional[str]
- visa_expiration_date#
The date of expiration for visa, Required if visa_type is set.
- Type:
Optional[str]
- date_of_departure_from_usa#
Required if visa_type = B1 or B2
- Type:
Optional[str]
- permanent_resident#
Only used to collect permanent residence status in the USA.
- Type:
Optional[bool]
- funding_source#
How the user will fund their account
- Type:
Optional[List[FundingSource]]
- annual_income_min#
The minimum of the user’s income range
- Type:
Optional[float]
- annual_income_max#
The maximum of the user’s income range
- Type:
Optional[float]
- liquid_net_worth_min#
The minimum of the user’s liquid net worth range
- Type:
Optional[float]
- liquid_net_worth_max#
The maximum of the user’s liquid net worth range
- Type:
Optional[float]
- total_net_worth_min#
The minimum of the user’s total net worth range
- Type:
Optional[float]
- total_net_worth_max#
The maximum of the user’s total net worth range
- Type:
Optional[float]
UpdatableDisclosures#
- class alpaca.broker.requests.UpdatableDisclosures(*, is_control_person: Optional[bool] = None, is_affiliated_exchange_or_finra: Optional[bool] = None, is_politically_exposed: Optional[bool] = None, immediate_family_exposed: Optional[bool] = None, employment_status: Optional[EmploymentStatus] = None, employer_name: Optional[str] = None, employer_address: Optional[str] = None, employment_position: Optional[str] = None)#
An extended version of Disclosures that has all fields as optional, so you don’t need to specify all fields if you only want to update a subset of them.
- is_control_person#
Whether user holds a controlling position in a publicly traded company
- Type:
Optional[bool]
- is_affiliated_exchange_or_finra#
If user is affiliated with any exchanges or FINRA
- Type:
Optional[bool]
- is_politically_exposed#
If user is politically exposed
- Type:
Optional[bool]
- immediate_family_exposed#
If user’s immediate family member is either politically exposed or holds a control position.
- Type:
Optional[bool]
- employment_status#
The employment status of the user
- Type:
Optional[EmploymentStatus]
- employer_name#
The user’s employer’s name, if any
- Type:
Optional[str]
- employer_address#
The user’s employer’s address, if any
- Type:
Optional[str]
- employment_position#
The user’s employment position, if any
- Type:
Optional[str]
UpdatableTrustedContact#
- class alpaca.broker.requests.UpdatableTrustedContact(*, given_name: Optional[str] = None, family_name: Optional[str] = None, email_address: Optional[str] = None, phone_number: Optional[str] = None, street_address: Optional[str] = None, city: Optional[str] = None, state: Optional[str] = None, postal_code: Optional[str] = None, country: Optional[str] = None)#
An extended version of TrustedContact that has all fields as optional, so you don’t need to specify all fields if you only want to update a subset of them.
- given_name#
The first name of the user’s trusted contact
- Type:
Optional[str]
- family_name#
The last name of the user’s trusted contact
- Type:
Optional[str]
- email_address#
The email address of the user’s trusted contact
- Type:
Optional[str]
- phone_number#
The email address of the user’s trusted contact
- Type:
Optional[str]
- city#
The email address of the user’s trusted contact
- Type:
Optional[str]
- state#
The email address of the user’s trusted contact
- Type:
Optional[str]
- postal_code#
The email address of the user’s trusted contact
- Type:
Optional[str]
- country#
The email address of the user’s trusted contact
- Type:
Optional[str]
ListAccountsRequest#
- class alpaca.broker.requests.ListAccountsRequest(*args, query: Optional[str] = None, created_before: Optional[datetime] = None, created_after: Optional[datetime] = None, status: Optional[List[AccountStatus]] = None, sort: Sort, entities: Optional[List[AccountEntities]] = None)#
Represents the values you can specify when making a request to list accounts
- query#
Pass space-delimited tokens. The response will contain accounts that match with each of the tokens (logical AND). A match means the token is present in either the account’s associated account number, phone number, name, or e-mail address (logical OR).
- Type:
Optional[str]
- created_before#
Accounts that were created before this date
- Type:
Optional[datetime]
- created_after#
Accounts that were created after this date
- Type:
Optional[datetime]
- status#
Accounts that have their status field as one of these
- Type:
Optional[AccountStatus]
- sort#
The chronological order of response based on the submission time. Defaults to DESC.
- Type:
Sort, optional
- entities#
By default, this endpoint doesn’t return all information for each account to save space in the response. This field lets you specify what additional information you want to be included on each account.
ie, specifying [IDENTITY, CONTACT] would ensure that each returned account has its identity and contact fields filled out.
- Type:
Optional[List[AccountEntities]]
GetAccountActivitiesRequest#
- class alpaca.broker.requests.GetAccountActivitiesRequest(*args, account_id: Optional[Union[UUID, str]] = None, activity_types: Optional[List[ActivityType]] = None, date: Optional[datetime] = None, until: Optional[datetime] = None, after: Optional[datetime] = None, direction: Optional[Sort] = None, page_size: Optional[int] = None, page_token: Optional[Union[UUID, str]] = None)#
Represents the filtering values you can specify when getting AccountActivities for an Account
Notes on pagination and the `page_size` and `page_token` fields.
The BrokerClient::get_account_activities function by default will automatically handle the pagination of results for you to get all results at once. However, if you’re requesting a very large amount of results this can use a large amount of memory and time to gather all the results. If you instead want to handle pagination yourself page_size and page_token are how you would handle this.
Say you put in a request with page_size set to 4, you’ll only get 4 results back to get the next “page” of results you would set page_token to be the id field of the last Activity returned in the result set.
This gets more indepth if you start specifying the sort field as well. If specified with a direction of Sort.DESC, for example, the results will end before the activity with the specified ID. However, specified with a direction of Sort.ASC, results will begin with the activity immediately after the one specified.
Also, to note if date is not specified, the default and maximum page_size value is 100. If date is specified, the default behavior is to return all results, and there is no maximum page size; page size is still supported in this state though.
Please see https://alpaca.markets/docs/api-references/broker-api/accounts/account-activities/#retrieving-account-activities for more information
- account_id#
Specifies to filter to only activities for this Account
- Type:
Optional[Union[UUID, str]]
- activity_types#
A list of ActivityType’s to filter results down to
- Type:
Optional[List[ActivityType]]
- date#
Filter to Activities only on this date.
- Type:
Optional[datetime]
- until#
Filter to Activities before this date. Cannot be used if date is also specified.
- Type:
Optional[datetime]
- after#
Filter to Activities after this date. Cannot be used if date is also specified.
- Type:
Optional[datetime]
- direction#
Which direction to sort results in. Defaults to Sort.DESC
- Type:
Optional[Sort]
- page_size#
The maximum number of entries to return in the response
- Type:
Optional[int]
- page_token#
If you’re not using the built-in pagination this field is what you would use to mark the end of the results of your last page.
- Type:
Optional[Union[UUID, str]]
GetTradeDocumentsRequest#
- class alpaca.broker.requests.GetTradeDocumentsRequest(*, start: Optional[Union[date, str]] = None, end: Optional[Union[date, str]] = None, type: Optional[TradeDocumentType] = None)#
Represents the various filters you can specify when making a call to get TradeDocuments for an Account
- start#
Filter to TradeDocuments created after this Date. str values will attempt to be upcast into date instances. Format must be in YYYY-MM-DD.
- Type:
Optional[Union[date, str]]
- end#
Filter to TradeDocuments created before this Date. str values will attempt to be upcast into date instances. Format must be in YYYY-MM-DD.
- Type:
Optional[Union[date, str]]
- type#
Filter to only these types of TradeDocuments
- Type:
Optional[TradeDocumentType]
UploadDocumentRequest#
- class alpaca.broker.requests.UploadDocumentRequest(*, document_type: DocumentType, document_sub_type: Optional[UploadDocumentSubType] = None, content: str, mime_type: UploadDocumentMimeType)#
- document_type#
The type of document you are uploading
- Type:
- document_sub_type#
If supported for the corresponding document_type this field allows you to specify a sub type to be even more specific.
- Type:
Optional[UploadDocumentSubType]
- content#
A string containing Base64 encoded data to upload.
- Type:
str
- mime_type#
The mime type of the data in content
- Type:
UploadW8BenDocumentRequest#
- class alpaca.broker.requests.UploadW8BenDocumentRequest(*, document_type: DocumentType, document_sub_type: UploadDocumentSubType, content: Optional[str] = None, content_data: Optional[W8BenDocument] = None, mime_type: UploadDocumentMimeType)#
- content#
A string containing Base64 encoded data to upload. Must be set if content_data is not set.
- Type:
Optional[str]
- content_data#
The data representing a W8BEN document in field form. Must be set if content is not set.
- Type:
Optional[W8BenDocument]
- mime_type#
The mime type of the data in content, or if using content_data must be UploadDocumentMimeType.JSON. If content_data is set this will default to JSON
- Type:
CreateACHRelationshipRequest#
- class alpaca.broker.requests.CreateACHRelationshipRequest(*, account_owner_name: str, bank_account_type: BankAccountType, bank_account_number: str, bank_routing_number: str, nickname: Optional[str] = None)#
- account_owner_name#
The name of the ACH account owner for the relationship that is being created.
- Type:
str
- bank_account_type#
Specifies the type of bank account for the ACH relationship that is being created.
- Type:
- bank_account_number#
The bank account number associated with the ACH relationship.
- Type:
str
- bank_routing_number#
THe bank routing number associated with the ACH relationship.
- Type:
str
- nickname#
Optionally specify a nickname to assign to the created ACH relationship.
- Type:
Optional[str]
CreatePlaidRelationshipRequest#
- class alpaca.broker.requests.CreatePlaidRelationshipRequest(*, processor_token: str)#
This request is made following the Plaid bank account link user flow.
Upon the user completing their connection with Plaid, a public token specific to the user is returned by Plaid. This token is used to get an Alpaca processor token via Plaid’s /processor/token/create endpoint, which is subsequently used by this endpoint to transfer the user’s Plaid information to Alpaca.
- processor_token#
The processor token that is specific to Alpaca and was returned by Plaid.
- Type:
str
CreateBankRequest#
- class alpaca.broker.requests.CreateBankRequest(*, name: str, bank_code_type: IdentifierType, bank_code: str, account_number: str, country: Optional[str] = None, state_province: Optional[str] = None, postal_code: Optional[str] = None, city: Optional[str] = None, street_address: Optional[str] = None)#
- name#
The name of the recipient bank.
- Type:
str
- bank_code_type#
Specifies the type of the bank (international or domestic). See enums.IdentifierType for more details.
- Type:
- bank_code#
The 9-digit ABA routing number (domestic) or bank identifier code (BIC, international).
- Type:
str
- account_number#
The bank account number.
- Type:
str
- country#
The country of the bank, if and only if creating an international bank account connection.
- Type:
Optional[str]
- state_province#
The state/province of the bank, if and only if creating an international bank account connection.
- Type:
Optional[str]
- postal_code#
The postal code of the bank, if and only if creating an international bank account connection.
- Type:
Optional[str]
- city#
The city of the bank, if and only if creating an international bank account connection.
- Type:
Optional[str]
- street_address#
The street address of the bank, if and only if creating an international bank account connection.
- Type:
Optional[str]
CreateACHTransferRequest#
- class alpaca.broker.requests.CreateACHTransferRequest(*, amount: str, direction: TransferDirection, timing: TransferTiming, fee_payment_method: Optional[FeePaymentMethod] = None, relationship_id: UUID, transfer_type: TransferType = TransferType.ACH)#
- transfer_type#
Type of the transfer.
- Type:
- relationship_id#
ID of the relationship to use for the transfer, required for ACH transfers.
- Type:
Optional[UUID]
CreateBankTransferRequest#
- class alpaca.broker.requests.CreateBankTransferRequest(*, amount: str, direction: TransferDirection, timing: TransferTiming, fee_payment_method: Optional[FeePaymentMethod] = None, bank_id: UUID, transfer_type: TransferType = TransferType.WIRE, additional_information: Optional[str] = None)#
- bank_id#
ID of the bank to use for the transfer, required for wire transfers.
- Type:
UUID
- additional_information#
Additional wire transfer details.
- Type:
Optional[str]
GetTransfersRequest#
- class alpaca.broker.requests.GetTransfersRequest(*, direction: Optional[TransferDirection] = None, limit: Optional[int] = None, offset: Optional[int] = None)#
- direction#
Optionally filter for transfers of only a single TransferDirection.
- Type:
Optional[alpaca.broker.enums.TransferDirection]
OrderRequest#
- class alpaca.broker.requests.OrderRequest(*, symbol: str, qty: Optional[float] = None, notional: Optional[float] = None, side: OrderSide, type: OrderType, time_in_force: TimeInForce, order_class: Optional[OrderClass] = None, extended_hours: Optional[bool] = None, client_order_id: Optional[str] = None, take_profit: Optional[TakeProfitRequest] = None, stop_loss: Optional[StopLossRequest] = None, position_intent: Optional[PositionIntent] = None, commission: Optional[float] = None, currency: Optional[SupportedCurrencies] = None)#
See base alpaca.trading.requests.OrderRequest model for more information.
- symbol#
The symbol identifier for the asset being traded
- Type:
str
- qty#
The number of shares to trade. Fractional qty for stocks only with market orders.
- Type:
Optional[float]
- notional#
The base currency value of the shares to trade. For stocks, only works with MarketOrders. Does not work with qty.
- Type:
Optional[float]
- time_in_force#
The expiration logic of the order.
- Type:
- extended_hours#
Whether the order can be executed during regular market hours.
- Type:
Optional[float]
- client_order_id#
A string to identify which client submitted the order.
- Type:
Optional[float]
- order_class#
The class of the order. Simple orders have no other legs.
- Type:
Optional[OrderClass]
- take_profit#
For orders with multiple legs, an order to exit a profitable trade.
- Type:
Optional[TakeProfitRequest]
- stop_loss#
For orders with multiple legs, an order to exit a losing trade.
- Type:
Optional[StopLossRequest]
- commission#
The dollar value commission you want to charge the end user.
- Type:
Optional[float]
MarketOrderRequest#
- class alpaca.broker.requests.MarketOrderRequest(*, symbol: str, qty: Optional[float] = None, notional: Optional[float] = None, side: OrderSide, type: OrderType, time_in_force: TimeInForce, order_class: Optional[OrderClass] = None, extended_hours: Optional[bool] = None, client_order_id: Optional[str] = None, take_profit: Optional[TakeProfitRequest] = None, stop_loss: Optional[StopLossRequest] = None, position_intent: Optional[PositionIntent] = None, commission: Optional[float] = None)#
See base alpaca.trading.requests.MarketOrderRequest model for more information.
- symbol#
The symbol identifier for the asset being traded
- Type:
str
- qty#
The number of shares to trade. Fractional qty for stocks only with market orders.
- Type:
Optional[float]
- notional#
The base currency value of the shares to trade. For stocks, only works with MarketOrders. Does not work with qty.
- Type:
Optional[float]
- time_in_force#
The expiration logic of the order.
- Type:
- extended_hours#
Whether the order can be executed during regular market hours.
- Type:
Optional[float]
- client_order_id#
A string to identify which client submitted the order.
- Type:
Optional[float]
- order_class#
The class of the order. Simple orders have no other legs.
- Type:
Optional[OrderClass]
- take_profit#
For orders with multiple legs, an order to exit a profitable trade.
- Type:
Optional[TakeProfitRequest]
- stop_loss#
For orders with multiple legs, an order to exit a losing trade.
- Type:
Optional[StopLossRequest]
- commission#
The dollar value commission you want to charge the end user.
- Type:
Optional[float]
LimitOrderRequest#
- class alpaca.broker.requests.LimitOrderRequest(*, symbol: str, qty: Optional[float] = None, notional: Optional[float] = None, side: OrderSide, type: OrderType, time_in_force: TimeInForce, order_class: Optional[OrderClass] = None, extended_hours: Optional[bool] = None, client_order_id: Optional[str] = None, take_profit: Optional[TakeProfitRequest] = None, stop_loss: Optional[StopLossRequest] = None, position_intent: Optional[PositionIntent] = None, limit_price: Optional[float] = None, commission: Optional[float] = None)#
See base alpaca.trading.requests.LimitOrderRequest model for more information.
- symbol#
The symbol identifier for the asset being traded
- Type:
str
- qty#
The number of shares to trade. Fractional qty for stocks only with market orders.
- Type:
Optional[float]
- notional#
The base currency value of the shares to trade. For stocks, only works with MarketOrders. Does not work with qty.
- Type:
Optional[float]
- time_in_force#
The expiration logic of the order.
- Type:
- extended_hours#
Whether the order can be executed during regular market hours.
- Type:
Optional[float]
- client_order_id#
A string to identify which client submitted the order.
- Type:
Optional[float]
- order_class#
The class of the order. Simple orders have no other legs.
- Type:
Optional[OrderClass]
- take_profit#
For orders with multiple legs, an order to exit a profitable trade.
- Type:
Optional[TakeProfitRequest]
- stop_loss#
For orders with multiple legs, an order to exit a losing trade.
- Type:
Optional[StopLossRequest]
- limit_price#
The worst fill price for a limit or stop limit order.
- Type:
float
- commission#
The dollar value commission you want to charge the end user.
- Type:
Optional[float]
StopOrderRequest#
- class alpaca.broker.requests.StopOrderRequest(*, symbol: str, qty: Optional[float] = None, notional: Optional[float] = None, side: OrderSide, type: OrderType, time_in_force: TimeInForce, order_class: Optional[OrderClass] = None, extended_hours: Optional[bool] = None, client_order_id: Optional[str] = None, take_profit: Optional[TakeProfitRequest] = None, stop_loss: Optional[StopLossRequest] = None, position_intent: Optional[PositionIntent] = None, stop_price: float, commission: Optional[float] = None)#
See base alpaca.trading.requests.StopOrderRequest model for more information.
- symbol#
The symbol identifier for the asset being traded
- Type:
str
- qty#
The number of shares to trade. Fractional qty for stocks only with market orders.
- Type:
Optional[float]
- notional#
The base currency value of the shares to trade. For stocks, only works with MarketOrders. Does not work with qty.
- Type:
Optional[float]
- time_in_force#
The expiration logic of the order.
- Type:
- extended_hours#
Whether the order can be executed during regular market hours.
- Type:
Optional[float]
- client_order_id#
A string to identify which client submitted the order.
- Type:
Optional[float]
- order_class#
The class of the order. Simple orders have no other legs.
- Type:
Optional[OrderClass]
- take_profit#
For orders with multiple legs, an order to exit a profitable trade.
- Type:
Optional[TakeProfitRequest]
- stop_loss#
For orders with multiple legs, an order to exit a losing trade.
- Type:
Optional[StopLossRequest]
- stop_price#
The price at which the stop order is converted to a market order or a stop limit order is converted to a limit order.
- Type:
float
- commission#
The dollar value commission you want to charge the end user.
- Type:
Optional[float]
StopLimitOrderRequest#
- class alpaca.broker.requests.StopLimitOrderRequest(*, symbol: str, qty: Optional[float] = None, notional: Optional[float] = None, side: OrderSide, type: OrderType, time_in_force: TimeInForce, order_class: Optional[OrderClass] = None, extended_hours: Optional[bool] = None, client_order_id: Optional[str] = None, take_profit: Optional[TakeProfitRequest] = None, stop_loss: Optional[StopLossRequest] = None, position_intent: Optional[PositionIntent] = None, stop_price: float, limit_price: float, commission: Optional[float] = None)#
See base alpaca.trading.requests.StopLimitOrderRequest model for more information.
- symbol#
The symbol identifier for the asset being traded
- Type:
str
- qty#
The number of shares to trade. Fractional qty for stocks only with market orders.
- Type:
Optional[float]
- notional#
The base currency value of the shares to trade. For stocks, only works with MarketOrders. Does not work with qty.
- Type:
Optional[float]
- time_in_force#
The expiration logic of the order.
- Type:
- extended_hours#
Whether the order can be executed during regular market hours.
- Type:
Optional[float]
- client_order_id#
A string to identify which client submitted the order.
- Type:
Optional[float]
- order_class#
The class of the order. Simple orders have no other legs.
- Type:
Optional[OrderClass]
- take_profit#
For orders with multiple legs, an order to exit a profitable trade.
- Type:
Optional[TakeProfitRequest]
- stop_loss#
For orders with multiple legs, an order to exit a losing trade.
- Type:
Optional[StopLossRequest]
- stop_price#
The price at which the stop order is converted to a market order or a stop limit order is converted to a limit order.
- Type:
float
- limit_price#
The worst fill price for a limit or stop limit order.
- Type:
float
- commission#
The dollar value commission you want to charge the end user
- Type:
Optional[float]
TrailingStopOrderRequest#
- class alpaca.broker.requests.TrailingStopOrderRequest(*, symbol: str, qty: Optional[float] = None, notional: Optional[float] = None, side: OrderSide, type: OrderType, time_in_force: TimeInForce, order_class: Optional[OrderClass] = None, extended_hours: Optional[bool] = None, client_order_id: Optional[str] = None, take_profit: Optional[TakeProfitRequest] = None, stop_loss: Optional[StopLossRequest] = None, position_intent: Optional[PositionIntent] = None, trail_price: Optional[float] = None, trail_percent: Optional[float] = None, commission: Optional[float] = None)#
See base alpaca.trading.requests.TrailingStopOrderRequest model for more information.
- symbol#
The symbol identifier for the asset being traded
- Type:
str
- qty#
The number of shares to trade. Fractional qty for stocks only with market orders.
- Type:
Optional[float]
- notional#
The base currency value of the shares to trade. For stocks, only works with MarketOrders. Does not work with qty.
- Type:
Optional[float]
- time_in_force#
The expiration logic of the order.
- Type:
- extended_hours#
Whether the order can be executed during regular market hours.
- Type:
Optional[float]
- client_order_id#
A string to identify which client submitted the order.
- Type:
Optional[float]
- order_class#
The class of the order. Simple orders have no other legs.
- Type:
Optional[OrderClass]
- take_profit#
For orders with multiple legs, an order to exit a profitable trade.
- Type:
Optional[TakeProfitRequest]
- stop_loss#
For orders with multiple legs, an order to exit a losing trade.
- Type:
Optional[StopLossRequest]
- trail_price#
The absolute price difference by which the trailing stop will trail.
- Type:
Optional[float]
- trail_percent#
The percent price difference by which the trailing stop will trail.
- Type:
Optional[float]
- commission#
The dollar value commission you want to charge the end user.
- Type:
Optional[float]
CreateJournalRequest#
- class alpaca.broker.requests.CreateJournalRequest(*, from_account: UUID, entry_type: JournalEntryType, to_account: UUID, amount: Optional[float] = None, symbol: Optional[str] = None, qty: Optional[float] = None, description: Optional[str] = None, transmitter_name: Optional[str] = None, transmitter_account_number: Optional[str] = None, transmitter_address: Optional[str] = None, transmitter_financial_institution: Optional[str] = None, transmitter_timestamp: Optional[str] = None, currency: Optional[SupportedCurrencies] = None)#
Data for request to initiate a single journal.
- to_account#
The account ID that received the journal.
- Type:
UUID
- from_account#
The account ID that initiates the journal.
- Type:
UUID
- entry_type#
Whether the journal is a cash or security journal.
- Type:
- symbol#
For security journals, the symbol identifier of the security being journaled.
- Type:
Optional[str]
- qty#
For security journals, the quantity of the security being journaled.
- Type:
Optional[float]
- amount#
For cash journals, the total cash amount journaled in USD.
- Type:
Optional[float]
- description#
Journal description. It can include fixtures for sandbox API.
- Type:
Optional[str]
- transmitter_name#
For cash journals, travel rule related name info.
- Type:
Optional[str]
- transmitter_account_number#
For cash journals, travel rule account number info.
- Type:
Optional[str]
- transmitter_address#
For cash journals, travel rule related address info.
- Type:
Optional[str]
- transmitter_financial_institution#
For cash journals, travel rule related institution info.
- Type:
Optional[str]
- transmitter_timestamp#
For cash journals, travel rule related timestamp info.
- Type:
Optional[str]
CreateBatchJournalRequest#
- class alpaca.broker.requests.CreateBatchJournalRequest(*, entry_type: JournalEntryType, from_account: UUID, entries: List[BatchJournalRequestEntry])#
This model represents the fields you can specify when creating a request of many Journals out of one account to many others at once.
Currently, batch journals are only enabled on cash journals.
- entry_type#
The type of journal transfer.
- Type:
- from_account#
The originator of funds. Most likely is your Sweep Firm Account
- Type:
UUID
- entries#
List of journals to execute.
- Type:
List[BatchJournalRequestEntry]
BatchJournalRequestEntry#
- class alpaca.broker.requests.BatchJournalRequestEntry(*, to_account: UUID, amount: Union[str, float], description: Optional[str] = None, transmitter_name: Optional[str] = None, transmitter_account_number: Optional[str] = None, transmitter_address: Optional[str] = None, transmitter_financial_institution: Optional[str] = None, transmitter_timestamp: Optional[str] = None)#
Entry in batch journal request.
- to_account#
Account to fund in batch journal request.
- Type:
UUID
- amount#
The cash amount in USD to fund by.
- Type:
Union[str, float]
- description#
Journal description.
- Type:
Optional[str]
- transmitter_name#
For cash journals, travel rule related name info.
- Type:
Optional[str]
- transmitter_account_number#
For cash journals, travel rule account number info.
- Type:
Optional[str]
- transmitter_address#
For cash journals, travel rule related address info.
- Type:
Optional[str]
- transmitter_financial_institution#
For cash journals, travel rule related institution info.
- Type:
Optional[str]
- transmitter_timestamp#
For cash journals, travel rule related timestamp info.
- Type:
Optional[str]
CreateReverseBatchJournalRequest#
- class alpaca.broker.requests.ReverseBatchJournalRequestEntry(*, from_account: UUID, amount: Union[str, float], description: Optional[str] = None, transmitter_name: Optional[str] = None, transmitter_account_number: Optional[str] = None, transmitter_address: Optional[str] = None, transmitter_financial_institution: Optional[str] = None, transmitter_timestamp: Optional[str] = None)#
Entry in reverse batch journal request.
- from_account#
Account from fund in batch journal request.
- Type:
UUID
- amount#
The cash amount in USD to fund by.
- Type:
Union[str, float]
- description#
Journal description.
- Type:
Optional[str]
- transmitter_name#
For cash journals, travel rule related name info.
- Type:
Optional[str]
- transmitter_account_number#
For cash journals, travel rule account number info.
- Type:
Optional[str]
- transmitter_address#
For cash journals, travel rule related address info.
- Type:
Optional[str]
- transmitter_financial_institution#
For cash journals, travel rule related institution info.
- Type:
Optional[str]
- transmitter_timestamp#
For cash journals, travel rule related timestamp info.
- Type:
Optional[str]
GetJournalsRequest#
- class alpaca.broker.requests.GetJournalsRequest(*, after: Optional[date] = None, before: Optional[date] = None, status: Optional[JournalStatus] = None, entry_type: Optional[JournalEntryType] = None, to_account: Optional[UUID] = None, from_account: Optional[UUID] = None)#
This model represents the fields you can specify when querying from the list of all journals.
- after#
Journal creation dates after this date.
- Type:
Optional[date]
- before#
Journal creation dates before this date.
- Type:
Optional[date]
- status#
Only journals with this status.
- Type:
Optional[JournalStatus]
- entry_type#
Only journals with this entry type.
- Type:
Optional[JournalEntryType]
- to_account#
Only journals to this account.
- Type:
Optional[UUID]
- from_account#
Only journals from this account.
- Type:
Optional[UUID]