Providing the TA-Lib trigonometric function (sin-cos, n cotangent, hyperbolic), rounded, logarithmic, square root mathematical transformation functions, it is based on time series vector transform.
SIN: Vector Trigonometric Sin sine function: ta.SIN (close)
COS: Vector Trigonometric Cos cosine function: ta.COS (close)
TAN: Vector Trigonometric Tan tangent function: ta.TAN (close)
ASIN: Vector Trigonometric ASIN arc sine function: ta.ASIN (close)
ACOS: Vector Trigonometric ACOS arc cosine function: ta.ACOS (close)
ATAN: Vector Trigonometric ATAN arc tangent function: ta.ATAN (close)
SINH: Vector Trigonometric Sinh hyperbolic sine function: ta.SINH (close)
COSH: Vector Trigonometric Cosh sigmoidal cosine function: ta.COSH (close)
TANH: Vector Trigonometric Tanh sigmoidal tangent function: ta.TANH (close)
CEIL: vector Ceil rounded up to an integer: ta.CEIL (close)
FLOOR: Vector Floor rounded down: ta.FLOOR (close)
EXP: Vector Arithmetic Ecp exponential curve: ta.EXP (close)
LN: Vector Log Natural natural logarithm: ta.LN (close)
LOG10: Vector log 10 of the base 10 number: ta.LOG10 (close)
SQRT: Vector Square Root Square Root: ta.SQRT (close)
import numpy as np import pandas as pd import matplotlib.pyplot as plt import talib as ta import tushare as ts plt.rcParams['font.sans-serif'] = ['SimHei'] plt.rcParams['axes.unicode_minus'] = False def get_data(code, start='2015-01-01'): df = ts.get_k_data(code, start) df.index = pd.to_datetime(df.date) df = df.sort_index() return df df = get_data('sh')[['open', 'close', 'high', 'low']] df['sin'] = ta.SIN(df.close) df['cos'] = ta.COS(df.close) df['ln'] = ta.LN(df.close) df[['close', ''without, 'cos', 'ln'] ].plot(figsize=(18,8), subplots=True, layout=(2,2)) plt.subplots_adjust(wspace=0, hspace=0.2)