Skip to content

Accounts

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

niveshpy accounts

Wrapper group for account-related commands.

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.
  -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.
  -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]
  --offset INTEGER        Number of accounts to skip before starting to list.
                          Use with --limit for pagination.  [default: 0]
  --json
  --csv
  -o, --output-file FILE  Path to save the output file (when using
                          --csv/--json flag).
  -h, --help              Show this message and exit.

Model Reference

Account model for user financial data.

AccountCreate

Model for creating a new account.

Attributes:

Name Type Description
name str

Name of the account.

institution str

Financial institution managing the account.

properties Mapping[str, Any]

Additional properties of the account. Defaults to an empty dictionary.

AccountPublic

Public model for account data exposure.

Attributes:

Name Type Description
id int

Primary key ID of the account.

name str

Name of the account.

institution str

Financial institution managing the account.

created datetime

Timestamp when the account was created.

properties Mapping[str, Any]

Additional properties of the account.

source str | None

Optional source identifier extracted from properties.

__attrs_post_init__

__attrs_post_init__() -> None

Extract source from properties if available.

Source code in niveshpy/models/account.py
46
47
48
def __attrs_post_init__(self) -> None:
    """Extract source from properties if available."""
    object.__setattr__(self, "source", self.properties.get("source"))