Skip to content

Commit

Permalink
✨ Update trades report example for actual version
Browse files Browse the repository at this point in the history
  • Loading branch information
esemi committed Nov 23, 2020
1 parent 4c3ec2e commit f28d704
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ $ pip install investments --upgrade --user
- пока **НЕ** поддерживаются сделки Forex, сделка пропускается и выводится сообщение о том, что это может повлиять на итоговый отчет

*Пример отчета:*
TODO UPDATE example
![ibtax report example](./images/ibtax_2016.jpg)
![ibtax report example](./images/ibtax_2020.jpg)


### Запуск
Expand Down
Binary file removed images/ibtax_2016.jpg
Binary file not shown.
Binary file added images/ibtax_2020.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion investments/ibtax/ibtax.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def prepare_trades_report(finished_trades: List[FinishedTrade], cbr_client_usd:
trade_date_column = 'trade_date'
tax_date_column = 'settle_date'

df = pandas.DataFrame(finished_trades, columns=finished_trades[0]._fields) # noqa: WPS437
df = pandas.DataFrame(finished_trades, columns=finished_trades[0].fields)

df[trade_date_column] = df[trade_date_column].dt.normalize()
df[tax_date_column] = pandas.to_datetime(df[tax_date_column])
Expand Down
4 changes: 0 additions & 4 deletions investments/trade.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ class Trade(NamedTuple):
# комиссия за сделку
fee: Money

@property
def settle_datetime(self) -> datetime.datetime:
return datetime.datetime.combine(self.settle_date, datetime.datetime.min.time())

@property
def fee_per_piece(self) -> Money:
"""Комиссия за сделку за одну бумагу, полезно для расчёта налогов."""
Expand Down
4 changes: 4 additions & 0 deletions investments/trades_fifo.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class FinishedTrade(NamedTuple):
# комиссия за сделку с одной бумагой, "-"
fee_per_piece: Money

@property
def fields(self) -> Tuple[str, ...]:
return self._fields


class PortfolioElement(NamedTuple):
ticker: Ticker
Expand Down

0 comments on commit f28d704

Please sign in to comment.