This example shows how to connect to Wind Data Feed Services (WDS) and retrieve current and historical WDS data. The example then shows how to trigger a buy decision for a single security using the current high price. This example requires that you open and log in to the Wind Financial Terminal.
c = wind;
Format output data for currency.
0001.HK security, retrieve the current high and low prices.
s = '0001.HK'; f = ["high","low"]; d = getdata(c,s,f)
d=1×2 table HIGH LOW _____ _____ 0001.HK 99.00 97.70
d is a table with one row for the single security. Each variable in the table corresponds to each specified field.
Using the same security, retrieve the high and low prices from August 1, 2017 through August 30, 2017.
f = ["high","low"]; startdate = datetime('2017-08-01'); enddate = datetime('2017-08-30'); h = history(c,s,f,startdate,enddate);
h is a timetable that contains one row for each trading day with the time and a variable for each specified field.
To create a threshold, you can analyze the historical data for the maximum and minimum high price.
ans = 108.9000
ans = 100.7000
Assume a threshold of $100. Determine if the current high price is less than $100. Set the buy indicator
true when the threshold is met.
buynow = (d.HIGH < 100);
Use the buy indicator and the
createorder function to create a buy order of