Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get minimum trade amount #465

Closed
lcdunne opened this issue Dec 22, 2019 · 4 comments
Closed

How to get minimum trade amount #465

lcdunne opened this issue Dec 22, 2019 · 4 comments

Comments

@lcdunne
Copy link

lcdunne commented Dec 22, 2019

I'm trying to do a market buy/sell, and I need information on the minimum amount and to how many decimal places for a given symbol.

I can get the rounding precision as follows:

    symbol = 'BTCUSDT'
    SYMBOL_INFO = Client.get_symbol_info(symbol)
    PREC = SYMBOL_INFO['filters'][2]['stepSize'].find('1')-1

... but I'm not quite sure how to get the minimum trade order. As far as I'm aware it's 0.002 BTC, but I can't see anything in my SYMBOL_INFO that takes this value. I'd like to get this programmatically as I want to generalise to other symbols. Is there a way to do this?

Also, I know this is not a bug but I wasn't sure where else to post for support - is there somewhere specific to post other than here? Would be great to know.

@pplonski
Copy link

pplonski commented Feb 3, 2020

I'm using the following function:

def get_round_precision(market):
    info = binance_client.get_symbol_info(market)
    f = [i["stepSize"] for i in info["filters"] if i["filterType"] == "LOT_SIZE"][0]
    prec = 0
    for i in range(10):
        if f[i] == "1":
            break
        if f[i] == ".":
            continue
        else:
            prec += 1
    return prec

@hamishakl
Copy link

@lcdunne did you ever manage to figure this out? I've been currently bashing my head against the wall trying to figure it out 😂

@amaye15
Copy link

amaye15 commented Feb 3, 2022

Any update, still can't seem to figure out the minimum trade possible...

@angiopteris
Copy link

angiopteris commented Feb 6, 2022

I guess the solution for your problem will be close to this, then make the exchange rate operation to whatever currency of your interest to have min transaction amount
client.get_symbol_info('BTCUSDT') will get you a json object where you'll find the desired info
You could access it with dict the dict key 'filters'

filters = client.get_symbol_info('BTCUSDT')["filters"]

for i in filters:
    if i["filterType"] == "PRICE_FILTER":
        print(i['minPrice'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants