Skip to main content

rs_trader

from rs_trader import Exchange
from rs_trader.interfaces import DatabaseInterface
from rs_trader.storage import JsonDatabase
from rs_trader.structs import Order, OrderStatus, OrderType

# Initialize the database and exchange
database = JsonDatabase()
exchange = Exchange(database=database)

# Place a sell order
exchange.place_order(
    Order(user_id=2, item_id=123, order_type=OrderType.SELL, quantity=1000, price=1)
)
exchange.place_order(
    Order(user_id=2, item_id=123, order_type=OrderType.SELL, quantity=100, price=3)
)

# Place a buy order
buy_order = Order(user_id=1, item_id=123, order_type=OrderType.BUY, quantity=150, price=5)
exchange.place_order(buy_order)

orders = exchange.get_orders(item_id=123)
_ = [print(o, database.get_order_remaining_quantity(o.order_id)) for o in orders]

order_parts = exchange.get_order_parts(order_id=buy_order.order_id)
_ = [print(o)for o in order_parts]

median_price = exchange.get_median_price(item_id=123)
print(median_price)

Metadata

Release files for rs-trader 0.2.0

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

Source distribution (sdist)

Source distribution for rs-trader 0.2.0
File Size Uploaded Provenance Actions
rs_trader-0.2.0.tar.gz 5.9 kB With provenance Details for rs_trader-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rs-trader 0.2.0
File Interpreter ABI Platform Actions
rs_trader-0.2.0-py3-none-any.whl Python 3 none any Details for rs_trader-0.2.0-py3-none-any.whl

Total release size: 12.6 kB

Release files / rs_trader-0.2.0.tar.gz

Download URL rs_trader-0.2.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
06799366f0cb977ef56bcb983fd4ac3bcc964dbc81fcf1318f224beb55c79faa
BLAKE2b-256 checksum
How to use checksums
5299e118c699289eac8b7f25e679377b2828def558dfafb3052e8110d8b1534f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2024.

Transparency log

Release files / rs_trader-0.2.0-py3-none-any.whl

Download URL rs_trader-0.2.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cb17c9d8cc50e76eb8fd761cef7f8cda4356cc31582b3fe7aac0942271af95f
BLAKE2b-256 checksum
How to use checksums
eb5faee381509bb1f7c6a685f94de6e5c73edf9c52cc88286c582e6e503f74fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2024.

Transparency log

Security for rs-trader 0.2.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rs_trader-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2024.

Transparency log

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