Models#

Account#

class alpaca.broker.models.accounts.Account(*, id: UUID, account_number: str, status: AccountStatus, crypto_status: Optional[AccountStatus] = None, kyc_results: Optional[KycResults] = None, currency: str, last_equity: str, created_at: str, contact: Optional[Contact] = None, identity: Optional[Identity] = None, disclosures: Optional[Disclosures] = None, agreements: Optional[List[Agreement]] = None, documents: Optional[List[AccountDocument]] = None, trusted_contact: Optional[TrustedContact] = None)#

Contains information pertaining to a specific brokerage account

see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#the-account-model

The fields contact, identity, disclosures, agreements, documents, trusted_contact, and trading_configurations are all optional and won’t always be provided by the api depending on what endpoint you use and what options you pass

id#

The account uuid used to reference this account

Type:

str

account_number#

A more human friendly identifier for this account

Type:

str

status#

The approval status of this account

Type:

AccountStatus

crypto_status#

The crypto trading status. Only present if crypto trading is enabled.

Type:

Optional[AccountStatus]

kyc_results#

Hold information about the result of KYC.

Type:

Optional[KycResult]

currency#

The currency the account’s values are returned in

Type:

str

last_equity#

The total equity value stored in the account

Type:

str

created_at#

The timestamp when the account was created

Type:

str

contact#

The contact details for the account holder

Type:

Optional[Contact]

identity#

The identity details for the account holder

Type:

Optional[Identity]

disclosures#

The account holder’s political disclosures

Type:

Optional[Disclosures]

agreements#

The agreements the account holder has signed

Type:

Optional[List[Agreement]]

documents#

The documents the account holder has submitted

Type:

Optional[List[AccountDocument]]

trusted_contact#

The account holder’s trusted contact details

Type:

Optional[TrustedContact]

Contact#

class alpaca.broker.models.accounts.Contact(*, email_address: str, phone_number: Optional[str] = None, street_address: List[str], unit: Optional[str] = None, city: str, state: Optional[str] = None, postal_code: Optional[str] = None, country: Optional[str] = None)#

User contact details within Account Model

see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#the-account-model

email_address#

The user’s email address

Type:

str

phone_number#

The user’s phone number. It should include the country code.

Type:

str

street_address#

The user’s street address lines.

Type:

List[str]

unit#

The user’s apartment unit, if any.

Type:

Optional[str]

city#

The city the user resides in.

Type:

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:

str

country#

The country the user resides in. 3 letter country code is permissible.

Type:

str

Identity#

class alpaca.broker.models.accounts.Identity(*, given_name: str, middle_name: Optional[str] = None, family_name: str, date_of_birth: Optional[str] = None, tax_id: Optional[str] = None, tax_id_type: Optional[TaxIdType] = None, country_of_citizenship: Optional[str] = None, country_of_birth: Optional[str] = None, country_of_tax_residence: str, 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)#

User identity details within Account Model

see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#the-account-model

given_name#

The user’s first name

Type:

str

middle_name#

The user’s middle name, if any

Type:

Optional[str]

family_name#

The user’s last name

Type:

str

date_of_birth#

The user’s date of birth

Type:

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:

str

visa_type#

Only used to collect visa types for users residing in the USA.

Type:

Optional[VisaType]

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]

Disclosures#

class alpaca.broker.models.accounts.Disclosures(*, is_control_person: Optional[bool] = None, is_affiliated_exchange_or_finra: Optional[bool] = None, is_politically_exposed: Optional[bool] = None, immediate_family_exposed: bool, employment_status: Optional[EmploymentStatus] = None, employer_name: Optional[str] = None, employer_address: Optional[str] = None, employment_position: Optional[str] = None)#

User disclosures within Account Model

see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#the-account-model

is_control_person#

Whether user holds a controlling position in a publicly traded company

Type:

bool

is_affiliated_exchange_or_finra#

If user is affiliated with any exchanges or FINRA

Type:

bool

is_politically_exposed#

