bvanelli / actualpy

Python API implementation for Actual server - reference https://actualbudget.org/
20 stars 4 forks source link

feat: Implement creating split transactions. #26

Closed bvanelli closed 3 months ago

bvanelli commented 3 months ago

Here is one example:

import datetime
from actual import Actual
from actual.queries import create_transaction, create_splits, get_or_create_account

with Actual(
    base_url="http://localhost:5006", password="mypass", encryption_password="mypass", file="My budget"
) as actual:
    today = datetime.date.today()
    act = get_or_create_account(actual.session, "My account")
    t = create_transaction(actual.session, today, act, "My payee", notes="My first transaction", amount=-10.5)
    taxes = create_transaction(actual.session, today, act, "Government", "Damn taxes", category="Taxes", amount=-3.0)
    create_splits(actual.session, (t, taxes))
    actual.commit()

and the result on the server:

image

Closes #24

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 98.30508% with 1 line in your changes missing coverage. Please review.

Project coverage is 96.54%. Comparing base (f7d81a1) to head (fde4258).

Files Patch % Lines
actual/queries.py 97.87% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #26 +/- ## ========================================== + Coverage 96.16% 96.54% +0.37% ========================================== Files 9 9 Lines 1434 1447 +13 ========================================== + Hits 1379 1397 +18 + Misses 55 50 -5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.