Math Transform Functions数学转换函数

  TA-Lib提供了三角函数(正余弦、正余切、双曲)、取整、对数、平方根等数学转换函数,均是基于时间序列的向量变换。

SIN : Vector Trigonometric Sin 正弦函数:ta.SIN(close)

COS : Vector Trigonometric Cos 余弦函数:ta.COS(close)

TAN : Vector Trigonometric Tan 正切函数:ta.TAN(close)

ASIN : Vector Trigonometric ASIN 反正弦函数:ta.ASIN(close)

ACOS : Vector Trigonometric ACOS 反余弦函数:ta.ACOS(close)

ATAN : Vector Trigonometric ATAN 反正切函数:ta.ATAN(close)

SINH : Vector Trigonometric Sinh 双曲正弦函数:ta.SINH(close)

COSH : Vector Trigonometric Cosh 反曲余弦函数:ta.COSH(close)

TANH : Vector Trigonometric Tanh 反曲正切函数:ta.TANH(close)

CEIL : vector Ceil 向上取整数:ta.CEIL(close)

FLOOR : Vector Floor 向下取整数:ta.FLOOR(close)

EXP : Vector Arithmetic Ecp 指数曲线:ta.EXP(close)

LN : Vector Log Natural 自然对数:ta.LN(close)

LOG10 : Vector log 10 以10为底对数:ta.LOG10(close)

SQRT : Vector 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‘, ‘sin‘, ‘cos‘, ‘ln‘]
].plot(figsize=(18,8), subplots=True, layout=(2,2))
plt.subplots_adjust(wspace=0, hspace=0.2)

原文地址:https://www.cnblogs.com/wintalau/p/11618631.html

时间: 2024-08-30 16:11:50

Math Transform Functions数学转换函数的相关文章

talib 中文文档(十四):Math Transform Functions 数学变换

Math Transform Functions ACOS - Vector Trigonometric ACos 函数名:ACOS 名称:acos函数是反余弦函数,三角函数 real = ACOS(close) ASIN - Vector Trigonometric ASin 函数名:ASIN 名称:反正弦函数,三角函数 real = ASIN(close) ATAN - Vector Trigonometric ATan 函数名:ASIN 名称:数字的反正切值,三角函数 real = ATA

talib 中文文档(十五):Math Operator Functions 数学方法

Math Operator Functions 数学运算符函数 ADD - Vector Arithmetic Add 函数名:ADD 名称:向量加法运算 real = ADD(high, low) DIV - Vector Arithmetic Div 函数名:DIV 名称:向量除法运算 real = DIV(high, low) MAX - Highest value over a specified period 函数名:MAX 名称:周期内最大值(未满足周期返回nan) real = M

Javascript中,数学方法可以分成以下几类: constans(常数)、power functions(乘方函数)、trigonometic functions(三角函数)、rounding functions(舍入函数)、random numbers(随机数字)

在Javascript中,数学方法可以分成以下几类: constans(常数).power functions(乘方函数).trigonometic functions(三角函数).rounding functions(舍入函数).random numbers(随机数字) 常数和乘方函数 Math.E 自然对数的底(为常数) 2.718 Math.LN10 10的自然对数 2.302 Math.LN2 2的自然对数 0.693 Math.PI 圆周率 3.1415 Math.SQRT1_2 1/

SQl Server 函数篇 数学函数,字符串函数,转换函数,时间日期函数

数据库中的函数和c#中的函数很相似 按顺序来, 这里价格特别的 print  可以再消息栏里打印东西 数学函数 ceiling()  取上限   不在乎小数点后面有多大,直接忽略 floor()     取下限   同上 round(列名,保留的位数)   四舍五入   保留小数最后那位数进不进一只看保留位数的后一位数够不够条件,再往后的就不管了 ABS()     绝对值---防抱死233 PI()        圆周率   就是查询一个圆周率 SQRT()平方根 字符串函数 upper()

SQL Fundamentals || Single-Row Functions || 转换函数 Conversion function

SQL Fundamentals: Using Single-Row Functions to Customize Output使用单行函数自定义输出 SQL Fundamentals || Single-Row Functions || 字符函数 character functions SQL Fundamentals || Single-Row Functions || 数字函数number functions SQL Fundamentals || Single-Row Functions

Python 基础学习之: Python math 模块、cmath 模块 区别是 cmath 模块运算的是复数,math 模块运算的是数学运算 Python数学函数列表及解释 Python math 模块提供了许多对浮点数的数学运算函数。 Python cmath 模块包含了一些用于复数运算的函数

Python math 模块.cmath 模块 Python 中数学运算常用的函数基本都在 math 模块.cmath 模块中. Python math 模块提供了许多对浮点数的数学运算函数. Python cmath 模块包含了一些用于复数运算的函数. cmath 模块的函数跟 math 模块函数基本一致,区别是 cmath 模块运算的是复数,math 模块运算的是数学运算. 要使用 math 或 cmath 函数必须先导入: import math 查看 math 查看包中的内容: impo

MySQL 转换函数与运算符

Table 12.14 转换函数(Cast Function) 名称 说明 BINARY 将 string 转换为二进制 string CAST() 将某个值转换为特定类型 CONVERT() 将某个值转换为特定类型 BINARY BINARY 运算符将紧随其后的 string 转换为 二进制字符串.主要用来强制进行按字节进行比较(byte by byte),字节而不是字符的字符.这使得字符串比较是区分大小写的, 不管原始的列定义是否是 BINARY 或者 BLOB.BINARY 也对字符串末尾

3字节浮点数在C#的转换函数

单片机中,浮点数常用3字节浮点数表示 将浮点数表示成如下形式进行存储: M为尾数,0<=M<1: E为阶码,是指数部分: C为基数,二进制数的C取2. 上位机从单片机中读取到的字节数据不能直接使用,需要进行转换,以下是在C#中用到的一个转换函数 1 //将3字节浮点数据转换成float 2 static double ToSingle3(byte A, byte B, byte C) 3 { 4 double v = 0; 5 int sign0 = (A & 0x80) == 0 ?

【C/C++学院】0822-类型转换函数与构造转换函数/类的继承/类的继承以及区别/继承静态成员与静态函数//继承实现代码重用/单继承QT案例/多继承简介以及实战/Gpu编程

类型转换函数与构造转换函数 #include<iostream> class fushu { public: explicit fushu(int num)//避免隐式转换,引发歧义 { x = num; y = num; } void print() { std::cout << x << "+" << y << "i" << std::endl; } operator int(); //不支