den4ik2003

Untitled

Jan 17th, 2026
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.11 KB | None | 0 0
  1. self.logger.debug(f'LTX condition: {market.symbol[1].upper() == "LTX"} and {target_price <= book['ask_price']} and {target_price >= book['bid_price']}')
  2.  
  3.                 if market.symbol[1].upper() == 'LTX' and target_price <= book['ask_price'] and target_price >= book['bid_price']:
  4.                     self.logger.info('LTX and target price is in spread')
  5.                     tp_treshold = 0.5
  6.  
  7.                     tp_upper = target_price * (1 + tp_treshold / 100)
  8.                     tp_lower = target_price * (1 - tp_treshold / 100)
  9.                     tp_upper = float(f'%.{market.symbol[3]}f' % tp_upper)
  10.                     tp_lower = float(f'%.{market.symbol[3]}f' % tp_lower)
  11.  
  12.                     calc_spread_ask_p = min(tp_upper, book['ask_price'])
  13.                     calc_spread_bid_p = max(tp_lower, book['bid_price'])
  14.                     cur_price = (calc_spread_bid_p + step_size) + (calc_spread_ask_p - calc_spread_bid_p - 2 * step_size) * norm_price
  15.                     self.logger.info(
  16.                         f'calc_spread_ask_p: {calc_spread_ask_p}',
  17.                         f'calc_spread_bid_p: {calc_spread_bid_p}',
  18.                         f'tp_upper: {tp_upper}',
  19.                         f'tp_lower: {tp_lower}',
  20.                         f'book_ask_p {book['ask_price']}',
  21.                         f'book_bid_p: {book['bid_price']}',
  22.                     )
  23.  
  24.                 self.logger.debug(
  25.                     f'LTX condition: {market.symbol[1].upper() == "LTX"} '
  26.                     f'and {last_price is not None} '
  27.                     f'and {last_price is not None and last_price <= book['ask_price']} '
  28.                     f'and {last_price is not None and last_price >= book['bid_price']}\n'
  29.                     f'last_price: {last_price}\n'
  30.                     f'book: {book}'
  31.                 )
  32.  
  33.                 if market.symbol[1].upper() == 'LTX' and last_price is not None and last_price <= book['ask_price'] and last_price >= book['bid_price']:
  34.                     self.logger.info('LTX and last price is in spread')
  35.                     tp_treshold = 0.3
  36.  
  37.                     lp_upper = last_price * (1 + tp_treshold / 100)
  38.                     lp_lower = last_price * (1 - tp_treshold / 100)
  39.                     lp_upper = float(f'%.{market.symbol[3]}f' % lp_upper)
  40.                     lp_lower = float(f'%.{market.symbol[3]}f' % lp_lower)
  41.  
  42.                     calc_spread_ask_p = min(lp_upper, book['ask_price'])
  43.                     calc_spread_bid_p = max(lp_lower, book['bid_price'])
  44.                     cur_price = (calc_spread_bid_p + step_size) + (calc_spread_ask_p - calc_spread_bid_p - 2 * step_size) * norm_price
  45.                     self.logger.info(
  46.                         f'last_price: {last_price}\n',
  47.                         f'calc_spread_ask_p: {calc_spread_ask_p}\n',
  48.                         f'calc_spread_bid_p: {calc_spread_bid_p}\n',
  49.                         f'lp_upper: {lp_upper}\n',
  50.                         f'lp_lower: {lp_lower}\n',
  51.                         f'book_ask_p {book['ask_price']}\n',
  52.                         f'book_bid_p: {book['bid_price']}',
  53.                     )
Advertisement
Add Comment
Please, Sign In to add comment