Testnet API using python-binance & websocket - weird price feeds

Hi, I am using python-binance package, connected to Binance’s test Websocket:

wss://testnet.binance.vision/ws/bnbusdt@trade

Sometimes, the price (“p” from the json response) is below 1 usdt, when a second before it is around 200, and the second after it returns to 200. This is really messing up my bot, I wonder if it is a bug in the testnet or is it something I am doing wrong?
I trigger order events (to https://testnet.binance.vision/api) whenever there is a a certain price % change from my last order, so when everything is ok it triggers once in a few minutes.
When I get suddenly a 99+% change (as I said, the websocket json response says price is bellow 1 usdt), it goes crazy and I get all of a sudden lots of price feeds from Testnet.

I read the price from on_message function, like this:
def onMessage(ws, message):
json_message = json.loads(message)
price = round(float(json_message[‘p’]),2)

Thanks !!

Hello, the filter PRICE_FILTER for BNBUSDT doesn’t allow orders with price < 200*0.2 = 40 (weightedAveragePrice * multiplierDown), so getting trade with “p” lower than 1USDT is strange.

From my side, I’ve being running websocat wss://testnet.binance.vision/ws/bnbusdt@trade for 30min and it’s all good. Can you capture the full raw data with the wrong “p” from websocket and share it here?

Hey, thank you for your comment. It can run hours without any issues, and then get messed up prices for a few minutes.
What do you mean by capture the full raw data?
Is it the message it receive from the websocked before serializing it to json?

Do you use https://github.com/sammchardy/python-binance? It doesn’t work very well with spot test wss. Please share your major code to show you configure it correct to sub from testnet wss.

Then we can exclude the possible problem caused by Python-Binance
Please share the raw message that you think problematic like Aisling said

I noticed it happens more (or only) after making market orders

Don’t see any anomaly. It’s testnet, so it’s technically okay as long as it meets price filter

I’ll post here when i’ll get a below $ price, but for now, are these 20% percent changes happening back to back normal? It happens a lot, and sometimes with a 99% percent change

{“e”:“trade”,“E”:1614715653030,“s”:“BNBUSDT”,“t”:27381,“p”:“229.78900000”,“q”:“5.25000000”,“b”:284459,“a”:284530,“T”:1614715653029,“m”:true,“M”:true}
{“e”:“trade”,“E”:1614715653030,“s”:“BNBUSDT”,“t”:27382,“p”:“182.25170000”,“q”:“0.07000000”,“b”:284527,“a”:284530,“T”:1614715653029,“m”:true,“M”:true}
{“e”:“trade”,“E”:1614715654210,“s”:“BNBUSDT”,“t”:27383,“p”:“230.31760000”,“q”:“1.45000000”,“b”:284533,“a”:284532,“T”:1614715654209,“m”:false,“M”:true}

Hi, I am running my bot now, will post when i’ll get a below 1$ price, but what about those back-to-back 20+% percent change prices happening all the time, like the example I posted?
Here it is again:

{“e”:“trade”,“E”:1614715653030,“s”:“BNBUSDT”,“t”:27381,“p”:“229.78900000”,“q”:“5.25000000”,“b”:284459,“a”:284530,“T”:1614715653029,“m”:true,“M”:true}
{“e”:“trade”,“E”:1614715653030,“s”:“BNBUSDT”,“t”:27382,“p”:“182.25170000”,“q”:“0.07000000”,“b”:284527,“a”:284530,“T”:1614715653029,“m”:true,“M”:true}
{“e”:“trade”,“E”:1614715654210,“s”:“BNBUSDT”,“t”:27383,“p”:“230.31760000”,“q”:“1.45000000”,“b”:284533,“a”:284532,“T”:1614715654209,“m”:false,“M”:true}

or another example:

{“e”:“trade”,“E”:1614762196088,“s”:“BNBUSDT”,“t”:36212,“p”:“252.18640000”,“q”:“0.14000000”,“b”:390428,“a”:390435,“T”:1614762196087,“m”:true,“M”:true}
{“e”:“trade”,“E”:1614762196088,“s”:“BNBUSDT”,“t”:36213,“p”:“188.87520000”,“q”:“0.06000000”,“b”:390434,“a”:390435,“T”:1614762196087,“m”:true,“M”:true}

Is that normal? Because obviously it is not happening on the real market.
Few days ago those 20+% changes included some 99% percent changes, for now it is not happening but i’ll keep checking it

Yes, what is the problem with it?
This is the relevant code for the price feed:

SOCKET = “wss://testnet.binance.vision/ws/bnbusdt@trade”

def onMessage(ws, message):
json_message = json.loads(message)
price = round(float(json_message[‘p’]),2)

ws = websocket.WebSocketApp(SOCKET, on_open=onOpen, on_close=onClose,on_message=onMessage, on_error=onError)
ws.run_forever()

Also, is there a diffrenet package that you recommend? It doesn’t have to be in Python.
Thanks you for the comment

Oh, the websocket I use is another package: