Binance Spot TestNet is'nt updating prices using API client

I am trying to build a trading bot in Python using Binance API.

In the testnet, I was able to work until yesterday when orderbook and ticker API’s started giving me frozen prices. I am not a direct client to Binance so cannot confirm the issue directly with Binance. Please someone confirm the same issue as I haven’t seen any announcement on Binance official site. If it’s a reoccurring issue, I will check with my client (whose account I am using) so he can ask Binance to fix it this issue.

FYI, prices (bid/ask) of LTC coin change every 5 to 10 seconds. At least a single penny (0.01) up or down which I will show down below:

Here is a small portion of a long log shows that price is frozen. Ticker vs Orderbook way they are different from each other but they are frozen to their own values. Like OrderBook (bid/ask) are frozen to 64.18 and 64.1 while Ticker values are frozen to 64.1 and 64.18.

It clearly seems to be a problem and a blocker.

TestNet result:

2023-09-20 13:26:49,158 :: INFO :: Wait for 10 seconds
2023-09-20 13:27:00,580 :: INFO :: From orderbook: ####
2023-09-20 13:27:00,580 :: INFO :: ---------New bid: 64.18, new ask:64.1 ####
2023-09-20 13:27:01,213 :: INFO :: From Ticker: ####
2023-09-20 13:27:01,213 :: INFO :: ---------New bid: 64.1, new ask:64.18 ####
2023-09-20 13:27:01,213 :: INFO :: Wait for 10 seconds
2023-09-20 13:27:11,742 :: INFO :: From orderbook: ####
2023-09-20 13:27:11,742 :: INFO :: ---------New bid: 64.18, new ask:64.1 ####
2023-09-20 13:27:12,374 :: INFO :: From Ticker: ####
2023-09-20 13:27:12,375 :: INFO :: ---------New bid: 64.1, new ask:64.18 ####
2023-09-20 13:27:12,375 :: INFO :: Wait for 10 seconds
2023-09-20 13:27:22,855 :: INFO :: From orderbook: ####
2023-09-20 13:27:22,855 :: INFO :: ---------New bid: 64.18, new ask:64.1 ####
2023-09-20 13:27:23,796 :: INFO :: From Ticker: ####
2023-09-20 13:27:23,796 :: INFO :: ---------New bid: 64.1, new ask:64.18 ####
2023-09-20 13:27:23,796 :: INFO :: Wait for 10 seconds

(Before you suggest a theory that prices are not changing because of unavailable matching prices, I can respond to that in advance. Binance is big exchange, even in the TestNet, there should be enough orders changing market price. However, I came to know from a source that TestNet prices should be always closer to the prices in Live. So prices should be changing in the Testnet regardless.)

I ran same code in Spot Live and guess what? Prices are changing as expected.

2023-09-20 13:39:04,633 :: INFO :: From orderbook: ####
2023-09-20 13:39:04,633 :: INFO :: ---------New bid: 64.63, new ask:64.62 ####
2023-09-20 13:39:04,948 :: INFO :: From Ticker: ####
2023-09-20 13:39:04,948 :: INFO :: ---------New bid: 64.62, new ask:64.63 ####
2023-09-20 13:39:04,948 :: INFO :: Wait for 10 seconds
2023-09-20 13:39:15,119 :: INFO :: From orderbook: ####
2023-09-20 13:39:15,119 :: INFO :: ---------New bid: 64.63, new ask:64.62 ####
2023-09-20 13:39:15,434 :: INFO :: From Ticker: ####
2023-09-20 13:39:15,434 :: INFO :: ---------New bid: 64.62, new ask:64.63 ####
2023-09-20 13:39:15,434 :: INFO :: Wait for 10 seconds
2023-09-20 13:39:25,602 :: INFO :: From orderbook: ####
2023-09-20 13:39:25,602 :: INFO :: ---------New bid: 64.61, new ask:64.6 ####
2023-09-20 13:39:25,917 :: INFO :: From Ticker: ####
2023-09-20 13:39:25,917 :: INFO :: ---------New bid: 64.6, new ask:64.61 ####
2023-09-20 13:39:25,917 :: INFO :: Wait for 10 seconds
2023-09-20 13:39:36,086 :: INFO :: From orderbook: ####
2023-09-20 13:39:36,086 :: INFO :: ---------New bid: 64.58, new ask:64.57 ####
2023-09-20 13:39:36,401 :: INFO :: From Ticker: ####
2023-09-20 13:39:36,401 :: INFO :: ---------New bid: 64.57, new ask:64.58 ####
2023-09-20 13:39:36,401 :: INFO :: Wait for 10 seconds
2023-09-20 13:39:46,563 :: INFO :: From orderbook: ####
2023-09-20 13:39:46,563 :: INFO :: ---------New bid: 64.57, new ask:64.56 ####
2023-09-20 13:39:46,879 :: INFO :: From Ticker: ####
2023-09-20 13:39:46,879 :: INFO :: ---------New bid: 64.56, new ask:64.57 ####
2023-09-20 13:39:46,879 :: INFO :: Wait for 10 seconds

while(True):
    order_book = client.get_order_book(symbol=symbol)
    new_bid = float(order_book['asks'][0][0])
    new_ask = float(order_book['bids'][0][0])
    
    logging.info(f" From orderbook:  ####")
    logging.info(f" ---------New bid: {new_bid}, new ask:{new_ask}  ####")
    
    ticker = client.get_orderbook_ticker(symbol=symbol)
    

    new_bid = float(ticker['bidPrice']) 
    new_ask = float(ticker['askPrice'])

    logging.info(f" From Ticker:  ####")
    logging.info(f" ---------New bid: {new_bid}, new ask:{new_ask}  ####")
                    
            
    logging.info(f"Wait for {pause_time} seconds")
    time.sleep(pause_time)

A frustrating issue with the Binance TestNet API is the most common one we’ve encountered. According to recent discussions and reports, I’ve read that other users are also experiencing similar issues with frozen prices on Binance TestNet¹. This issue may not have been widely acknowledged or officially announced by Binance yet.

1 Like