量化合約開(kāi)發(fā)(源碼),量化合約系統(tǒng)開(kāi)發(fā)(策略及分析),量化合約系統(tǒng)
量化系統(tǒng)是一種基于區(qū)塊鏈技術(shù)的交易系統(tǒng),它利用智能合約來(lái)自動(dòng)化交易操作,將交易信息和數(shù)據(jù)記錄在區(qū)塊鏈上,保證交易的公開(kāi)透明和數(shù)據(jù)的可靠性。
The characteristics of quantitative trading robots:
1.The most obvious feature of quantitative trading is to reduce the impact of investor sentiment fluctuations,avoid making irrational investment decisions in extremely fanatical or pessimistic market situations,and avoid subjective assumptions.Quantitative trading robots use programs to turn their ideas into quantifiable strategies,using computers to only calculate and buy and sell strategies;開(kāi)發(fā)策略唯:MrsFu123
2.Historical backtesting,implemented using computer programs,can verify the rationality of trading strategies by quantifying trading ideas;
3.Able to ensure the execution of transactions/profits,especially quantitative analysis at medium and low frequencies,without any supervision;
from __future__ import absolute_import,print_function,division
import os
from rknn.api import RKNN
#onnx_model='./resource/onnx/model_256x256_max_mscf_0.924553.onnx'G:/6666Ground_segmentation0813
onnx_model='G:/6666Ground_segmentation0813/onnx/model0124.onnx'#onnx路徑
save_rknn_dir='G:/6666Ground_segmentation0813/rknn'#rknn保存路徑
if __name__=='__main__':
#Create RKNN object
rknn=RKNN()
#pre-process config
print('-->Config model')
rknn.config(mean_values=[[83.0535,94.095,82.1865]],std_values=[[53.856,54.774,53.9325]],reorder_channel='2 1 0',target_platform=['rk1808'],batch_size=1,quantized_dtype='asymmetric_quantized-u8')#需要輸入為RGB#####需要轉(zhuǎn)化一下均值和歸一化的值
#rknn.config(mean_values=[[0.0,0.0,0.0]],std_values=[[255,255,255]],reorder_channel='2 1 0',target_platform=['rv1126'],batch_size=1)#需要輸入為RGB
print('done')
model_name=onnx_model[onnx_model.rfind('/')+1:]
#Load ONNX model
print('-->Loading model%s'%model_name)
ret=rknn.load_onnx(model=onnx_model)
if ret!=0:
print('Load%s failed!'%model_name)
exit(ret)
print('done')
#Build model
print('-->Building model')
#ret=rknn.build(do_quantization=False,dataset='./quantization_dataset.txt',pre_compile=True)###路哥的版本pre_compil=True離線預(yù)編譯
ret=rknn.build(do_quantization=True,dataset='G:/6666Ground_segmentation0813/rknntxt.txt',pre_compile=False)
#do_quantization是否對(duì)模型進(jìn)行量化,datase量化校正數(shù)據(jù)集,pre_compil模型預(yù)編譯開(kāi)關(guān),預(yù)編譯RKNN模型可以減少模型初始化時(shí)間,但是無(wú)法通過(guò)模擬器進(jìn)行推理或性能評(píng)估
if ret!=0:
print('Build net failed!')
exit(ret)
print('done')
#Export RKNN model
print('-->Export RKNN model')
#save_name=model_name.replace(os.path.splitext(model_name)[-1],"_no_quant.rknn")
save_name=model_name.replace(os.path.splitext(model_name)[-1],"_quant.rknn")
ret=rknn.export_rknn(os.path.join(save_rknn_dir,save_name))
if ret!=0:
print('Export rknn failed!')
exit(ret)
print('done')
rknn.release()