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

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

jmpf2018 opened this issue · comments

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']);
        });