欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件高级功能研发区 → C++ 中 PleaseOrder 无反应的情况是咋回事

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有4179人关注过本帖树形打印复制链接

主题:C++ 中 PleaseOrder 无反应的情况是咋回事

帅哥哟,离线,有人找我吗?
小峨武
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:35 积分:0 威望:0 精华:2 注册:2016/3/3 21:01:46
C++ 中 PleaseOrder 无反应的情况是咋回事  发帖心情 Post By:2016/6/7 14:36:45 [显示全部帖子]

if (context.getOrder().getOrder() == "order")
{
int orderType = 0;//0限价  
int orderOperateType = 0; //0开仓 1平仓 2平今
int direction = 0; //0买入 1卖出
int stockType = 0; //股票(0普通 1融资)
int runType = 0;  //是否为队列委托方式,即成交上一笔后再委托下一笔
WORD wMarket = 'S' | 'H' << 8;

std::vector<std::string>* values = context.getOrder().getParam(std::string("market"));
const char *value = values->front().c_str();
wMarket = value[0] << 8 | value[1];
values = context.getOrder().getParam(std::string("stockCode"));

const char *stockCode = values->front().c_str();
values = context.getOrder().getParam(std::string("amount"));

float orderPrice = boost::lexical_cast<float>(values->front().c_str());
values = context.getOrder().getParam(std::string("volumn"));

unsigned int orderAmount = boost::lexical_cast<int>(values->front().c_str());
const char *account;
values = context.getOrder().getParam(std::string("account"));
if (values != nullptr)
account = values->front().c_str();
else
account = nullptr;
long orderId = server->PlaceOrder(orderType, orderPrice, 0, orderAmount, direction, stockCode, wMarket, 1, account, orderOperateType, stockType, runType);
if (orderId == -1)
{
context.getOrder().setError("call execute error");
}
else
{
context.getOrder().addParam(std::string("orderNo"), orderId);
}
return true;
}
 

 回到顶部