L2行情接口怎么用最高效?
小編根據規律發現l2行情接口中買單的明顯是少于賣單的,那么如果主力進行打壓式吸籌的時候我們做交易時就一定要警惕,因為在買一到買十的位置上一般來說買一的位置是不會出現在買一的位置的!那么我們為了高效的利用l2行情接口我們可以在網上找到相對應的代碼然后根據原有的代碼根據自身的需要進行調整,這是一種不錯的方式,那么接下來小編和大家分享一下l2行情接口的代碼實例!
1.l2行情接口c++例子(部分)
// 加載DLL
HINSTANCE?hDLL = LoadLibraryA("MetaTrade.dll");
assert(hDLL);
// 初始化
typedef?int?(*InitProc)();
const?auto?Init = reinterpret_cast<InitProc>(GetProcAddress(hDLL, "Init"));
assert(Init);
const?int?authorizedCount = Init(); // 已授權賬號數量
assert(authorizedCount > 0);
std::cout <<?"已授權賬號數量: "?<<?authorizedCount <<?std::endl;
std::cout <<?std::endl;
?// 接收緩沖區,?用于接收返回結果和錯誤信息
auto?resultBuf = std::make_unique<char[]>(1024 * 1024);
auto?errinfoBuf = std::make_unique<char[]>(256);
char?*const?result = resultBuf.get();
char?*const?errinfo = errinfoBuf.get();
// 登錄?接口支持普通交易和兩融交易賬號, 以下例子使用兩融賬號
typedef?int?(*LogonProc)(const?char?*ip, short?port, const?char?*version,
?????????????????????????short?yybid, const?char?*account,
?????????????????????????const?char?*tradeAccount, const?char?*jyPassword,
?????????????????????????const?char?*txPassword, char?*errinfo);
const?auto?Logon = reinterpret_cast<LogonProc>(GetProcAddress(hDLL, "Logon"));
assert(Logon);
std::string?ip = "1.2.3.4"; // 券商IP(注意區分兩融和普通)
short?port = 5678; ?????????// 券商端口(注意區分兩融和普通)
std::string?version = ""; ??// 版本號: 一般填空
short?yybid = 0; ???????????// 營業部ID: 一般填0
std::string?account = "12345678.C"; // 登錄賬號: 兩融賬號需添加.C結尾
std::string?tradeAccount =?"12345678"; // 交易賬號: 一般與登錄賬號相同, 但不需添加.C結尾
std::string?jyPassword = "password"; // 交易密碼
std::string?txPassword = "";?// 通訊密碼: 一般填空
const?int?clientId = Logon(ip.c_str(), port, version.c_str(), yybid,
???????????????????????????account.c_str(), tradeAccount.c_str(),
???????????????????????????jyPassword.c_str(), txPassword.c_str(), errinfo);
assert(clientId >= 0);
std::cout <<?"登錄成功, client = "?<<?clientId <<?std::endl;
std::cout <<?std::endl;
?2.L2行情接口(十檔行情快照)
| 字段名 | 類型 | 備注 |
| stock_exchange | uint32 | 證券市場,見數據字典 |
| stock_code | string | 證券代碼 |
| created_at | int64 | 快照日期時間戳(毫秒) |
| status | uint32 | 狀態:0-開盤前,1-開盤集合競價,2-集合競價至連續競價,3-連續競價, 4-中午休市,5-收盤集合競價,6-閉市 |
| prev_close_price | uint32 | 前收盤價 |
| open_price | uint32 | 開盤價 |
| latest_price | uint32 | 最新價 |
| high_price | uint32 | 最高價 |
| low_price | uint32 | 最低價 |
| limit_up_price | uint32 | 漲停價 |
| limit_down_price | uint32 | 跌停價 |
| order_quantity | uint32 | 成交筆數 |
| volume | uint64 | 成交數量 |
| amount | uint64 | 成交金額 |
| bid_volume | uint64 | 委托買入數量 |
| bid_price | uint32 | 委托買入加權平均價 |
| ask_volume | uint64 | 委托賣出數量 |
| ask_price | uint32 | 委托賣出加權平均價 |
| bid_price_detail | repeated uint32 | 委托買入價格明細(十檔) |
| bid_volume_detail | repeated uint32 | 委托買入數量明細(十檔) |
| ask_price_detail | repeated uint32 | 委托賣出價格明細(十檔) |
| ask_volume_detail | repeated uint32 | 委托賣出數量明細(十檔) |
返回示例:
當然以上只是其中的一種方法,還有一個更便捷的方法就是直接買接口的,現好的接口和普通的軟件應用一樣買回去后安裝好就可以用了,那么有想通過l2行情接口提高交易效率的話可以看看下方名片!
總結
以上是生活随笔為你收集整理的L2行情接口怎么用最高效?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Create.js实战-MovieCli
- 下一篇: MM理论