예제 #1
0
  def getSummData(self, ticker):
    invs = Investment.all().filter("ticker", ticker);
    data = SummaryData();
    data.ticker = ticker;
    for inv in invs:
      data.amount = data.amount + inv.amount;
      data.shares = data.shares + inv.shares;
    latestPriceQ = stockPrice.all().filter("ticker", ticker).order("-date");
    latestPrice = latestPriceQ.get().price;
    data.currPrice = latestPrice;

    data.value = data.currPrice * data.shares;
    if data.amount > 0:
      data.percentage = data.value / Decimal(data.amount) - Decimal("1.0");
    return data;
 def get(self):
  #invs = investment.all();
   sps = stockPrice.all();
   self.response.out.write("done");