tastytrade.session¶
-
pydantic model tastytrade.session.Address(*, city: str, country: str, is_domestic: bool, is_foreign: bool, postal_code: str, state_region: str, street_one: str, street_two: str | None =
None, street_three: str | None =None)¶ Bases:
TastytradeDataDataclass containing customer address information.
Show JSON schema
{ "title": "Address", "description": "Dataclass containing customer address information.", "type": "object", "properties": { "city": { "title": "City", "type": "string" }, "country": { "title": "Country", "type": "string" }, "is-domestic": { "title": "Is-Domestic", "type": "boolean" }, "is-foreign": { "title": "Is-Foreign", "type": "boolean" }, "postal-code": { "title": "Postal-Code", "type": "string" }, "state-region": { "title": "State-Region", "type": "string" }, "street-one": { "title": "Street-One", "type": "string" }, "street-two": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Street-Two" }, "street-three": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Street-Three" } }, "required": [ "city", "country", "is-domestic", "is-foreign", "postal-code", "state-region", "street-one" ] }
-
pydantic model tastytrade.session.Customer(*, id: str, first_name: str, first_surname: str, last_name: str, address: Address, customer_suitability: CustomerSuitability, mailing_address: Address, is_foreign: bool, regulatory_domain: str, usa_citizenship_type: str, home_phone_number: str, mobile_phone_number: str, work_phone_number: str, birth_date: date, email: str, external_id: str, tax_number: str, tax_number_type: str, citizenship_country: str, agreed_to_margining: bool, subject_to_tax_withholding: bool, agreed_to_terms: bool, ext_crm_id: str, has_industry_affiliation: bool, has_listed_affiliation: bool, has_political_affiliation: bool, has_delayed_quotes: bool, has_pending_or_approved_application: bool, is_professional: bool, permitted_account_types: list[CustomerAccountType], created_at: datetime, identifiable_type: str, person: CustomerPerson, gender: str | None =
None, middle_name: str | None =None, prefix_name: str | None =None, second_surname: str | None =None, suffix_name: str | None =None, foreign_tax_number: str | None =None, birth_country: str | None =None, visa_expiration_date: date | None =None, visa_type: str | None =None, signature_of_agreement: bool | None =None, desk_customer_id: str | None =None, entity: CustomerEntity | None =None, family_member_names: str | None =None, has_institutional_assets: str | None =None, industry_affiliation_firm: str | None =None, is_investment_adviser: bool | None =None, listed_affiliation_symbol: str | None =None, political_organization: str | None =None, user_id: str | None =None)¶ Bases:
TastytradeDataDataclass containing customer information.
Show JSON schema
{ "title": "Customer", "description": "Dataclass containing customer information.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "first-name": { "title": "First-Name", "type": "string" }, "first-surname": { "title": "First-Surname", "type": "string" }, "last-name": { "title": "Last-Name", "type": "string" }, "address": { "$ref": "#/$defs/Address" }, "customer-suitability": { "$ref": "#/$defs/CustomerSuitability" }, "mailing-address": { "$ref": "#/$defs/Address" }, "is-foreign": { "title": "Is-Foreign", "type": "boolean" }, "regulatory-domain": { "title": "Regulatory-Domain", "type": "string" }, "usa-citizenship-type": { "title": "Usa-Citizenship-Type", "type": "string" }, "home-phone-number": { "title": "Home-Phone-Number", "type": "string" }, "mobile-phone-number": { "title": "Mobile-Phone-Number", "type": "string" }, "work-phone-number": { "title": "Work-Phone-Number", "type": "string" }, "birth-date": { "format": "date", "title": "Birth-Date", "type": "string" }, "email": { "title": "Email", "type": "string" }, "external-id": { "title": "External-Id", "type": "string" }, "tax-number": { "title": "Tax-Number", "type": "string" }, "tax-number-type": { "title": "Tax-Number-Type", "type": "string" }, "citizenship-country": { "title": "Citizenship-Country", "type": "string" }, "agreed-to-margining": { "title": "Agreed-To-Margining", "type": "boolean" }, "subject-to-tax-withholding": { "title": "Subject-To-Tax-Withholding", "type": "boolean" }, "agreed-to-terms": { "title": "Agreed-To-Terms", "type": "boolean" }, "ext-crm-id": { "title": "Ext-Crm-Id", "type": "string" }, "has-industry-affiliation": { "title": "Has-Industry-Affiliation", "type": "boolean" }, "has-listed-affiliation": { "title": "Has-Listed-Affiliation", "type": "boolean" }, "has-political-affiliation": { "title": "Has-Political-Affiliation", "type": "boolean" }, "has-delayed-quotes": { "title": "Has-Delayed-Quotes", "type": "boolean" }, "has-pending-or-approved-application": { "title": "Has-Pending-Or-Approved-Application", "type": "boolean" }, "is-professional": { "title": "Is-Professional", "type": "boolean" }, "permitted-account-types": { "items": { "$ref": "#/$defs/CustomerAccountType" }, "title": "Permitted-Account-Types", "type": "array" }, "created-at": { "format": "date-time", "title": "Created-At", "type": "string" }, "identifiable-type": { "title": "Identifiable-Type", "type": "string" }, "person": { "$ref": "#/$defs/CustomerPerson" }, "gender": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Gender" }, "middle-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Middle-Name" }, "prefix-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Prefix-Name" }, "second-surname": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Second-Surname" }, "suffix-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Suffix-Name" }, "foreign-tax-number": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Foreign-Tax-Number" }, "birth-country": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Birth-Country" }, "visa-expiration-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Visa-Expiration-Date" }, "visa-type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Visa-Type" }, "signature-of-agreement": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Signature-Of-Agreement" }, "desk-customer-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Desk-Customer-Id" }, "entity": { "anyOf": [ { "$ref": "#/$defs/CustomerEntity" }, { "type": "null" } ], "default": null }, "family-member-names": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Family-Member-Names" }, "has-institutional-assets": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Has-Institutional-Assets" }, "industry-affiliation-firm": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Industry-Affiliation-Firm" }, "is-investment-adviser": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": null, "title": "Is-Investment-Adviser" }, "listed-affiliation-symbol": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Listed-Affiliation-Symbol" }, "political-organization": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Political-Organization" }, "user-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "User-Id" } }, "$defs": { "Address": { "description": "Dataclass containing customer address information.", "properties": { "city": { "title": "City", "type": "string" }, "country": { "title": "Country", "type": "string" }, "is-domestic": { "title": "Is-Domestic", "type": "boolean" }, "is-foreign": { "title": "Is-Foreign", "type": "boolean" }, "postal-code": { "title": "Postal-Code", "type": "string" }, "state-region": { "title": "State-Region", "type": "string" }, "street-one": { "title": "Street-One", "type": "string" }, "street-two": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Street-Two" }, "street-three": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Street-Three" } }, "required": [ "city", "country", "is-domestic", "is-foreign", "postal-code", "state-region", "street-one" ], "title": "Address", "type": "object" }, "CustomerAccountMarginType": { "description": "Dataclass containing margin information for a customer account type.", "properties": { "name": { "title": "Name", "type": "string" }, "is-margin": { "title": "Is-Margin", "type": "boolean" } }, "required": [ "name", "is-margin" ], "title": "CustomerAccountMarginType", "type": "object" }, "CustomerAccountType": { "description": "Dataclass containing information for a type of customer account.", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "title": "Description", "type": "string" }, "is-tax-advantaged": { "title": "Is-Tax-Advantaged", "type": "boolean" }, "is-publicly-available": { "title": "Is-Publicly-Available", "type": "boolean" }, "has-multiple-owners": { "title": "Has-Multiple-Owners", "type": "boolean" }, "margin-types": { "items": { "$ref": "#/$defs/CustomerAccountMarginType" }, "title": "Margin-Types", "type": "array" } }, "required": [ "name", "description", "is-tax-advantaged", "is-publicly-available", "has-multiple-owners", "margin-types" ], "title": "CustomerAccountType", "type": "object" }, "CustomerEntity": { "description": "Dataclass containing customer entity information.", "properties": { "id": { "title": "Id", "type": "string" }, "address": { "$ref": "#/$defs/Address" }, "business-nature": { "title": "Business-Nature", "type": "string" }, "email": { "title": "Email", "type": "string" }, "entity-officers": { "items": { "$ref": "#/$defs/EntityOfficer" }, "title": "Entity-Officers", "type": "array" }, "entity-suitability": { "$ref": "#/$defs/EntitySuitability" }, "entity-type": { "title": "Entity-Type", "type": "string" }, "foreign-institution": { "title": "Foreign-Institution", "type": "string" }, "grantor-birth-date": { "title": "Grantor-Birth-Date", "type": "string" }, "grantor-email": { "title": "Grantor-Email", "type": "string" }, "grantor-first-name": { "title": "Grantor-First-Name", "type": "string" }, "grantor-last-name": { "title": "Grantor-Last-Name", "type": "string" }, "grantor-middle-name": { "title": "Grantor-Middle-Name", "type": "string" }, "grantor-tax-number": { "title": "Grantor-Tax-Number", "type": "string" }, "has-foreign-bank-affiliation": { "title": "Has-Foreign-Bank-Affiliation", "type": "string" }, "has-foreign-institution-affiliation": { "title": "Has-Foreign-Institution-Affiliation", "type": "string" }, "is-domestic": { "title": "Is-Domestic", "type": "boolean" }, "legal-name": { "title": "Legal-Name", "type": "string" }, "phone-number": { "title": "Phone-Number", "type": "string" }, "tax-number": { "title": "Tax-Number", "type": "string" } }, "required": [ "id", "address", "business-nature", "email", "entity-officers", "entity-suitability", "entity-type", "foreign-institution", "grantor-birth-date", "grantor-email", "grantor-first-name", "grantor-last-name", "grantor-middle-name", "grantor-tax-number", "has-foreign-bank-affiliation", "has-foreign-institution-affiliation", "is-domestic", "legal-name", "phone-number", "tax-number" ], "title": "CustomerEntity", "type": "object" }, "CustomerPerson": { "description": "Dataclass containing customer person information.", "properties": { "external-id": { "title": "External-Id", "type": "string" }, "first-name": { "title": "First-Name", "type": "string" }, "last-name": { "title": "Last-Name", "type": "string" }, "citizenship-country": { "title": "Citizenship-Country", "type": "string" }, "usa-citizenship-type": { "title": "Usa-Citizenship-Type", "type": "string" }, "employment-status": { "title": "Employment-Status", "type": "string" }, "marital-status": { "title": "Marital-Status", "type": "string" }, "number-of-dependents": { "title": "Number-Of-Dependents", "type": "integer" }, "occupation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Occupation" }, "middle-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Middle-Name" }, "prefix-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Prefix-Name" }, "suffix-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Suffix-Name" }, "birth-country": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Birth-Country" }, "birth-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Birth-Date" }, "visa-expiration-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Visa-Expiration-Date" }, "visa-type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Visa-Type" }, "employer-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Employer-Name" }, "job-title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Job-Title" } }, "required": [ "external-id", "first-name", "last-name", "citizenship-country", "usa-citizenship-type", "employment-status", "marital-status", "number-of-dependents" ], "title": "CustomerPerson", "type": "object" }, "CustomerSuitability": { "description": "Dataclass containing customer suitability information.", "properties": { "id": { "title": "Id", "type": "integer" }, "annual-net-income": { "title": "Annual-Net-Income", "type": "integer" }, "covered-options-trading-experience": { "title": "Covered-Options-Trading-Experience", "type": "string" }, "employment-status": { "title": "Employment-Status", "type": "string" }, "futures-trading-experience": { "title": "Futures-Trading-Experience", "type": "string" }, "liquid-net-worth": { "title": "Liquid-Net-Worth", "type": "integer" }, "marital-status": { "title": "Marital-Status", "type": "string" }, "net-worth": { "title": "Net-Worth", "type": "integer" }, "number-of-dependents": { "title": "Number-Of-Dependents", "type": "integer" }, "stock-trading-experience": { "title": "Stock-Trading-Experience", "type": "string" }, "uncovered-options-trading-experience": { "title": "Uncovered-Options-Trading-Experience", "type": "string" }, "customer-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Customer-Id" }, "employer-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Employer-Name" }, "job-title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Job-Title" }, "occupation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Occupation" }, "tax-bracket": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Tax-Bracket" } }, "required": [ "id", "annual-net-income", "covered-options-trading-experience", "employment-status", "futures-trading-experience", "liquid-net-worth", "marital-status", "net-worth", "number-of-dependents", "stock-trading-experience", "uncovered-options-trading-experience" ], "title": "CustomerSuitability", "type": "object" }, "EntityOfficer": { "description": "Dataclass containing entity officer information.", "properties": { "id": { "title": "Id", "type": "string" }, "external-id": { "title": "External-Id", "type": "string" }, "first-name": { "title": "First-Name", "type": "string" }, "last-name": { "title": "Last-Name", "type": "string" }, "middle-name": { "title": "Middle-Name", "type": "string" }, "prefix-name": { "title": "Prefix-Name", "type": "string" }, "suffix-name": { "title": "Suffix-Name", "type": "string" }, "address": { "$ref": "#/$defs/Address" }, "birth-country": { "title": "Birth-Country", "type": "string" }, "birth-date": { "format": "date", "title": "Birth-Date", "type": "string" }, "citizenship-country": { "title": "Citizenship-Country", "type": "string" }, "email": { "title": "Email", "type": "string" }, "employer-name": { "title": "Employer-Name", "type": "string" }, "employment-status": { "title": "Employment-Status", "type": "string" }, "home-phone-number": { "title": "Home-Phone-Number", "type": "string" }, "is-foreign": { "title": "Is-Foreign", "type": "boolean" }, "job-title": { "title": "Job-Title", "type": "string" }, "marital-status": { "title": "Marital-Status", "type": "string" }, "mobile-phone-number": { "title": "Mobile-Phone-Number", "type": "string" }, "number-of-dependents": { "title": "Number-Of-Dependents", "type": "integer" }, "occupation": { "title": "Occupation", "type": "string" }, "owner-of-record": { "title": "Owner-Of-Record", "type": "boolean" }, "relationship-to-entity": { "title": "Relationship-To-Entity", "type": "string" }, "tax-number": { "title": "Tax-Number", "type": "string" }, "tax-number-type": { "title": "Tax-Number-Type", "type": "string" }, "usa-citizenship-type": { "title": "Usa-Citizenship-Type", "type": "string" }, "visa-expiration-date": { "format": "date", "title": "Visa-Expiration-Date", "type": "string" }, "visa-type": { "title": "Visa-Type", "type": "string" }, "work-phone-number": { "title": "Work-Phone-Number", "type": "string" } }, "required": [ "id", "external-id", "first-name", "last-name", "middle-name", "prefix-name", "suffix-name", "address", "birth-country", "birth-date", "citizenship-country", "email", "employer-name", "employment-status", "home-phone-number", "is-foreign", "job-title", "marital-status", "mobile-phone-number", "number-of-dependents", "occupation", "owner-of-record", "relationship-to-entity", "tax-number", "tax-number-type", "usa-citizenship-type", "visa-expiration-date", "visa-type", "work-phone-number" ], "title": "EntityOfficer", "type": "object" }, "EntitySuitability": { "description": "Dataclass containing entity suitability information.", "properties": { "id": { "title": "Id", "type": "string" }, "annual-net-income": { "title": "Annual-Net-Income", "type": "integer" }, "covered-options-trading-experience": { "title": "Covered-Options-Trading-Experience", "type": "string" }, "entity-id": { "title": "Entity-Id", "type": "integer" }, "futures-trading-experience": { "title": "Futures-Trading-Experience", "type": "string" }, "liquid-net-worth": { "title": "Liquid-Net-Worth", "type": "integer" }, "net-worth": { "title": "Net-Worth", "type": "integer" }, "stock-trading-experience": { "title": "Stock-Trading-Experience", "type": "string" }, "tax-bracket": { "title": "Tax-Bracket", "type": "string" }, "uncovered-options-trading-experience": { "title": "Uncovered-Options-Trading-Experience", "type": "string" } }, "required": [ "id", "annual-net-income", "covered-options-trading-experience", "entity-id", "futures-trading-experience", "liquid-net-worth", "net-worth", "stock-trading-experience", "tax-bracket", "uncovered-options-trading-experience" ], "title": "EntitySuitability", "type": "object" } }, "required": [ "id", "first-name", "first-surname", "last-name", "address", "customer-suitability", "mailing-address", "is-foreign", "regulatory-domain", "usa-citizenship-type", "home-phone-number", "mobile-phone-number", "work-phone-number", "birth-date", "email", "external-id", "tax-number", "tax-number-type", "citizenship-country", "agreed-to-margining", "subject-to-tax-withholding", "agreed-to-terms", "ext-crm-id", "has-industry-affiliation", "has-listed-affiliation", "has-political-affiliation", "has-delayed-quotes", "has-pending-or-approved-application", "is-professional", "permitted-account-types", "created-at", "identifiable-type", "person" ] }
- pydantic model tastytrade.session.CustomerAccountMarginType(*, name: str, is_margin: bool)¶
Bases:
TastytradeDataDataclass containing margin information for a customer account type.
Show JSON schema
{ "title": "CustomerAccountMarginType", "description": "Dataclass containing margin information for a customer account type.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "is-margin": { "title": "Is-Margin", "type": "boolean" } }, "required": [ "name", "is-margin" ] }- Fields:¶
- pydantic model tastytrade.session.CustomerAccountType(*, name: str, description: str, is_tax_advantaged: bool, is_publicly_available: bool, has_multiple_owners: bool, margin_types: list[CustomerAccountMarginType])¶
Bases:
TastytradeDataDataclass containing information for a type of customer account.
Show JSON schema
{ "title": "CustomerAccountType", "description": "Dataclass containing information for a type of customer account.", "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "title": "Description", "type": "string" }, "is-tax-advantaged": { "title": "Is-Tax-Advantaged", "type": "boolean" }, "is-publicly-available": { "title": "Is-Publicly-Available", "type": "boolean" }, "has-multiple-owners": { "title": "Has-Multiple-Owners", "type": "boolean" }, "margin-types": { "items": { "$ref": "#/$defs/CustomerAccountMarginType" }, "title": "Margin-Types", "type": "array" } }, "$defs": { "CustomerAccountMarginType": { "description": "Dataclass containing margin information for a customer account type.", "properties": { "name": { "title": "Name", "type": "string" }, "is-margin": { "title": "Is-Margin", "type": "boolean" } }, "required": [ "name", "is-margin" ], "title": "CustomerAccountMarginType", "type": "object" } }, "required": [ "name", "description", "is-tax-advantaged", "is-publicly-available", "has-multiple-owners", "margin-types" ] }
- pydantic model tastytrade.session.CustomerEntity(*, id: str, address: Address, business_nature: str, email: str, entity_officers: list[EntityOfficer], entity_suitability: EntitySuitability, entity_type: str, foreign_institution: str, grantor_birth_date: str, grantor_email: str, grantor_first_name: str, grantor_last_name: str, grantor_middle_name: str, grantor_tax_number: str, has_foreign_bank_affiliation: str, has_foreign_institution_affiliation: str, is_domestic: bool, legal_name: str, phone_number: str, tax_number: str)¶
Bases:
TastytradeDataDataclass containing customer entity information.
Show JSON schema
{ "title": "CustomerEntity", "description": "Dataclass containing customer entity information.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "address": { "$ref": "#/$defs/Address" }, "business-nature": { "title": "Business-Nature", "type": "string" }, "email": { "title": "Email", "type": "string" }, "entity-officers": { "items": { "$ref": "#/$defs/EntityOfficer" }, "title": "Entity-Officers", "type": "array" }, "entity-suitability": { "$ref": "#/$defs/EntitySuitability" }, "entity-type": { "title": "Entity-Type", "type": "string" }, "foreign-institution": { "title": "Foreign-Institution", "type": "string" }, "grantor-birth-date": { "title": "Grantor-Birth-Date", "type": "string" }, "grantor-email": { "title": "Grantor-Email", "type": "string" }, "grantor-first-name": { "title": "Grantor-First-Name", "type": "string" }, "grantor-last-name": { "title": "Grantor-Last-Name", "type": "string" }, "grantor-middle-name": { "title": "Grantor-Middle-Name", "type": "string" }, "grantor-tax-number": { "title": "Grantor-Tax-Number", "type": "string" }, "has-foreign-bank-affiliation": { "title": "Has-Foreign-Bank-Affiliation", "type": "string" }, "has-foreign-institution-affiliation": { "title": "Has-Foreign-Institution-Affiliation", "type": "string" }, "is-domestic": { "title": "Is-Domestic", "type": "boolean" }, "legal-name": { "title": "Legal-Name", "type": "string" }, "phone-number": { "title": "Phone-Number", "type": "string" }, "tax-number": { "title": "Tax-Number", "type": "string" } }, "$defs": { "Address": { "description": "Dataclass containing customer address information.", "properties": { "city": { "title": "City", "type": "string" }, "country": { "title": "Country", "type": "string" }, "is-domestic": { "title": "Is-Domestic", "type": "boolean" }, "is-foreign": { "title": "Is-Foreign", "type": "boolean" }, "postal-code": { "title": "Postal-Code", "type": "string" }, "state-region": { "title": "State-Region", "type": "string" }, "street-one": { "title": "Street-One", "type": "string" }, "street-two": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Street-Two" }, "street-three": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Street-Three" } }, "required": [ "city", "country", "is-domestic", "is-foreign", "postal-code", "state-region", "street-one" ], "title": "Address", "type": "object" }, "EntityOfficer": { "description": "Dataclass containing entity officer information.", "properties": { "id": { "title": "Id", "type": "string" }, "external-id": { "title": "External-Id", "type": "string" }, "first-name": { "title": "First-Name", "type": "string" }, "last-name": { "title": "Last-Name", "type": "string" }, "middle-name": { "title": "Middle-Name", "type": "string" }, "prefix-name": { "title": "Prefix-Name", "type": "string" }, "suffix-name": { "title": "Suffix-Name", "type": "string" }, "address": { "$ref": "#/$defs/Address" }, "birth-country": { "title": "Birth-Country", "type": "string" }, "birth-date": { "format": "date", "title": "Birth-Date", "type": "string" }, "citizenship-country": { "title": "Citizenship-Country", "type": "string" }, "email": { "title": "Email", "type": "string" }, "employer-name": { "title": "Employer-Name", "type": "string" }, "employment-status": { "title": "Employment-Status", "type": "string" }, "home-phone-number": { "title": "Home-Phone-Number", "type": "string" }, "is-foreign": { "title": "Is-Foreign", "type": "boolean" }, "job-title": { "title": "Job-Title", "type": "string" }, "marital-status": { "title": "Marital-Status", "type": "string" }, "mobile-phone-number": { "title": "Mobile-Phone-Number", "type": "string" }, "number-of-dependents": { "title": "Number-Of-Dependents", "type": "integer" }, "occupation": { "title": "Occupation", "type": "string" }, "owner-of-record": { "title": "Owner-Of-Record", "type": "boolean" }, "relationship-to-entity": { "title": "Relationship-To-Entity", "type": "string" }, "tax-number": { "title": "Tax-Number", "type": "string" }, "tax-number-type": { "title": "Tax-Number-Type", "type": "string" }, "usa-citizenship-type": { "title": "Usa-Citizenship-Type", "type": "string" }, "visa-expiration-date": { "format": "date", "title": "Visa-Expiration-Date", "type": "string" }, "visa-type": { "title": "Visa-Type", "type": "string" }, "work-phone-number": { "title": "Work-Phone-Number", "type": "string" } }, "required": [ "id", "external-id", "first-name", "last-name", "middle-name", "prefix-name", "suffix-name", "address", "birth-country", "birth-date", "citizenship-country", "email", "employer-name", "employment-status", "home-phone-number", "is-foreign", "job-title", "marital-status", "mobile-phone-number", "number-of-dependents", "occupation", "owner-of-record", "relationship-to-entity", "tax-number", "tax-number-type", "usa-citizenship-type", "visa-expiration-date", "visa-type", "work-phone-number" ], "title": "EntityOfficer", "type": "object" }, "EntitySuitability": { "description": "Dataclass containing entity suitability information.", "properties": { "id": { "title": "Id", "type": "string" }, "annual-net-income": { "title": "Annual-Net-Income", "type": "integer" }, "covered-options-trading-experience": { "title": "Covered-Options-Trading-Experience", "type": "string" }, "entity-id": { "title": "Entity-Id", "type": "integer" }, "futures-trading-experience": { "title": "Futures-Trading-Experience", "type": "string" }, "liquid-net-worth": { "title": "Liquid-Net-Worth", "type": "integer" }, "net-worth": { "title": "Net-Worth", "type": "integer" }, "stock-trading-experience": { "title": "Stock-Trading-Experience", "type": "string" }, "tax-bracket": { "title": "Tax-Bracket", "type": "string" }, "uncovered-options-trading-experience": { "title": "Uncovered-Options-Trading-Experience", "type": "string" } }, "required": [ "id", "annual-net-income", "covered-options-trading-experience", "entity-id", "futures-trading-experience", "liquid-net-worth", "net-worth", "stock-trading-experience", "tax-bracket", "uncovered-options-trading-experience" ], "title": "EntitySuitability", "type": "object" } }, "required": [ "id", "address", "business-nature", "email", "entity-officers", "entity-suitability", "entity-type", "foreign-institution", "grantor-birth-date", "grantor-email", "grantor-first-name", "grantor-last-name", "grantor-middle-name", "grantor-tax-number", "has-foreign-bank-affiliation", "has-foreign-institution-affiliation", "is-domestic", "legal-name", "phone-number", "tax-number" ] }- Fields:¶
-
pydantic model tastytrade.session.CustomerPerson(*, external_id: str, first_name: str, last_name: str, citizenship_country: str, usa_citizenship_type: str, employment_status: str, marital_status: str, number_of_dependents: int, occupation: str | None =
None, middle_name: str | None =None, prefix_name: str | None =None, suffix_name: str | None =None, birth_country: str | None =None, birth_date: date | str | None =None, visa_expiration_date: date | None =None, visa_type: str | None =None, employer_name: str | None =None, job_title: str | None =None)¶ Bases:
TastytradeDataDataclass containing customer person information.
Show JSON schema
{ "title": "CustomerPerson", "description": "Dataclass containing customer person information.", "type": "object", "properties": { "external-id": { "title": "External-Id", "type": "string" }, "first-name": { "title": "First-Name", "type": "string" }, "last-name": { "title": "Last-Name", "type": "string" }, "citizenship-country": { "title": "Citizenship-Country", "type": "string" }, "usa-citizenship-type": { "title": "Usa-Citizenship-Type", "type": "string" }, "employment-status": { "title": "Employment-Status", "type": "string" }, "marital-status": { "title": "Marital-Status", "type": "string" }, "number-of-dependents": { "title": "Number-Of-Dependents", "type": "integer" }, "occupation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Occupation" }, "middle-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Middle-Name" }, "prefix-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Prefix-Name" }, "suffix-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Suffix-Name" }, "birth-country": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Birth-Country" }, "birth-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "string" }, { "type": "null" } ], "default": null, "title": "Birth-Date" }, "visa-expiration-date": { "anyOf": [ { "format": "date", "type": "string" }, { "type": "null" } ], "default": null, "title": "Visa-Expiration-Date" }, "visa-type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Visa-Type" }, "employer-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Employer-Name" }, "job-title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Job-Title" } }, "required": [ "external-id", "first-name", "last-name", "citizenship-country", "usa-citizenship-type", "employment-status", "marital-status", "number-of-dependents" ] }- Fields:¶
-
pydantic model tastytrade.session.CustomerSuitability(*, id: int, annual_net_income: int, covered_options_trading_experience: str, employment_status: str, futures_trading_experience: str, liquid_net_worth: int, marital_status: str, net_worth: int, number_of_dependents: int, stock_trading_experience: str, uncovered_options_trading_experience: str, customer_id: str | None =
None, employer_name: str | None =None, job_title: str | None =None, occupation: str | None =None, tax_bracket: str | None =None)¶ Bases:
TastytradeDataDataclass containing customer suitability information.
Show JSON schema
{ "title": "CustomerSuitability", "description": "Dataclass containing customer suitability information.", "type": "object", "properties": { "id": { "title": "Id", "type": "integer" }, "annual-net-income": { "title": "Annual-Net-Income", "type": "integer" }, "covered-options-trading-experience": { "title": "Covered-Options-Trading-Experience", "type": "string" }, "employment-status": { "title": "Employment-Status", "type": "string" }, "futures-trading-experience": { "title": "Futures-Trading-Experience", "type": "string" }, "liquid-net-worth": { "title": "Liquid-Net-Worth", "type": "integer" }, "marital-status": { "title": "Marital-Status", "type": "string" }, "net-worth": { "title": "Net-Worth", "type": "integer" }, "number-of-dependents": { "title": "Number-Of-Dependents", "type": "integer" }, "stock-trading-experience": { "title": "Stock-Trading-Experience", "type": "string" }, "uncovered-options-trading-experience": { "title": "Uncovered-Options-Trading-Experience", "type": "string" }, "customer-id": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Customer-Id" }, "employer-name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Employer-Name" }, "job-title": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Job-Title" }, "occupation": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Occupation" }, "tax-bracket": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Tax-Bracket" } }, "required": [ "id", "annual-net-income", "covered-options-trading-experience", "employment-status", "futures-trading-experience", "liquid-net-worth", "marital-status", "net-worth", "number-of-dependents", "stock-trading-experience", "uncovered-options-trading-experience" ] }- Fields:¶
- pydantic model tastytrade.session.EntityOfficer(*, id: str, external_id: str, first_name: str, last_name: str, middle_name: str, prefix_name: str, suffix_name: str, address: Address, birth_country: str, birth_date: date, citizenship_country: str, email: str, employer_name: str, employment_status: str, home_phone_number: str, is_foreign: bool, job_title: str, marital_status: str, mobile_phone_number: str, number_of_dependents: int, occupation: str, owner_of_record: bool, relationship_to_entity: str, tax_number: str, tax_number_type: str, usa_citizenship_type: str, visa_expiration_date: date, visa_type: str, work_phone_number: str)¶
Bases:
TastytradeDataDataclass containing entity officer information.
Show JSON schema
{ "title": "EntityOfficer", "description": "Dataclass containing entity officer information.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "external-id": { "title": "External-Id", "type": "string" }, "first-name": { "title": "First-Name", "type": "string" }, "last-name": { "title": "Last-Name", "type": "string" }, "middle-name": { "title": "Middle-Name", "type": "string" }, "prefix-name": { "title": "Prefix-Name", "type": "string" }, "suffix-name": { "title": "Suffix-Name", "type": "string" }, "address": { "$ref": "#/$defs/Address" }, "birth-country": { "title": "Birth-Country", "type": "string" }, "birth-date": { "format": "date", "title": "Birth-Date", "type": "string" }, "citizenship-country": { "title": "Citizenship-Country", "type": "string" }, "email": { "title": "Email", "type": "string" }, "employer-name": { "title": "Employer-Name", "type": "string" }, "employment-status": { "title": "Employment-Status", "type": "string" }, "home-phone-number": { "title": "Home-Phone-Number", "type": "string" }, "is-foreign": { "title": "Is-Foreign", "type": "boolean" }, "job-title": { "title": "Job-Title", "type": "string" }, "marital-status": { "title": "Marital-Status", "type": "string" }, "mobile-phone-number": { "title": "Mobile-Phone-Number", "type": "string" }, "number-of-dependents": { "title": "Number-Of-Dependents", "type": "integer" }, "occupation": { "title": "Occupation", "type": "string" }, "owner-of-record": { "title": "Owner-Of-Record", "type": "boolean" }, "relationship-to-entity": { "title": "Relationship-To-Entity", "type": "string" }, "tax-number": { "title": "Tax-Number", "type": "string" }, "tax-number-type": { "title": "Tax-Number-Type", "type": "string" }, "usa-citizenship-type": { "title": "Usa-Citizenship-Type", "type": "string" }, "visa-expiration-date": { "format": "date", "title": "Visa-Expiration-Date", "type": "string" }, "visa-type": { "title": "Visa-Type", "type": "string" }, "work-phone-number": { "title": "Work-Phone-Number", "type": "string" } }, "$defs": { "Address": { "description": "Dataclass containing customer address information.", "properties": { "city": { "title": "City", "type": "string" }, "country": { "title": "Country", "type": "string" }, "is-domestic": { "title": "Is-Domestic", "type": "boolean" }, "is-foreign": { "title": "Is-Foreign", "type": "boolean" }, "postal-code": { "title": "Postal-Code", "type": "string" }, "state-region": { "title": "State-Region", "type": "string" }, "street-one": { "title": "Street-One", "type": "string" }, "street-two": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Street-Two" }, "street-three": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Street-Three" } }, "required": [ "city", "country", "is-domestic", "is-foreign", "postal-code", "state-region", "street-one" ], "title": "Address", "type": "object" } }, "required": [ "id", "external-id", "first-name", "last-name", "middle-name", "prefix-name", "suffix-name", "address", "birth-country", "birth-date", "citizenship-country", "email", "employer-name", "employment-status", "home-phone-number", "is-foreign", "job-title", "marital-status", "mobile-phone-number", "number-of-dependents", "occupation", "owner-of-record", "relationship-to-entity", "tax-number", "tax-number-type", "usa-citizenship-type", "visa-expiration-date", "visa-type", "work-phone-number" ] }- Fields:¶
- pydantic model tastytrade.session.EntitySuitability(*, id: str, annual_net_income: int, covered_options_trading_experience: str, entity_id: int, futures_trading_experience: str, liquid_net_worth: int, net_worth: int, stock_trading_experience: str, tax_bracket: str, uncovered_options_trading_experience: str)¶
Bases:
TastytradeDataDataclass containing entity suitability information.
Show JSON schema
{ "title": "EntitySuitability", "description": "Dataclass containing entity suitability information.", "type": "object", "properties": { "id": { "title": "Id", "type": "string" }, "annual-net-income": { "title": "Annual-Net-Income", "type": "integer" }, "covered-options-trading-experience": { "title": "Covered-Options-Trading-Experience", "type": "string" }, "entity-id": { "title": "Entity-Id", "type": "integer" }, "futures-trading-experience": { "title": "Futures-Trading-Experience", "type": "string" }, "liquid-net-worth": { "title": "Liquid-Net-Worth", "type": "integer" }, "net-worth": { "title": "Net-Worth", "type": "integer" }, "stock-trading-experience": { "title": "Stock-Trading-Experience", "type": "string" }, "tax-bracket": { "title": "Tax-Bracket", "type": "string" }, "uncovered-options-trading-experience": { "title": "Uncovered-Options-Trading-Experience", "type": "string" } }, "required": [ "id", "annual-net-income", "covered-options-trading-experience", "entity-id", "futures-trading-experience", "liquid-net-worth", "net-worth", "stock-trading-experience", "tax-bracket", "uncovered-options-trading-experience" ] }
-
class tastytrade.session.OAuthSession(provider_secret: str, refresh_token: str, is_test: bool =
False, proxy: str | None =None)¶ Bases:
SessionContains a managed user login which can then be used to interact with the remote API.
Note that OAuth sessions can’t be used to create streamers!
- Parameters:¶
- provider_secret: str¶
OAuth secret for your provider
- refresh_token: str¶
refresh token for the user
- is_test: bool =
False¶ whether to use the test API endpoints, default False
- proxy: str | None =
None¶ if provided, all requests will be made through this proxy, as well as web socket connections for streamers.
- async_client¶
httpx client for async requests
- classmethod deserialize(serialized: str) Self¶
Create a new Session object from a serialized string.
- expires_at¶
Unix timestamp for when the session token expires
- is_test¶
Whether this is a cert or real session
- provider_secret¶
OAuth secret for your provider
- proxy¶
Proxy URL to use for requests and web sockets
- refresh_token¶
Refresh token for the user
- serialize() str¶
Serializes the session to a string, useful for storing a session for later use. Could be used with pickle, Redis, etc.
- sync_client¶
httpx client for sync requests
-
class tastytrade.session.Session(login: str, password: str | None =
None, remember_me: bool =False, remember_token: str | None =None, is_test: bool =False, two_factor_authentication: str | None =None, dxfeed_tos_compliant: bool =False, proxy: str | None =None)¶ Bases:
objectContains a local user login which can then be used to interact with the remote API.
- Parameters:¶
- login: str¶
Tastytrade username or email
- remember_me: bool =
False¶ whether or not to create a remember token to use instead of a password
- password: str | None =
None¶ tastytrade password to login; if absent, remember token is required
- remember_token: str | None =
None¶ previously generated token; if absent, password is required
- is_test: bool =
False¶ whether to use the test API endpoints, default False
- two_factor_authentication: str | None =
None¶ if two factor authentication is enabled, this is the code sent to the user’s device
- dxfeed_tos_compliant: bool =
False¶ whether to use the dxfeed TOS-compliant API endpoint for the streamer
- proxy: str | None =
None¶ if provided, all requests will be made through this proxy, as well as web socket connections for streamers.
- async a_destroy() None¶
Sends a API request to log out of the existing session. This will invalidate the current session token and login.
- async a_get_2fa_info() TwoFactorInfo¶
Gets the 2FA info for the current user.
- async a_get_customer() Customer¶
Gets the customer dict from the API.
- Returns:¶
a Tastytrade ‘Customer’ object in JSON format.
- async a_validate() bool¶
Validates the current session by sending a request to the API.
- Returns:¶
True if the session is valid and False otherwise.
- async_client¶
httpx client for async requests
- classmethod deserialize(serialized: str) Self¶
Create a new Session object from a serialized string.
- destroy() None¶
Sends a API request to log out of the existing session. This will invalidate the current session token and login.
- dxlink_url¶
URL for dxfeed websocket
- get_2fa_info() TwoFactorInfo¶
Gets the 2FA info for the current user.
- get_customer() Customer¶
Gets the customer dict from the API.
- Returns:¶
a Tastytrade ‘Customer’ object in JSON format.
- is_test¶
Whether this is a cert or real session
- proxy¶
Proxy URL to use for requests and web sockets
- remember_token¶
A single-use token which can be used to login without a password
- serialize() str¶
Serializes the session to a string, useful for storing a session for later use. Could be used with pickle, Redis, etc.
- session_expiration¶
expiration for session token
- session_token¶
The session token used to authenticate requests
- streamer_token¶
Auth token for dxfeed websocket
- sync_client¶
httpx client for sync requests
- user¶
The user dict returned by the API; contains basic user information
-
pydantic model tastytrade.session.TwoFactorInfo(*, is_active: bool, type: str | None =
None)¶ Bases:
TastytradeDataDataclass containing information about two-factor authentication.
Show JSON schema
{ "title": "TwoFactorInfo", "description": "Dataclass containing information about two-factor authentication.", "type": "object", "properties": { "is-active": { "title": "Is-Active", "type": "boolean" }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Type" } }, "required": [ "is-active" ] }- Fields:¶
-
pydantic model tastytrade.session.User(*, email: str, external_id: str, is_confirmed: bool, username: str, name: str | None =
None, nickname: str | None =None)¶ Bases:
TastytradeDataDataclass containing information about a Tastytrade user.
Show JSON schema
{ "title": "User", "description": "Dataclass containing information about a Tastytrade user.", "type": "object", "properties": { "email": { "title": "Email", "type": "string" }, "external-id": { "title": "External-Id", "type": "string" }, "is-confirmed": { "title": "Is-Confirmed", "type": "boolean" }, "username": { "title": "Username", "type": "string" }, "name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Name" }, "nickname": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Nickname" } }, "required": [ "email", "external-id", "is-confirmed", "username" ] }