예제 #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()
    )
예제 #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)
예제 #3
0
def read_file(transaction_file):
    return prg.to_dataframe(rt.read_file(transaction_file))
예제 #4
0
def invested(money_transactions):
    df = prg.to_dataframe(money_transactions)
    byowner = df.groupby("owner")
    return str(byowner["quantity"].sum())
예제 #5
0
def sum_money(money_transactions):
    dt = prg.to_dataframe(money_transactions)
    dt["cum_sum"] = dt.quantity.cumsum()
    return dt
예제 #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)
예제 #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)