Add your description here
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rs_trader-0.2.0.tar.gz.
File metadata
- Download URL: rs_trader-0.2.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06799366f0cb977ef56bcb983fd4ac3bcc964dbc81fcf1318f224beb55c79faa
|
|
| MD5 |
97460dced320564bce7714f744d0c1f2
|
|
| BLAKE2b-256 |
5299e118c699289eac8b7f25e679377b2828def558dfafb3052e8110d8b1534f
|
Provenance
The following attestation bundles were made for rs_trader-0.2.0.tar.gz:
Publisher:
python-package.yml on extreme4all/rs_trader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rs_trader-0.2.0.tar.gz -
Subject digest:
06799366f0cb977ef56bcb983fd4ac3bcc964dbc81fcf1318f224beb55c79faa - Sigstore transparency entry: 152327696
- Sigstore integration time:
-
Permalink:
extreme4all/rs_trader@2dc29641067bdb68aa3a683d3ffd942b37d4d8d3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/extreme4all
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@2dc29641067bdb68aa3a683d3ffd942b37d4d8d3 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file rs_trader-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rs_trader-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cb17c9d8cc50e76eb8fd761cef7f8cda4356cc31582b3fe7aac0942271af95f
|
|
| MD5 |
0470c2bab6a545ca404845fe9ffe09bc
|
|
| BLAKE2b-256 |
eb5faee381509bb1f7c6a685f94de6e5c73edf9c52cc88286c582e6e503f74fb
|
Provenance
The following attestation bundles were made for rs_trader-0.2.0-py3-none-any.whl:
Publisher:
python-package.yml on extreme4all/rs_trader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rs_trader-0.2.0-py3-none-any.whl -
Subject digest:
6cb17c9d8cc50e76eb8fd761cef7f8cda4356cc31582b3fe7aac0942271af95f - Sigstore transparency entry: 152327698
- Sigstore integration time:
-
Permalink:
extreme4all/rs_trader@2dc29641067bdb68aa3a683d3ffd942b37d4d8d3 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/extreme4all
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@2dc29641067bdb68aa3a683d3ffd942b37d4d8d3 -
Trigger Event:
workflow_dispatch
-
Statement type: