示例#1
0
 def test_to_str(self):
     self.assertEqual(dollars.to_str(D('10.50')), '$10.50')
     self.assertEqual(dollars.to_str(D('1234.99')), '$1234.99')
     self.assertEqual(dollars.to_str(D('1.2345')), '$1.23')
     self.assertEqual(dollars.to_str(D('1234.5678')), '$1234.57')
     self.assertEqual(dollars.to_str(D('-1.2345')), '$(1.23)')
     self.assertEqual(dollars.to_str(D('-1234.5678')), '$(1234.57)')
示例#2
0
 def _dollar_str(self, value):
     return dollars.to_str(value,
                           limit_precision=False,
                           accounting_style=False)
示例#3
0
 def __repr__(self):
     if self.amount > 0:
         return '%s  Deposited %s' % (
             self.date, dollars.to_str(self.amount))
     return '%s  Withdrew %s' % (self.date, dollars.to_str(self.amount))
示例#4
0
 def __str__(self):
     return '%s  Dividend of %s from %s%s%s' % \
         (self.date, dollars.to_str(self.amount), self.symbol,
          ' (qualified)' if self.qualified else '',
          ' - reinvested' if self.reinvested else '')
示例#5
0
 def __repr__(self):
     return '%s  Sold %.2f %s at %s - %s fee' % (
         self.date, self.num_shares, self.symbol,
         dollars.to_str(self.price), dollars.to_str(self.fees))
示例#6
0
 def __repr__(self):
     return '%s  Bought %.2f %s at %s%s - %s fee' % (
         self.date, self.num_shares, self.symbol,
         dollars.to_str(self.price),
         ' (reinvestment)' if self.is_reinvestment else '',
         dollars.to_str(self.fees))
示例#7
0
 def __repr__(self):
     return '%s  Interest: %s' % (self.date, dollars.to_str(self.amount))
示例#8
0
 def __repr__(self):
     return '%s  %s liquidation of %s' % (self.date,
                                          dollars.to_str(self.amount),
                                          self.description[:30])
示例#9
0
 def __repr__(self):
     return '%s  %s-Term Cap Gain of %s from %s%s' % (
         self.date,
         'Long' if self.long_term else 'Short',
         dollars.to_str(self.amount), self.symbol,
         ' - reinvested' if self.reinvested else '')