I am using this endpoint to get time and sales for ftse350 stocks.
def get_time_and_sales(rics, query_start_date, query_end_date, max_retries=10, retry_delay=20, identifier_type: str = "Ric"):
"""
Retrieves time and sales data for given RICs from Refinitiv.
Docs: https://developers.lseg.com/en/article-catalog/article/using-tick-history-in-r-language-part-3
This method fetches historical time and sales data which includes trade information
such as price, volume, and timestamp for each trade.
Args:
rics (str or list[str]): The RIC identifier(s) for the instrument(s) (e.g., "AAPL.O" or ["AAPL.O", "MSFT.O"])
query_start_date (str): Start date in ISO format (e.g., "2024-03-01T09:30:00Z")
query_end_date (str): End date in ISO format (e.g., "2024-03-01T16:00:00Z")
max_retries (int): Maximum number of polling retries (default: 10)
retry_delay (int): Delay between polling attempts in seconds (default: 5)
Returns:
requests.Response: A streaming response containing the time and sales data in CSV format
Example:
response = get_time_and_sales("AAPL.O", "2024-03-01T09:30:00Z", "2024-03-01T16:00:00Z")
response = get_time_and_sales(["AAPL.O", "MSFT.O"], "2024-03-01T09:30:00Z", "2024-03-01T16:00:00Z")
# Process the response as needed
"""
# Handle both single RIC and list of RICs
if isinstance(rics, str):
rics = [rics]
logger.info(f"Fetching time and sales data for {rics} from {query_start_date} to {query_end_date}...")
json_blob = {
"ExtractionRequest": {
"@odata .type": "#DataScope.Select.Api.Extractions.ExtractionRequests.TickHistoryTimeAndSalesExtractionRequest",
"ContentFieldNames": [
"Trade - Price",
"Trade - Volume",
"Trade - Exchange Time",
"Trade - Exchange/Contributor ID",
"Trade - Bid Price",
"Trade - Ask Price",
"Trade - Bid Size",
"Trade - Ask Size",
"Trade - Odd-Lot Trade Price",
"Trade - Odd-Lot Trade Volume",
"Trade - Categorization of Trades",
"Trade - Display Name",
"Trade - Unique Trade Identification",
],
"IdentifierList": {
"@odata .type": "#DataScope.Select.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [
{
"Identifier": ric,
"IdentifierType": identifier_type
} for ric in rics
],
"ValidationOptions": {"AllowHistoricalInstruments": "true"},
"UseUserPreferencesForValidationOptions": "false"
},
"Condition": {
"MessageTimeStampIn": "GmtUtc",
"ReportDateRangeType": "Range",
"QueryStartDate": query_start_date,
"QueryEndDate": query_end_date
},
}
}
post_url = URL_BASE + "/Extractions/ExtractRaw"
# Make the request directly instead of using post_request_with_auth to include Content-Type header
request_response = requests.post(
post_url,
headers={
"Authorization": f"Token {get_cached_refinitiv_auth_token()}",
"Content-Type": "application/json",
"Prefer": "respond-async"
},
json=json_blob
Notice my Trade - Field list. Sometimes the data comes back with a 0 in the volume.
{'#RIC': 'CMCX.L', 'Domain': 'Market Price', 'Date-Time': '2025-10-06T07:00:27.397244106Z', 'GMT Offset': '+1', 'Type': 'Trade', 'Ex/Cntrb.ID': 'XOFF', 'LOC': '', 'Price': '220', 'Volume': '0', 'Market VWAP': '220', 'Bid Price': '220.5', 'Bid Size': '462', 'Ask Price': '228.5', 'Ask Size': '2270', 'Qualifiers': 'T[ACT_FLAG1];T[CONDCODE_1];[CONDCODE_2];N [ELIGBL_TRD];Off Book Trades[USER];"RO "[TR_TRD_FLG];46------MP----[MMT_CLASS]', 'Exch Time': '07:00:04.670000000', 'Block Trd': '', 'Open': '', 'High': '', 'Low': '', 'Acc. Volume': '3', 'Turnover': '829.2262', 'Total Volume': '', 'Changed Market': '', 'Original Volume': '', 'Display Name': '', 'Odd-Lot Trade Price': '', 'Odd-Lot Trade Volume': '', 'Source Reference': '', 'Unique Trade Identification': '584333668982510163', 'Aggressive Order Condition': '', 'Categorisation of Trades': 'RO ', 'Instrument Description': '', 'Trading Status': '', 'ISIN': ''}
Or it's ''. I assume in these instances a trade has occurred but it's fractional. How do I get it?
Is there a config I need to change to get decimals? Is there a field I can add to my API call to get the decimals?