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
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>.
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
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
-h, --help Show this message and exit.
Model Reference¶
Account model for user financial data.
Account
¶
Bases: AccountBase
Database model for investment accounts.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int | None
|
Primary key ID of the account. None if not yet stored in DB. |
name |
str
|
Name of the account. |
institution |
str
|
Financial institution managing the account. |
properties |
dict[str, Any]
|
Additional properties of the account. |
created_at |
datetime
|
Timestamp when the account was created. |
AccountBase
¶
Bases: SQLModel
Base model for investment accounts.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the account. |
institution |
str
|
Financial institution managing the account. |
properties |
dict[str, Any]
|
Additional properties of the account. Defaults to an empty dictionary. |
__init_subclass__
¶
__init_subclass__(**kwargs)
Ensure subclasses inherit schema extra metadata.
Source code in niveshpy/models/account.py
29 30 31 | |
AccountCreate
¶
Bases: AccountBase
Model for creating a new account.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Name of the account. |
institution |
str
|
Financial institution managing the account. |
properties |
dict[str, Any]
|
Additional properties of the account. Defaults to an empty dictionary. |
AccountPublic
¶
Bases: AccountBase
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_at |
datetime
|
Timestamp when the account was created. |
properties |
dict[str, Any]
|
Additional properties of the account. |