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
605 stars 497 forks source link

How to get depthCache information without using WebSocket, is that possible? #495

Open jmpf2018 opened 1 year ago

jmpf2018 commented 1 year ago

i'm creating a Job that stores price information at every 1 minute, when using WebSocket I'm not able to do so because the Job doen't end. Is there any easy way to do this and get the information?

$api->depthCache([$this->pair_ticker], function($api, $symbol, $depth) {
            $limit = 10; // Show only the closest asks/bids
            $sorted = $api->sortDepth($symbol, $limit);
            $bid = $api->first($sorted['bids']);
            $ask = $api->first($sorted['asks']);
        });