Skip to content

base ¤

BaseTransaction ¤

BaseTransaction(
    id: str, exchange: Exchange, data: DataFeed, size: float
)

Base class of Execution/Order/Position

Parameters:

  • id (str) –

    description

  • exchange (Exchange) –

    description

  • data (DataFeed) –

    description

  • size (float) –

    description

Source code in lettrade/exchange/base.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
def __init__(
    self,
    id: str,
    exchange: "Exchange",
    data: "DataFeed",
    size: float,
) -> None:
    """_summary_

    Args:
        id (str): _description_
        exchange (Exchange): _description_
        data (DataFeed): _description_
        size (float): _description_
    """
    self.id: str = id
    self.exchange: "Exchange" = exchange
    self.data: "DataFeed" = data
    self.size: float = size

is_long property ¤

is_long: bool

True if side is long (size is positive).

Returns:

  • bool ( bool ) –

    True/False

is_short property ¤

is_short: bool

True if side is short (size is negative).

Returns:

  • bool ( bool ) –

    description

side property ¤

side: TradeSide

True if side is short (size is negative).

Returns:

OrderState ¤

Bases: str, Enum

Order state

Canceled class-attribute instance-attribute ¤

Canceled = 'canceled'

Canceled

Filled class-attribute instance-attribute ¤

Filled = 'filled'

Full filled

Partial class-attribute instance-attribute ¤

Partial = 'partial'

Partial filled, still wait for full fill

Pending class-attribute instance-attribute ¤

Pending = 'pending'

Pending order, wait for exchange accept

Placed class-attribute instance-attribute ¤

Placed = 'place'

Placed order on exchange

OrderType ¤

Bases: str, Enum

Order type

Limit class-attribute instance-attribute ¤

Limit = 'limit'

Limit order

Market class-attribute instance-attribute ¤

Market = 'market'

Market order

Stop class-attribute instance-attribute ¤

Stop = 'stop'

Stop order

StopLimit class-attribute instance-attribute ¤

StopLimit = 'stoplimit'

Stop-Limit order

PositionState ¤

Bases: str, Enum

Position state

Exit class-attribute instance-attribute ¤

Exit = 'exit'

Exited state

Open class-attribute instance-attribute ¤

Open = 'open'

Opening state

TradeSide ¤

Bases: int, Enum

Side of Trade

Buy class-attribute instance-attribute ¤

Buy = 1

Buy/Long side

Sell class-attribute instance-attribute ¤

Sell = -1

Sell/Short side