Here’s the drawing of an article based on your request:
Ethereum: Problems with market order Python Binance
As a merchant, it is necessary to ensure that your algorithms are accurate and reliability. However, I faced the problem of my existing model, which prevents me from sending me to buy a market and sell orders via Binance. In this article I will describe the problem and provide possible solutions.
Question
My algorithm is designed to automatically place market orders on Ethereum Exchange, like Binance. Fragment of the code below illustrates a simple example of how it works:
`Python
Importing time
Def Place_market_order (Order_type, Page):
Url = f ” {Exchange_Symbol} & interval = 1m & limit = 100″
Paramets = {
“Symbol”: Exchange_Symbol,
“Interval”: 1m,
Limit: 100
Iche
Try:
Answer = Requirements.GET (URL, Titles = {“Contents-Tip”: “Application/Json”}, for days = days = days)
Data = Answer.json ()
If Order_type == “Buy”:
I am in the range (len (data):
If data [i] [“Close”]> Price and fun == “Buy”:
Send a market order
Order_id = Data [I] [“ID”]
Trade_id = place_order (Order_id, Exchange_symbol, side)
Print (F “
Elif Order_type == “Sell”:
I am in the range (len (data):
If data [i] [“Close”]
Send a market sales order
Order_id = Data [I] [“ID”]
Trade_id = place_order (Order_id, Exchange_symbol, side)
Print (F “
In addition to the request.exception.requestexception as E:
Print (f “Request an exception: {e}”)
Def Place_order (Order_id, Symbol, Half):
Mimic an order for an order
Time.Sleep (1)
mimic a delay in the store
Return orders_id
Exchange_Symbol = Eth-BTC
Price = 2000.0
Current Price of Real Estate
Side = “Buy”
Buy or Sell
Put orders to buy and sell on the market
Place_market_order (Purchase, Half)
Place_market_order (for sale, side)
`
In this fragment of the code we are making a request for receiving Binance APIs to obtain data from Ethereum historical markets. Then we repeat the data received and place transactions using our Place_order feature, which imitates the order by setting up sleeping in 1 second.
Problem
However, I faced this code code. The problem occurs in several orders at the same time or at short intervals (such as every millisecond). This can cause:
1
2.
I recommend that you implement the following solutions to solve this problem:
- This will reduce the number of requests that API submitted.
2.
Conclusion
In order to solve my problems with Python Binance and prevent future problems, I plan to implement the party’s appearance and order priorities using Python. By doing this, I will reduce the risk of coincidence, ranks and other usual questions that can occur in several orders at a time or short intervals.
Leave a Reply