量化交易机器人丨合约跟单(对接API火币/币安/OK交易所)系统开发方案策略及源码项目
“量化交易”有着两层含义:一是从狭义上来讲,是指量化交易的内容,将交易条件转变成为程序,自动下单;二是从广义上来讲,是指系统交易方法,就是一个整合的交易系统。即为根据一系列交易条件,智能化辅助决策体系,Combine rich professional experience with trading conditions to manage and control risks during the trading process.
量化交易是根据量化分析得出交易策略的一种交易技术,它通过数学计算和数值分析来识别交易机会。以往的完整数据是量化分析的基础,价格和数量是建立数学模型中的主要变量。
//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();