pymarket.bids.bids module

class pymarket.bids.bids.BidManager[source]

Bases: object

A class used to store and manipulate a collection of all the bids in the market.


Column names for the different attributes in the dataframe to be created. Currently and in order: quantity, price, user, buying, time, divisible.

Type:list of str

Number of bids currently stored. Used as a unique identifier for each bid within a BidManager.


A list where all the recieved bids are stored.

Type:list of tuple
add_bid(quantity, price, user, buying=True, time=0, divisible=True)[source]

Appends a bid to the bid list

  • quantity (float) – Quantity of good desired. If divisible=True then any fraction of the good is an acceptable outcome of the market.
  • price (float) – Uniform price offered in the market for each unit of the the good.
  • user (int) – Identifier of the user submitting the bid.
  • buying (bool) – True if the bid is for buying the good and False`otherwise. Default is `True.
  • time (float) – Instant at which the offer was made. This is relevant only if the market mechanism has perferences for earlier bids. Default is 0
  • divisible (bool) – True is the user accepts a fraction of the asked quantity as a result and False otherwise.

Unique identifier of the added bid.

Return type:



>>> bm = pm.BidManager()
>>> bm.add_bid(2, 1, 0)
col_names = ['quantity', 'price', 'user', 'buying', 'time', 'divisible']

Creates a dataframe with the bids

Returns:Dataframe with each row a different bid and each column each of the different attributes.
Return type:pd.DataFrame


>>> bm = pm.BidManager()
>>> bm.add_bid(2, 1, 0)
>>> bm.add_bid(1, 3, 1, buying=False)
>>> print(bm.get_df())
   quantity  price  user  buying  time  divisible
0         2      1     0    True     0       True
1         1      3     1   False     0       True