Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- self.logger.debug(f'LTX condition: {market.symbol[1].upper() == "LTX"} and {target_price <= book['ask_price']} and {target_price >= book['bid_price']}')
- if market.symbol[1].upper() == 'LTX' and target_price <= book['ask_price'] and target_price >= book['bid_price']:
- self.logger.info('LTX and target price is in spread')
- tp_treshold = 0.5
- tp_upper = target_price * (1 + tp_treshold / 100)
- tp_lower = target_price * (1 - tp_treshold / 100)
- tp_upper = float(f'%.{market.symbol[3]}f' % tp_upper)
- tp_lower = float(f'%.{market.symbol[3]}f' % tp_lower)
- calc_spread_ask_p = min(tp_upper, book['ask_price'])
- calc_spread_bid_p = max(tp_lower, book['bid_price'])
- cur_price = (calc_spread_bid_p + step_size) + (calc_spread_ask_p - calc_spread_bid_p - 2 * step_size) * norm_price
- self.logger.info(
- f'calc_spread_ask_p: {calc_spread_ask_p}',
- f'calc_spread_bid_p: {calc_spread_bid_p}',
- f'tp_upper: {tp_upper}',
- f'tp_lower: {tp_lower}',
- f'book_ask_p {book['ask_price']}',
- f'book_bid_p: {book['bid_price']}',
- )
- self.logger.debug(
- f'LTX condition: {market.symbol[1].upper() == "LTX"} '
- f'and {last_price is not None} '
- f'and {last_price is not None and last_price <= book['ask_price']} '
- f'and {last_price is not None and last_price >= book['bid_price']}\n'
- f'last_price: {last_price}\n'
- f'book: {book}'
- )
- if market.symbol[1].upper() == 'LTX' and last_price is not None and last_price <= book['ask_price'] and last_price >= book['bid_price']:
- self.logger.info('LTX and last price is in spread')
- tp_treshold = 0.3
- lp_upper = last_price * (1 + tp_treshold / 100)
- lp_lower = last_price * (1 - tp_treshold / 100)
- lp_upper = float(f'%.{market.symbol[3]}f' % lp_upper)
- lp_lower = float(f'%.{market.symbol[3]}f' % lp_lower)
- calc_spread_ask_p = min(lp_upper, book['ask_price'])
- calc_spread_bid_p = max(lp_lower, book['bid_price'])
- cur_price = (calc_spread_bid_p + step_size) + (calc_spread_ask_p - calc_spread_bid_p - 2 * step_size) * norm_price
- self.logger.info(
- f'last_price: {last_price}\n',
- f'calc_spread_ask_p: {calc_spread_ask_p}\n',
- f'calc_spread_bid_p: {calc_spread_bid_p}\n',
- f'lp_upper: {lp_upper}\n',
- f'lp_lower: {lp_lower}\n',
- f'book_ask_p {book['ask_price']}\n',
- f'book_bid_p: {book['bid_price']}',
- )
Advertisement
Add Comment
Please, Sign In to add comment