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

Class Auction

source code

object --+
         |
        Auction
Known Subclasses:

The base class Auction represents auctions in an electronic auction house. Each auction object represents an auction for a single item that has been put up for sale. Each auction has a description, a starting price and a minimum price. An auction may be open or closed. A closed auction can have a buyer or it may have expired. These features are common to all kinds of auctions. However, the specifics of how an auction's price changes as the auction proceeds, and various other implementation details will vary for different kinds of auctions (i.e., different implementations of this interface).

Every day, the method advance_one_day must be called to update an auction status. Different kinds of auctions will have different kinds of daily status changes. The way items are bought is also defined differently for each different kind of auction.

All prices and bid amounts are integers. Buyers are represented simply by their names (strings).

Instance Methods [hide private]
 
get_description(self)
Returns a description of the auction and the item being sold.
source code
 
get_starting_price(self)
Returns the starting price of the auction.
source code
 
get_price_ratio(self)
Returns a number indicating the relative "cheapness" of the item.
source code
 
matches_keyword(self, keyword)
Determines if the auction matches a given search keyword, i.e., if the auction description contains the given keyword.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

get_description(self)

source code 

Returns a description of the auction and the item being sold.

Returns:
auction description

get_starting_price(self)

source code 

Returns the starting price of the auction.

Returns:
starting price

get_price_ratio(self)

source code 

Returns a number indicating the relative "cheapness" of the item. This is obtained by dividing the current price of the item by the minimum price.

Returns:
price ratio

matches_keyword(self, keyword)

source code 

Determines if the auction matches a given search keyword, i.e., if the auction description contains the given keyword. Upper and lowercase letters are considered equal for the purposes of this matching operation.

For instance, if the auction description is "Big golden Rolex", then the keywords "rolex", "Rolex", "GOLD", "olde" and "en r" match the auction.

Parameters:
  • keyword - a search string
Returns:
a boolean value indicating if the auction matches the keyword