Skip to main content

Economic agent-based models with financial accounting

abcFinance (short for 'agent-based computational Finance') provides tools for using standard double-entry bookkeeping methods either directly or within an agent-based modelling framework. It is a sister library to the abcEconomics (agent-based computational Economics) library.

Direct use of double-entry bookkeeping tools

The Ledger class implements an accounting system. Booking statements are recorded through the book() method. The basic syntax works as follows:

accountingsystem = Ledger()
accountingsystem.make_stock_accounts('Assets', 'Liabilities')
accountingsystem.book(debit=[('Assets',100)], credit=[('Liabilities',100)]

where debit and credit are lists of tuples ('account', amount) of accounts that should be booked by amount on the debit and credit side, respectively. The total sum of debits and credits needs to be equal in one booking statement. Accounts have to be declared as either stock or flow accounts before they can be booked.

The balance sheet is composed of all stock accounts and includes an equity account whose name can be set using the optional residual_account_name flag in the constructor of Ledger. The profit and loss statement is composed of all flow accounts. It can be viewed using the print_profit_and_loss() statement. The profit or loss for the period can be booked against equity using the book_end_of_period() method, which also resets all flow accounts. The balance sheet can be printed using the print_balance_sheet() method. draw_balance_sheet() returns the string representation of an SVG image of the balance sheet. Several other helpful methods are available.

Extensive examples can be found in the examples\money_creation folder.

Use in an agent-based modelling system

The Ledger class can be used as an attribute for an Agent class in an agent-based modelling system, enabling the use of financial accounting within agent-based models. One implementation is provided in the form of the AbcFinanceAgent class, which inherits from the Agent class in the abcEconomics library. abcEconomics is designed to be compatible with abcFinance and provides several methods to facilitate the use of abcFinance methods in agent-based models. The accounting system provided in abcFinance can in principle be used with any agent-based modelling system.

Release files for abcFinance 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for abcFinance 0.1.1
File Size Uploaded
abcFinance-0.1.1.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for abcFinance 0.1.1
File Interpreter ABI Platform
abcFinance-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 20.2 kB

Release files / abcFinance-0.1.1.tar.gz

Download URL abcFinance-0.1.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f0184c61de1dcf0234eed972ca8faf8aa806178bce62ea304157e323084a1e80
BLAKE2b-256 checksum
How to use checksums
5d0f50d2c0948ebcd504da3f49223e7aebddec730b9a2fbf6bfaeff1de4ff760
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.5

Release files / abcFinance-0.1.1-py3-none-any.whl

Download URL abcFinance-0.1.1-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb3d03838ab491159e7d06e0684ee9f4a5cded465f004ef8503b5631f4027562
BLAKE2b-256 checksum
How to use checksums
1f23c02d4d04140c1199b4ea3e7d83ccb47a480bad3ab6bc26e38f6159f03f54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page