Package auction :: Module auction_house :: Class AuctionHouse
[hide private]
[frames] | no frames]

Class AuctionHouse

source code

object --+
         |
        AuctionHouse

The class AuctionHouse represents an electronic auction house. It provides methods for adding auctions and keyword searches, among other things.

Instance Methods [hide private]
 
__init__(self)
Creates a new auction house with no auctions.
source code
 
add_auction(self, new_auction)
Adds the given auction to the auction house.
source code
 
advance_one_day(self)
Records one day as having passed.
source code
 
get_total_worth(self)
Returns the current total price of all the items for sale in the auction house.
source code
 
search(self, keyword)
Returns a list of all the auctions in this auction house which match the given keyword, in the order in which they were added to the auction house.
source code
 
get_bargain_of_the_day(self)
Returns the "Bargain of the Day", the auction which has the lowest current/minimum price ratio of all the open auctions in the auction house.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Creates a new auction house with no auctions.

Overrides: object.__init__

add_auction(self, new_auction)

source code 

Adds the given auction to the auction house.

Parameters:
  • new_auction - an auction

advance_one_day(self)

source code 

Records one day as having passed. This is equivalent to calling auction.advance_one_day() for each of the auctions in this auction house.

See Also: Dutch_auction#advance_one_day()

get_total_worth(self)

source code 

Returns the current total price of all the items for sale in the auction house. The total includes the prices of all auctions, be they open or closed.

Returns:
total item worth

search(self, keyword)

source code 

Returns a list of all the auctions in this auction house which match the given keyword, in the order in which they were added to the auction house. Both open and closed auctions are included.

Returns:
auctions matching the keyword

get_bargain_of_the_day(self)

source code 

Returns the "Bargain of the Day", the auction which has the lowest current/minimum price ratio of all the open auctions in the auction house.

Returns:
bargain of the day, or None if there are no open auctions

See Also: Dutch_auction#get_price_ratio()