Quote

class abce.Quote[source]

Bases: object

Quotes as opposed to trades are uncommitted offers. They can be made even if they agent can not fullfill them. With accept_quote() and accept_quote_partial(), the receiver of a quote can transform them into a trade.

accept_quote(quote)[source]

makes a commited buy or sell out of the counterparties quote. For example, if you receive a buy quote you can accept it and a sell offer is send to the offering party.

Args::
quote: buy or sell quote that is accepted
accept_quote_partial(quote, quantity)[source]

makes a commited buy or sell out of the counterparties quote

Args::
quote: buy or sell quote that is accepted quantity: the quantity that is offered/requested it should be less than propsed in the quote, but this is not enforced.
get_quotes(good, descending=False)[source]

self.get_quotes() returns all new quotes and removes them. The order is randomized.

Args:
good:
the good which should be retrieved
descending(bool,default=False):
False for descending True for ascending by price
Returns:
list of quotes ordered by price

Example:

quotes = self.get_quotes()
get_quotes_all(descending=False)[source]

self.get_quotes_all() returns a dictionary with all now new quotes ordered by the good type and removes them. The order is randomized.

Args:
descending(bool,default=False):
False for descending True for ascending by price
Returns:
dictionary of list of quotes ordered by price. The dictionary itself is ordered by price.

Example:

quotes = self.get_quotes()
quote_buy(receiver_group, receiver_id, good=None, quantity=None, price=None)[source]

quotes a price to buy quantity of ‘good’ a receiver. Use None, if you do not want to specify a value.

price (money) per unit offers a deal without checking or committing resources

Args:
receiver_group:
agent group name of the agent
receiver_id:
the agent’s id number
‘good’:
name of the good
quantity:
maximum units disposed to buy at this price
price:
price per unit
quote_sell(receiver_group, receiver_id, good=None, quantity=None, price=None)[source]

quotes a price to sell quantity of ‘good’ to a receiver. Use None, if you do not want to specify a value.

price (money) per unit offers a deal without checking or committing resources

Args:
receiver_group:
agent group name of the agent
receiver_id:
the agent’s id number
‘good’:
name of the good
quantity:
maximum units disposed to sell at this price
price:
price per unit
abce.Offer()

This is an offer container that is send to the other agent. You can access the offer container both at the receiver as well as at the sender, if you have saved the offer. (e.G. self.offer = self.sell(...))

it has the following properties:
sender_group:
this is the group name of the sender
sender_id:
this is the ID of the sender
receiver_group:
This is the group name of the receiver
receiver_id:
this is the ID of the sender
good:
the good offered or demanded
quantity:
the quantity offered or demanded
price:
the suggested tansaction price
buysell:
this can have the values ‘b’ for buy; ‘s’ for sell; ‘qb’ for a nonbinding buy quote; and ‘qs’ for a nonbinding sell quote
status:
‘new’:
has been created, but not answered
‘accepted’:
trade fully accepted
‘rejected’:
trade rejected
‘pending’:
offer has not yet answered, and is not older than one round.
‘perished’:
the perishable good was not accepted by the end of the round and therefore perished.
final_quantity:
If the offer has been answerd this returns the actual quantity bought or sold. (Equal to quantity if the offer was accepted fully)
id:
a unique identifier