profile
viewpoint
Simon esemi @semrush St. Petersburg esemi.github.io +7 999 2412779

esemi/investments 3

Analysis of Interactive Brokers reports for tax reporting in Russia

esemi/blogpost_clustering 2

Source code for blog post about clustering and python

esemi/github-activity-visualiser 2

Activity visualiser for github users

esemi/dseyenew 1

Source code for dseye.ru

esemi/aiotask-context 0

Contextual information for asyncio tasks

esemi/api 0

Хантфлоу API

esemi/asyncio_stripe 0

Asyncio Stripe API bindings

esemi/blogpost_image_validator 0

Source code for blog post

Pull request review commentcdump/investments

Trade fee

 import datetime+from decimal import Decimal  import pytest  from investments.currency import Currency from investments.money import Money from investments.ticker import Ticker, TickerKind from investments.trade import Trade-from investments.trades_fifo import TradesAnalyzer+from investments.trades_fifo import TradesAnalyzer, FinishedTrade  analyze_trades_fifo_testdata = [     # trades: [(Date, Symbol, Quantity, Price)]-    # expect_trades: (N, Symbol, Quantity, Total, Profit)

WIP: подумать, не сломается ли https://github.com/cdump/investments/issues/8 - тест на подобный баг

esemi

comment created time in 3 days

Pull request review commentcdump/investments

Trade fee

 from investments.data_providers.cbr import ExchangeRatesRUB from investments.money import Money - test_cases = [     (datetime(2015, 1, 15), Currency.USD, Money('66.0983', Currency.RUB)),     (datetime(2015, 3, 7), Currency.USD, Money('59.9938', Currency.RUB)),     (datetime(2015, 3, 8), Currency.USD, Money('59.9938', Currency.RUB)),     (datetime(2020, 3, 31), Currency.USD, Money('77.7325', Currency.RUB)),     (datetime(2020, 1, 9), Currency.USD, Money('61.9057', Currency.RUB)),+    (date(2020, 2, 4), Currency.EUR, Money('70.7921', Currency.RUB)),

Смысл одинокого date посреди datetime чтобы проверить возможность принмать функцией такой тип? Лучше добавить про это небольшой коммент, иначе можно подумать что это просто непонятная неконсистентность в типах тут

esemi

comment created time in 3 days

Pull request review commentcdump/investments

Trade fee

  import pandas  # type: ignore +from investments.calculators import compute_total_cost from investments.currency import Currency from investments.data_providers import cbr from investments.dividend import Dividend from investments.fees import Fee from investments.interests import Interest from investments.money import Money from investments.report_parsers.ib import InteractiveBrokersReportParser-from investments.trades_fifo import PortfolioElement, TradesAnalyzer+from investments.trades_fifo import TradesAnalyzer, FinishedTrade, PortfolioElement  # noqa: I001  -def prepare_trades_report(df: pandas.DataFrame, cbr_client_usd: cbr.ExchangeRatesRUB) -> pandas.DataFrame:+def prepare_trades_report(finished_trades: List[FinishedTrade], cbr_client_usd: cbr.ExchangeRatesRUB, verbose: bool) -> pandas.DataFrame:+    fee_round_digits = 4+    trade_date_column = 'trade_date'     tax_date_column = 'settle_date' -    df['date'] = df['datetime'].dt.normalize()+    df = pandas.DataFrame(finished_trades, columns=finished_trades[0]._fields)  # noqa: WPS437

Вкусовщина, но я бы скорее сделал в FinishedTrade @property fields -> return self._fields и тут бы использовал его - и noqa уберется, и чуть больше абстракций над типом) Но можно и оставить

esemi

comment created time in 2 days

Pull request review commentcdump/investments

Trade fee

 class FinishedTrade(NamedTuple):     N: int     ticker: Ticker-    datetime: datetime.datetime++    # дата сделки, нужна для расчёта комиссии в рублях на дату+    trade_date: datetime.datetime++    # дата поставки, нужна для расчёта цены сделки в рублях на дату     settle_date: datetime.date++    # количество бумаг, "+/-"

"+/-" -> "положительное для операции покупки, отрицательное для операции продажи"

# цена одной бумаги, "+" -> "всегда положительное"

  • про fee_per_piece аналогично

Чуть проще будет потом понять тому, кто первый раз читает

esemi

comment created time in 3 days

Pull request review commentcdump/investments

Trade fee

 def final_portfolio(self) -> List[PortfolioElement]:         return self._portfolio  -def sign(v: int) -> int:-    assert v != 0-    return -1 if v < 0 else 1-- class _TradesFIFO:     def __init__(self):         self._portfolio = defaultdict(list) +    @staticmethod

Какие приемущества по внесению sign внутрь класса как @staticmethod? Я слышал что обычно так "хорошо делать" когда функция сильно связанна с классом (но не использует никакие его поля), в данном случае - связанности сильной вроде бы нет. Можно ссылку какой-то best-practice-guide или просто описание своими словами почему решил внести?

esemi

comment created time in 3 days

Pull request review commentcdump/investments

Trade fee

  class Trade(NamedTuple):     ticker: Ticker-    datetime: datetime.datetime+    trade_date: datetime.datetime     settle_date: datetime.date     quantity: int++    # цена одной бумаги     price: Money++    # комиссия за сделку     fee: Money++    @property+    def settle_datetime(self) -> datetime.datetime:

Не нашел где используется, предлагаю добавлять такое только когда потребуется

esemi

comment created time in 3 days

Pull request review commentcdump/investments

Trade fee

 def __init__(self, currency: Currency, year_from: int = 2000, cache_dir: str = N     def dataframe(self) -> pandas.DataFrame:         return self._df -    def get_rate(self, date: datetime.date) -> Money:-        return self._df.loc[date].item()+    def get_rate(self, dt: datetime.date) -> Money:+        if isinstance(dt, datetime.datetime):+            dt = datetime.datetime.combine(dt.date(), datetime.datetime.min.time())++        if isinstance(dt, datetime.date):+            dt = datetime.datetime.combine(dt, datetime.datetime.min.time())++        return self._df.loc[dt].item()

В self._df.loc[] ключем является datetime.date, почему тут все приводится к datetime.datetime, а не к datetime.date?

Т.е. я ожидал бы тут такое:

def get_rate(self, dt: datetime.date) -> Money:
  if isinstance(dt, datetime.datetime):
    dt = dt.date()
  return self._df.loc[dt].item()
esemi

comment created time in 3 days

push eventcdump/investments

Simon

commit sha 81693c5627a1c9c982242333dc536465c9e044e9

:fix: Changed untrusted commands on github-actions

view details

Maxim Andreev

commit sha 1e488cc86c839b54a7fe474b48f7d40f1777a9cd

Merge pull request #29 from esemi/fix_actions_env Change unsecure commands to legal on github actions

view details

push time in 6 days

PR merged cdump/investments

:fix: Change unsecure commands to legal on github actions

see https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ and https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files

+2 -2

0 comment

2 changed files

esemi

pr closed time in 6 days

created repositoryseth2810/frontend-project-lvl3

created time in 9 days

created repositoryseth2810/backend-project-lvl4

created time in 9 days

startedbrettcannon/python-launcher

started time in 11 days

startedvmkteam/vfs

started time in 12 days

fork Sergievskiy/investments

Analysis of Interactive Brokers reports for tax reporting in Russia

fork in 13 days

startedesemi/investments

started time in 13 days

startedgrpc-ecosystem/awesome-grpc

started time in 14 days

created repositoryvmkteam/vfs

created time in 14 days

startedGitSquared/edex-ui

started time in 15 days

starteddeepinsight/insightface

started time in 16 days

startedesemi/investments

started time in 21 days

startedesemi/investments

started time in 25 days

push eventcdump/investments

Simon

commit sha 3b543e8e6770a766d76fbd26fb4ca7f251773237

:recycle: Move dividends and portfolio presenters to separate functions

view details

Simon

commit sha 81f4848ac7cef7c0ec33a85d5122441b1bad7a11

:recycle: Move convert_to function from Money class to separate functions for compatible with multi-currency operations and manual compute trades profit

view details

Maxim Andreev

commit sha deec0a3133fbb05e2422f2a891ca029bc92d9679

Merge pull request #25 from esemi/currency_converter Currency converter

view details

push time in a month

PR merged cdump/investments

Reviewers
Currency converter

Переделал работу с конвертацией валют @cdump глянь плиз, прокатит? Ифчик из Money.convert_to уехал =)

+268 -174

2 comments

6 changed files

esemi

pr closed time in a month

PR opened esemi/pornhub-graph

⬆️ Bump cryptography from 2.5 to 3.2

Bumps cryptography from 2.5 to 3.2. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pyca/cryptography/blob/master/CHANGELOG.rst">cryptography's changelog</a>.</em></p> <blockquote> <p>3.2 - 2020-10-25</p> <pre><code>

  • SECURITY ISSUE: Attempted to make RSA PKCS#1v1.5 decryption more constant time, to protect against Bleichenbacher vulnerabilities. Due to limitations imposed by our API, we cannot completely mitigate this vulnerability and a future release will contain a new API which is designed to be resilient to these for contexts where it is required. Credit to Hubert Kario for reporting the issue. CVE-2020-25659
  • Support for OpenSSL 1.0.2 has been removed. Users on older version of OpenSSL will need to upgrade.
  • Added basic support for PKCS7 signing (including SMIME) via :class:~cryptography.hazmat.primitives.serialization.pkcs7.PKCS7SignatureBuilder. <p>.. _v3-1-1:</p> <p>3.1.1 - 2020-09-22 </code></pre></p> <ul> <li>Updated Windows, macOS, and <code>manylinux</code> wheels to be compiled with OpenSSL 1.1.1h.</li> </ul> <p>.. _v3-1:</p> <p>3.1 - 2020-08-26</p> <pre><code>
  • BACKWARDS INCOMPATIBLE: Removed support for idna based :term:U-label parsing in various X.509 classes. This support was originally deprecated in version 2.1 and moved to an extra in 2.5.
  • Deprecated OpenSSL 1.0.2 support. OpenSSL 1.0.2 is no longer supported by the OpenSSL project. The next version of cryptography will drop support for it.
  • Deprecated support for Python 3.5. This version sees very little use and will be removed in the next release.
  • backend arguments to functions are no longer required and the default backend will automatically be selected if no backend is provided.
  • Added initial support for parsing certificates from PKCS7 files with :func:~cryptography.hazmat.primitives.serialization.pkcs7.load_pem_pkcs7_certificates and :func:~cryptography.hazmat.primitives.serialization.pkcs7.load_der_pkcs7_certificates .
  • Calling update or update_into on :class:~cryptography.hazmat.primitives.ciphers.CipherContext with data longer than 2\ :sup:31 bytes no longer raises an OverflowError. This also resolves the same issue in :doc:/fernet. <p>.. _v3-0:</p> <p>3.0 - 2020-07-20 </tr></table> </code></pre></p> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pyca/cryptography/commit/c9e65222c91df8b6f61650a3460e30232962c1e0"><code>c9e6522</code></a> 3.2 release (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5508">#5508</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/58494b41d6ecb0f56b7c5f05d5f5e3ca0320d494"><code>58494b4</code></a> Attempt to mitigate Bleichenbacher attacks on RSA decryption (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5507">#5507</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/cf9bd6a36bc7b05abca114b76e216598d9ad9b16"><code>cf9bd6a</code></a> move blinding to <strong>init</strong> on both RSA public and private (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5506">#5506</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/bf4b962f4b92a1633835b2d17974f18de2d61620"><code>bf4b962</code></a> be more verbose in the 102 deprecation notice (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5505">#5505</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/ada53e7ca0f04a33711c330a130d34376e5ecc2b"><code>ada53e7</code></a> make the regexes for branches more strict (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5504">#5504</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/8be1d4b1113eabea306dd60ab64e7f00815d6a52"><code>8be1d4b</code></a> Stop using <a href="https://github.com/master">@master</a> for GH actions (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5503">#5503</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/08a97cca715ca0842d6792d0079e351efbb48ec9"><code>08a97cc</code></a> Bump actions/upload-artifact from v1 to v2.2.0 (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5502">#5502</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/52a0e44e97dd6e150509b14c9b1f76a261f12786"><code>52a0e44</code></a> Add a dependabot configuration to bump our github actions (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5501">#5501</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/611c4a340f6c53a7e28a9695a3248bd4e9f8558d"><code>611c4a3</code></a> PKCS7SignatureBuilder now supports new option NoCerts when signing (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5500">#5500</a>)</li> <li><a href="https://github.com/pyca/cryptography/commit/836a92a28fbe9df8c37121e340b91ed9cd519ddd"><code>836a92a</code></a> chunking didn't actually work (<a href="https://github-redirect.dependabot.com/pyca/cryptography/issues/5499">#5499</a>)</li> <li>Additional commits viewable in <a href="https://github.com/pyca/cryptography/compare/2.5...3.2">compare view</a></li> </ul> </details> <br />

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


<details> <summary>Dependabot commands and options</summary> <br />

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the Security Alerts page.

</details>

+1 -1

0 comment

1 changed file

pr created time in a month

create barnchesemi/pornhub-graph

branch : dependabot/pip/cryptography-3.2

created branch time in a month

created repositoryDamTerrion/nDXF

Clearing dxf-files from superfluous entries before convertion to g-code in pat-format

created time in a month

created repositoryDamTerrion/nDXF

Clearing dxf-files from superfluous entries before convertion to g-code in pat-format

created time in a month

startedHexlet/hexlet-editor

started time in a month

more