Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing couple of bugs #12

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ RUN cd /tmp && \
COPY .. .

RUN pip install --upgrade pip
RUN pip install -r app/requirements-step-1.txt
RUN pip install -r app/requirements-step-2.txt
RUN pip install -r app/requirements-step-1.txt --no-cache-dir --root-user-action=ignore
RUN pip install -r app/requirements-step-2.txt --no-cache-dir --root-user-action=ignore

CMD ["tail", "-f", "/dev/null"]

6 changes: 3 additions & 3 deletions app/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ notifiers:
template: "{{exchange}}-{{market}}-{{indicator}}-{{indicator_number}} is {{status}}!{{ '\n' -}}"
redis:
required:
host: null
port: null
host: "kriptora_station_redis"
port: "6379"
channel: "pubsub_channel"
optional:
password: null
password: "root"


indicators:
Expand Down
1 change: 0 additions & 1 deletion app/exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ def get_exchange_markets(self, exchanges=[], markets=[]):
self.logger.info(
'%s has no market %s, ignoring.', exchange, market)
else:
print(self.base_markets)
if self.base_markets[exchange]:
if self.top_pairs and self.top_pairs > 0:
self.logger.info('Getting top %d pairs from %s in %s', self.top_pairs, str(
Expand Down
15 changes: 10 additions & 5 deletions app/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import asyncio
import copy
import json
import math
import os
import re
import sys
Expand Down Expand Up @@ -748,7 +749,7 @@ def get_indicator_messages(self, new_analysis):

if not self.first_run and not self.conditional_config:
if analysis['config']['alert_frequency'] == 'once' and last_status == status:
self.logger.info('Alert frecuency once. Dont alert. %s %s %s',
self.logger.info('Alert frequency once. Dont alert. %s %s %s',
market_pair, indicator, candle_period)
should_alert = False
else:
Expand All @@ -761,7 +762,7 @@ def get_indicator_messages(self, new_analysis):
if 'mute_cold' in analysis['config'] and analysis['config'][
'mute_cold'] == True and latest_result['is_cold'] == True:
self.logger.info(
'Skiping cold notification for %s %s %s', market_pair, indicator, candle_period)
'Skipping cold notification for %s %s %s', market_pair, indicator, candle_period)
should_alert = False

if should_alert:
Expand All @@ -770,8 +771,13 @@ def get_indicator_messages(self, new_analysis):
if len(base_currency) == 2:
base_currency, quote_currency = base_currency
precision = self.market_data[exchange][market_pair]['precision']
decimal_format = '.{}f'.format(
precision['price'])

precision_value = precision['price']
# Determine the number of decimal places
decimal_places = abs(
int(round(-math.log10(precision_value)))) if precision_value > 0 else 0
# Create a valid format specifier
decimal_format = '.{}f'.format(decimal_places)

prices = ''
price_value = {}
Expand All @@ -782,7 +788,6 @@ def get_indicator_messages(self, new_analysis):
for key, value in candle_values[candle_period].items(
):
price_value[key] = value

value = format(
value, decimal_format)
prices = '{} {}: {}'.format(
Expand Down