Mariner Backtesting - service.query_data()

service method

Query returns news data from start time to end time for symbol

Live
 service.query_data(source, symbol)

Will return all yesterday's data and all news data for today up to current time.

source: dataset name ie '!acquire_news'

symbol: Symbol to load. If set to None, all symbols will be loaded NOT CONFIRMED

Live Returns

'headLine_text' 'timestamp' (note it is GMT, see code below to adjust).

Backtesting

service.query_data(source, symbol, start_timestamp, end_timestamp)

This will return all news for yesterday for a symbol and all news up to the current timestamp if the start and end are omitted.

source: dataset name ie '!acquire_news'

start_timestamp: int64 muts timestamp (set to None for prev_close)

end_timestamp: int64 muts timestamp (None means "current time")

Backtesting Returns

'headline' 'timestamp' 'source_instructions' 'hyperlink' 'symbol' 'symbols' 'synopsis' 'provider_name' 'story_codes'

LIVE/Forward Returns

'wire_description' 'provider_name' 'hyperlink 'headLine_text' 'symbols' 'display_time' 'category' 'synopsis' timestamp' 'resource_id' 'symbol' 'story_codes'

Code
news_articles = service.query_data('!acquire_news',my_symbol)
for item in news_articles:
    headline = item['headline']
    timestamp = service.time_to_string(item['timestamp']) # for live use service.time_to_string(item['timestamp']-18000000000) to adjust from GMT
    source_instructions = item['source_instructions']
    hyperlink = item['hyperlink']
    symbol = item['symbol']
    symbols = item['symbols']
    synopsis = item['synopsis']
    provider_name = item['provider_name']
    story_codes = item['story_codes']
    print(symbol, service.time_to_string(timestamp), headline, synopsis)