If user is politically exposed

Type:

bool

immediate_family_exposed#

If user’s immediate family member is either politically exposed or holds a control position.

Type:

bool

employment_status#

The employment status of the user

Type:

EmploymentStatus

employer_name#

The user’s employer’s name, if any

Type:

str

employer_address#

The user’s employer’s address, if any

Type:

str

employment_position#

The user’s employment position, if any

Type:

str

Agreement#

class alpaca.broker.models.accounts.Agreement(*, agreement: AgreementType, signed_at: str, ip_address: str, revision: Optional[str] = None)#

User agreements signed within Account Model

see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#the-account-model

agreement#

The type of agreement signed by the user

Type:

Agreement

signed_at#

The timestamp the agreement was signed

Type:

str

ip_address#

The ip_address the signed agreements were sent from by the user

Type:

str

revision#

The revision date

Type:

str

TrustedContact#

class alpaca.broker.models.accounts.TrustedContact(*, given_name: str, family_name: str, 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)#

User’s trusted contact details within Account Model

see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#the-account-model

Attributes:given_name

given_name (str): The first name of the user’s trusted contact family_name (str): The last name of the user’s trusted contact email_address (Optional[str]): The email address of the user’s trusted contact phone_number (Optional[str]): The email address of the user’s trusted contact city (Optional[str]): The email address of the user’s trusted contact state (Optional[str]): The email address of the user’s trusted contact postal_code (Optional[str]): The email address of the user’s trusted contact country (Optional[str]): The email address of the user’s trusted contact

AccountDocument#

class alpaca.broker.models.documents.AccountDocument(*, id: Optional[UUID], document_type: Optional[DocumentType], document_sub_type: Optional[str] = None, content: Optional[str] = None, mime_type: Optional[str] = None)#

User documents provided within Account Model.

This model is different from the TradeDocument model in that this model represents documents having to do with a brokerage Account.

see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#the-account-model

id#

ID of the Document

Type:

UUID

document_type#

The type of document uploaded

Type:

DocumentType

document_sub_type#

The specific type of document, e.g. passport

Type:

Optional[str]

name#

Name of the document if present

Type:

Optional(str)

content#

Base64 string representing the document

Type:

str

mime_type#

The format of content encoded by the string

Type:

str

TradeAccount#

class alpaca.broker.models.accounts.TradeAccount(*, id: UUID, account_number: str, status: AccountStatus, crypto_status: Optional[AccountStatus] = None, currency: Optional[str] = None, buying_power: Optional[str] = None, regt_buying_power: Optional[str] = None, daytrading_buying_power: Optional[str] = None, non_marginable_buying_power: Optional[str] = None, cash: Optional[str] = None, accrued_fees: Optional[str] = None, pending_transfer_out: Optional[str] = None, pending_transfer_in: Optional[str] = None, portfolio_value: Optional[str] = None, pattern_day_trader: Optional[bool] = None, trading_blocked: Optional[bool] = None, transfers_blocked: Optional[bool] = None, account_blocked: Optional[bool] = None, created_at: Optional[datetime] = None, trade_suspended_by_user: Optional[bool] = None, multiplier: Optional[str] = None, shorting_enabled: Optional[bool] = None, equity: Optional[str] = None, last_equity: Optional[str] = None, long_market_value: Optional[str] = None, short_market_value: Optional[str] = None, initial_margin: Optional[str] = None, maintenance_margin: Optional[str] = None, last_maintenance_margin: Optional[str] = None, sma: Optional[str] = None, daytrade_count: Optional[int] = None, options_buying_power: Optional[str] = None, options_approved_level: Optional[int] = None, options_trading_level: Optional[int] = None, cash_withdrawable: Optional[str], cash_transferable: Optional[str], previous_close: Optional[datetime], last_long_market_value: Optional[str], last_short_market_value: Optional[str], last_cash: Optional[str], last_initial_margin: Optional[str], last_regt_buying_power: Optional[str], last_daytrading_buying_power: Optional[str], last_daytrade_count: Optional[int], last_buying_power: Optional[str], clearing_broker: Optional[ClearingBroker])#

