-
Notifications
You must be signed in to change notification settings - Fork 0
/
InvestmentPlanApp.py
executable file
·60 lines (50 loc) · 2.74 KB
/
InvestmentPlanApp.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#Copyright (c) 2015 Yodlee, Inc. All Rights Reserved.
# This software is the confidential and proprietary information of Yodlee, Inc.
# Use is subject to license terms.
import loginapp #importing loginapp, to get a coBrand and User Session response and used
import http1 #importing http1, its the key for all the apps, and to post and get the json response
import json #library package for the json response access
import yaml #converts unicode to byte code
import requests #requests, for requesting the response from json
#<summary>
#The PortfolioAssetSummaryApp class provides summary of Asset Classifications with value.
#Steps to Use this App:
#i) doCoBrandLogin(coBrandUserName, coBrandPassword)
#ii) doMemberLogin(userName, userPassword)
#Browse all Accounts for member profile:
#getAssetSummary()
class InvestmentPlanApp:
fqcn = "InvestmentPlanApp"
global userSession
global cobSession
@staticmethod
def getInvestmentOptions():
global userSession
global cobSession
uSession = loginapp.userSession
cSession = loginapp.cobSession
hdr = {'Authorization':'{userSession='+uSession+',cobSession='+cSession+'}'}
mn = "getInvestmentOptions()"
print(InvestmentPlanApp.fqcn + " :: " + mn)
portfolioURL = loginapp.LoginApp.localURLVer1 + "v1/accounts/investmentPlan/investmentOptions?include=assetClassification"
jsonResponse = http1.HTTP.doGet(portfolioURL, hdr)
parsed_json = json.loads(jsonResponse)
node = parsed_json.get("account",{})
print 'IP --> InvestmentPlan'
print 'IO --> InvestmentOption'
print '-------------------------------------------------------------------------------------------------------'
print "AccountId - IP.planName - IP.providerName - IO.cusipNumber - IO.description - IO.holdingType - IO.price"
print '-------------------------------------------------------------------------------------------------------'
for i in node:
# print i
if ('investmentPlan' in i):
#print i
print i['id']," - ",i['investmentPlan']['planName']," - ",i['investmentPlan']['providerName']
io = i.get("investmentoption",{})
#print io
for j in io:
if ('price' in j):
print " - "," - "," - "," - "," - "," - ",j['cusipNumber']," - ",j['description']," - ",j['holdingType']," - ",j['price']['amount']
else:
print " - "," - "," - "," - "," - "," - ",j['cusipNumber']," - ",j['description']," - ",j['holdingType']," - "," - "
print '--------------------------------------------------------------------------------------------------------------'