question

Upvotes
Accepted
1 0 0 0

Matlab TRTH Timeseries - Getting two days of data when requesting a year

I am using Matlab to connect to the Datascope API (TRTH). When I try to pull a year's worth of timeseries, intraday data using the below code, I get back two days of data rather than the requested year's worth. I am not specifying an interval in order to get back unaggregated results. I have tried putting in two digits on month and day instead of one (e.g. 06/01/2023) where I had used one prior without any changes to the results. I have added an interval to see if that is required, which did not change the results.

Below is the code I am using:

username = '*username*';

password = '*password*';


c = trth(username,password);


% Importing table with RICs, start dates, and end dates

T = readtable("../input/HistoricalSearchResults_ric.csv");


ric_labels = T.RIC;

ric_start = T.FirstDate;

ric_end = T.LastDate;


% Pulling all RICs

for let_num = 1:length(ric_labels)

security = ric_labels(let_num);

disp(security);


sec = [security,"Ric"];

fields = ["Trade - Price";"Trade - Volume";"Trade - Market VWAP";"Trade - Bid Price";...

"Trade - Bid Size";"Trade - Ask Price";"Trade - Ask Size";"Trade - Qualifiers";...

"Trade - Sequence Number";"Trade - Exchange Time";"Trade - Date";"Trade - Tick Direction";...

"Trade - Open";"Trade - High";"Trade - Low";"Trade - Accumulated Volume";"Trade - Percent Change";...

"Trade - Unique Trade Identification";"Trade - Aggressive Order Condition";"Trade - Net Change"];


startdate = datetime(ric_start(let_num),'InputFormat','MM/dd/yyyy');

enddate = datetime(ric_end(let_num),'InputFormat','MM/dd/yyyy');


d1 = timeseries(c,sec,fields,startdate,enddate);


path = strcat("../output/",security,".csv");


writetimetable(d1,path);

#productdatascope-selectapitick-history-rest-apitick-datatimeseriesmatlab
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
24.8k 64 15 21

Hi @fm1554,

Matlab Datafeed toolbox is developed and supported by Matlab.

Its best to ask this question at Matlab support forums.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.