See Base TradeAccount model in common for full details on available fields. Represents trading account information for an Account.

cash_withdrawable#

Cash available for withdrawal from the account

Type:

Optional[str]

cash_transferable#

Cash available for transfer (JNLC) from the account

Type:

Optional[str]

previous_close#

Previous sessions close time

Type:

Optional[datetime]

last_long_market_value#

Value of all long positions as of previous trading day at 16:00:00 ET

Type:

Optional[str]

last_short_market_value#

Value of all short positions as of previous trading day at 16:00:00 ET

Type:

Optional[str]

last_cash#

Value of all cash as of previous trading day at 16:00:00 ET

Type:

Optional[str]

last_initial_margin#

Value of initial_margin as of previous trading day at 16:00:00 ET

Type:

Optional[str]

last_regt_buying_power#

Value of regt_buying_power as of previous trading day at 16:00:00 ET

Type:

Optional[str]

last_daytrading_buying_power#

Value of daytrading_buying_power as of previous trading day at 16:00:00 ET

Type:

Optional[str]

last_daytrade_count#

Value of daytrade_count as of previous trading day at 16:00:00 ET

Type:

Optional[int]

last_buying_power#

Value of buying_power as of previous trading day at 16:00:00 ET

Type:

Optional[str]

clearing_broker#

The Clearing broker for this account

Type:

Optional[ClearingBroker]

TradeDocument#

class alpaca.broker.models.documents.TradeDocument(*, id: UUID, name: str, type: TradeDocumentType, sub_type: Optional[TradeDocumentSubType] = None, date: date)#

Similar to the AccountDocument model but this represents documents having to do with a TradeAccount not a regular Account.

IE: Account Monthly Statements or Trade Confirmations.

id#

Unique id of the TradeDocument

Type:

UUID

name#

Name of the document

Type:

str

type#

The kind of TradeDocument this is

Type:

TradeDocumentType

sub_type#

The subtype of the document. The API returns “” in the case of this not being specified, however we transform this case into None for convenience.

Type:

Optional[TradeDocumentSubType]

date#

Date on when this TradeDocument was generated

Type:

date

W8BenDocument#

class alpaca.broker.models.documents.W8BenDocument(*, country_citizen: str, date: date, date_of_birth: date, full_name: str, ip_address: Union[IPv4Address, IPv6Address], permanent_address_city_state: str, permanent_address_country: str, permanent_address_street: str, revision: str, signer_full_name: str, timestamp: datetime, additional_conditions: Optional[str] = None, foreign_tax_id: Optional[str] = None, ftin_not_required: Optional[bool] = None, income_type: Optional[str] = None, mailing_address_city_state: Optional[str] = None, mailing_address_country: Optional[str] = None, mailing_address_street: Optional[str] = None, paragraph_number: Optional[str] = None, percent_rate_withholding: Optional[str] = None, reference_number: Optional[str] = None, residency: Optional[str] = None, tax_id_ssn: Optional[str] = None)#

Represents the information normally contained in a W8BEN document as fields for convenience if you don’t want to upload a file.

Please see https://alpaca.markets/docs/api-references/broker-api/accounts/accounts/#international-accounts for more information.

TODO: None of the docs or code explain what any of these fields mean. Guessing based on name alone for

all of them; but we really need the docs updated.

additional_conditions#

Any additional conditions to specify

Type:

Optional[str]

country_citizen#

The Country that the applicant is a citizen of

Type:

str

date#

date signed

Type:

date

date_of_birth#

DOB of applicant

Type:

date

foreign_tax_id#

Applicant’s tax id in their home country

Type:

Optional[str]

ftin_not_required#

Required if foreign_tax_id and tax_id_ssn are empty.

Type:

Optional[bool]

full_name#

Full name of applicant

Type:

str

income_type#

income type of applicant

Type:

Optional[str]

ip_address#

ip address of applicant when signed

Type:

IPAddress

mailing_address_city_state#

mailing city/state of applicant

Type:

Optional[str]

mailing_address_country#

mailing country for applicant

Type:

Optional[str]

mailing_address_street#

mailing street address for applicant

Type:

Optional[str]

paragraph_number#

TODO: get documentation for this field

Type:

Optional[str]

percent_rate_withholding#

TODO: get documentation for this field

Type:

Optional[str]

permanent_address_city_state#

permanent city/state of applicant

Type:

str

permanent_address_country#

permanent country of residence of applicant

Type:

str

permanent_address_street#

permanent street address of applicant

Type:

str

reference_number#

TODO: Get documentation for this field

Type:

Optional[str]

residency#

Country of residency of applicant TODO: get real documentation for this field. current is just guess based on example

Type:

Optional[str]

revision#

Revision of the W8BEN form

Type:

str

signer_full_name#

Full name of signing user

Type:

str

tax_id_ssn#

TaxID/SSN of applicant

Type:

Optional[str]

timestamp#

timestamp when form data was gathered

Type:

datetime

CIPKYCInfo#

class alpaca.broker.models.cip.CIPKYCInfo(*, id: str, risk_score: Optional[int] = None, risk_level: Optional[str] = None, risk_categories: Optional[List[str]] = None, applicant_name: Optional[str] = None, email_address: Optional[str] = None, nationality: Optional[str] = None, date_of_birth: Optional[datetime] = None, address: Optional[str] = None, postal_code: Optional[str] = None, country_of_residency: Optional[str] = None, kyc_completed_at: Optional[datetime] = None, ip_address: Optional[str] = None, check_initiated_at: Optional[datetime] = None, check_completed_at: Optional[datetime] = None, approval_status: Optional[CIPApprovalStatus] = None, approved_by: Optional[str] = None, approved_reason: Optional[str] = None, approved_at: Optional[datetime] = None)#

Represents Know Your Customer (KYC) info for a CIPInfo

id#

Your internal ID of check

Type:

str

risk_score#

Overall risk score returned by KYC provider or assessed

Type:

Optional[int]

risk_level#

Overall risk level returned by KYC provider or assessed

Type:

Optional[str]

risk_categories#

The list of risk categories returned by the KYC provider or assessed

Type:

Optional[List[str]]

applicant_name#

Given and family name of applicant

Type:

Optional[str]

email_address#

email address of applicant

Type:

Optional[str]

nationality#

nationality of applicant

Type:

Optional[str]

date_of_birth#

DOB of applicant

Type:

Optional[datetime]

address#

Concatenated street address, city, state and country of applicant

Type:

Optional[str]

postal_code#

postal code for address field

Type:

Optional[str]

country_of_residency#

country for address field

Type:

Optional[str]

kyc_completed_at#

Datetime that KYC check was completed at

Type:

Optional[datetime]

ip_address#

ip address of applicant at time of KYC check

Type:

Optional[str]

check_initiated_at#

start datetime of KYC check

Type:

Optional[datetime]

check_completed_at#

completion datetime of KYC check

Type:

Optional[datetime]

approval_status#

Approval status of KYC check

Type:

Optional[CIPApprovalStatus]

approved_by#

Identifier of who approved KYC check

Type:

Optional[str]

approved_reason#

Reason for approving this KYC check

Type:

Optional[str]

approved_at#

Datetime that this KYC check was approved

Type:

Optional[datetime]

CIPDocument#

