forked from anthonymorast/AllyInvest.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
25 lines (20 loc) · 923 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from ally import *
## These values are from Ally Invest API Applications page.
CONSUMER_KEY = "CONSUMER KEY"
CONSUMER_SECRET = "CONSUMER SECRET"
OAUTH_TOKEN = "OAUTH TOKEN"
OAUTH_SECRET = "OAUTH TOKEN SECRET"
if __name__ == "__main__":
ally = AllyAPI(OAUTH_SECRET, OAUTH_TOKEN, CONSUMER_KEY, response_format="json")
print(ally.get_member_profile())
print(ally.get_status())
print(ally.get_quote("AAPL"))
print(ally.get_quote(["AAPL", "MSFT", "XLNX", "NXPI"]))
print(ally.news_search("AAPL"))
print(ally.news_search(["AAPL", "MSFT", "XLNX", "NXPI"]))
quote_request = QuotesRequest(symbols=['SND', 'PRU', 'HMC'])
response = quote_request.execute(ally)
print(response.get_raw_data())
accounts_balances_request = AccountsBalancesRequest()
accounts_balances_response = accounts_balances_request.execute(ally)
print(accounts_balances_response.get_raw_data())