def create_limit_order(symbol='EOSUSDT', side='BUY', positionside='LONG', ordtype='LIMIT', price=0, quantity='1',
message=''):""" 全仓合约市价下单 @param symbol: 产品ID EOSUSDT @param side: 订单方向:BUY:买, SELL:卖 @param positionside: 持仓方向:LONG 或 SHORT @param ordtype: 订单类型:MARKET:市价单、LIMIT:限价单 @param price: 委托价格 @param quantity: 委托数量 @param message: 判断依据 @return: """ quantitys = float(quantity)
result = client.futures_create_order(symbol=symbol, side=side, positionSide=positionside, type=ordtype, price=price,quantity=quantitys, timeInForce='GTC')if side == 'SELL':
sides = '卖出' else:
sides = '买入' if positionside == 'SHORT':
possides = '做空' else:
possides = '做多' weixin.senddata('@all', 'Binance 限价单委托下单成功,\n 订单ID:' + str(result["orderId"]) + '\n 交易对:' + symbol +'\n 买卖方式:' + sides + '\n 购买方向:' + possides + '\n 购买价格:' + str(
price) + '\n 购买数量:' + str(quantity) + '\n 判断依据:' + message)def create_market_order(symbol='EOSUSDT', side='BUY', positionside='LONG', ordtype='MARKET', quantity='1', message=''):""" 全仓合约市价下单 @param symbol: 产品ID EOSUSDT @param side: 订单方向:BUY:买, SELL:卖 @param positionside: 持仓方向:LONG 或 SHORT @param ordtype: 订单类型:MARKET:市价单、LIMIT:限价单 @param quantity: 委托数量 @param message: 判断依据 @return: """ quantitys = float(quantity)
result = client.futures_create_order(symbol=symbol, side=side, positionSide=positionside,type=ordtype, quantity=quantitys)if side == 'SELL':
sides = '卖出' else:
sides = '买入' if positionside == 'SHORT':
possides = '做空' else:
possides = '做多' weixin.senddata('@all', 'Binance 市价单下单成功,\n 订单ID:' + str(result["orderId"]) + '\n 交易对:' + symbol +'\n 买卖方式:' + sides + '\n 购买方向:' + possides + '\n 购买数量:' + str(quantity) +'\n 判断依据:' + message)'''开平仓模式下,side和posSide需要进行组合开多:买入开多(side 填写 buy; posSide 填写 long )开空:卖出开空(side 填写 sell; posSide 填写 short )平多:卖出平多(
message=''):""" 全仓合约市价下单 @param symbol: 产品ID EOSUSDT @param side: 订单方向:BUY:买, SELL:卖 @param positionside: 持仓方向:LONG 或 SHORT @param ordtype: 订单类型:MARKET:市价单、LIMIT:限价单 @param price: 委托价格 @param quantity: 委托数量 @param message: 判断依据 @return: """ quantitys = float(quantity)
result = client.futures_create_order(symbol=symbol, side=side, positionSide=positionside, type=ordtype, price=price,quantity=quantitys, timeInForce='GTC')if side == 'SELL':
sides = '卖出' else:
sides = '买入' if positionside == 'SHORT':
possides = '做空' else:
possides = '做多' weixin.senddata('@all', 'Binance 限价单委托下单成功,\n 订单ID:' + str(result["orderId"]) + '\n 交易对:' + symbol +'\n 买卖方式:' + sides + '\n 购买方向:' + possides + '\n 购买价格:' + str(
price) + '\n 购买数量:' + str(quantity) + '\n 判断依据:' + message)def create_market_order(symbol='EOSUSDT', side='BUY', positionside='LONG', ordtype='MARKET', quantity='1', message=''):""" 全仓合约市价下单 @param symbol: 产品ID EOSUSDT @param side: 订单方向:BUY:买, SELL:卖 @param positionside: 持仓方向:LONG 或 SHORT @param ordtype: 订单类型:MARKET:市价单、LIMIT:限价单 @param quantity: 委托数量 @param message: 判断依据 @return: """ quantitys = float(quantity)
result = client.futures_create_order(symbol=symbol, side=side, positionSide=positionside,type=ordtype, quantity=quantitys)if side == 'SELL':
sides = '卖出' else:
sides = '买入' if positionside == 'SHORT':
possides = '做空' else:
possides = '做多' weixin.senddata('@all', 'Binance 市价单下单成功,\n 订单ID:' + str(result["orderId"]) + '\n 交易对:' + symbol +'\n 买卖方式:' + sides + '\n 购买方向:' + possides + '\n 购买数量:' + str(quantity) +'\n 判断依据:' + message)'''开平仓模式下,side和posSide需要进行组合开多:买入开多(side 填写 buy; posSide 填写 long )开空:卖出开空(side 填写 sell; posSide 填写 short )平多:卖出平多(