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 Sell Shares Using Historical Data from Thomson Reuters Tick History

This example shows how to connect to Thomson Reuters® Tick History and trigger a sell decision for a single Reuters® Instrument Code (RIC) using the closing 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 historical data for the IBM® security. Using the history function, retrieve the closing price from November 6, 2017 through November 7, 2017.

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

d = history(c,sec,fields,startdate,enddate);
  2×1 timetable

       Time        Last 
    __________    ______

    2017/11/06    150.84
    2017/11/07    151.35

Assume a price threshold of $150. Determine if the closing price is greater than $150. Set the sell indicator sellnow to true when the threshold is met.

sellnow = (d.Last > 150);

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

See Also


Related Topics

External Websites