python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

The limit parameter setting of ThreadedDepthCacheManager.start_futures_depth_socket don't work

Open yclsl opened this issue 3 years ago • 0 comments

Describe the bug The limit parameter setting is invalid, no matter how I set the limit, the returned bid and ask lengths are 10.

To Reproduce

from binance.depthcache import DepthCache
from binance import ThreadedDepthCacheManager

api_key = 'XX'
api_secret = 'XX'

def main():

    dcm = ThreadedDepthCacheManager(api_key=api_key, api_secret=api_secret)
    # start is required to initialise its internal loop
    dcm.start()

    def handle_depth_cache(depth_cache: DepthCache):
        print("type(depth_cache) =", type(depth_cache))
        print(f"symbol {depth_cache.symbol}")
        print("size of bids = {}".format(len(depth_cache.get_bids())))
        print(depth_cache.get_bids()[:len(depth_cache.get_bids())])
        print("size of asks = {}".format(len(depth_cache.get_asks())))
        print(depth_cache.get_asks()[:len(depth_cache.get_asks())])
        print("last update time {}".format(depth_cache.update_time))

    dcm_name = dcm.start_futures_depth_socket(handle_depth_cache, symbol='BTCUSDT', limit=50)
    dcm.join()

if __name__ == "__main__":
   main()

Expected behavior I expect both bid and ask lengths to be returned to be 50.

Environment (please complete the following information):

  • Python version: 3.9
  • Virtual Env: conda
  • OS: Centos
  • python-binance version: 1.0.16

yclsl avatar Jul 01 '22 10:07 yclsl