中诚信期货 - STOP_MARKET (Python)
CCXT Futues - STOP_MARKET (Python)
我正在尝试创建 STOP_MARKET 期货订单 这是我的代码:
def futurePlaceOrder(self, symbol, type, side, amount, price=None, params={}):
return = self.binanceFuture.createOrder (symbol, type, side, amount, price, params = {})
STOP_LOSS = (futurePlaceOrder(
symbol = 'BTC/USDT',
type = 'STOP_MARKET',
side = 'BUY',
amount = 0.003,
params = {
'stopPrice': 29500,
'closePosition': False
}
))
但我收到以下错误:
ccxt.base.errors.InvalidOrder:binance createOrder() 需要一个 STOP_MARKET 订单的 stopPrice 额外参数
有什么建议,谢谢
这是否达到了您的要求?
import ccxt
import asyncio
import json
exchange = ccxt.binance({
'apiKey': [...],
'secret': [...],
'enableRateLimit': True,
})
exchange.options = {'defaultType': 'future', # or 'margin' or 'spot'
'adjustForTimeDifference': True,
'newOrderRespType': 'FULL',
'defaultTimeInForce': 'GTC'}
markets = exchange.load_markets()
symbol = 'BTC/USDT'
type ='TAKE_PROFIT'
side = 'buy'
amount = 0.001
price = 26000
params = {
'stopPrice': 25000,
}
order = exchange.createOrder(symbol, type, side, amount, price, params)
open_orders = exchange.fetchOrders('BTC/USDT')
data = json.dumps(open_orders, indent=4, separators=(',', ': ') )
print(data)
我正在尝试创建 STOP_MARKET 期货订单 这是我的代码:
def futurePlaceOrder(self, symbol, type, side, amount, price=None, params={}):
return = self.binanceFuture.createOrder (symbol, type, side, amount, price, params = {})
STOP_LOSS = (futurePlaceOrder(
symbol = 'BTC/USDT',
type = 'STOP_MARKET',
side = 'BUY',
amount = 0.003,
params = {
'stopPrice': 29500,
'closePosition': False
}
))
但我收到以下错误:
ccxt.base.errors.InvalidOrder:binance createOrder() 需要一个 STOP_MARKET 订单的 stopPrice 额外参数
有什么建议,谢谢
这是否达到了您的要求?
import ccxt
import asyncio
import json
exchange = ccxt.binance({
'apiKey': [...],
'secret': [...],
'enableRateLimit': True,
})
exchange.options = {'defaultType': 'future', # or 'margin' or 'spot'
'adjustForTimeDifference': True,
'newOrderRespType': 'FULL',
'defaultTimeInForce': 'GTC'}
markets = exchange.load_markets()
symbol = 'BTC/USDT'
type ='TAKE_PROFIT'
side = 'buy'
amount = 0.001
price = 26000
params = {
'stopPrice': 25000,
}
order = exchange.createOrder(symbol, type, side, amount, price, params)
open_orders = exchange.fetchOrders('BTC/USDT')
data = json.dumps(open_orders, indent=4, separators=(',', ': ') )
print(data)