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

Class AuctionHouse

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.
 
add_auction(self, new_auction)
Adds the given auction to the auction house.
 
advance_one_day(self)
Records one day as having passed.
int
get_total_worth(self)
Returns the sum of the current prices of all the items for sale in the auction house.
list of dutch/english auction objects
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.
english/dutch auction object
get_bargain_of_the_day(self)
Returns the "Bargain of the Day", the auction which has the lowest current/minimum price (or current/starting price) ratio of all the open auctions in the auction house.

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

Instance Variables [hide private]
  auctions
instance variable: list of auctions(objects) in an auction house
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

 

Creates a new auction house with no auctions.

Overrides: object.__init__

add_auction(self, new_auction)

 

Adds the given auction to the auction house.

Parameters:
  • new_auction (English or Dutch auction object) - an auction

advance_one_day(self)

 

Records one day as having passed. This is equivalent to calling auction.advance_one_day() for each of the auctions in this auction house. In other words: advances every open auction by one day

See Also: english/dutch_auction#advance_one_day()

get_total_worth(self)

 

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

Returns: int
total item worth

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. Both open and closed auctions are included.

Returns: list of dutch/english auction objects
auctions matching the keyword

See Also: matches_keyword() in Auction

get_bargain_of_the_day(self)

 

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

Returns: english/dutch auction object
bargain of the day, or None if there are no open auctions

See Also: english/dutch_auction#get_price_ratio()