jaggedsoft / php-binance-api

PHP Binance API is an asynchronous PHP library for the Binance API designed to be easy to use. https://github.com/binance-exchange/php-binance-api
MIT License
610 stars 496 forks source link

Laravel error {message: "signedRequest error: {"code":-1013,"msg":"Filter failure: LOT_SIZE"}" #464

Closed zorrero closed 2 years ago

zorrero commented 2 years ago

Hello, i'm new using binance api. I was trying to create a simple interface to make orders.

At the moment everything is okey but when i put some symbols to make orders i get that error.

I saw the others related questions to this but i don't understand how to solve it with php documentation.

As i know i should use the min_notional variable to get the correct LOT SIZE but i don't know how to get that information by using laravel.

My current code is:

        $data['pair'] = $request->pair['pair'];
        $data['ratebuy'] = $request->ratebuy;
        $data['raterebuy'] = $request->raterebuy;
        $data['stoploss'] = $request->stoploss;
        $data['takeprofit'] = $request->takeprofit;
        $data['amountusdt'] = $request->amountusdt;
        $data['amountbuy'] = number_format($request->amountusdt / $request->ratebuy,2);
        $data['type'] = 'buy';
        $data['result'] = 'Pending';
        $data['status'] = 'Filled';
        $api = new Binance\API("xxxx","xxx");
        $quantity = $data['amountbuy'];
        $price = $data['ratebuy'];
        $order = $api->buy($data['pair'], $quantity, $price);
        if ($order) {
          $data['buyrefid'] = $order['orderId'];
          $neworder = Operationsbuy::create($data);
          return $order;
        }else{
          return $order;
        }

I would be very grateful for someone that helps me to fix it inside my code.

Thanks!!

ePascalC commented 2 years ago

@zorrero I can't really help you with Laravel, but LOT_SIZE is something you have to deal with in your code. Please check our wiki on https://github.com/jaggedsoft/php-binance-api/wiki/FAQ#how-can-i-fix-my-lot_size-error

zorrero commented 2 years ago

Hi ePascal thanks for your reply. I don't understand how to make a marketquotebuy order. Can you simply help me to understand it? I'm a newbie trying 3 days ago to fix it.

I only see in the php binance api that i'm able to make a limit order passing quantity to buy and price but i don't see the option to pass marketquotebuy. Thanks and regards