Trade#

tradingstrategy.direct_feed.trade_feed.Trade Python class in Trading Strategy framework.

class Trade[source]#

Bases: object

Capture information about single trade.

Designed for technical analysis and trading, prices are not intentionally unit accurate and thus not suitable for accounting.

__init__(pair, block_number, block_hash, timestamp, tx_hash, log_index, price, amount, exchange_rate)#
Parameters:
Return type:

None

Methods

__init__(pair, block_number, block_hash, ...)

filter_buys(df)

Filter buy in trades.

filter_sells(df)

Filter buy in trades.

get_dataframe_columns()

Attributes

pair

Trading pair id.

block_number

Block number

block_hash

Block hash

timestamp

Block mined at

tx_hash

Block mined at

log_index

Trade index within the block

price

Trade price in quote token

amount

Trade amount in quote token.

exchange_rate

The US dollar conversion rate.

pair: str#

Trading pair id.

Ethereum address. Always lowercased.

block_number: int#

Block number

block_hash: str#

Block hash

timestamp: Timestamp#

Block mined at

tx_hash: str#

Block mined at

log_index: int#

Trade index within the block

price: Decimal#

Trade price in quote token

amount: Decimal#

Trade amount in quote token.

Positive for buys, negative for sells.

exchange_rate: Decimal#

The US dollar conversion rate.

You can use this to convert price and amount to US dollars.

static filter_buys(df)[source]#

Filter buy in trades.

Parameters:

df (DataFrame) –

Return type:

DataFrame

static filter_sells(df)[source]#

Filter buy in trades.

Parameters:

df (DataFrame) –

Return type:

DataFrame

__init__(pair, block_number, block_hash, timestamp, tx_hash, log_index, price, amount, exchange_rate)#
Parameters:
Return type:

None