-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHoldingAssetClassificationApp.py
executable file
·55 lines (45 loc) · 2.69 KB
/
HoldingAssetClassificationApp.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
#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 HoldingAssetClassificationApp class provides Asset classifications for the holdings for a member account.
#Steps to Use this App:
#i) doCoBrandLogin(coBrandUserName, coBrandPassword)
#ii) doMemberLogin(userName, userPassword)
#Browse all Accounts for member profile:
#getHoldings()
class HoldingAssetClassificationApp:
fqcn = "HoldingAssetClassificationApp"
global userSession
global cobSession
@staticmethod
def getAssetClassificationHoldings():
global userSession
global cobSession
uSession = loginapp.userSession
cSession = loginapp.cobSession
hdr = {'Authorization':'{userSession='+uSession+',cobSession='+cSession+'}'}
mn = "getAssetClassificationHoldings()"
print(HoldingAssetClassificationApp.fqcn + " :: " + mn)
holdingURL = loginapp.LoginApp.localURLVer1 + "v1/holdings?include=assetClassification"
jsonResponse = http1.HTTP.doGet(holdingURL, hdr)
parsed_json = json.loads(jsonResponse)
node = parsed_json.get("holding",{})
print '-----------------------------------------------------------------------------------------------------------------'
print "holdingId - accountId - holdingType - value - classificationType - classificationValue - allocation" #description
print '-----------------------------------------------------------------------------------------------------------------'
for i in node:
if ('value' in i):
print i['id']," - ",i['accountId']," - ",i['holdingType']," - ",i['value']['amount'] #,i['description']
else:
print i['id']," - ",i['accountId']," - ",i['holdingType']," - "," - " #,i['description']
if ('assetClassification' in i):
classificationNode = i.get("assetClassification",{})
for j in classificationNode:
print " - "," - "," - "," - "," - "," - "," - "," - ",j['classificationType']," - ",j['classificationValue']," - ",j['allocation']
print '--------------------------------------------------------------------------------------------------------------'