對接API火幣/幣安/OK/歐易交易所合約跟單系統(tǒng)開發(fā)成熟方案/案例詳細/項目開發(fā)/源碼版
現(xiàn)貨合約量化交易所機器人系統(tǒng)是指通過計算機程序實現(xiàn)自動化交易的系統(tǒng),它可以根據事先設定的交易策略和規(guī)則進行自動交易。
策略設計:在開發(fā)量化交易機器人系統(tǒng)前,需要制定一個可行的交易策略,Including factors such as buying and selling points,stop loss points,etc.Only in this way can corresponding robot systems be developed based on strategies.
數(shù)據獲取與處理:In transaction robot systems,data acquisition is very important.main要獲取市場行情數(shù)據、技術指標數(shù)據、基本面數(shù)據等,以便于對市場趨勢的分析。
mc=mpf.make_marketcolors(
up='red',
down='green',
edge='i',
wick='i',
volume='in',
inherit=True)
#設置圖形風格
#gridaxis:設置網格線位置
#gridstyle:設置網格線線型
#y_on_right:設置y軸位置是否在右
s=mpf.make_mpf_style(
gridaxis='both',
gridstyle='-.',
y_on_right=False,
marketcolors=mc)
#設置均線顏色,配色表可見下圖
#建議設置較深的顏色且與紅色、綠色形成對比
#此處設置七條均線的顏色,也可應用默認設置
mpl.rcParams['axes.prop_cycle']=cycler(
color=['dodgerblue','deeppink',
'navy','teal','maroon','darkorange',
'indigo'])
#設置線寬
mpl.rcParams['lines.linewidth']=.5
#圖形繪制
#show_nontrading:是否顯示非交易日,默認False
#savefig:導出圖片,填寫文件名及后綴
mpf.plot(df,
**kwargs,
style=s,
show_nontrading=False,
savefig='%s_begin%d_end%d'
%(ts_codes,begin_count,end_count)+'.png')
#candlestick2_ochl(ax,opens=opens,closes=closes,highs=highs,lows=lows,width=0.75,colorup='red',colordown='green')
#plt.legend(loc='best')
#plt.xticks(range(len(date)),date,rotation=30)
#plt.grid(True)
#plt.title(ts_codes)
#plt.show
#plot實例
def test_plot():
#繪制曲線
x=np.linspace(2,21,20)#取閉區(qū)間[2,21]之間的等差數(shù)列,列表長度20
y=np.log10(x)+0.5
plt.figure()#添加一個窗口。如果只顯示一個窗口,可以省略該句。
plt.plot(x,y)#plot在一個figure窗口中添加一個圖,繪制曲線,默認顏色
#繪制離散點
plt.plot(x,y,'.y')#繪制黃色的點,為了和曲線顏色不一樣
x0,y0=15,np.log10(15)+0.5
plt.annotate('Interpolation point',xy=(x0,y0),xytext=(x0,y0-1),arrowprops=dict(arrowstyle='->'))#添加注釋
for x0,y0 in zip(x,y):
plt.quiver(x0,y0-0.3,0,1,color='g',width=0.005)#繪制箭頭
x=range(2,21,5)
y=np.log10(x)+0.5
plt.plot(x,y,'om')#繪制紫紅色的圓形的點
x0,y0=7,np.log10(7)+0.5
plt.annotate('Original point',xy=(x0,y0),xytext=(x0,y0-1),arrowprops=dict(arrowstyle='->'))
for x0,y0 in zip(x,y):
plt.quiver(x0,y0+0.3,0,-1,color='g',width=0.005)#繪制箭頭