Skip to content
alienbrett edited this page Apr 7, 2020 · 5 revisions

Account Functions

Transaction History

Returns list of dictionaries, each one holding a transaction.

Can specify a range to pull transactions from

  • 'all' [default]
  • 'today'
  • 'current_week'
  • 'current_month'
  • 'last_month'

Can also specify which transactions to pull,

  • 'all' [default]
  • 'bookkeeping'
  • 'trade'
trans_history = a.account_history(
    account=12345678, # (optional)
    type_="all",
    range_="current_week"
)

Current Accounts

Get current accounts in JSON dict format. (Includes account cash)

accounts = a.get_accounts()

Current Account Holdings

Get current holdings for an account in JSON dict format.

Optionally dump json to file, if specified in outfile.

current_holdings = a.get_holdings(
    account=12345678,         # (optional)
    outfile="./holdings.json" # (optional)
)

Holdings Pie Chart

Uses matplotlib to create a basic pie chart organized by underlying.

Specify regen=True to regenerate graph, otherwise it will quickly output a cached image.

graph_file can be used to set filename of ouptut (Defaults to ./graph.png)

pie_file = a.holdings_chart(
    account=12345678,
    graph_file="./my_graph_file.png",
    regen=True
)

Cash Balances

Ally provides information cash held (and on hold) in a specified account.

a.get_cash( account = 1234567 )
# output
>> {
    'accruedinterest': '0',
    'cash': '1.00',
    'cashavailable': '0',
    'marginbalance': '1.00',
    'mmf': '0',
    'total': '1.00',
    'uncleareddeposits': '0',
    'unsettledfunds': '0',
    'yield': '0'
}