asynctradier.common.market_data module

class asynctradier.common.market_data.MarketData(**kwargs)[source]

Bases: object

Represents market data for a specific type.

Parameters:

**kwargs – Additional keyword arguments to initialize the market data.

type

The type of market data.

Type:

MarketDataType

data

The specific market data object based on the type.

Type:

MarketDataTrade, MarketDataQuote, MarketDataSummary, MarketDataTimesale

to_dict() dict[source]

Convert the MarketData object to a dictionary.

Returns:

A dictionary representation of the MarketData object.

Return type:

dict

to_string() str[source]

Convert the MarketData object to a string representation.

Returns:

The string representation of the MarketData object.

Return type:

str

class asynctradier.common.market_data.MarketDataQuote(**kwargs)[source]

Bases: object

Represents a market data quote. The quote event is issued when a viable quote has been created an exchange. This represents the most current bid/ask pricing available.

symbol

The symbol of the quote.

Type:

str

bid

The bid price of the quote.

Type:

float

bidsz

The bid size of the quote.

Type:

int

bidexch

The exchange where the bid was placed.

Type:

str

biddate

The date of the bid.

Type:

str

ask

The ask price of the quote.

Type:

float

asksz

The ask size of the quote.

Type:

int

askexch

The exchange where the ask was placed.

Type:

str

askdate

The date of the ask.

Type:

str

to_dict()[source]

Convert the MarketData object to a dictionary.

Returns:

A dictionary representation of the MarketData object.

Return type:

dict

to_string()[source]

Convert the MarketDataQuote object to a string representation.

Returns:

A string representation of the MarketDataQuote object.

Return type:

str

class asynctradier.common.market_data.MarketDataSummary(**kwargs)[source]

Bases: object

Represents a market data summary. The summary event is triggered when a market session high, low, open, or close event is triggered.

symbol

The symbol of the summary.

Type:

str

exch

The exchange where the summary occurred.

Type:

str

open

The opening price of the summary.

Type:

float

high

The highest price of the summary.

Type:

float

low

The lowest price of the summary.

Type:

float

prev_close

The previous closing price of the summary.

Type:

float

to_dict()[source]

Convert the MarketData object to a dictionary.

Returns:

A dictionary representation of the MarketData object.

Return type:

dict

to_string()[source]

Convert the MarketDataSummary object to a string representation.

Returns:

A string representation of the MarketDataSummary object.

Return type:

str

class asynctradier.common.market_data.MarketDataTimesale(**kwargs)[source]

Bases: object

Represents a market data timesale. Time and Sale represents a trade or other market event with price, like market open/close price, etc. Time and Sales are intended to provide information about trades in a continuous time slice (unlike Trade events which are supposed to provide snapshot about the current last trade). Timesale events are uniquely sequenced.

symbol

The symbol of the timesale.

Type:

str

exch

The exchange of the timesale.

Type:

str

bid

The bid price of the timesale.

Type:

float

ask

The ask price of the timesale.

Type:

float

last

The last price of the timesale.

Type:

float

size

The size of the timesale.

Type:

int

date

The date of the timesale.

Type:

str

seq

The sequence number of the timesale.

Type:

int

flag

The flag of the timesale. Reference: https://docs.dxfeed.com/misc/dxFeed_TimeAndSale_Sale_Conditions.htm

Type:

str

cancel

Indicates if the timesale is a cancel.

Type:

bool

correction

Indicates if the timesale is a correction.

Type:

bool

session

The session of the timesale.

Type:

str

to_dict()[source]

Convert the MarketDataTimesale object to a dictionary.

Returns:

A dictionary representation of the MarketDataTimesale object.

Return type:

dict

to_string()[source]

Convert the MarketDataTimesale object to a string representation.

Returns:

A string representation of the MarketDataTimesale object.

Return type:

str

class asynctradier.common.market_data.MarketDataTrade(**kwargs)[source]

Bases: object

Represents a market data trade. The trade event is sent for all trade events at exchanges. By default, the trade event is filtered to only include valid ticks (removing trade corrections, errors, etc).

symbol

The symbol of the trade.

Type:

str

exch

The exchange where the trade occurred.

Type:

str

price

The price of the trade.

Type:

float

size

The size of the trade.

Type:

int

cvol

The cumulative volume of the trade.

Type:

int

date

The date of the trade.

Type:

str

last

The last price of the trade.

Type:

str

to_dict()[source]

Convert the MarketData object to a dictionary.

Returns:

A dictionary representation of the MarketData object.

Return type:

dict

to_string()[source]

Convert the MarketDataTrade object to a string representation.

Returns:

A string representation of the MarketDataTrade object.

Return type:

str