Example #1
0
 def get(self):
     bidsObj = {}
     for bid in Bid.all():
         bidObj = {}
         # Extracting properties
         bidId = bid.key().id_or_name()
         time = bid.createdAt.strftime("%H:%M:%S")
         date = bid.createdAt.strftime("%Y-%m-%d")
         participation = bid.participation
         loanId = bid.loan.key().id_or_name()
         bidRate = bid.bidrate
         if bidRate > 0:
             orderType = 'Competitive'
         else:
             orderType = 'Noncompetitive'
         userId = bid.user.key().id_or_name()
         # Passing properties to the obj
         bidObj['bidId'] = bidId
         bidObj['date'] = date
         bidObj['time'] = time
         bidObj['bidType'] = 'Specified'
         bidObj['participation'] = participation
         bidObj['assetSubset'] = 'Loan'
         bidObj['loanId'] = loanId
         bidObj['orderType'] = orderType
         if (orderType == 'Competitive'):
             bidObj['bidRate'] = bidRate
         bidObj['orderTiming'] = 'Day Trade'
         bidObj['userId'] = userId
         # Inserting new object into the accumulation object
         bidsObj[bidId] = bidObj
     # Dumping to JSON the accumulation object
     self.response.headers['Content-Type'] = 'application/json'
     self.response.out.write(json.dumps(bidsObj))
Example #2
0
 def get(self):
     usersObj = {}
     for bid in Bid.all():
         user = bid.user
         userId = user.key().id_or_name()
         if (userId not in usersObj):
             userObj = {}
             # Extracting properties
             fundsAvailable = user.fundsAvailable
             # Passing properties to the obj
             userObj['userId'] = userId
             userObj['fundsAvailable'] = fundsAvailable
             # Inserting new object into the accumulation object
             usersObj[userId] = userObj
     # Dumping to JSON the accumulation object
     self.response.headers['Content-Type'] = 'application/json'
     self.response.out.write(json.dumps(usersObj))
Example #3
0
 def get(self):
     loansObj = {}
     for bid in Bid.all():
         loan = bid.loan
         loanId = loan.key().id_or_name()
         if (loanId not in loansObj):
             loanObj = {}
             # Extracting properties
             mo = loan.customer_account_key
             loanAmount = loan.curr_upb
             # Passing properties to the obj
             loanObj['loanId'] = loanId
             loanObj['mortgageOriginator'] = mo
             loanObj['loanAmount'] = loanAmount
             # Inserting new object into the accumulation object
             loansObj[loanId] = loanObj
     # Dumping to JSON the accumulation object
     self.response.headers['Content-Type'] = 'application/json'
     self.response.out.write(json.dumps(loansObj))