def get_single_number_beanquery_result(query:str, entries):
"""
Function returns a single number from a beanquery result.
"""
result = None
## Some code goes here to update rsult
return result
def get_net_worth_at_date_and_currency(entries,my_date, currency):
query=f"""
select SUM(CONVERT(COST(position),{currency},{ my_date})
WHERE (account ~'Assets' OR account ~'Liabilities') AND date <= {my_date}
"""
return get_single_number_beanquery_result(query, entries)
def get_changes_to_net_worth_over_a_period_in_single_currency(entries,start_date, end_date, currency):
# Note, that the date is the date of transaction here
query=f"""
select SUM(CONVERT(COST(position),{currency},date)) as cost
WHERE (account ~'Expenses' OR account ~'Income' ) AND date >= f{start_date} AND date <= {end_date}
"""
return get_single_number_beanquery_result(query, entries)
def insert_unrealyzed_gains_for_networth_diff_analisys(entries, start_date, end_date, currency):
"""
This is the function I am looking for
"""
updated_entries = None
# Some code to update entries
return updated_entries