2016-07-26 47 views

回答

1

如果您有管理員帳戶,您應該使用管理API來獲取它,您可以創建自己的包裝或使用現有的包裝,例如MetaTrader4.Manager.Wrapper。對於MT5,你可以從metaquotes中獲得官方的一個。

如果您有客戶帳戶,沒有官方的方式來獲取它,並且必須打開MT4終端,但也有一些項目可以幫助您,例如: nj4x

1

其實是的,你可以直接得到它,因爲你沒有提到任何API。
只需將套接字發送到MT4服務器即可。
以下是官方支持網站的功能。

USERHISTORY - 用戶帳戶的歷史接收。

格式:
USERHISTORY-login=_login_|password=_password_|from=_from_|to=_to_


描述:
該命令用於接收一個給定的時間範圍內進行的操作的歷史。

參數:
登錄 - 賬號;
密碼 - 用戶密碼;
from - 以Unix時間戳格式開始請求的時間範圍;
- 以Unix時間戳格式請求的時間範圍結束。

實施例:

// 1. Start Session. 
$ptr=fsockopen('192.168.0.1',443); 
// error check 
if (!$ptr){ 
    echo "Connection error"; 
    exit; 
} 
// 2. Send request to MT4 
fputs($ptr,"WUSERHISTORY-login=55555|password=55555|from=1117551473|to=1120143473\nQUIT\n"); 
// 3. Reading and processing server responses 
while(!feof($ptr)) 
    { 
    // read line of symbols 
    $line=fgets($ptr,128); 
    // the symbol of the end of result transfer 
    if($line=="end\r\n") break; 
    // process 
    print $line; 
    $buf .= $line; 
    } 
// 4. Session completion 
    fclose($ptr); 
相關問題