Account and Trading
Schwab Account and Trading Production
Accounts and Trading Operations
Method: account_linked
account_linkedclient.account_linked()Retrieves a list of all linked accounts, returning plain text and encrypted account values for further use in account-related operations.
Returns:
A
request.Responseobject containing the linked account numbers and corresponding encrypted values.
Method: account_details_all
account_details_allclient.account_details_all(fields=None)Fetches detailed information for all linked accounts, including balances and optionally positions (if the fields parameter is set to "positions").
Parameters:
fields (
str, optional): Set to"positions"to include positions in the account details. Default isNone.
Returns:
A
request.Responseobject containing account details for all linked accounts.
Method: account_details
account_detailsclient.account_details(accountHash, fields=None)Fetches detailed information for a specific linked account, including balances and optionally positions.
Parameters:
accountHash (
str): The encrypted account hash obtained fromaccount_linked().fields (
str, optional): Set to"positions"to include positions in the account details. Default isNone.
Returns:
A
request.Responseobject containing account details for the specified account.
Method: account_orders
account_ordersclient.account_orders(accountHash, fromEnteredTime, toEnteredTime, maxResults=None, status=None)Fetches all orders for a specific linked account, with optional filtering by date, status, and other parameters. The maximum date range is one year.
Parameters:
accountHash (
str): The encrypted account hash obtained fromaccount_linked().fromEnteredTime (
datetime | str): The start time for filtering orders.toEnteredTime (
datetime | str): The end time for filtering orders.maxResults (
int, optional): Maximum number of results to return. Default isNone.status (
str, optional): Filter orders by status (e.g.,"FILLED","CANCELED", etc.). Default isNone.
Returns:
A
request.Responseobject containing orders for the specified account.
Method: order_place
order_placeclient.order_place(accountHash, order)Places a new order for the specified account.
Parameters:
accountHash (
str): The encrypted account hash obtained fromaccount_linked().order (
dict): A dictionary representing the order details (as specified in Schwab’s API documentation).
Returns:
A
request.Responseobject containing the order number in the response header (if the order is not immediately filled).
Method: order_details
order_detailsclient.order_details(accountHash, orderId)Retrieves details of a specific order for the specified account.
Parameters:
accountHash (
str): The encrypted account hash obtained fromaccount_linked().orderId (
str | int): The ID of the order.
Returns:
A
request.Responseobject containing the order details.
Method: order_cancel
order_cancelclient.order_cancel(accountHash, orderId)Cancels a specific order for the specified account.
Parameters:
accountHash (
str): The encrypted account hash obtained fromaccount_linked().orderId (
str | int): The ID of the order to cancel.
Returns:
A
request.Responseobject indicating the success of the cancellation.
Method: order_replace
order_replaceclient.order_replace(accountHash, orderId, order)Replaces an existing order with a new order. The old order is canceled, and the new order is created.
Parameters:
accountHash (
str): The encrypted account hash obtained fromaccount_linked().orderId (
str | int): The ID of the order to replace.order (
dict): A dictionary representing the new order details.
Returns:
A
request.Responseobject containing the result of the order replacement.
Method: transactions
transactionsclient.transactions(accountHash, startDate, endDate, types, symbol=None)Fetches all transactions for a specific account, filtered by date and transaction type. The maximum number of transactions returned is 3,000, and the maximum date range is one year.
Parameters:
accountHash (
str): The encrypted account hash obtained fromaccount_linked().startDate (
datetime | str): The start date for filtering transactions.endDate (
datetime | str): The end date for filtering transactions.types (
str): The type of transaction (e.g.,"TRADE","DIVIDEND_OR_INTEREST").symbol (
str, optional): The stock symbol to filter transactions. Default isNone.
Returns:
A
request.Responseobject containing the list of transactions.
Method: transaction_details
transaction_detailsclient.transaction_details(accountHash, transactionId)Retrieves specific transaction details for a given account and transaction ID.
Parameters:
accountHash (
str): The encrypted account hash obtained fromaccount_linked().transactionId (
str | int): The ID of the transaction.
Returns:
A
request.Responseobject containing the transaction details.
Last updated