Esempio n. 1
0
def worth_at_date(money_transactions, date):
    df = prg.to_dataframe(money_transactions)
    qs = df[df.dt_date <= date].groupby(["owner", "ticker"]).quantity.sum()
    return str(
        pd.DataFrame(qs)
        .apply(lambda x: cv.in_CZK(date, x.name[1]) * x.quantity, axis=1)
        .reset_index()
        .groupby("owner")
        .sum()
    )
Esempio n. 2
0
def appreciation(money_transactions, stocks, owner):
    m = prg.to_dataframe(money_transactions)
    m = m[m.owner == owner]
    m['neg'] = m.apply(lambda x: (x.quantity * (-1)), axis=1)
    subset = m[['dt_date', 'neg']]
    investments = [tuple(x) for x in subset.values]
    assets = st.worth_at_date_czk(stocks, date.today())
    assets = assets.loc[owner]
    assets = assets.iloc[0]
    assetss = (date.today(), assets)
    investments.append(assetss)
    return xirr(investments)
Esempio n. 3
0
def read_file(transaction_file):
    return prg.to_dataframe(rt.read_file(transaction_file))
Esempio n. 4
0
def invested(money_transactions):
    df = prg.to_dataframe(money_transactions)
    byowner = df.groupby("owner")
    return str(byowner["quantity"].sum())
Esempio n. 5
0
def sum_money(money_transactions):
    dt = prg.to_dataframe(money_transactions)
    dt["cum_sum"] = dt.quantity.cumsum()
    return dt
Esempio n. 6
0
def test_transaction_at_missing_inter():
    df = prg.to_dataframe(rt.read_file('transactions'))
    tr = prg.transaction_at("2014-04-09", df)
    field_by_field_equal(tr, example_dict_inter)
Esempio n. 7
0
def test_transaction_at_direct():
    df = prg.to_dataframe(rt.read_file('transactions'))
    tr = prg.transaction_at("2014-04-10", df)
    field_by_field_equal(tr, example_dict)