Contact : ck@xueqiubot.com/ WeChat@stay37 This policy automatically transfers USDT from the contract account to the cash account to purchase BNB, transferring the BNB to the contract account to debit the transaction fee. Add the Airbnb_usdt transaction pair in advance
# Contact : ck@xueqiubot.com / WeChat@stay37 import time def supply_bnb(transfer_usdt,i): Log("当前BNB不足,补充BNB作为手续费抵扣") #获取当前BNB_USDT价格 depth = _C(exchanges[i].GetDepth) #转出transfer_usdt个USDT timestamp = time.time() * 1000 transfer = exchanges[i].IO("api","POST","/sapi/v1/futures/transfer","asset=USDT&amount="+str(transfer_usdt)+"&type=2×tamp=+"+str(timestamp)) time.sleep(1) #获取BNB深度 下单购买 depth = _C(exchanges[i].GetDepth) buyamount = round(transfer_usdt / (depth.Asks[0].Price + 0.2) , 2) buyid = exchanges[i].Buy(round(depth.Asks[0].Price + 0.1 , 4) , buyamount) time.sleep(1) #查询购买结果 将购买后的BNB以及剩余的USDT转入合约账户 acc = _C(exchanges[i].GetAccount) transfer_usdt = acc.Balance transfer_bnb = acc.Stocks timestamp = time.time() * 1000 transfer = exchanges[i].IO("api","POST","/sapi/v1/futures/transfer","asset=USDT&amount="+str(transfer_usdt)+"&type=1×tamp=+"+str(timestamp)) transfer = exchanges[i].IO("api","POST","/sapi/v1/futures/transfer","asset=BNB&amount="+str(transfer_bnb)+"&type=1×tamp=+"+str(timestamp)) Log("BNB补充完成") def main(): if '合约账户内BNB不足': #transfer_usdt: 需要购买的usdt金额 #i: bnb_usdt现货交易对的序号 supply_bnb(transfer_usdt,i)
0x0000000Traceback (most recent call last): File "
The grassYes, that's right.
Xueqiu BotUsing a BNB/USDT transaction pair that requires the addition of a bitcoin, i refers to the order number of the transaction pair added.
0x0000000'transfer_usdt' I get it, what should the Binance Platform i parameter fill in? Sorry, I don't have any programming background so the problem is relatively minor, please forgive me.
Xueqiu Bot'transfer_usdt' This is the setting of how many USDT you want to use to buy BNB as a rebate each time, the program will automatically transfer the set USDT to buy BNB and then return to the contract account