gitee.com/quant1x/engine@v1.8.4/datasource/tdxweb/margintrading.go (about) 1 package tdxweb 2 3 import ( 4 "fmt" 5 "gitee.com/quant1x/gox/http" 6 ) 7 8 const ( 9 // https://wenda.tdx.com.cn/site/wenda/stock_index.html?message=%E8%9E%8D%E8%B5%84%E8%9E%8D%E5%88%B8 10 //urlMarginTrading = "https://wenda.tdx.com.cn/TQL?Entry=JNLPSE.getAllCode&RI=6C07" 11 urlMarginTrading = "https://wenda.tdx.com.cn/TQL?Entry=JNLPSE.getAllCode&RI=6BFD" 12 ) 13 14 func MarginTrading() { 15 //params := urlpkg.Values{ 16 // "direction": {direction.String()}, 17 // "code": {fmt.Sprintf("%s.%s", symbol, strings.ToUpper(mflag))}, 18 // "price": {fmt.Sprintf("%f", price)}, 19 // "volume": {fmt.Sprintf("%d", volume)}, 20 // "strategy": {models.QmtStrategyName(model)}, 21 // "remark": {models.QmtOrderRemark(model)}, 22 //} 23 //body := params.Encode() 24 body := `[{"nlpse_id":"7318110250698020161","op_flag":1,"sec_code":"","order_field":"sec_code","dynamic_order":"","order_flag":"1","POS":"0","COUNT":"30","timestamps":0,"RANG":"AG"}]` 25 //body = `[{"op_flag":1,"sec_code":"","order_field":"sec_code","dynamic_order":"","order_flag":"1","POS":"0","COUNT":"30","timestamps":0,"RANG":"AG"}]` 26 body = `[{"nlpseId":"7318094960614448284","orderField":"chg","orderFlag":"0"}]` 27 //logger.Infof("trader-order: %s", body) 28 header := map[string]any{ 29 http.ContextType: "application/x-www-form-urlencoded" + "; charset=UTF-8", 30 //"Cookie": "Hm_lvt_5c4c948b141e4d66943a8430c3d600d0=1703193725; Hm_lpvt_5c4c948b141e4d66943a8430c3d600d0=1703720553; LST=10; ASPSessionID=3755195075085152819", 31 "Cookie": "Hm_lvt_5c4c948b141e4d66943a8430c3d600d0=1703193725; Hm_lpvt_5c4c948b141e4d66943a8430c3d600d0=1703720553; LST=10; ASPSessionID=3755195113739858633", 32 "Origin": "https://wenda.tdx.com.cn", 33 "Referer": "https://wenda.tdx.com.cn/", 34 } 35 36 data, _, err := http.Request(urlMarginTrading, http.MethodPost, body, header) 37 38 fmt.Println(data, err) 39 }