edit python files

Job ID: 31687758

Budget: $10 – $30 USD

I have a python file that reads the Binance APIs to buy and sell automatically.
But the actual script is simple after a buy or sell order is aborted.

I would like the script not to be interrupted but stores the purchase price made and adding 0.5% to the purchase price then automatically sell as soon as it rises to the set price.

example:

bb_1m = bollingerband(symbo1_trade, width, '1T', length)



print('1 minute upper center lower: ', bb_1m)

marketprice = 'https://api.binance.com/api/v1/ticker/24hr?symbol=' + symbo1_trade
res = requests.get(marketprice)
data = res.json()
lastprice = float(data['lastPrice'])

print(lastprice)



try:
if lastprice > bb_1m[0]:
print('sell')
client.order_market_sell(symbol=symbo1_trade, quantity=orderquantity)
break
#the loop stops if the order is made
except:
pass

try:
if lastprice < bb_1m[2]:
print('buy')
client.order_market_buy(symbol=symbo1_trade, quantity=orderquantity)
break
#the loop stops if the order is made
except:
pass

time.sleep(1)


currently, this piece of code blocks the script with the break command.
but it should store the value bb_1m [2].
adding 0.5% and selling it as soon as it goes up at that price.

lastprice < bb_1m[2]:
print('buy')
client.order_market_buy(symbol=symbo1_trade, quantity=orderquantity)
break
example:
bb_1m [2] ---> € 2945 + 0.5% = € 2957.725
should place the sell order at this price.
and continue the script in the loop for selling and buying.

for the purchase code portion, if the order has been placed, a new purchase order must not be made until the open order is sold.
Related categories: PHP JavaScript Python Django Software Architecture