C++ 中 PleaseOrder 無反應的情況是咋回事 [金字塔]
- 咨詢內容:
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; } - 金字塔客服:
請問下單后long orderId這個返回結果是多少?是-1嗎?
- 用戶回復:
另外,你是不是在交易回報或者行情的觸發消息處理中直接調用這個下單指令了?
試試用金字塔自帶的下單插件范例,人工下單試試。
- 網友回復:
返回是-1
- 網友回復:
人工下單是成功的, Formula 1是我調用時生成的, Formula 0是人工下單生成的日志2016-06-07 14:08:06.689 【下單】600020 價4.520000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 02016-06-07 14:08:08.510 【指令】收到回報指令 ID = 82016-06-07 14:08:08.574 【回報】60001386 : 600020 - 已報單 100 價格:4.52 開 買2016-06-07 14:08:08.600 【指令】收到成交回報指令 ORDERID = 82016-06-07 14:08:08.627 【回報】60001386 : 600020 - 已成交 100 價格:4.52 開 買2016-06-07 14:08:08.666 【回報】60001386 : 600020 - 全部成交 1002016-06-07 14:08:13.053 【下單】600020 價4.530000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 12016-06-07 14:08:43.434 【下單】600020 價4.520000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 12016-06-07 14:08:59.531 【下單】600020 價4.520000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 02016-06-07 14:09:01.405 【指令】收到回報指令 ID = 92016-06-07 14:09:01.447 【回報】60001386 : 600020 - 已報單 100 價格:4.52 開 買2016-06-07 14:09:01.456 【指令】收到成交回報指令 ORDERID = 92016-06-07 14:09:01.482 【回報】60001386 : 600020 - 已成交 100 價格:4.52 開 買2016-06-07 14:09:01.540 【回報】60001386 : 600020 - 全部成交 1002016-06-07 14:33:40.627 【下單】600020 價4.520000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 12016-06-07 14:33:45.486 【下單】600020 價4.520000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 12016-06-07 14:33:56.529 【下單】600020 價4.530000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 02016-06-07 14:34:13.153 【指令】收到回報指令 ID = 102016-06-07 14:34:13.194 【回報】60001386 : 600020 - 已報單 100 價格:4.53 開 買2016-06-07 14:34:13.211 【指令】收到成交回報指令 ORDERID = 102016-06-07 14:34:13.241 【回報】60001386 : 600020 - 已成交 100 價格:4.53 開 買2016-06-07 14:34:13.301 【回報】60001386 : 600020 - 全部成交 1002016-06-07 14:34:34.155 【下單】600020 價4.520000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 12016-06-07 14:34:40.433 【下單】600020 價4.530000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 12016-06-07 14:35:19.036 【下單】600020 價4.530000 量100 買賣0 類型0 開平0 賬戶60001386 Formula 1
有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友
可聯系技術人員 QQ: 511411198 進行 有償 編寫!(不貴!點擊查看價格!)
相關文章
-
沒有相關內容