[关闭]
@Lee2011 2020-06-12T04:12:01.000000Z 字数 2473 阅读 1567

MT4 API 文档

MT4 API


概要

MT4 是一款市场行情接收与交易软件,MT4是MetaQuotes Software Corp4 缩写,由迈达克软件公司发布。它适用于外汇, CFD以及期货市场。

MT4分为服务器与客户端,而客户端又分为普通用户端和 Manager 管理端。

本接口主要是封装 Manager 管理端提供的 API 接口(dll库),以服务的形式运行在 Windows 平台,并对外提供方便调用的 HTTP 请求形式的调用入口,实现诸如新增账户,修改账户,同步账户信息,出入金,同步账户交易订单信息等接口。

接口列表

判断是否连接到服务器 IsConnected

  1. http://127.0.0.1:15000/IsConnected
  2. 心跳成功: {"retcode":0,"msg":"IsConnected"}
  3. 心跳失败: {"retcode":1,"msg":"NOT Connected"}

与服务器断开连接 Disconnect

  1. http://127.0.0.1:15000/Disconnect
  2. 断开连接成功: {"retcode":0,"msg":"Disconnect Success"}
  3. 断开连接失败: {"retcode":1,"msg":"Disconnect Failed"}

连接服务器 Connect 需指定服务器和端口

  1. http://127.0.0.1:PORT/Connect?ip=47.52.230.9&port=443

用户登录 Login 需指定login和密码

  1. http://127.0.0.1:PORT/Login?login=6008&passwd=XXXX

心跳 Ping

  1. http://127.0.0.1:15000/Ping
  2. 心跳成功: {"retcode":0,"msg":"Ping Success"}
  3. 心跳失败: {"retcode":1,"msg":"Ping Failed"}

账户列表

  1. login 指定账户,为 UserRecordsRequest
  2. login = 0时列举全部账户 UsersRequest
  3. http://127.0.0.1:PORT/UsersRequest?login=733256

获取可用组 - GroupsRequest - 用户组

  1. http://127.0.0.1:PORT/GroupsRequest

修改组别 - UsersGroupOp

  1. http://127.0.0.1:PORT/UsersGroupOp?login=733256&optype=DISABLE&newgroup=manager&newleverage=200
  2. optype=DISABLE 禁用
  3. optype=ENABLE 启用
  4. optype=DELETE 删除
  5. newgroup 新组名必须包含在通过GroupsRequest接口获得的全部可用组名内

新开账户 - UserRecordNew

  1. http://127.0.0.1:PORT/UserRecordNew?login=next&passwd=weqw123q&group=ComPro-USD&name=111111&email=234143234@qq.com
  2. 不能用manager组,login 为指定的login号码,如果不知道建议为 0 next

更新用户 UserRecordUpdate

  1. http://127.0.0.1:PORT/UserRecordUpdate?login=XXXXXX&$$$$$$=#######
  2. 需指定需要修改用户属性的login(XXXXXX)、该属性名称($$)和该属性的值(######)
  3. 这里的属性名称和属性值的组合可以是多组

账户历史交易数据 TradesUserHistory

  1. http://127.0.0.1:PORT/TradesUserHistory?login=733256&from=917144243&to=1548296243
  2. 用户交易记录 需指定login和查询的开始时间时间戳(from)、结束时间的时间戳(to)

获取 symbols SymbolsGetAll

  1. http://127.0.0.1:PORT/SymbolsGetAll

修改用户密码 UserPasswordSet

  1. http://127.0.0.1:PORT/UserPasswordSet?login=XXXXXX&passwd=#######
  2. 需要指定需要修改密码的login(XXXXXX)和该账户的新密码(######)

当前manager账号的权限列表 ManagerRights

  1. http://127.0.0.1:15000/ManagerRights
  2. 正确返回:{"retcode":0,"msg":"ManagerRights Success","data":{"admin":"1","broker":"1","email":"0","logs":"1","manager":"1","market":"0","market_watch":"1","money":"1","news":"0","notifications":"0","online":"1","plugins":"0","reports":"1","riskman":"1","see_trades":"1","server_reports":"0","techsupport":"0","trades":"1","user_details":"1"}}

出金,入金 TradeTransaction

  1. http://127.0.0.1:15000/TradeTransaction?login=507980&amount=11.00&comment=测试
  2. 成功返回 {"retcode":0,"msg":"TradeTransaction Success"}

获取服务器时区 CfgRequestCommon

  1. http://127.0.0.1:15000/RequestCommon
  2. 正确返回:{"retcode":0,"msg":"RequestCommon Success","data":"GMT+02:00"}
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注