Перейти к публикации
Форум ботоводов

boris1982

Members
  • Публикации

    1
  • Зарегистрирован

  • Посещение

boris1982's Achievements

Newbie

Newbie (1/14)

0

Репутация

  1. Помогите разобраться. Первый день в программировании. Бот работает на бинансе. Обычная закупка/продажа по заготовленному массиву. Не знаю почему, но идет бесконечный цикл закупка/продажа несмотря на проверку есть/нету ордера. Толи не сразу обновляется информация из "client.get_all_orders" Толи корявый код. Написан на python def search(status, side, price): for p in check_order: if p['status'] == status and p['side'] == side and p['price'] == price: return p price_buy = ['28.18300000','28.36530000','28.54950000','28.73520000','28.92180000','29.10980000','29.29920000','29.48950000','29.68130000','29.87430000'] price_sell = ['28.36530000','28.54950000','28.73520000','28.92180000','29.10980000','29.29920000','29.48950000','29.68130000','29.87430000','30.07530000'] order_numb = ['0.38','0.37','0.37','0.37','0.37','0.37','0.36','0.36','0.36','0.36'] jj = 0.5 while True: check_order = client.get_all_orders(symbol='LINKUSDT', limit=10) #check_price = client.get_symbol_ticker(symbol='LINKUSDT') k = 0 sox = len(check_order) while sox > 0: check_price = client.get_symbol_ticker(symbol='LINKUSDT') # BUY if search("FILLED", "BUY", price_buy[k]): if search("NEW", "SELL", price_sell[k]): if float(check_price['price']) < float(price_sell[k]): order = client.create_order(symbol='LINKUSDT', side=SIDE_SELL, type=ORDER_TYPE_LIMIT, timeInForce=TIME_IN_FORCE_GTC, quantity=order_numb[k], price=price_sell[k]) print('new order') time.sleep(jj) else: if search("NEW", "BUY", price_buy[k]): print('wait') time.sleep(jj) else: if float(check_price['price']) > float(price_buy[k]): order = client.create_order(symbol='LINKUSDT', side=SIDE_BUY, type=ORDER_TYPE_LIMIT, timeInForce=TIME_IN_FORCE_GTC, quantity=order_numb[k], price=price_buy[k]) print('new order from buy') time.sleep(jj) # SELL if search("FILLED", "SELL", price_sell[k]): if search("NEW", "BUY", price_buy[k]): if float(check_price['price']) > float(price_buy[k]): order = client.create_order(symbol='LINKUSDT', side=SIDE_BUY, type=ORDER_TYPE_LIMIT, timeInForce=TIME_IN_FORCE_GTC, quantity=order_numb[k], price=price_buy[k]) print('new order from sell') time.sleep(jj) else: if search("NEW", "SELL", price_sell[k]): print('wait') time.sleep(jj) else: if float(check_price['price']) < float(price_sell[k]): order = client.create_order(symbol='LINKUSDT', side=SIDE_SELL, type=ORDER_TYPE_LIMIT, timeInForce=TIME_IN_FORCE_GTC, quantity=order_numb[k], price=price_sell[k]) print('new order') time.sleep(jj) k = k + 1 sox = sox - 1
×
×
  • Создать...