Skip to content

Conversation

@balancy
Copy link
Owner

@balancy balancy commented Jan 8, 2021

  1. Спроектирована модель и создана таблица по фундаментальным показателям
  2. Реализовано извлечение большинства необходимых для построения перспективности фундаментальных показателей с финансового API и скринера Finviz
  3. Рефакторинг проекта в соответствии с разбиением на модули
  4. Организация записи фундаментальных показателей в БД
  5. Считываие фундаментальных показателей из БД
  6. Проверка условия записи показателей в БД в том случае, если записи по этому тикеру на эту дату еще нет
  7. Расчет коэффициентов перспективности акций на основе фундаментальных показателей
  8. Построение диаграммы перспективности на основе коэффициентов и сохранение картинки
  9. Построение простой страницы на bootstrap, которая пока выводит только движение цены
  10. Небольшая работа с ботом - добавление описания, приветствия, картинки. Также добавление иконки на сайт

…from financial API and Finviz; Calculating perspective coefficients and plotting Spider Plot based on these coefficients. New DB table Fundamentals created. Organisation of saving/extracting fundamentals from and to DB.
@balancy balancy requested a review from morgangt January 8, 2021 14:43
Comment on lines 1 to 48
APScheduler==3.6.3
beautifulsoup4==4.9.3
certifi==2020.12.5
cffi==1.14.4
chardet==3.0.4
click==7.1.2
convertdate==2.2.0
cryptography==3.3.1
decorator==4.4.2
dnspython==2.0.0
email-validator==1.1.2
Flask==1.1.2
Flask-SQLAlchemy==2.4.4
Flask-WTF==0.14.3
holidays==0.10.4
idna==2.10
itsdangerous==1.1.0
Jinja2==2.11.2
korean-lunar-calendar==0.2.1
lxml==4.6.2
MarkupSafe==1.1.1
multitasking==0.0.9
numpy==1.19.4
pandas==1.1.5
pandas-datareader==0.9.0
pandas-market-calendars==1.6.1
psycopg2==2.8.6
pyaes==1.6.1
pyasn1==0.4.8
pycparser==2.20
PyMeeus==0.3.7
pymongo==3.11.2
python-dateutil==2.8.1
python-telegram-bot==13.1
pytz==2020.4
requests==2.25.0
rsa==4.6
simplejson==3.17.2
six==1.15.0
soupsieve==2.0.1
SQLAlchemy==1.3.22
Telethon==1.18.2
toolz==0.11.1
tornado==6.1
trading-calendars==2.1.0
tzlocal==2.1
urllib3==1.26.2
Werkzeug==1.0.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

предлагаю пересмотреть requirements.txt и добавлять все пакеты руками и только те что мы используем и не выгружать автоматически все библиотеки


# categories
categories = df.keys()
N = len(categories)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

с большими буквами называют только константы или классы, надо переименовать например в n_len_categories

Comment on lines +35 to +42
if score_ < 10:
return RED
elif score_ < 16:
return ORANGE
elif score_ < 23:
return YELLOW
else:
return GREEN
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

если цвета используются только в этой функции то константы можно упростить

Comment on lines +9 to +12
RED = 'red'
ORANGE = 'orange'
YELLOW = 'yellow'
GREEN = 'green'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это обще принятые значения их можно не выводить в константы, но если добавить осмысленности, например: использовать каждый цвет в определенном случае (green - perfectly, yellow-good, orange-passably, red-bad)

Comment on lines +28 to +29
# sector
sector = df[4][0][2].split('|')[0].rstrip()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

чуть больше комментариев что тут происходит, можно привести пример разбераймой строки

from flaskr.db import Base


class News(Base):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

К моделям лучше везде добавить пояснительный docstring

for one_old_news in old_news:
db_session.delete(one_old_news)
db_session.commit()
print(f"{num_old_news} old news were deleted from the DB.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print надо везде заменить на log

"""

old_news = db.session.query(News).filter(News.date < datetime.now() - timedelta(days=2))
old_news = News.query.filter(News.date < datetime.now() - timedelta(days=2))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для улучшения читабильности лучше добавить скобки
News.date < (datetime.now() - timedelta(days=2))



def delete_news_from_db() -> None:
"""Удаление старых новосте из БД
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

первая строка docstring заканчивается точкой, для проверки таких мелочей можно установить flake8 и black и использовать их для проверки и исправления кода

flaskr/static/data/ListingSecurityList.csv
flaskr.db
flaskr/config.py No newline at end of file
config.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

для примера в проект обычно добавляют файл example.config.py в котором перечисляют все переменные который будут в боевом config.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants