def __init__( self, instrument_id, name, instrument_type, url=None, expense_ratio=None, currency=None, xccy_rate=None, xccy_rate_date=None, ): self.id = instrument_id self.name = name self.instrument_type = instrument_type self.url = url self.expense_ratio = expense_ratio if currency is not None: self.currency = currency self.xccy_rate = xccy_rate self.xccy_date = epoch2date(xccy_rate_date)
def __init__(self, dao, the_date): self.positions = [ [x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], str(epoch2date(x[8])), x[9], x[10]] for x in dao.get_funds_positions(the_date)]
def raw_trans(dao): q = [[str(epoch2date(x['date'])), x['name'], x['type'], x['price'], x['shares'], x['fee']] for x in dao.query('SELECT date,name,type,price,shares,fee FROM stock_trans')] return Report.to_json_packed({'data': q})
def raw_xccy(dao): q = [[str(epoch2date(x['date'])), x['From'], x['To'], x['rate']] for x in dao.query('SELECT * FROM xccy_hist')] return Report.to_json_packed({'data': q})
def raw_quote(dao): q = [[str(epoch2date(x['date'])), x['name'], x['price']] for x in dao.query('SELECT * FROM stock_quote ORDER BY date DESC')] return Report.to_json_packed({'data': q})
def __init__(self, instrument, name, price, quote_date): self.instrument = instrument self.symbol = name self.price = price self.date = epoch2date(quote_date) # the actual date