class alpaca.broker.models.cip.CIPDocument(*, id: str, result: Optional[CIPResult] = None, status: Optional[CIPStatus] = None, created_at: Optional[datetime] = None, date_of_birth: Optional[datetime] = None, date_of_expiry: Optional[datetime] = None, document_numbers: Optional[List[str]] = None, document_type: Optional[str] = None, first_name: Optional[str] = None, last_name: Optional[str] = None, gender: Optional[str] = None, issuing_country: Optional[str] = None, nationality: Optional[str] = None, age_validation: Optional[CIPResult] = None, compromised_document: Optional[CIPResult] = None, police_record: Optional[CIPStatus] = None, data_comparison: Optional[CIPResult] = None, data_comparison_breakdown: Optional[str] = None, image_integrity: Optional[CIPResult] = None, image_integrity_breakdown: Optional[str] = None, visual_authenticity: Optional[str] = None)#

Represents results of checking a document for CIPInfo

id#

Your internal ID of check

Type:

str

result#

Overall result of specific check

Type:

Optional[CIPResult]

status#

Overall status of specific check

Type:

Optional[CIPStatus]

created_at#

Datetime for when this check was done

Type:

Optional[datetime]

date_of_birth#

DOB for applicant if found on document

Type:

Optional[datetime]

date_of_expiry#

date of expiry for the checked document

Type:

Optional[datetime]

document_numbers#

Number of the document that was checked

Type:

Optional[List[str]]

document_type#

Type of the document that was checked

Type:

Optional[str]

first_name#

First name extracted from the document

Type:

Optional[str]

last_name#

Last name extracted from the document

Type:

Optional[str]

gender#

Gender info extracted from the document

Type:

Optional[str]

issuing_country#

Country for which issued the document

Type:

Optional[str]

nationality#

Nationality extracted from the document

Type:

Optional[str]

age_validation#

Result of checks on whether the age calculated from the document’s date of birth data point is greater than or equal to the minimum accepted age set at account level

Type:

Optional[CIPResult]

compromised_document#

Result of check on whether the image of the document has been found in our internal database of compromised documents

Type:

Optional[CIPResult]

police_record#

Result of check on whether the document has been identified as lost, stolen or otherwise compromised

Type:

Optional[CIPStatus]

data_comparison#

Result of check on whether data on the document is consistent with data provided when creating an applicant through the API

Type:

Optional[CIPResult]

data_comparison_breakdown#

json object representing the results of the various sub-checks done when calculating the result on data_comparison. Example: {“date_of_birth”: “clear”, “date_of_expiry”: “clear” “document_numbers”: “clear”, “document_type”: “clear”, “first_name”: “clear”, “gender”: “clear”, “issuing_country”: “clear”, “last_name”: “clear”}

Type:

Optional[str]

image_integrity#

Result of checks on whether the document was of sufficient quality to verify

Type:

Optional[CIPResult]

image_integrity_breakdown#

json object representing the results of the various sub-checks done when calculating the result on image_integrity. Example: example: {“colour_picture”: “clear”, “conclusive_document_quality”: “clear”, “image_quality”: “clear”, “supported_document”: “clear”}

Type:

Optional[str]

visual_authenticity#

json object representing the the various sub-checks done when determening whether visual (non-textual) elements are correct given the document type. Example: { “digital_tampering”: “clear”, “face_detection”: “clear”, “fonts”: “clear”, “original_document_present”: “clear”, “picture_face_integrity”: “clear”, “security_features”: “clear”, “template”: “clear”}

Type:

Optional[str]

CIPPhoto#

class alpaca.broker.models.cip.CIPPhoto(*, id: str, result: Optional[CIPResult] = None, status: Optional[CIPStatus] = None, created_at: Optional[datetime] = None, face_comparision: Optional[CIPResult] = None, face_comparison_breakdown: Optional[str] = None, image_integrity: Optional[CIPResult] = None, image_integrity_breakdown: Optional[str] = None, visual_authenticity: Optional[CIPResult] = None, visual_authenticity_breakdown: Optional[str] = None)#

Represents the results of checking a Photo for CIPInfo

id#

Your internal ID of check

Type:

str

result#

Overall result of check

Type:

Optional[CIPResult]

status#

Overall status of check

Type:

Optional[CIPStatus]

created_at#

datetime of when check happened

Type:

Optional[datetime]

face_comparision#

Checks whether the face in the document matches the face in the live photo

