INNER CODE UNIT · Python
tp_outside_maxrange_price
hadialaddin/crypto-genie · crypto-genie.py:1932
tp_outside_maxrange_price = round_to_tick(entry_price + (((tp_price_ratio_maxrange/100) / leverage_for_tp_calc) * entry_price), tick_size[symbol])
#print('Max Range TP Price = ' + str(tp_outside_maxrange_price))
break
# Now we calculate total TPs
for active_order in fetched_active_orders["result"]:
if symbol.endswith('USDT'): # USDT Perpetual
limit_price = float(active_order['price'])
# if active_order['side'] == 'Sell' and limit_price > last_price and limit_price > entry_price and active_order['reduce_only'] == True:
if active_order['side'] == 'Sell' and active_order['reduce_only'] == True:
# Take Profit found, add it to the total
total_tp_found += float(active_order['qty'])
active_tps_order_id.append(active_order['order_id'])
if limit_price > tp_outside_maxrange_price:
tp_outside_maxrange_found = True
else: # Inverse Perpetuals or Futures
limit_price = float(active_order['price'])
if active_order['side'] == 'Sell' and limit_price > last_price and limit_price > entry_price: