ACOS
real = ACOS(close)
Plot
Working Example
from cloudquant.interfaces import Strategy
from collections import OrderedDict
import ktgfunc
import talib
class WE_ACOS(Strategy):
def on_start(self, md, order, service, account):
# symbol and timestamp
print(self.symbol + ": " + service.time_to_string(service.system_time))
daily_bars = md.bar.daily(start=-100)
# normalize close prices for use with arccos
close = daily_bars.close / max(daily_bars.close)
real = talib.ACOS(close)
# get the date values
dates = service._context.market._storage.market_hours.keys()
dateList = []
for date in dates:
dateList.append(str(date.strftime('%Y-%m-%d')))
dates = sorted(dateList, reverse=True)[1:101]
dates.sort()
dict = OrderedDict()
dict['date'] = dates
dict['close'] = close
dict['real'] = real
symbol = 'ACOS: ' + self.symbol
print ktgfunc.talib_table(symbol, 1, dict)
Console
MSFT: 2017-02-09 09:30:00.000000
ACOS: MSFT | ||
---|---|---|
Input | Output | |
date | close | real |
2016-09-16 | 0.86 | 0.53 |
2016-09-19 | 0.86 | 0.54 |
2016-09-20 | 0.86 | 0.54 |
2016-09-21 | 0.87 | 0.51 |
2016-09-22 | 0.87 | 0.51 |
2016-09-23 | 0.87 | 0.52 |
2016-09-26 | 0.86 | 0.54 |
2016-09-27 | 0.88 | 0.51 |
2016-09-28 | 0.88 | 0.50 |
2016-09-29 | 0.87 | 0.52 |
2016-09-30 | 0.87 | 0.52 |
2016-10-03 | 0.87 | 0.52 |
2016-10-04 | 0.86 | 0.53 |
2016-10-05 | 0.87 | 0.51 |
2016-10-06 | 0.87 | 0.51 |
2016-10-07 | 0.87 | 0.51 |
2016-10-10 | 0.88 | 0.50 |
2016-10-11 | 0.86 | 0.53 |
2016-10-12 | 0.86 | 0.53 |
2016-10-13 | 0.86 | 0.54 |
2016-10-14 | 0.87 | 0.52 |
2016-10-17 | 0.86 | 0.53 |
2016-10-18 | 0.87 | 0.51 |
2016-10-19 | 0.87 | 0.52 |
2016-10-20 | 0.86 | 0.53 |
2016-10-21 | 0.90 | 0.45 |
2016-10-24 | 0.92 | 0.40 |
2016-10-25 | 0.92 | 0.40 |
2016-10-26 | 0.92 | 0.41 |
2016-10-27 | 0.91 | 0.43 |
2016-10-28 | 0.90 | 0.44 |
2016-10-31 | 0.90 | 0.44 |
2016-11-01 | 0.90 | 0.44 |
2016-11-02 | 0.90 | 0.46 |
2016-11-03 | 0.89 | 0.46 |
2016-11-04 | 0.89 | 0.48 |
2016-11-07 | 0.91 | 0.42 |
2016-11-08 | 0.91 | 0.42 |
2016-11-09 | 0.91 | 0.43 |
2016-11-10 | 0.89 | 0.48 |
2016-11-11 | 0.89 | 0.47 |
2016-11-14 | 0.88 | 0.50 |
2016-11-15 | 0.89 | 0.46 |
2016-11-16 | 0.91 | 0.44 |
2016-11-17 | 0.92 | 0.40 |
2016-11-18 | 0.92 | 0.41 |
2016-11-21 | 0.93 | 0.39 |
2016-11-22 | 0.93 | 0.38 |
2016-11-23 | 0.92 | 0.41 |
2016-11-25 | 0.92 | 0.40 |
2016-11-28 | 0.92 | 0.40 |
2016-11-29 | 0.93 | 0.38 |
2016-11-30 | 0.92 | 0.41 |
2016-12-01 | 0.90 | 0.45 |
2016-12-02 | 0.90 | 0.45 |
2016-12-05 | 0.92 | 0.41 |
2016-12-06 | 0.91 | 0.42 |
2016-12-07 | 0.93 | 0.37 |
2016-12-08 | 0.93 | 0.38 |
2016-12-09 | 0.94 | 0.34 |
2016-12-12 | 0.95 | 0.33 |
2016-12-13 | 0.96 | 0.29 |
2016-12-14 | 0.95 | 0.31 |
2016-12-15 | 0.95 | 0.31 |
2016-12-16 | 0.95 | 0.33 |
2016-12-19 | 0.97 | 0.26 |
2016-12-20 | 0.97 | 0.26 |
2016-12-21 | 0.97 | 0.26 |
2016-12-22 | 0.97 | 0.26 |
2016-12-23 | 0.96 | 0.28 |
2016-12-27 | 0.96 | 0.28 |
2016-12-28 | 0.96 | 0.29 |
2016-12-29 | 0.96 | 0.30 |
2016-12-30 | 0.94 | 0.33 |
2017-01-03 | 0.95 | 0.31 |
2017-01-04 | 0.95 | 0.33 |
2017-01-05 | 0.95 | 0.33 |
2017-01-06 | 0.96 | 0.30 |
2017-01-09 | 0.95 | 0.31 |
2017-01-10 | 0.95 | 0.31 |
2017-01-11 | 0.96 | 0.28 |
2017-01-12 | 0.95 | 0.31 |
2017-01-13 | 0.95 | 0.31 |
2017-01-17 | 0.95 | 0.32 |
2017-01-18 | 0.95 | 0.32 |
2017-01-19 | 0.95 | 0.33 |
2017-01-20 | 0.95 | 0.31 |
2017-01-23 | 0.96 | 0.29 |
2017-01-24 | 0.97 | 0.26 |
2017-01-25 | 0.97 | 0.25 |
2017-01-26 | 0.98 | 0.21 |
2017-01-27 | 1.00 | 0.00 |
2017-01-30 | 0.99 | 0.14 |
2017-01-31 | 0.98 | 0.19 |
2017-02-01 | 0.97 | 0.26 |
2017-02-02 | 0.96 | 0.28 |
2017-02-03 | 0.97 | 0.25 |
2017-02-06 | 0.97 | 0.26 |
2017-02-07 | 0.96 | 0.27 |
2017-02-08 | 0.96 | 0.27 |