-
Notifications
You must be signed in to change notification settings - Fork 0
08.01.2021. Работа с диаграмой перспективности и связанных с ней фундаментальными показателями #8
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
base: main
Are you sure you want to change the base?
Conversation
balancy
commented
Jan 8, 2021
- Спроектирована модель и создана таблица по фундаментальным показателям
- Реализовано извлечение большинства необходимых для построения перспективности фундаментальных показателей с финансового API и скринера Finviz
- Рефакторинг проекта в соответствии с разбиением на модули
- Организация записи фундаментальных показателей в БД
- Считываие фундаментальных показателей из БД
- Проверка условия записи показателей в БД в том случае, если записи по этому тикеру на эту дату еще нет
- Расчет коэффициентов перспективности акций на основе фундаментальных показателей
- Построение диаграммы перспективности на основе коэффициентов и сохранение картинки
- Построение простой страницы на bootstrap, которая пока выводит только движение цены
- Небольшая работа с ботом - добавление описания, приветствия, картинки. Также добавление иконки на сайт
…ct, added fundamentals tabl
…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.
| 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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
с большими буквами называют только константы или классы, надо переименовать например в n_len_categories
| if score_ < 10: | ||
| return RED | ||
| elif score_ < 16: | ||
| return ORANGE | ||
| elif score_ < 23: | ||
| return YELLOW | ||
| else: | ||
| return GREEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
если цвета используются только в этой функции то константы можно упростить
| RED = 'red' | ||
| ORANGE = 'orange' | ||
| YELLOW = 'yellow' | ||
| GREEN = 'green' |
There was a problem hiding this comment.
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)
| # sector | ||
| sector = df[4][0][2].split('|')[0].rstrip() |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.") |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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: | ||
| """Удаление старых новосте из БД |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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