量化交易機器人丨合約跟單(對接API火幣/幣安/OK交易所)系統(tǒng)開發(fā)方案策略及源碼項目
“量化交易”有著兩層含義:一是從狹義上來講,是指量化交易的內(nèi)容,將交易條件轉(zhuǎn)變成為程序,自動下單;二是從廣義上來講,是指系統(tǒng)交易方法,就是一個整合的交易系統(tǒng)。即為根據(jù)一系列交易條件,智能化輔助決策體系,Combine rich professional experience with trading conditions to manage and control risks during the trading process.
量化交易是根據(jù)量化分析得出交易策略的一種交易技術(shù),它通過數(shù)學(xué)計算和數(shù)值分析來識別交易機會。以往的完整數(shù)據(jù)是量化分析的基礎(chǔ),價格和數(shù)量是建立數(shù)學(xué)模型中的主要變量。
//wrapping input tensor,convert nhwc to nchw
std::vector<int>dims{1,INPUT_SIZE,INPUT_SIZE,3};
auto nhwc_Tensor=MNN::Tensor::create<float>(dims,NULL,MNN::Tensor::TENSORFLOW);
auto nhwc_data=nhwc_Tensor->host<float>();
auto nhwc_size=nhwc_Tensor->size();
::memcpy(nhwc_data,image.data,nhwc_size);
std::string input_tensor="data";
auto inputTensor=net->getSessionInput(session,nullptr);
inputTensor->copyFromHostTensor(nhwc_Tensor);
//run network
net->runSession(session);
//get output data
std::string output_tensor_name0="conv5_fwd";
MNN::Tensor*tensor_lmks=net->getSessionOutput(session,output_tensor_name0.c_str());
MNN::Tensor tensor_lmks_host(tensor_lmks,tensor_lmks->getDimensionType());
tensor_lmks->copyToHostTensor(&tensor_lmks_host);
//load and config mnn model
auto revertor=std::unique_ptr<Revert>(new Revert(model_name.c_str()));
revertor->initialize();
auto modelBuffer=revertor->getBuffer();
const auto bufferSize=revertor->getBufferSize();
auto net=std::shared_ptr<MNN::Interpreter>(MNN::Interpreter::createFromBuffer(modelBuffer,bufferSize));
revertor.reset();
MNN::ScheduleConfig config;
config.numThread=threads;
config.type=static_cast<MNNForwardType>(forward);
MNN::BackendConfig backendConfig;
config.backendConfig=&backendConfig;
auto session=net->createSession(config);
net->releaseModel();