Account and Trading
Schwab Account and Trading Production
Accounts and Trading Operations
Method: account_linked
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.Response
object containing the linked account numbers and corresponding encrypted values.
Method: account_details_all
account_details_all
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.Response
object containing account details for all linked accounts.
Method: account_details
account_details
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.Response
object containing account details for the specified account.
Method: account_orders
account_orders
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.Response
object containing orders for the specified account.
Method: order_place
order_place
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.Response
object containing the order number in the response header (if the order is not immediately filled).
Method: order_details
order_details
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.Response
object containing the order details.
Method: order_cancel
order_cancel
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.Response
object indicating the success of the cancellation.
Method: order_replace
order_replace
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.Response
object containing the result of the order replacement.
Method: transactions
transactions
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.Response
object containing the list of transactions.
Method: transaction_details
transaction_details
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.Response
object containing the transaction details.
Last updated