From d74dff3e9f202f6d0c059cc0852d3f975174a9bb Mon Sep 17 00:00:00 2001 From: Igor Kroitor Date: Mon, 9 Apr 2018 20:18:29 +0300 Subject: [PATCH] added examples/py/bitmex-create-order.py fix #2499 --- examples/py/bitmex-create-order.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/py/bitmex-create-order.py diff --git a/examples/py/bitmex-create-order.py b/examples/py/bitmex-create-order.py new file mode 100644 index 000000000000..4d0b59b0bae9 --- /dev/null +++ b/examples/py/bitmex-create-order.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +import os +import sys + +root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +sys.path.append(root + '/python') + +import ccxt # noqa: E402 + + +exchange = ccxt.bitmex({ + 'apiKey': 'YOUR_API_KEY', + 'secret': 'YOUR_SECRET', + 'enableRateLimit': True, +}) + +symbol = 'XBTM18' # bitcoin contract according to bitmex futures coding +type = 'StopLimit' # or 'market', or 'Stop' or 'StopLimit' +side = 'sell' # or 'buy' +amount = 1.0 +price = 6500.0 # or None + +# extra params and overrides +params = { + 'stopPx': 6000.0, # if needed +} + +order = exchange.create_order(symbol, type, side, amount, price, params) +print(order)