├── tesouro
├── direto
│ ├── __init__.py
│ ├── importer.py
│ ├── calculator.py
│ ├── reporter.py
│ └── client.py
├── __init__.py
├── templates
│ ├── email.html
│ └── brokerage.html
├── dates.py
└── holidays.csv
├── requirements-test.txt
├── MANIFEST.in
├── tox.ini
├── .travis.yml
├── tests
├── conftest.py
└── tesouro
│ └── test_dates.py
├── .gitignore
├── LICENSE
├── setup.py
└── README.rst
/tesouro/direto/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tesouro/__init__.py:
--------------------------------------------------------------------------------
1 |
2 | __version__ = '0.1.0'
3 |
--------------------------------------------------------------------------------
/requirements-test.txt:
--------------------------------------------------------------------------------
1 | requests
2 | mock
3 | pytest
4 | jinja2
5 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include tesouro/holidays.csv
2 | recursive-include tesouro/templates *
3 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | [tox]
2 | envlist = py27
3 |
4 | [testenv]
5 | deps = -rrequirements-test.txt
6 | commands = py.test ./tests
7 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: python
2 | sudo: false
3 | python:
4 | - "2.7"
5 | install:
6 | - "pip install tox --use-mirrors"
7 | script:
8 | - "tox"
9 |
--------------------------------------------------------------------------------
/tests/conftest.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 |
4 |
5 | # Add module to the path
6 | base = os.path.abspath(os.path.dirname(__file__))
7 | sys.path.insert(0, (os.path.join(base, '..')))
8 |
--------------------------------------------------------------------------------
/tesouro/templates/email.html:
--------------------------------------------------------------------------------
1 |
2 | {% for brokerage, titles in new.iteritems() %}
3 | {% set newt = titles %}
4 | {% if old is defined and old[brokerage] is defined %}
5 | {% set oldt = old[brokerage] %}
6 | {% else %}
7 | {% set oldt = undefined %}
8 | {% endif %}
9 |
10 |
11 |
| Título | 14 |Vencimento | 15 |Valor (R$) | 16 |Quantidade | 17 ||||
|---|---|---|---|---|---|---|
| Investido | 20 |Bruto Atual | 21 |Líquido Atual | 22 |Total | 23 |Bloqueada | 24 |||
| 35 | {{ title }} 36 | | 37 |38 | {{ data['due_date'] }} 39 | | 40 |41 | {{ print_diff(data, data_old, 'invested_value') }} 42 | | 43 |44 | {{ print_diff(data, data_old, 'current_gross_value') }} 45 | | 46 |47 | {{ print_diff(data, data_old, 'current_net_value') }} 48 | | 49 |50 | {{ print_diff(data, data_old, 'total_titles') }} 51 | | 52 |53 | {{ print_diff(data, data_old, 'bloqued_titles') }} 54 | | 55 |
| 69 | Dados do seu investimento 70 | | 71 |72 | Situação hoje (no caso de venda antecipada) 73 | | 74 |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
77 | Data da 78 | aplicação 79 | |
80 |
81 | Qtd de 82 | títulos 83 | A 84 | |
85 |
86 | Preço do 87 | título na 88 | aplicação (R$) 89 | B 90 | |
91 |
92 | Valor investido (R$) 93 | A x B 94 | |
95 |
96 | Rentabilidade 97 | contratada 98 | |
99 |
100 | Rentabilidade bruta acumulada 101 | |
102 |
103 | Valor bruto 104 | C 105 | |
106 |
107 | Tempo da 108 | aplicação 109 | |
110 | 111 | Alíq I.R. 112 | | 113 |
114 | Imposto
115 | previsto (R$) 116 | D 117 | |
118 |
119 | Taxa devida (R$) 120 | E 121 | |
122 |
123 | Valor líquido 124 | C-D-E 125 | |
126 | ||||
|
130 | Acum a.a 131 | |
132 | 133 | Acum % 134 | | 135 |136 | (R$) 137 | | 138 |
139 | Dias Corridos 140 | |
141 | 142 | (%) 143 | | 144 |145 | I.R. 146 | | 147 |148 | IOF 149 | | 150 |151 | BOV 152 | | 153 |154 | Cor 155 | | 156 |157 | (R$) 158 | | 159 | 160 |||||||
| 171 | {{ detail['date'] }} 172 | | 173 |174 | {{ format(detail.total_titles) }} 175 | | 176 |177 | {{ format(detail.buy_unit) }} 178 | | 179 |180 | {{ print_diff(detail, old_detail, 'invested_value') }} 181 | | 182 |183 | {{ detail['agreed_rate'] }} 184 | | 185 |186 | {{ print_diff(detail, old_detail, 'current_anual_rate') }} 187 | | 188 |189 | {{ print_diff(detail, old_detail, 'current_rate') }} 190 | | 191 |192 | {{ print_diff(detail, old_detail, 'gross_value') }} 193 | | 194 |195 | {{ detail['days'] }} 196 | | 197 |198 | {{ print_diff(detail, old_detail, 'ir_rate', True) }} 199 | | 200 |201 | {{ print_diff(detail, old_detail, 'ir_tax', True) }} 202 | | 203 |204 | {{ print_diff(detail, old_detail, 'iof_tax', True) }} 205 | | 206 |207 | {{ print_diff(detail, old_detail, 'bvmf_tax', True) }} 208 | | 209 |210 | {{ print_diff(detail, old_detail, 'custody_tax', True) }} 211 | | 212 |213 | {{ print_diff(detail, old_detail, 'net_value') }} 214 | | 215 ||