['profit_markup']) # We calculate the minimum price for sale min_price = (need_to_earn / sell_amount) / ( (1 - STOCK_FEE) if not USE_BNB_FEES else 1) # Reduce to the desired form, if the price after cutting off the excess characters is less than the necessary, increase by one cut_price = max( adjust_to_step( min_price, CURR_LIMITS['filters'][0]['tickSize'], increase=True), adjust_to_step( min_price, CURR_LIMITS['filters'][0]['tickSize'])) # Get current exchange rates curr_rate = float( bot.tickerPrice(symbol=orders_info[order] ['order_pair'])['price']) # If the current price is higher than necessary, we sell at the current need_price = max(cut_price, curr_rate) log.info(""" It was originally purchased {buy_initial: 0.8f}, minus the commission {has_amount: 0.8f}, It turns out to sell only {sell_amount: 0.8f} You need to get at least {need_to_earn: 0.8f} {curr} Min price(with commission) will be {min_price}, after casting {cut_price: 0.8f} Current Market Price {curr_rate: 0.8f} Final sale price: {need_price: 0.8f} """.format(buy_initial=orders_info[order]['buy_amount'], has_amount=has_amount, sell_amount=sell_amount, need_to_earn=need_to_earn, curr=all_pairs[orders_info[order]
import telebot from binance_api import Binance from tg_api import bot_key from telebot import types from cbr_rates import dollar_cbr from cbr_rates import euro_cbr import finviz import os from flask import Flask, request token = bot_key() bot = telebot.TeleBot(token) crypto_bot = Binance(API_KEY='Your_Key', API_SECRET='Your_Key') p_btc = crypto_bot.tickerPrice(symbol='BTCUSDT') price_btc = p_btc['price'] p_eth = crypto_bot.tickerPrice(symbol='ETHUSDT') price_eth = p_eth['price'] p_trx = crypto_bot.tickerPrice(symbol='TRXUSDT') price_trx = p_trx['price'] p_bnb = crypto_bot.tickerPrice(symbol='BNBUSDT') price_bnb = p_bnb['price'] p_eos = crypto_bot.tickerPrice(symbol='EOSUSDT') price_eos = p_eos['price'] p_xrp = crypto_bot.tickerPrice(symbol='XRPUSDT')