Here is an article based on its code fragment:
Ethereum: Binance SpotwebesocketClient will not send answers to the ordered symbol
As a cryptocurrency operator, getting real IME upgrades from a reliable source is crucial to making information -based decisions. One of these sources is API Binance Spot Websockt, which provides a way to connect to the Ethereum block chain and receive the real -time market information. However, the use of the library’s binacespotweboketclientlibrary is a problem that can prevent answers to the ordered symbols.
Problem: Order without order
In its Code fragment, it creates a new deposit in the class 'SpotwebsocketClient' and by transferring the details of the order. However, when ordered for a particular symbol used using the 'order' method, they may not be given its order. If this happens, the customer will continue to send the information from that symbol, which will also be signed after removing the list.
Solution: Using the "Under Commercation" application
To solve this problem, you should always call the 'Cancel Order' method when distributed by order. Here's an updated version of your code with this solution:
Python
Bring JSON
Bring the dateim
From binance.websocket.spot.websocket_client import Spotwebsocketclient
Def Safe_JSON_LOAD (Data):
refund information
Def Taskacal_json_dump (Data):
Return JSON.DUMPS (Data)
Binacespotweboketclient class:
Def __init __ (yourself, symbol, secretkey, add point):
Self.symbol = symbol
self
self
Self.Subricriptions = {}
Space (yourself, symbol, call back = nothing):
If the symbol is not in itself. Orders:
self
Answer = Safe_JSON_LOAD (CALL RETURN)
If the answer is not:
Raise the value ("order not valid")
self
DEF does not order (self, symbol):
If the symbol is not in itself. Orders:
return
Self.Subscriptions [Symbol]
Call a call return function to activate the non -mode event
If a self.callbackfuncts symbol:
Self.CallbackFunctions [Symbol] ()
Def _subscribe (self, symbol, data):
This method is called when ordering is created
Print (f "signed to {symbol} correct time updates")
Def Sendrealtim Media (Self, Symbol):
This method can be used for a specific symbol to restore the actual time information
accept
Example of use:
Customer = BinacespotwebsocketClient (
"Eth",
symbol
"Your_secret_Key",
secret key
"
API terminal
In
Def Onrealtimedatitarive (Data):
Print (F "{data ['symbol']} updated {data ['newprice']}")
customer
Try code
You can try this code using it in the Jupyter notebook. Make sure you have installed theBinancelibrary and also make sure you have replaced '' your_secret_key 'with its secret Binance key.
Once you have created an example of the "Binacespotweboketclient" event, you can order a certain symbol by using the 'SunScribe method that activates the actual data updates for that symbol. Then you can cancel your order by inviting the ‘Ungrisco’ method when you are ready to stop receiving updates.
As a result of these steps, you must be able to solve the problem with your code and make sure you send the answers to the ordered symbols.