What is a quantitative trading robot?
In essence,the trading robot is a software program that directly interacts with the financial exchange(usually uses API to obtain and interpret relevant information),and issues trading orders according to the interpretation of market data.These robots make these decisions by monitoring the market price trend and responding to a set of preset and programmed rules.Generally,a trading robot will analyze market behavior,such as trading volume,order,price and time.They can usually be programmed according to your own preferences.
自动交易机器人在云服务器上24小时运行。初始化设置参数之后,机器人将按照策略进行自动交易。达到设定条件自动买入或者卖出,无须长时间盯盘。机器人内置多种交易策略,满足不同的类型。设置策略后,机器人将智能分配每次进单的条件,严格执行交易策略,交易补单策略,根据当前行情,云大数据实时调整。
import os
import pandas as pd
import tushare as ts
import numpy as np
from pathlib import Path
import matplotlib.pyplot as plt
import mplfinance as mpf
import matplotlib as mpl
from cycler import cycler#用于定制线条颜色
import time
#分红
def dividend(ts_code):
df=pro.dividend(ts_code=ts_code)
df.to_csv(dividend.csv,encoding=utf_8_sig)
#画市柱状图【更全面的开发源码搭建可看我昵称】
def draw_finance(ts_codes,begin_count,end_count=-1):
df=load_data(ts_codes)
fig=plt.figure()
ax=fig.add_subplot(111)
opens=df[open].values[begin_count:end_count]
closes=df[close].values[begin_count:end_count]
highs=df[high].values[begin_count:end_count]
lows=df[low].values[begin_count:end_count]
dates=df[trade_date].values[begin_count:end_count]
vols=df[vol].values[begin_count:end_count]
data=[dates,opens,closes,highs,lows,vols]
data=np.transpose(data)#矩阵转置
df=pd.DataFrame(data,columns=[Date,Open,Close,High,Low,Volume])
df[Date]=pd.to_datetime(df[Date])
df.set_index([Date],inplace=True)
#df.index.name=Date
#设置基本参数
#type:绘制图形的类型,有candle,renko,ohlc,line等
#此处选择candle,即K线图【更全面的开发源码搭建可看我昵称】
#mav(moving average):均线类型,此处设置7,30,60日线
#volume:布尔类型,设置是否显示成交量,默认False
#title:设置标题
#y_label:设置纵轴主标题
#y_label_lower:设置成交量图一栏的标题