Skip to content

Commit

Permalink
fix: Add optional parameters to transactions command (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic authored Oct 3, 2024
1 parent 42c565b commit 1c732b0
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,4 @@ dmypy.json

# Pyre type checker
.pyre/
.aider*
47 changes: 31 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,32 @@ Run ``python -m finary_uapi` for an up to date version.

```
Usage:
finary_uapi signin
finary_uapi signin [MFA_CODE]
finary_uapi me
finary_uapi institution_connections
finary_uapi dashboard net [all | 1w | 1m | ytd | 1y]
finary_uapi dashboard gross [all | 1w | 1m | ytd | 1y]
finary_uapi dashboard finary [all | 1w | 1m | ytd | 1y]
finary_uapi portfolio [all | 1w | 1m | ytd | 1y]
finary_uapi commodities [all | 1w | 1m | ytd | 1y]
finary_uapi checking_accounts [all | 1w | 1m | ytd | 1y]
finary_uapi fonds_euro [all | 1w | 1m | ytd | 1y]
finary_uapi other_assets [all | 1w | 1m | ytd | 1y]
finary_uapi saving_accounts [all | 1w | 1m | ytd | 1y]
finary_uapi real_estates [all | 1w | 1m | ytd | 1y]
finary_uapi organizations
finary_uapi timeseries <period> <type>
finary_uapi checking_accounts transactions [--page=<page>] [--perpage=<perpage>] [--account=<account_ids>] [--institution=<institution_ids>] [--query=<query>]
finary_uapi fonds_euro
finary_uapi startups
finary_uapi investments
finary_uapi investments dividends
finary_uapi investments transactions [--page=<page>] [--perpage=<perpage>] [--account=<account_ids>] [--institution=<institution_ids>] [--query=<query>]
finary_uapi crowdlendings
finary_uapi crowdlendings distribution
finary_uapi crowdlendings add <account_name> <name> <annual_yield> <month_duration> <initial_investment> <current_price> <currency_code> <start_date>
finary_uapi crowdlendings delete <crowdlending_id>
finary_uapi cryptos
finary_uapi cryptos distribution
finary_uapi cryptos add <code> <quantity> <price> <account_id>
finary_uapi cryptos update <code> <quantity> <price> <account_id>
finary_uapi cryptos delete <code> <account_id>
finary_uapi precious_metals search QUERY
finary_uapi precious_metals
finary_uapi precious_metals add <name> <quantity> <price>
finary_uapi precious_metals delete <commodity_id>
finary_uapi holdings_accounts [crypto | stocks | <account_name>]
finary_uapi holdings_accounts add (crypto | stocks) <account_name>
finary_uapi holdings_accounts [crypto | stocks | crowdlending | <account_name>]
finary_uapi holdings_accounts add (crypto | stocks | crowdlending) <account_name>
finary_uapi holdings_accounts add (checking | saving) <account_name> <bank_name> <account_type> <balance>
finary_uapi holdings_accounts delete <account_id>
finary_uapi holdings_accounts update <account_id> <account_name> [<account_balance>]
Expand All @@ -60,18 +61,32 @@ Usage:
finary_uapi generic_assets add <name> <category> <quantity> <buying_price> <current_price>
finary_uapi generic_assets update <asset_id> <name> <category> <quantity> <buying_price> <current_price>
finary_uapi generic_assets delete <asset_id>
finary_uapi crypto_chains
finary_uapi crypto_currency search QUERY
finary_uapi fiat_currency search QUERY
finary_uapi institutions search QUERY
finary_uapi securities search QUERY
finary_uapi securities
finary_uapi securities add <code> <quantity> <price> <account_id>
finary_uapi securities delete <security_id>
finary_uapi insights
finary_uapi loans
finary_uapi credit_accounts transactions [--page=<page>] [--perpage=<perpage>] [--account=<account_ids>] [--institution=<institution_ids>] [--query=<query>]
finary_uapi real_estates
finary_uapi real_estates add rent <address> <user_estimated_value> <description> <surface> <buying_price> <building_type> <ownership_percentage> <monthly_charges> <monthly_rent> <yearly_taxes> <rental_period> <rental_type> [<currency_code>]
finary_uapi real_estates add <category> <address> <user_estimated_value> <description> <surface> <buying_price> <building_type> <ownership_percentage> [<currency_code>]
finary_uapi real_estates update rent <asset_id> <user_estimated_value> <description> <buying_price> <ownership_percentage> <monthly_rent>
finary_uapi real_estates update <category> <asset_id> <user_estimated_value> <description> <buying_price> <ownership_percentage>
finary_uapi real_estates delete <asset_id>
finary_uapi scpis search QUERY
finary_uapi scpis
finary_uapi watches search QUERY
finary_uapi import crowdlending_csv FILENAME [-d] [-f]
finary_uapi import cryptocom FILENAME [(--new=NAME | --edit=account_id | --add=account_id)]
finary_uapi import nexo FILENAME [(--new=NAME | --edit=account_id | --add=account_id)]
finary_uapi import crypto_csv FILENAME [(--new=NAME | --edit=account_id | --add=account_id)]
finary_uapi import stocks_csv FILENAME [(--new=NAME | --edit=account_id | --add=account_id)]
finary_uapi import stocks_json FILENAME [(--new=NAME | --edit=account_id | --add=account_id)]
finary_uapi import stocks_csv FILENAME [(--new=NAME | --edit=account_id | --add=account_id)] [-d]
finary_uapi import stocks_json FILENAME [(--new=NAME | --edit=account_id | --add=account_id)] [-d]
```

## Examples
Expand Down Expand Up @@ -151,4 +166,4 @@ Thanks go to these people ([emoji key](https://allcontributors.org/docs/en/emoji
<!-- ALL-CONTRIBUTORS-LIST:END -->


This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
46 changes: 37 additions & 9 deletions finary_uapi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
finary_uapi institution_connections
finary_uapi organizations
finary_uapi timeseries <period> <type>
finary_uapi checking_accounts transactions
finary_uapi checking_accounts transactions [--page=<page>] [--perpage=<perpage>] [--account=<account_ids>] [--institution=<institution_ids>] [--query=<query>]
finary_uapi fonds_euro
finary_uapi startups
finary_uapi investments
finary_uapi investments dividends
finary_uapi investments transactions
finary_uapi investments transactions [--page=<page>] [--perpage=<perpage>] [--account=<account_ids>] [--institution=<institution_ids>] [--query=<query>]
finary_uapi crowdlendings
finary_uapi crowdlendings distribution
finary_uapi crowdlendings add <account_name> <name> <annual_yield> <month_duration> <initial_investment> <current_price> <currency_code> <start_date>
Expand Down Expand Up @@ -45,7 +45,7 @@
finary_uapi securities delete <security_id>
finary_uapi insights
finary_uapi loans
finary_uapi credit_accounts transactions
finary_uapi credit_accounts transactions [--page=<page>] [--perpage=<perpage>] [--account=<account_ids>] [--institution=<institution_ids>] [--query=<query>]
finary_uapi real_estates
finary_uapi real_estates add rent <address> <user_estimated_value> <description> <surface> <buying_price> <building_type> <ownership_percentage> <monthly_charges> <monthly_rent> <yearly_taxes> <rental_period> <rental_type> [<currency_code>]
finary_uapi real_estates add <category> <address> <user_estimated_value> <description> <surface> <buying_price> <building_type> <ownership_percentage> [<currency_code>]
Expand All @@ -64,9 +64,16 @@
Options:
--new=NAME Create a new account and import the lines
--edit=account_id Edit the line with new value if it exists, create it otherwise
--add=account_id If line exists, add the quantity and change the price accordingly, create it otherwise
--new=NAME Create a new account and import the lines
--edit=account_id Edit the line with new value if it exists, create it otherwise
--add=account_id If line exists, add the quantity and change the price accordingly, create it otherwise
--page=<page> First page [default: 1].
--perpage=<perpage> Elements per page [default: 50].
--account=<account_ids> Account ids, comma separated if necessary
--institution=<institution_ids> Institutions (banks) ids, comma separated if necessary
--query=<query> Full text search
""" # noqa

import json
Expand Down Expand Up @@ -167,7 +174,14 @@ def main() -> int: # pragma: nocover
result = get_user_me_institution_connections(session)
elif args["checking_accounts"]:
if args["transactions"]:
result = get_portfolio_checking_accounts_transactions(session)
result = get_portfolio_checking_accounts_transactions(
session,
page=args["--page"],
per_page=args["--perpage"],
account_id=args["--account"],
institution_id=args["--institution"],
query=args["--query"],
)
elif args["fonds_euro"]:
result = get_user_fonds_euro(session)
elif args["startups"]:
Expand Down Expand Up @@ -339,7 +353,14 @@ def main() -> int: # pragma: nocover
if args["dividends"]:
result = get_portfolio_investments_dividends(session)
elif args["transactions"]:
result = get_portfolio_investments_transactions(session)
result = get_portfolio_investments_transactions(
session,
page=args["--page"],
per_page=args["--perpage"],
account_id=args["--account"],
institution_id=args["--institution"],
query=args["--query"],
)
else:
result = get_portfolio_investments(session)
elif args["timeseries"]:
Expand Down Expand Up @@ -368,7 +389,14 @@ def main() -> int: # pragma: nocover
result = get_loans(session)
elif args["credit_accounts"]:
if args["transactions"]:
result = get_portfolio_credit_accounts_transactions(session)
result = get_portfolio_credit_accounts_transactions(
session,
page=args["--page"],
per_page=args["--perpage"],
account_id=args["--account"],
institution_id=args["--institution"],
query=args["--query"],
)
elif args["real_estates"]:
result = get_user_real_estates(session)
elif args["scpis"]:
Expand Down

0 comments on commit 1c732b0

Please sign in to comment.