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[Union[List[str], 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:

Optional[int]

conditions#

The trade conditions. Defaults to None.

Type:

Optional[Union[List[str], 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:

Optional[Trade]

latest_quote#

Level 1 ask/bid pair quote data.

Type:

Optional[Quote]

minute_bar#

The latest minute OHLC bar data

Type:

Optional[Bar]

daily_bar#

The latest daily OHLC bar data

Type:

Optional[Bar]

previous_daily_bar#

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

Type:

Optional[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


ActiveStock#

class alpaca.data.models.screener.ActiveStock(*, symbol: str, volume: float, trade_count: float)#

Represent one asset that was a most active on the most actives endpoint.

symbol#

Symbol of market moving asset.

Type:

str

volume#

Cumulative volume for the current trading day.

Type:

float

trade_count#

Cumulative trade count for the current trading day.

Type:

float

MostActives#

class alpaca.data.models.screener.MostActives(*, most_actives: List[ActiveStock], last_updated: datetime)#

Represent the response model for the MostActives endpoint. .. attribute:: most_actives

list of top N most active symbols.

type:

List[ActiveStock]

last_updated#

Time when the MostActives were last computed. Formatted as a RFC 3339 formatted datetime with nanosecond precision.

Type:

datetime

Mover#

class alpaca.data.models.screener.Mover(*, symbol: str, percent_change: float, change: float, price: float)#

Represent one asset that was a top mover on the top market movers endpoint. .. attribute:: symbol

Symbol of market moving asset.

type:

str

percent_change#

Percentage difference change for the day.

Type:

float

change#

Difference in change for the day.

Type:

float

price#

Current price of market moving asset.

Type:

float

Movers#

class alpaca.data.models.screener.Movers(*, gainers: List[Mover], losers: List[Mover], market_type: MarketType, last_updated: datetime)#

Represent the response model for the top market movers endpoint. .. attribute:: gainers

list of top N gainers.

type:

List[Mover]

losers#

list of top N losers.

Type:

List[Mover]

market_type#

Market type (stocks or crypto).

Type:

MarketType

last_updated#

Time when the movers were last computed. Formatted as a RFC 3339 formatted datetime with nanosecond precision.

Type:

datetime