pymarket.datasets.uniform_bidders module

pymarket.datasets.uniform_bidders.generate(cant_buyers, cant_sellers, offset_sellers=0, offset_buyers=0, r=None, eps=0.0001)[source]

Generates random bids. All the volumes and reservation prices are sampled independently from a uniform distribution. For sellers, the reservation price is shifted offset_seller while for the buyers is shifter offset_buyers. If there are two sellers or two buyers with the same price, the reservation price of one of them is resampled until in both side of the market, all players have different values.

The maximum number of players is limited by 1/eps, although the parameter currently updates itself to allow the requested quantity of buyers and sellers.

Parameters:
  • cant_buyers (int) – Number of buyers to generate. Has to be positiv
  • cant_sellers (int) – Number of sellers to generate. Has to be positive.
  • offset_sellers (float) – Quantity to shift the reservation price of sellers
  • offset_buyers (float) – Quantity to shift the reservation price of buyers
  • r (optional, RandomState) – RandomState used to generate the data
  • eps (optional, float) – Minimum precision of the prices.
Returns:

List of tuples of all the bids generated

Return type:

bids

Examples

>>> r = np.random.RandomState(420)
>>> generate(2, 3, 1, 2, r, 0.1)
[(0.5, 2.8, 0, True, 0, True), (0.7000000000000001, 2.5, 1, True, 0, True), (0.6000000000000001, 1.2, 2, False, 0, True), (0.1, 1.7000000000000002, 3, False, 0, True), (0.2, 1.3, 4, False, 0, True)]