Account¶
- class ally.Ally(params=None, timeout: float = 1.0)
The ally.Ally.Ally class.
This is the main class for this library.
- accounts(dataframe: bool = True, block: bool = True)
Gets list of available accounts, and some basic metrics for each one.
Calls the ‘accounts.json’ endpoint to get the current list of accounts. This includes account number, cash account balances, and P/L.
- Parameters
dataframe – Specify an output format
block – Specify whether to block thread if request exceeds rate limit
- Returns
- A pandas dataframe by default,
otherwise a flat dictionary.
- Raises
RateLimitException – If block=False, rate limit problems will be raised
- balances(dataframe: bool = True, block: bool = True)
Gets current cash and various account metrics.
Calls the ‘accounts/./balances.json’ endpoint to get the current list of balances. This includes margin amounts, cash, etc.
- Parameters
dataframe – Specify an output format
block – Specify whether to block thread if request exceeds rate limit
- Returns
- A pandas dataframe with 1 row by default,
otherwise a flat dictionary.
- Raises
RateLimitException – If block=False, rate limit problems will be raised
- history(dataframe: bool = True, block: bool = True)
Gets the transaction history for the account.
Calls the ‘accounts/./history.json’ endpoint to get list of all trade and cash movement history for an account. This includes dividends, cash deposits and withdrawals, and all trades, including pricing information about each trade.
- Parameters
dataframe – Specify an output format
block – Specify whether to block thread if request exceeds rate limit
- Returns
Pandas dataframe Otherwise: flat list of dictionaries
- Return type
Default
- Raises
RateLimitException – If block=False, rate limit problems will be raised
- holdings(dataframe: bool = True, block: bool = True)
Gets all current account holdings.
Calls the ‘accounts/./history.json’ endpoint to get list of all current account holdings, including stocks and options. This also includes current market value, cost of acquisition, etc.
- Parameters
dataframe – Specify an output format
block – Specify whether to block thread if request exceeds rate limit
- Returns
- A pandas dataframe by default,
otherwise a flat list of dictionaries.