Mariner Backtesting - TA-LIB Vector Trigonometric ASin

ASIN

 

 real = ASIN(close)

Plot

Vector Trigonometric ASin

Working Example

 from cloudquant.interfaces import Strategy
from collections import OrderedDict
import ktgfunc
import talib

class WE_ASIN(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 arcsin
        close = daily_bars.close / max(daily_bars.close)
        real = talib.ASIN(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 = 'ASIN: ' + self.symbol
        print ktgfunc.talib_table(symbol, 1, dict)

Console

MSFT:  2017-02-09 09:30:00.000000
ASIN: MSFT
Input Output
date close real
2016-09-16 0.86 1.04
2016-09-19 0.86 1.03
2016-09-20 0.86 1.03
2016-09-21 0.87 1.06
2016-09-22 0.87 1.06
2016-09-23 0.87 1.05
2016-09-26 0.86 1.03
2016-09-27 0.88 1.07
2016-09-28 0.88 1.07
2016-09-29 0.87 1.05
2016-09-30 0.87 1.05
2016-10-03 0.87 1.05
2016-10-04 0.86 1.04
2016-10-05 0.87 1.06
2016-10-06 0.87 1.06
2016-10-07 0.87 1.06
2016-10-10 0.88 1.07
2016-10-11 0.86 1.04
2016-10-12 0.86 1.04
2016-10-13 0.86 1.03
2016-10-14 0.87 1.05
2016-10-17 0.86 1.04
2016-10-18 0.87 1.06
2016-10-19 0.87 1.05
2016-10-20 0.86 1.04
2016-10-21 0.90 1.12
2016-10-24 0.92 1.17
2016-10-25 0.92 1.17
2016-10-26 0.92 1.16
2016-10-27 0.91 1.14
2016-10-28 0.90 1.13
2016-10-31 0.90 1.13
2016-11-01 0.90 1.13
2016-11-02 0.90 1.11
2016-11-03 0.89 1.11
2016-11-04 0.89 1.09
2016-11-07 0.91 1.15
2016-11-08 0.91 1.15
2016-11-09 0.91 1.14
2016-11-10 0.89 1.09
2016-11-11 0.89 1.10
2016-11-14 0.88 1.07
2016-11-15 0.89 1.11
2016-11-16 0.91 1.14
2016-11-17 0.92 1.17
2016-11-18 0.92 1.16
2016-11-21 0.93 1.18
2016-11-22 0.93 1.19
2016-11-23 0.92 1.16
2016-11-25 0.92 1.17
2016-11-28 0.92 1.17
2016-11-29 0.93 1.19
2016-11-30 0.92 1.16
2016-12-01 0.90 1.12
2016-12-02 0.90 1.12
2016-12-05 0.92 1.16
2016-12-06 0.91 1.15
2016-12-07 0.93 1.20
2016-12-08 0.93 1.19
2016-12-09 0.94 1.23
2016-12-12 0.95 1.24
2016-12-13 0.96 1.28
2016-12-14 0.95 1.26
2016-12-15 0.95 1.26
2016-12-16 0.95 1.24
2016-12-19 0.97 1.31
2016-12-20 0.97 1.31
2016-12-21 0.97 1.31
2016-12-22 0.97 1.31
2016-12-23 0.96 1.29
2016-12-27 0.96 1.29
2016-12-28 0.96 1.28
2016-12-29 0.96 1.27
2016-12-30 0.94 1.24
2017-01-03 0.95 1.26
2017-01-04 0.95 1.24
2017-01-05 0.95 1.24
2017-01-06 0.96 1.27
2017-01-09 0.95 1.26
2017-01-10 0.95 1.26
2017-01-11 0.96 1.29
2017-01-12 0.95 1.26
2017-01-13 0.95 1.26
2017-01-17 0.95 1.26
2017-01-18 0.95 1.25
2017-01-19 0.95 1.24
2017-01-20 0.95 1.27
2017-01-23 0.96 1.28
2017-01-24 0.97 1.31
2017-01-25 0.97 1.32
2017-01-26 0.98 1.36
2017-01-27 1.00 1.57
2017-01-30 0.99 1.43
2017-01-31 0.98 1.39
2017-02-01 0.97 1.31
2017-02-02 0.96 1.29
2017-02-03 0.97 1.32
2017-02-06 0.97 1.32
2017-02-07 0.96 1.30
2017-02-08 0.96 1.30