Type:

Optional[CIPResult]

face_comparison_breakdown#

a json object representing the breakdown of sub-checks done in face_comparison. Example: {“face_match”:{“result”: “clear”,“properties”:{“score”: “80”}}}

Type:

Optional[str]

image_integrity#

Checks whether the quality and integrity of the uploaded files were sufficient to perform a face comparison

Type:

Optional[CIPResult]

image_integrity_breakdown#

a json object representing the breakdown of sub-checks done in image_integrity. Example {“face_detected”:{“result”: “clear”},“source_integrity”: {“result”: “clear”}}

Type:

Optional[str]

visual_authenticity#

Checks whether the person in the live photo is real (not a spoof)

Type:

Optional[CIPResult]

visual_authenticity_breakdown#

a json object representing the breakdown of sub-checks don in visual_authenticity. Example {“spoofing_detection”: {“result”: “clear”,“properties”: {“score”: “26”}}}}

Type:

Optional[str]

CIPIdentity#

class alpaca.broker.models.cip.CIPIdentity(*, id: str, result: Optional[CIPResult] = None, status: Optional[CIPStatus] = None, created_at: Optional[datetime] = None, matched_address: Optional[CIPResult] = None, matched_addresses: Optional[str] = None, sources: Optional[CIPResult] = None, sources_breakdown: Optional[str] = None, address: Optional[CIPResult] = None, address_breakdown: Optional[str] = None, date_of_birth: Optional[CIPResult] = None, date_of_birth_breakdown: Optional[str] = None, tax_id: Optional[CIPResult] = None, tax_id_breakdown: Optional[str] = None)#

Represents the results of running an identity check for a CIPInfo

id#

Your internal ID of check

Type:

str

result#

Overall result of check

Type:

Optional[CIPResult]

status#

Overall status of check

Type:

Optional[CIPStatus]

created_at#

datetime when identity check happened

Type:

Optional[datetime]

matched_address#

Represents of the address matched for the applicant

Type:

Optional[CIPResult]

matched_addresses#

a json object representing the results of the check done in matched_address Example: [{“id”: “19099121”,“match_types”:[“credit_agencies”,“voting_register”]}]

Type:

Optional[str]

sources#

Shows the total number of sources found for applicant’s identity. (TODO: What? This doesnt make any sense its a CIPResult not a number but that’s whats in the docs)

Type:

Optional[CIPResult]

sources_breakdown#

a json object representing the breakdown of sources field. For example: {“total_sources”: {“result”: “clear”,“properties”: {“total_number_of_sources”: “3”}}}

Type:

Optional[str]

address#

Result if it was cleared against a data source

Type:

Optional[CIPResult]

address_breakdown#

