# Unlock Trade

# unlock_trade

unlock_trade(password=None, password_md5=None, is_unlock=True)

  • Description

    Lock or unlock trade

  • Parameters

    Parameter Type Description
    password str Transaction password.
    password_md5 str 32-bit MD5 encryption of transaction password (all lowercase).
    is_unlock bool Lock or unlock.
  • Return

    Parameter Type Description
    ret RET_CODE Interface result.
    msg NoneType If ret == RET_OK, None is returned.
    str If ret != RET_OK, error description is returned.
  • Example

from futu import *
pwd_unlock = '123456'
trd_ctx = OpenSecTradeContext(filter_trdmarket=TrdMarket.HK, host='127.0.0.1', port=11111, security_firm=SecurityFirm.FUTUSECURITIES)
ret, data = trd_ctx.unlock_trade(pwd_unlock)
if ret == RET_OK:
    print('unlock success!')
else:
    print('unlock_trade failed: ', data)
trd_ctx.close()
1
2
3
4
5
6
7
8
9
  • Output
unlock success!
1

TIP

  • When using live trading accounts, you need to unlock trade before calling Place Order or Modify or Cancel Orders interface, but when using paper trading accounts, you do not need to unlock trade.
  • Locking or unlocking the transaction is an operation on Futu OpenD. As long as one connection is unlocked, all other connections can call the transaction interface
  • It is strongly recommended that customers who connect to Futu OpenD via the external network for live trading use encrypted channels, refer to Enable protocol encryption
  • OpenAPI does not support Futu token. If you have activated Futu token, it will fail to unlock. You need to turn off the token and then use OpenAPI to unlock.

Interface Limitations

  • A maximum of 10 requests per 30 seconds