Trade

Defined in dccd.domain.records

class Trade(*, ts, price, amount, side=None, tid=None)[source]

Bases: BaseModel

Single trade (tick).

Attributes:
tsint

Trade timestamp, nanoseconds UTC.

pricefloat

Execution price.

amountfloat

Trade size (base asset).

sideLiteral[‘buy’, ‘sell’] or None

Taker side. None when not provided by the exchange.

tidstr or None

Trade ID as string (some exchanges use non-integer IDs).

Examples

>>> t = Trade(ts=1_000_000_000_000_000_000, price=50000.0, amount=0.1, side='buy')
>>> t.price
50000.0