Trades
Fetching Trades
Retrieve a list of trades with optional filters using the get_trades() method:
trades = client.get_trades(
instrument_id=instrument_id,
instrument_name=instrument_name,
instrument_type=instrument_type,
strike_price=strike_price,
expiration_timestamp=expiration_timestamp,
option_type=option_type,
limit=limit,
offset=offset
)
Parameters:
instrument_id(Optional[Union[int, List[int]]]): Filter by instrument ID (default is None)instrument_name(Optional[Union[str, List[str]]]): Filter by instrument name (default is None)instrument_type(Optional[Union[str, List[str]]]): Filter by instrument type (default is None)strike_price(Optional[Union[float, List[float]]]): Filter by strike price (default is None)expiration_timestamp(Optional[Union[str, List[str]]]): Filter by expiration timestamp (default is None)option_type(Optional[Union[str, List[str]]]): Filter by option type (default is None)limit(Optional[int]): Limit the number of results (default is None)offset(Optional[int]): Offset the results (default is None)
The returned list contains Trade objects with the following attributes:
created_at: The timestamp when the trade was created, as a stringinstrument: The instrument associated with the trade, as anInstrumentobjectprice: The price of the trade, as a floatquantity: The quantity of the trade, as a floatorder_type(Optional): The type of order associated with the trade, as anOrderTypeenumorder_side(Optional): The side of the order associated with the trade, as anOrderSideenumpnl(Optional): The profit and loss of the trade, as a floatfees(Optional): The fees of the trade, as a floatis_maker(Optional): Indicates whether the trade was a maker or not, as a booleantaker_side(Optional): The side of the taker order associated with the trade, as anOrderSideenum
Fetching All Trades
Retrieve a list of all trades across instruments with optional filters using the get_all_trades() method:
all_trades = client.get_all_trades(
instrument_id=instrument_id,
instrument_name=instrument_name,
instrument_type=instrument_type,
strike_price=strike_price,
expiration_timestamp=expiration_timestamp,
option_type=option_type,
limit=limit,
offset=offset
)
Parameters:
Same as get_trades() method.
The returned list contains Trade objects with the same attributes as described in the get_trades() section.
Updated almost 3 years ago
