量化交易/合约交易/秒合约/合约跟单系统开发(逻辑方案)及案例项目/源码功能
量化交易是指将计算机程序和系统性交易策略结合起来,使用数学模型和统计分析,The process of automatically determining the timing of trading through algorithms and automatically executing transactions.量化交易具有高效性、精确性和纪律性的特点,能够在瞬间完成决策并执行交易,Reduce human intervention and improve the accuracy and stability of trading decisions.
量化策略主要依赖于计算机算法进行交易。
投资者将初步的交易逻辑输入计算机,并运用大量的历史数据做统计和回测,在此基础上做出适当的修改、扬弃,以形成可接受的交易策略。策略在形成后,往往各个决策条件就已经确定,实盘中按照既定的程序执行。
def SMA(data,period=30):
return data['Close'].rolling(window=period).mean()
btc['SMA']=SMA(btc)
btc.tail()
#coding:utf-8
import os,sys
import time
#import matplotlib.pyplot as plt
import pandas as pd
import tushare as ts
if len(sys.argv)==2:
code=sys.argv[1]
else:
print('usage:python stock1.py stockcode')
sys.exit(1)
if len(code)!=6:
print('stock code length:6')
sys.exit(2)
#help(ts.get_k_data)了解参数
df=ts.get_k_data(code,start='2018-01-01')
if len(df)<10:
print("len(df)<10")
sys.exit(2)
df.to_csv(code+'.csv')
#数据基本统计量
df['close'].describe().to_csv(code+'.tsv',sep='t')