Keeping accounts

Turberfield provides the ability to:

Credit transactions

The Accounts class gives you a simple way of recording goods exchange on credit (between a merchant and miner in this example).

Accounts.credit.ledger contains a sequence of transactions between two parties. The first index supplied to the ledger is the giver of the goods, the second is the recipient. Think of it therefore as the book of credit on the seller’s countertop.

accounts = Accounts()
accounts.credit.ledger[merchant, miner].append(
    GoodsOnCredit(
        240000,
        Resource(Commodity.FOOD, Mass.Kg, 120),
        CreditRelationship.welcome)
    )
accounts.credit.ledger[miner, merchant].append(
    GoodsOnCredit(
        240000,
        Resource(Commodity.STON, Mass.Kg, 120),
        CreditRelationship.established)
    )

GoodsOnCredit is a data structure defined for use in this way. It contains a timestamp, information on the current nature of the credit relationship as well as details of the items dispatched.

Currencies

Banking

Reference

class turberfield.common.accounts.GoodsOnCredit[source]
at
a timestamp (integer or datetime)
resource
a Resource
status: an enum.Enum
a CreditRelationship
class turberfield.eargain.types.CreditRelationship[source]
established = None

Established customer under credit control

welcome = None

A new customer with favourable credit

class turberfield.common.accounts.Accounts(columns=None, ref=None)[source]

The accounts in Turberfield are a shareable object. You need to define it once in your main module:

accounts = Accounts(columns, ref)

Elsewhere, you can grab a readable copy like this:

accounts = Accounts()