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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Balance but no orders (Single, without composer)

patrickdegraaf opened this issue · comments

Hello,

A year ago I successfully used the binance-api-single withhout Composer. Everything worked perfectly.

Now, a year later, I use the exact same files and codes. Unfortunately, no more buy and sell orders are placed now.

My api-keys are correct, because my balance and open orders are retrieved correctly. The prices are also shown.

Are functionalities from the api outdated? What could be causing the problem? I really have no idea right now, and would like some help in the right direction.

In the meantime I have switched to a VPS server. PHP Version is 7.4.20, cURL is 7.29.0. Could it be the settings on the new server? If yes which one?

I am distraught and really need your help.

Yours sincerely,
Patrick

@patrickdegraaf The API is changing, so the code is changing (e.g. this month the wapi is being removed). I'm using just the php file like you do (not using composer) in a project I have and I can do all that is needed. You would need to check your PHP or server logs to see if you get any notices there. If you have a piece of code that is not functioning, feel free to share!

@patrickdegraaf Any further ideas on this?

After hours of trying I found out that the following code needed to be modified as follows:
from
$api->buy("BTCUSDT", $Quantity)
into
$api->buy("BTCUSDT", $Quantity, 0, "MARKET")

Luckily it wasn't any harder than this in the end.

@patrickdegraaf Then most probably you could have just changed 'buy' with 'marketBuy' which is a function that adds the "MARKET" automatically. You might also want to consider 'marketQuoteBuy'.
Closing as solved.