Models#

Bar#

class alpaca.data.models.bars.Bar(symbol: str, raw_data: Dict[str, Any])#

Represents one bar/candlestick of aggregated trade data over a specified interval.

symbol#

The ticker identifier for the security whose data forms the bar.

Type

str

timestamp#

The closing timestamp of the bar.

Type

datetime

open#

The opening price of the interval.

Type

float

high#

The high price during the interval.

Type

float

low#

The low price during the interval.

Type

float

close#

The closing price of the interval.

Type

float

volume#

The volume traded over the interval.

Type

float

trade_count#

The number of trades that occurred.

Type

Optional[float]

vwap#

The volume weighted average price.

Type

Optional[float]

exchange#

The exchange the bar was formed on.

Type

Optional[float]

BarSet#

class alpaca.data.models.bars.BarSet(raw_data: Dict[str, Any])#

A collection of Bars.

data#

The collection of Bars keyed by symbol.

Type

Dict[str, List[Bar]]


Quote#

class alpaca.data.models.quotes.Quote(symbol: str, raw_data: Dict[str, Any])#

Level 1 ask/bid pair quote data. Contains information about size and origin exchange.

symbol#

The ticker identifier for the security whose data forms the quote.

Type

str

timestamp#

The time of submission of the quote.

Type

datetime

ask_exchange#

The exchange the quote ask originates. Defaults to None.

Type

Optional[str, Exchange]

ask_price#

The asking price of the quote.

Type

float

ask_size#

The size of the quote ask.

Type

float

bid_exchange#

The exchange the quote bid originates. Defaults to None.

Type

Optional[str, Exchange]

bid_price#

The bidding price of the quote.

Type

float

bid_size#

The size of the quote bid.

Type

float

conditions#

The quote conditions. Defaults to None.

Type

Optional[List[str]]

tape#

The quote tape. Defaults to None.

Type

Optional[str]

QuoteSet#

class alpaca.data.models.quotes.QuoteSet(raw_data: Dict[str, Any])#

A collection of Quotes.

data#

The collection of Quotes keyed by symbol.

Type

Dict[str, List[Quote]]


Trade#

class alpaca.data.models.trades.Trade(symbol: str, raw_data: Dict[str, Any])#

A transaction from the price and sales history of a security.

symbol#

The ticker identifier for the security whose data forms the trade.

Type

str

timestamp#

The time of submission of the trade.

Type

datetime

exchange#

The exchange the trade occurred.

Type

Optional[Exchange]

price#

The price that the transaction occurred at.

Type

float

size#

The quantity traded

Type

float

id#

The trade ID

Type

int

conditions#

The trade conditions. Defaults to None.

Type

Optional[List[str]]

tape#

The trade tape. Defaults to None.

Type

Optional[str]

TradeSet#

class alpaca.data.models.trades.TradeSet(raw_data: Dict[str, Any])#

A collection of Trade history objects.

data#

The collection of Trades keyed by symbol.

Type

Dict[str, List[Trade]]]


Snapshot#

class alpaca.data.models.snapshots.Snapshot(symbol: str, raw_data: Dict[str, Dict[str, Any]])#

A Snapshot contains the latest trade, latest quote, minute bar daily bar and previous daily bar data for a given ticker symbol.

symbol#

The identifier for the snapshot security.

Type

str

latest_trade#

The latest transaction on the price and sales tape

Type

Trade

latest_quote#

Level 1 ask/bid pair quote data.

Type

Quote

minute_bar#

The latest minute OHLC bar data

Type

Bar

daily_bar#

The latest daily OHLC bar data

Type

Bar

previous_daily_bar#

The 2nd to latest (2 trading days ago) daily OHLC bar data

Type

Bar


Orderbook#

class alpaca.data.models.orderbooks.Orderbook(symbol: str, raw_data: Dict[str, Any])#

Level 2 ask/bid pair orderbook data.

symbol#

The ticker identifier for the security whose data forms the orderbook.

Type

str

timestamp#

The time of submission of the orderbook.

Type

datetime

bids#

The list of bid quotes for the orderbook

Type

List[OrderbookQuote]

asks#

The list of ask quotes for the orderbook

Type

List[OrderbookQuote]

OrderbookQuote#

class alpaca.data.models.orderbooks.OrderbookQuote(*, p: float, s: float)#

A single bid or ask quote in the orderbook