Dust Transfer More than One Coin
Hi I am trying to use the dust_transfer method on the binance client class and I was wondering if there is any support for transferring multiple coins in a single call (since I can only make this call every 24hrs)? I can transfer a single coin this: client.dust_transfer(asset='BTC')
but I would want to do something like this: client.dust_transfer(asset=['BTC', 'LSK', 'ETH'])
But that is not supported by the python api. Anyone know how to create the correct function signature or even the raw request? According to the Binance REST api docs example for the dust_transfer, it should be possible to pass it any array of coin assets.
https://github.com/binance-exchange/binance-official-api-docs/blob/9dbe0e961b80557bb19708a707c7fad08842b28e/wapi-api.md#dust-transfer-user_data
I tried writting my own implementation of the transfer dust method and built the request with multiple assets like the REST docs say and I get:
"Signature for this request is not valid"
Also tried building the request in postman and I can do a single asset fine its just when I try and do multiple assets I get that same error. Anyone have any ideas on what else I could try?

Upvote, I was trying the same and didn't find any solutions. Did anyone find one ?
@sdurivau25 I ended up using the ccxt python module. It supports passing a list of coins. Here is how I used it. https://github.com/jamesbaber1/user_data/blob/7a5cc14a31a2d844c8db9b59fad059e37c429abc/utils/bot.py#L229
Thanks mate ! I'll give it a look, as long as I think it's way better than what I did.
For the others, here is the solution I found :
What you can do is create a string :
to_be_dusted = "ONE ASSET U WANT TO DELETE&asset=SECOND ASSET&asset=THIRD ASSET" etc
It'll work when doing client.transfer_dust(asset=to_be_dusted)
But obviously it's a homemade and ugly solution. Poor error handling, unpythonic.
if we can get a PR for a fix on this, I would be glad to review + merge
if we can get a PR for a fix on this, I would be glad to review + merge
+1. transfer_dust really need to support having a list as argument. This is especially annoying since you cannot transfer dust more than once every 6 hours.
Any news on this one?
la ligne de commande doit etre comme caresult = client.transfer_dust(asset="EOS, XVG, STX")
et la limit de paire simultané est de 20
mon script est comme cela ` import json import binance
from binance.exceptions import BinanceAPIException from binance.client import Client
init
api_key = "" api_secret = "" client = Client(api_key, api_secret)
from binance.enums import *
info = client.get_account() data = json.dumps(info) result = json.loads(data) result_asset = result['balances'] listpaire = "" countpaire = 0 php = json.dumps(list(filter(lambda x:x["free"]!="0.00000000",result_asset))) #for e in result_asset: php2 = json.loads(php) for i in php2: paire = i["asset"] + "USDT" try: info2 = client.get_avg_price(symbol=paire) #print(info2['price']) calc = float(i["free"]) * float(info2['price']) if countpaire == 15: break else: if calc == 0: print("0") else: if calc < 10: if listpaire == "": listpaire = i["asset"] countpaire = countpaire + 1 else: listpaire = listpaire + ", " + i["asset"] countpaire = countpaire + 1 except BinanceAPIException: print("Oops!")
cmdbnb = str('(asset="' + listpaire + '")') cmdbnb = "client.transfer_dust" + cmdbnb print(cmdbnb) result = exec(cmdbnb) `
pas forcement optimisé mais ca fonctionne
la ligne de commande doit etre comme ca
result = client.transfer_dust(asset="EOS, XVG, STX")et la limit de paire simultané est de 20mon script est comme cela ` import json import binance
from binance.exceptions import BinanceAPIException from binance.client import Client
init
api_key = "" api_secret = "" client = Client(api_key, api_secret)
from binance.enums import *
info = client.get_account() data = json.dumps(info) result = json.loads(data) result_asset = result['balances'] listpaire = "" countpaire = 0 php = json.dumps(list(filter(lambda x:x["free"]!="0.00000000",result_asset))) #for e in result_asset: php2 = json.loads(php) for i in php2: paire = i["asset"] + "USDT" try: info2 = client.get_avg_price(symbol=paire) #print(info2['price']) calc = float(i["free"]) * float(info2['price']) if countpaire == 15: break else: if calc == 0: print("0") else: if calc < 10: if listpaire == "": listpaire = i["asset"] countpaire = countpaire + 1 else: listpaire = listpaire + ", " + i["asset"] countpaire = countpaire + 1 except BinanceAPIException: print("Oops!")
cmdbnb = str('(asset="' + listpaire + '")') cmdbnb = "client.transfer_dust" + cmdbnb print(cmdbnb) result = exec(cmdbnb) `
pas forcement optimisé mais ca fonctionne
This worked for me , thank you
There is an alternative solution for the latest api:
from binance.client import Client
client = Client(XXX, XXX)
dust_assets = ",".join([o['asset'] for o in client.get_dust_assets()['details']])
client.transfer_dust(asset=dust_assets)