a json object representing the breakdown of the address field. For example: {“credit_agencies”: {“result”: “clear”,“properties”:{“number_of_matches”:“1”}}

Type:

Optional[str]

date_of_birth#

Result if it was cleared against a data source

Type:

Optional[CIPResult]

date_of_birth_breakdown#

a json object representing the breakdown of the date_of_birth field. For example: example: {“credit_agencies”:{“result”: “clear”,“properties”: {“number_of_matches”: “1”}}

Type:

Optional[str]

tax_id#

Result if it was cleared against a data source

Type:

Optional[CIPResult]

tax_id_breakdown#

a json object representing the breakdown of the tax_id field

Type:

Optional[str]

CIPWatchlist#

class alpaca.broker.models.cip.CIPWatchlist(*, id: str, result: Optional[CIPResult] = None, status: Optional[CIPStatus] = None, created_at: Optional[datetime] = None, records: Optional[str] = None, politically_exposed_person: Optional[CIPResult] = None, sanction: Optional[CIPResult] = None, adverse_media: Optional[CIPResult] = None, monitored_lists: Optional[CIPResult] = None)#

Represents the result of checking to see if the applicant is in any watchlists for a CIPInfo

TODO: We’re missing almost entirely documentation in prod for this as well as even internal documentation

no clue what these fields are supposed to be or if they’re even close to correct.

id#

Your internal ID of check

Type:

str

result#

Overall result of specific check

Type:

Optional[CIPResult]

status#

Overall status of specific check

Type:

Optional[CIPStatus]

created_at#

datetime when check happened

Type:

Optional[datetime]

records#

a json object. Example [{“text”: “Record info”}]

Type:

Optional[str]

politically_exposed_person#

Result if it was cleared against a data source

Type:

Optional[CIPResult]

sanction#

Result if it was cleared against a data source

Type:

Optional[CIPResult]

adverse_media#

Result if it was cleared against a data source

Type:

Optional[CIPResult]

monitored_lists#

Result if it was cleared against a data source

Type:

Optional[CIPResult]

CIPInfo#

class alpaca.broker.models.cip.CIPInfo(*args, id: UUID, account_id: UUID, provider_name: List[CIPProvider], created_at: datetime, updated_at: datetime, kyc: Optional[CIPKYCInfo] = None, document: Optional[CIPDocument] = None, photo: Optional[CIPPhoto] = None, identity: Optional[CIPIdentity] = None, watchlist: Optional[CIPWatchlist] = None)#

The Customer Identification Program (CIP) API allows you to submit the CIP results received from your KYC provider.

This model is how to represent that information when talking to Alpaca

Parameters:
  • id (UUID) – ID of this CIPInfo

  • account_id (UUID) – UUID of the Account instance this CIPInfo is for

  • provider_name (List[CIPProvider]) – List of KYC providers this information came from

  • created_at (datetime) – date and time this CIPInfo was first uploaded to Alpaca

  • updated_at (datetime) – date and time that this CIPInfo was last update

  • kyc (Optional[CIPKYCInfo]) – KYC info for this Account if any

  • document (Optional[CIPDocument]) – Any CIP documents uploaded for this Account

  • photo (Optional[CIPPhoto]) – Any photos attached for CIP

  • identity (Optional[CIPIdentity]) – Any CIP Identity information

  • watchlist (Optional[CIPWatchlist]) – Any CIP watchlist information

ACHRelationship#

class alpaca.broker.models.funding.ACHRelationship(*, id: UUID, account_id: UUID, created_at: datetime, updated_at: datetime, status: ACHRelationshipStatus, account_owner_name: str, bank_account_type: BankAccountType, bank_account_number: str, bank_routing_number: str, nickname: Optional[str] = None, processor_token: Optional[str] = None)#
id#

ID of Relationship

Type:

UUID

account_id#

ID of the Account this ACHRelationship is tied to

Type:

UUID

created_at#

Date and time this relationship was created

Type:

datetime

updated_at#

Date and time of when this relationship was last updated

Type:

datetime

status#

Current status of the relationship

Type:

ACHRelationshipStatus

account_owner_name#

Full name of the account owner

Type:

str

bank_account_type#

The kind of bank account this relationship points to

Type:

BankAccountType

bank_account_number#

The number of bank account that the relationship points to

Type:

str

bank_routing_number#

Routing number for the bank account

Type:

str

nickname#

User provided name for account

Type:

str

processor_token#

If you are using Plaid, then this is a Plaid processor token.

Type:

Optional[str]

Bank#

class alpaca.broker.models.funding.Bank(*, id: UUID, account_id: UUID, created_at: datetime, updated_at: datetime, name: str, status: BankStatus, country: str, state_province: str, postal_code: str, city: str, street_address: str, account_number: str, bank_code: str, bank_code_type: IdentifierType)#
id#

ID of Bank.

Type:

UUID

account_id#

ID of the Account this Bank is tied to.

Type:

UUID

created_at#

Date and time this Bank was created.

Type:

datetime

updated_at#

Date and time of when this Bank was last updated.

Type:

datetime

name#

Name of the bank.

Type:

str

status#

The status of the bank connection.

Type:

BankStatus

country#

Country where bank account is located.

Type:

str

state_province#

State/Province where bank is located.

Type:

str

postal_code#

Postal code where bank is located.

Type:

str

city#

City where bank is located.

Type:

str

street_address#

Street address where bank is located.

Type:

str

account_number#

The bank account number.

Type:

str

bank_code#

The bank account code.

Type:

str

bank_code_type#

The bank identifier.

Type:

IdentifierType

Transfer#

class alpaca.broker.models.funding.Transfer(*, id: UUID, account_id: UUID, created_at: datetime, updated_at: datetime, expires_at: datetime, relationship_id: UUID, amount: str, type: TransferType, status: TransferStatus, direction: TransferDirection, reason: Optional[str] = None, requested_amount: Optional[str] = None, fee: Optional[str] = None, fee_payment_method: Optional[FeePaymentMethod] = None, additional_information: Optional[str] = None)#
id#

ID of Transfer.

Type:

UUID

account_id#

ID of the Account this Transfer is tied to.

Type:

UUID

created_at#

Date and time when this Transfer was created.

Type:

datetime

updated_at#

Date and time of when this Transfer was last updated.

Type:

datetime

expires_at#

Date and time of when this Transfer will expire.

Type:

datetime

relationship_id#

ID of the funding relationship used to make the transfer.

Type:

UUID

amount#

The amount the recipient will receive after any applicable fees are deducted.

Type:

str

type#

The type of transfer.

Type:

TransferType

status#

The status of the transfer.

Type:

TransferStatus

direction#

The direction of the transfer.

Type:

TransferDirection

reason#

Reasoning associated with the current status.

Type:

Optional[str]

requested_amount#

Amount entered upon creation of a transfer entity.

Type:

Optional[str]

fee#

Dollar amount of any applicable fees.

Type:

Optional[str]

fee_payment_method#

Denotes how any applicable fees will be paid.

Type:

Optional[FeePaymentMethod]

additional_information#

Additional information provided with wire transfers.

Type:

Optional[str]

Journal#

class alpaca.broker.models.journals.Journal(*, id: UUID, to_account: UUID, from_account: UUID, entry_type: JournalEntryType, status: JournalStatus, net_amount: Optional[float] = None, symbol: Optional[str] = None, qty: Optional[float] = None, price: Optional[float] = None, description: Optional[str] = None, settle_date: Optional[date] = None, system_date: Optional[date] = 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: SupportedCurrencies)#

Represents a transfer of cash or securities from one account to another.

There are two types of journals Cash Journals and Security Journals.

Travel Rule In an effort to fight the criminal financial transactions, FinCEN enacted the Travel Rule that applies to fund transfers of more than $3,000. When you use Journal API to bundle a bulk of transfers for the end-users, you will need to tell about the breakdown and each transmitter information using the optional fields of the POST request.

Learn more about journals here: https://alpaca.markets/docs/api-references/broker-api/journals/

id#

The journal ID

Type:

UUID

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:

JournalEntryType

status#

The lifecycle status of the journal.

Type:

JournalStatus

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]

price#

For security journals, the price at which the security is being journaled at.

Type:

Optional[float]

net_amount#

For cash journals, the total cash amount journaled

Type:

Optional[float]

description#

Journal description. It can include fixtures for sandbox API.

Type:

Optional[str]

settle_date#
Type:

Optional[date]

system_date#
Type:

Optional[date]

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]

BatchJournalResponse#

class alpaca.broker.models.journals.BatchJournalResponse(*, id: UUID, to_account: UUID, from_account: UUID, entry_type: JournalEntryType, status: JournalStatus, net_amount: Optional[float] = None, symbol: Optional[str] = None, qty: Optional[float] = None, price: Optional[float] = None, description: Optional[str] = None, settle_date: Optional[date] = None, system_date: Optional[date] = 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: SupportedCurrencies, error_message: Optional[str] = None)#

Represents a journal response from a batch journal request.

error_message#

An message that contains error details for failed journals.

Type:

Optional[str]