Mariner Backtesting - TA-LIB Vector Trigonometric Sinh

SINH

 

 real = SINH(close)

Plot

Vector Trigonometric Sinh

Working Example

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

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

Console

MSFT:  2017-02-09 09:30:00.000000
SINH: MSFT
Input Output
date close real
2016-09-16 56.87 2485837283424112039952384.00
2016-09-19 56.55 1809066422024852297744384.00
2016-09-20 56.43 1605779427186819173711872.00
2016-09-21 57.37 4125589687222473771188224.00
2016-09-22 57.43 4378953610462607697772544.00
2016-09-23 57.04 2972525796744654269448192.00
2016-09-26 56.52 1755950855558429182787584.00
2016-09-27 57.56 4982394474665613811777536.00
2016-09-28 57.64 5394656273877045488910336.00
2016-09-29 57.01 2885250177890689143013376.00
2016-09-30 57.21 3519474061660062186733568.00
2016-10-03 57.03 2943234285838635787878400.00
2016-10-04 56.86 2461351029993576985526272.00
2016-10-05 57.25 3662006124101379192520704.00
2016-10-06 57.35 4044713360134332817080320.00
2016-10-07 57.41 4293110443460219677704192.00
2016-10-10 57.65 5448344705627380066025472.00
2016-10-11 56.81 2342008062406537999548416.00
2016-10-12 56.73 2163245410256198649774080.00
2016-10-13 56.54 1791062084241424998465536.00
2016-10-14 57.03 2943234285838635787878400.00
2016-10-17 56.84 2412851209587950639644672.00
2016-10-18 57.27 3735614740595203681288192.00
2016-10-19 57.14 3283177142798303958663168.00
2016-10-20 56.87 2485837283424112039952384.00
2016-10-21 59.26 27235230188300537157386240.00
2016-10-24 60.59 103080355006718503647444992.00
2016-10-25 60.58 102054859632756478724538368.00
2016-10-26 60.22 71379616064424840043429888.00
2016-10-27 59.70 42161675183075292602171392.00
2016-10-28 59.47 33552469031586604884426752.00
2016-10-31 59.52 35258588576921547098292224.00
2016-11-01 59.40 31296657468325435132608512.00
2016-11-02 59.03 21671780934803520009273344.00
2016-11-03 58.81 17418083564278595251601408.00
2016-11-04 58.32 10599559881817908794359808.00
2016-11-07 60.01 57940083530843021736148992.00
2016-11-08 60.06 60886528452142067208945664.00
2016-11-09 59.77 45196136470570615646978048.00
2016-11-10 58.31 10495110956860792989810688.00
2016-11-11 58.62 14422812246905988694671360.00
2016-11-14 57.73 5899160955221261684834304.00
2016-11-15 58.87 18445298597806928063102976.00
2016-11-16 59.65 40238011696979869714874368.00
2016-11-17 60.64 108289692845716664213307392.00
2016-11-18 60.35 81029157716279496395456512.00
2016-11-21 60.86 134937431135945640873295872.00
2016-11-22 61.12 175004120518746463537201152.00
2016-11-23 60.40 85183871430967381723185152.00
2016-11-25 60.53 97009544142024318386176000.00
2016-11-28 60.61 105089377034318219172642816.00
2016-11-29 61.09 169832174424541855226003456.00
2016-11-30 60.26 74055062853261903045591040.00
2016-12-01 59.20 25656869448635153641373696.00
2016-12-02 59.25 26972304696599949420265472.00
2016-12-05 60.22 71151528585248104167505920.00
2016-12-06 59.95 54315593048989841638817792.00
2016-12-07 61.37 224709738771155163189084160.00
2016-12-08 61.01 156774569290608120495603712.00
2016-12-09 61.97 409448776798566914830893056.00
2016-12-12 62.17 500100339119631675131166720.00
2016-12-13 62.98 1124181090273363028420329472.00
2016-12-14 62.68 832814470407120661034041344.00
2016-12-15 62.58 753562844950936523481546752.00
2016-12-16 62.30 569529069022055481705758720.00
2016-12-19 63.62 2131986641317851473735843840.00
2016-12-20 63.54 1968075622833180505534365696.00
2016-12-21 63.54 1968075622833180505534365696.00
2016-12-22 63.55 1987851775130930345257467904.00
2016-12-23 63.24 1457987393430020790295724032.00
2016-12-27 63.28 1517484588266589374145101824.00
2016-12-28 62.99 1135481723711536624012623872.00
2016-12-29 62.90 1037751999257101280045170688.00
2016-12-30 62.14 485320732856914510631403520.00
2017-01-03 62.58 753562844950936523481546752.00
2017-01-04 62.30 569529069022055481705758720.00
2017-01-05 62.30 569529069022055481705758720.00
2017-01-06 62.84 977316685415340546835087360.00
2017-01-09 62.64 800158615372969541212569600.00
2017-01-10 62.62 784314054192991411525124096.00
2017-01-11 63.19 1386876276764763869904109568.00
2017-01-12 62.61 776511302308251697428824064.00
2017-01-13 62.70 849638827636718037448523776.00
2017-01-17 62.53 716808963797106950588596224.00
2017-01-18 62.50 695624906475415508537573376.00
2017-01-19 62.30 569529069022055481705758720.00
2017-01-20 62.74 884314055589813238779346944.00
2017-01-23 62.96 1101920308823290002190368768.00
2017-01-24 63.52 1929104231394411242066018304.00
2017-01-25 63.68 2263824441385419532610306048.00
2017-01-26 64.27 4083898111044877686654631936.00
2017-01-27 65.78 18486746832018322387506298880.00
2017-01-30 65.13 9650913383568864272214654976.00
2017-01-31 64.65 5971850431955211763830489088.00
2017-02-01 63.58 2048396188032031748838653952.00
2017-02-02 63.17 1359413664235100960643350528.00
2017-02-03 63.68 2263824441385419532610306048.00
2017-02-06 63.64 2175056624053293484999704576.00
2017-02-07 63.43 1763068247687150368555270144.00
2017-02-08 63.34 1611322807454417595031093248.00