Skip to content

Instantly share code, notes, and snippets.

@kroitor
Last active December 12, 2019 10:18
Show Gist options
  • Save kroitor/6d725dffb46c5086c7baab33692c8360 to your computer and use it in GitHub Desktop.
Save kroitor/6d725dffb46c5086c7baab33692c8360 to your computer and use it in GitHub Desktop.
import ccxt
exchange = ccxt.bitmex({
'apiKey': 'YOUR_API_KEY',
'secret': 'YOUR_API_SECRET',
'enableRateLimit': True, # ←------ required by the Manual!!!
'twofa': 'YOUR_OTP_SECRET', # looks like '3S23Q7EM7Z6TX5R2'
})
exchange.load_markets() # preload the markets manually
# enable verbose mode as documented in the Manual
# it could be added to the constructor above, but we don't want to see
# the output of load_markets() because there is nothing interesting there
# therefore we only want to enable verbosity after loading the markets
# but before issuing the actual withdraw() call
exchange.verbose = True
print('CCXT version:', ccxt.__version__) # also add this
code = 'BTC'
amount = 0.0001
address = 'YOUR_ADDRESS'
tag = None
params = {
'otpToken': exchange.oath(), # it requires exchange.twofa set above
}
exchange.withdraw(code, amount, address, tag, params) # execute the call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment