- initialize
- login
- shutdown
- version
- last_error
- account_info
- terminal_info
- symbols_total
- symbols_get
- symbol_info
- symbol_info_tick
- symbol_select
- market_book_add
- market_book_get
- market_book_release
- copy_rates_from
- copy_rates_from_pos
- copy_rates_range
- copy_ticks_from
- copy_ticks_range
- terminal_info
- orders_total
- orders_get
- order_calc_margin
- order_calc_profit
- order_check
- order_send
- positions_total
- positions_get
- history_deals_total
- history_deals_get
- history_orders_total
- history_orders_get
last_error
返回最后一个错误的数据。
last_error() |
返回值
以元组形式返回最后一个错误代码和描述。
注意
last_error()允许在MetaTrader 5程序库函数执行失败的情况下获取错误代码。它类似于GetLastError()。然而,它应用自己的错误代码。可能值:
常量 |
值 |
描述 |
---|---|---|
RES_S_OK |
1 |
通用成功 |
RES_E_FAIL |
-1 |
通用失败 |
RES_E_INVALID_PARAMS |
-2 |
无效参数 |
RES_E_NO_MEMORY |
-3 |
无存储条件 |
RES_E_NOT_FOUND |
-4 |
没有历史 |
RES_E_INVALID_VERSION |
-5 |
无效版本 |
RES_E_AUTH_FAILED |
-6 |
授权失败 |
RES_E_UNSUPPORTED |
-7 |
不受支持的方法 |
RES_E_AUTO_TRADING_DISABLED |
-8 |
禁用自动交易 |
RES_E_INTERNAL_FAIL |
-10000 |
内部IPC一般错误 |
RES_E_INTERNAL_FAIL_SEND |
-10001 |
内部IPC发送失败 |
RES_E_INTERNAL_FAIL_RECEIVE |
-10002 |
内部IPC接收失败 |
RES_E_INTERNAL_FAIL_INIT |
-10003 |
内部IPC初始化失败 |
RES_E_INTERNAL_FAIL_CONNECT |
-10003 |
内部IPC没有ipc |
RES_E_INTERNAL_FAIL_TIMEOUT |
-10005 |
内部超时 |
例如:
import MetaTrader5 as mt5
|
另见