|
AllyInvest.py
A blackbox Ally Invest/TradeKing API interface for application developers.
|
Public Member Functions | |
| def | __init__ (self, oauth_secret, oauth_token, client_key, response_format="json") |
| def | get_accounts (self) |
| def | get_accounts_balances (self) |
| def | get_account (self, id) |
| def | get_account_balances (self, id) |
| def | get_account_history (self, id) |
| def | get_account_holdings (self, id) |
| def | get_market_clock (self) |
| def | get_quote (self, symbols) |
| def | news_search (self, symbols, startdate=None, enddate=None, maxhits=10) |
| def | get_news_article (self, article_id) |
| def | get_toplists (self, listtype="topgainers", exchange="N") |
| def | get_member_profile (self) |
| def | get_status (self) |
| def | get_version (self) |
| def | get_watchlists (self) |
| def | create_watchlist (self, watchlist_name, symbols="") |
Public Attributes | |
| format | |
| url | |
| oauth_secret | |
| oauth_token | |
| client_key | |
| client_secret | |
| auth_time | |
| auth | |
| valid_auth_dt | |
The AllyAPI class providing blackbox use of the Ally Invest API.
This is the main class of the API module. This should be the only class used in
applictions built around the API. The AllyAPI class allows access to the GET and
POST requests supported by Ally Invest.
Missing Functionality:
ORDER/TRADE
GET accounts/:id/orders
POST accounts/:id/orders
POST accounts/:id/orders/preview
MARKET
GET market/options/search
GET market/options/strikes
GET market/options/expirations
GET market/timesales
WATCHLIST
GET watchlists/:id
DELETE watchlists/:id
POST watchlists/:id/symbols
DELETE watchlists/:id/symbols
STREAMING OPERATIONS
MARKET
GET market/quotes
| def ally.AllyAPI.__init__ | ( | self, | |
| oauth_secret, | |||
| oauth_token, | |||
| client_key, | |||
response_format = "json" |
|||
| ) |
AllyAPI constructor. Sets the response format on all of the URLs and
the oauth/client keys required to access the API.
Parameters
@param self - the object pointer
@param oauth_secret - secret oauth key from Ally
@param oauth_token - oauth token from Ally
@param client_key - client key from Ally
@param response_format - format of the response. Valid values are 'xml' and 'json'.
Specifying 'xml' will return an ElementTree containing the response XML while
'json' will return the response in the JSON format.
| def ally.AllyAPI.create_watchlist | ( | self, | |
| watchlist_name, | |||
symbols = "" |
|||
| ) |
Creates a watchlist and adds a symbol or list of symbols to a watchlist.
WARNING: There appears to be an issue when adding a list of symbols.
It is recommended that one ticker symbol is added at a time.
@param self - the object pointer
@param watchist_id - name of the watchlist
@param symbols - single ticker or list of tickers to add to the watchlist
| def ally.AllyAPI.get_account | ( | self, | |
| id | |||
| ) |
Returns a specific account provided the account ID (account number)
@param self - the object pointer
@param id - account number
| def ally.AllyAPI.get_account_balances | ( | self, | |
| id | |||
| ) |
Returns the balances of a specific account (ID = account number)
@param self - the object pointer
@param id - account number
| def ally.AllyAPI.get_account_history | ( | self, | |
| id | |||
| ) |
Returns the history of a specific account (ID = account number)
@param self - the object pointer
@param id - account number
| def ally.AllyAPI.get_account_holdings | ( | self, | |
| id | |||
| ) |
Returns the holdings of a specific account (ID = account number)
@param self - the object pointer
@param id - account number
| def ally.AllyAPI.get_accounts | ( | self | ) |
Returns all of the user's accounts.
| def ally.AllyAPI.get_accounts_balances | ( | self | ) |
Returns the balances of all of the user's accounts.
| def ally.AllyAPI.get_market_clock | ( | self | ) |
Returns the state of the market, the time until next state change,
and current server timestamp.
@param self - the object pointer
| def ally.AllyAPI.get_member_profile | ( | self | ) |
Returns general information associated with the user including account
numbers and account information.
@param self - the object pointer
| def ally.AllyAPI.get_news_article | ( | self, | |
| article_id | |||
| ) |
Gets a single news article based on the article ID. This ID can be retrieved
from the news_search() function.
@param self - the object pointer
@param article_id - ID of the article to retrieve
| def ally.AllyAPI.get_quote | ( | self, | |
| symbols | |||
| ) |
Returns quote information for a single ticker or list of tickers.
Note: this function does not implement selecting customer FIDs as
described in the API documentation. These can be filtered from the return
if need be.
@param self - the object pointer
@param symbols - single ticker or list of ticker to get quotes for
| def ally.AllyAPI.get_status | ( | self | ) |
Returns an error if the API endpoint/server is unavailable. Otherwise
returns the current server timestamp.
@param self - the object pointer
| def ally.AllyAPI.get_toplists | ( | self, | |
listtype = "topgainers", |
|||
exchange = "N" |
|||
| ) |
Returns a ranked list depending on listtype and exchange.
@param listtype - type of list to be queried, accepted values are:
'toplosers': top losers by dollar amount
'toppctlosers': top percentage losers
'topvolume': top volume
'topactive': top active
'topgainers': top gainers by dollar amount (default)
'toppctgainers': top percentage gainers
@param exchange - exchange to be queried, accepted values are:
'A': American Stock Exchange
'N': New York Stock Exchange (default)
'Q': NASDAQ
'U': NASDAQ Bulletin Board
'V': NASDAQ OTC Other
| def ally.AllyAPI.get_version | ( | self | ) |
Gets the current version of the API of the endpoint called.
@param self - the object pointer
| def ally.AllyAPI.get_watchlists | ( | self | ) |
Retrieves all watchlists belonging to the member.
@param self - the object pointer
| def ally.AllyAPI.news_search | ( | self, | |
| symbols, | |||
startdate = None, |
|||
enddate = None, |
|||
maxhits = 10 |
|||
| ) |
Retrieves a listing of news headlines based on symbols.
@param self - the object pointer
@param symbols - single ticker or list of ticker to get quotes for
@param startdate - search for articles between this date and enddate
@param enddate - search for articles between this date and startdate
@param maxhits - number of articles to return
1.8.16