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

Crypto-coins errors on sell and buy #31

Open
Kadiri84 opened this issue Aug 16, 2020 · 2 comments
Open

Crypto-coins errors on sell and buy #31

Kadiri84 opened this issue Aug 16, 2020 · 2 comments

Comments

@Kadiri84
Copy link

Hi fox,
i'm coding a scanner bot for short term profit however since the prices are different from coins to coins i got exceptions when buying and selling,i'm 99.9 sure that it has a relation with decimals and the way the function round() is doing the rounding. Here is a block of code:

        m1=client.get_klines(symbol=mycoin, interval='1m')
        tim=datetime.fromtimestamp(int(m1[-1][0])/1000)
        xlslog['Entred time'].append(tim)
        EnterPrice=round(float(m1[-1][4]),7)
        xlslog['inPrice'].append(EnterPrice)
        stoprsi=False
        buystat=True
        xt+=1
        Ploss=(float(EnterPrice)*0.08)/100
        divrsi=(float(EnterPrice)*0.6)/100
        Ploss=float(EnterPrice)-Ploss
        divrsi=round(float(EnterPrice)+divrsi,7)
        inprice=round(float(EnterPrice),7)
        qnt=round(float(15/inprice),4)
        try:
            buyorder = client.order_market_buy(symbol=mycoin,quantity=qnt)
        except BinanceAPIException as e:
            
            # error handling goes here
            qnt=int(qnt)
            buyorder = client.order_market_buy(symbol=mycoin,quantity=qnt)

Can any experienced coder that dealed with this issue before advise on an idea of how to solve it please?
Thank you in advance,

Regards,

@Kadiri84
Copy link
Author

Nobody?

@Dave-Vallance
Copy link
Owner

What exception are you getting? I would need to see the full error message. If you are getting a Binance API exception, a complete guess without looking at anything is that you are not meeting the minimum order size or tick size.

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

2 participants