Skip to main content

PyMarket

Build Status

Documentation Status

PyPI version

PyMarket is a python library designed to ease the simulation and comparison of different market mechanisms.

Marketplaces can be proposed to solve a diverse array of problems. They are used to sell ads online, bandwith spectrum, energy, etc. PyMarket provides a simple environment to try, simulate and compare different market mechanisms, a task that is inherent to the process of establishing a new market.

As an example, Local Energy Markets (LEMs) have been proposed to syncronize energy consumption with surplus of renewable generation. Several mechanisms have been proposed for such a market: from double sided auctions to p2p trading.

This library aims to provide a simple interface for such process, making results reproducible.

Getting Started

import pymarket as pm
import numpy as np

r = np.random.RandomState(1234)

mar = pm.Market()
bids = pm.datasets.uniform_bidders.generate(20, 20, 1, 1, r)
for b in bids:
    mar.accept_bid(*b)
    
mar.plot()

png

Access the bids

bids = mar.bm.get_df()
bids.head()
   quantity   price  user  buying  time  divisible
0    0.2374  1.0234     0    True     0       True
1    0.1784  1.1770     1    True     0       True
2    0.6301  1.5789     2    True     0       True
3    0.1600  1.8008     3    True     0       True
4    0.7920  1.5478     4    True     0       True

Run a market algorithm

transactions, extra = mar.run('p2p', r=r)
transactions = transactions.get_df()
transactions.head()
   bid  quantity   price  source  active
0   16    0.0000  0.0000      34    True
1   34    0.0000  0.0000      16    True
2    0    0.0000  0.0000      23    True
3   23    0.0000  0.0000       0    True
4   12    0.0786  1.3828      26   False

Documentation and Examples

Docs can be found here (click me!)

Installation

pip install pymarket

Metadata

Release files for pymarket 0.7.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymarket 0.7.6
File Size Uploaded Provenance Actions
pymarket-0.7.6.tar.gz 50.6 kB Without provenance Details for pymarket-0.7.6.tar.gz

Release files / pymarket-0.7.6.tar.gz

Download URL pymarket-0.7.6.tar.gz
Size 50.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d7147fe3d10170a60ef7b4a9266ded027ee1b77a929caf25f32f46189d67edcc
BLAKE2b-256 checksum
How to use checksums
b6d9519a9be70000b9498e2b3ce76fde1a863aab5d5de4e53cb5575808251501
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.5.7

Security for pymarket 0.7.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page