For quantitative trading,the most important thing is the establishment of models.Generally speaking,it is to use modern statistics and mathematical methods,use computer technology to find laws that can bring excess returns from massive historical data to formulate strategies,and use mathematical models to verify and solidify these laws and strategies,and then strictly implement them through programmed trading
机器人内置多种交易策略,从“保守-”到“激进+”,满足不同的风险类型。设置策略后,机器人将智能分配每次进单的仓位和条件,严格执行交易策略,交易补单策略,根据当前行情,云大数据实时调整。
Calibration::Calibration(MNN::NetTmodel,uint8_tmodelBuffer,const int bufferSize,const std::string&configPath)
:_originaleModel(model){
//when the format of input image is RGB/BGR,channels equal to 3,GRAY is 1
int channles=3;
//解析json
rapidjson::Document document;
{
std::ifstream fileNames(configPath.c_str());
std::ostringstream output;
output<<fileNames.rdbuf();
auto outputStr=output.str();
document.Parse(outputStr.c_str());
if(document.HasParseError()){
MNN_ERROR("Invalid jsonn");
return;开发需求及案例:MrsFu123
}
}
auto picObj=document.GetObject();
//构造ImageProcess::config对象,将json内容传入
ImageProcess::Config config;
config.filterType=BILINEAR;
config.destFormat=BGR;
{
if(picObj.HasMember("format")){
auto format=picObj["format"].GetString();
static std::map<std::string,ImageFormat>formatMap{{"BGR",BGR},{"RGB",RGB},{"GRAY",GRAY}};
if(formatMap.find(format)!=formatMap.end()){
config.destFormat=formatMap.find(format)->second;
}
}
}
if(config.destFormat==GRAY){
channles=1;
}
config.sourceFormat=RGBA;
std::string imagePath;
_imageNum=0;
{
if(picObj.HasMember("mean")){
auto mean=picObj["mean"].GetArray();
int cur=0;
for(auto iter=mean.begin();iter!=mean.end();iter++){
config.mean[cur++]=iter->GetFloat();
}
}
if(picObj.HasMember("normal")){
auto normal=picObj["normal"].GetArray();
int cur=0;
for(auto iter=normal.begin();iter!=normal.end();iter++){
config.normal[cur++]=iter->GetFloat();
}
}
if(picObj.HasMember("width")){
_width=picObj["width"].GetInt();
}
if(picObj.HasMember("height")){
_height=picObj["height"].GetInt();
}
if(picObj.HasMember("path")){
imagePath=picObj["path"].GetString();
}
if(picObj.HasMember("used_image_num")){
_imageNum=picObj["used_image_num"].GetInt();
}
if(picObj.HasMember("feature_quantize_method")){
std::string method=picObj["feature_quantize_method"].GetString();
if(Helper::featureQuantizeMethod.find(method)!=Helper::featureQuantizeMethod.end()){
_featureQuantizeMethod=method;
}else{
MNN_ERROR("not supported feature quantization method:%sn",method.c_str());
return;
}
}
if(picObj.HasMember("weight_quantize_method")){
std::string method=picObj["weight_quantize_method"].GetString();
if(Helper::weightQuantizeMethod.find(method)!=Helper::weightQuantizeMethod.end()){
_weightQuantizeMethod=method;
}else{
MNN_ERROR("not supported weight quantization method:%sn",method.c_str());
return;
}
}
DLOG(INFO)<<"Use feature quantization method:"<<_featureQuantizeMethod;
DLOG(INFO)<<"Use weight quantization method:"<<_weightQuantizeMethod;
}
std::shared_ptr<ImageProcess>process(ImageProcess::create(config));//生成ImageProcess对象
_process=process;
//read images file names
Helper::readImages(_imgaes,imagePath.c_str(),&_imageNum);
_initMNNSession(modelBuffer,bufferSize,channles);
_initMaps();
}