Keeping accounts¶
Turberfield provides the ability to:
- record credit transactions
- convert between currencies
- perform banking functions.
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