Skip to content

Accounts

Accounts can refer to both physical and virtual accounts, such as your mutual fund folios, demat accounts etc.

niveshpy accounts

Manage accounts.

Usage:

niveshpy accounts [options] <command>

Options:

  -h, --help  Show this message and exit.

Subcommands

  • add: Add a new account.
  • delete: Delete an account based on a query.
  • list: List all accounts.

niveshpy accounts add

Add a new account.

To add accounts interactively, run the command without any arguments. To add a single account non-interactively, provide the account name and institution using niveshpy account add <name> <institution>.

and are used to uniquely identify the account. If an account with the same name and institution already exists, it will not be added again.

Usage:

niveshpy accounts add [options] [<name>] [<institution>]

Options:

  --no-input     Run without user input, using defaults or skipping prompts.
  -v, --version  Show the version and exit.
  -h, --help     Show this message and exit.

niveshpy accounts delete

Delete an account based on a query.

If no ID is provided, you will be prompted to select from existing accounts. The query will first attempt to match an account by its unique ID. If no exact match is found, it will search by name and institution. If multiple accounts match the provided query, you will be prompted to select one.

Associated transactions and holdings are not deleted but might no longer be visible in some reports.

When running in a non-interactive mode, --force must be provided to confirm deletion. Additionally, the must match exactly one account ID.

Usage:

niveshpy accounts delete [options] [<queries>]

Options:

  -l, --limit INTEGER  Maximum number of limit to list.  [default: 100]
  --no-input           Run without user input, using defaults or skipping
                       prompts.
  -f, --force          Force the operation without confirmation.
  -n, --dry-run        Simulate the operation without making any changes.
  -v, --version        Show the version and exit.
  -h, --help           Show this message and exit.

niveshpy accounts list

List all accounts.

An optional QUERY can be provided to filter accounts by name or institution.

Usage:

niveshpy accounts list [options] [<queries>]

Options:

  -l, --limit INTEGER  Maximum number of accounts to list.  [default: 30]
  --json
  --csv
  -v, --version        Show the version and exit.
  -h, --help           Show this message and exit.

Model Reference

Account model for user financial data.

AccountRead(id, name, institution, created_at, metadata) dataclass

Model for account data.

AccountWrite(name, institution, metadata=dict()) dataclass

Model for creating or updating account data.