xtrading-models
Shared trading models for the XTrading ecosystem.
Installation
pip install xtrading-models
Usage
from datetime import datetime
from xtrading_models import MarketOrder, LimitOrder, BarData
# Create a market order
order = MarketOrder(action='BUY', totalQuantity=100)
# Create bar data
bar = BarData(
date=datetime.now(),
open=100.00,
high=105.00,
low=99.00,
close=104.00,
volume=1000000
)
Models
- Order classes:
Order,LimitOrder,MarketOrder,MarketOnCloseOrder,StopOrder,StopLimitOrder,TrailingStopMarket,TrailingStopLimit - Trade lifecycle:
Trade,OrderStatus,TradeLogEntry,TradeStatusTradeStatusis astrenum:PendingSubmit,PreSubmitted,Submitted,Filled,Cancelled,Inactive- Inherits from
str— compares equal to plain string literals for backward compatibility
- Bar data:
BarData- OHLCV candlestick representation;is_close_bar: boolmarks the last bar of a trading session (used by MOC order execution)- A
slotsdataclass, not a pydantic model (since 0.13.0): ~11x less memory and ~3.5x faster to build, for code that holds millions of bars. Keyword-only; numeric fields are stored asfloat; invalid OHLC raisesValueError, a missing or non-datetimedateraisesTypeError. Copy with changes viadataclasses.replace(bar, ...)(wasbar.model_copy(update=...)).
- A
- Execution:
Execution,CommissionReport,Fill - Sentinels:
UNSET_DOUBLE,UNSET_INTEGER
License
MIT
Metadata
Release files for xtrading-models 0.13.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xtrading_models-0.13.0.tar.gz | 12.5 kB | Without provenance | Details for xtrading_models-0.13.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xtrading_models-0.13.0-py3-none-any.whl | Python 3 | none | any | Details for xtrading_models-0.13.0-py3-none-any.whl |
Total release size: 20.6 kB
Release files / xtrading_models-0.13.0.tar.gz
| Download URL | xtrading_models-0.13.0.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8ea0b4b2fa3754d3b6b919bb288b70340988c54a229276d060cdebff11f6c9b
|
|
BLAKE2b-256 checksum How to use checksums |
f7db61e830171ba43e2a890e42e1288f103c5f8b8921f773ae82f154770b15f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / xtrading_models-0.13.0-py3-none-any.whl
| Download URL | xtrading_models-0.13.0-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9d0a773ae38d5ab92b5e0dde9f24a5b7d5d474409eac951d3ea5a9e1c4028b54
|
|
BLAKE2b-256 checksum How to use checksums |
5559f294ace2e31a745480ddcabc6e153dfa468b0d67398315fbbb59175a5950
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for xtrading-models 0.13.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.
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.