This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Decide to Buy Shares Using Intraday Data from Thomson Reuters Tick History

This example shows how to connect to Thomson Reuters® Tick History and trigger a buy decision for a single Reuters® Instrument Code (RIC) using the trade price.

Create a Thomson Reuters Tick History connection by using a user name and password. The appearance of the connection object c in the MATLAB® workspace indicates a successful connection.

username = 'username';
password = 'password';
c = trth(username,password);

Retrieve intraday data for the IBM® security. Using the timeseries function, retrieve the trade price from November 6, 2017 through November 7, 2017.

sec = ["IBM.N","Ric"];
fields = ["Trade - Price"];
startdate = datetime('11/06/2017','InputFormat','MM/dd/yyyy');
enddate = datetime('11/07/2017','InputFormat','MM/dd/yyyy');

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

Display the first three rows of intraday data.

head(d,3)
ans =

  3×5 timetable

            Time             x_RIC         Domain        GMTOffset     Type       Price  
    ____________________    _______    ______________    _________    _______    ________

    06-Nov-2017 14:30:10    'IBM.N'    'Market Price'      '-5'       'Trade'    '151.68'
    06-Nov-2017 14:30:10    'IBM.N'    'Market Price'      '-5'       'Trade'    '151.66'
    06-Nov-2017 14:30:10    'IBM.N'    'Market Price'      '-5'       'Trade'    '151.73'

d is a timetable that contains these variables:

  • Transaction date and time

  • RIC

  • Domain

  • GMT time zone offset

  • Transaction type

  • Price

Assume a price threshold of $160. Determine if the trade price is less than $160. Set the buy indicator buynow to true when the threshold is met.

value = str2double(d.Price);
buynow = (value < 160);

Use the buy indicator to create a buy order of IBM shares in the trading system of your choice.

See Also

|

Related Topics

External Websites