MartinPyka / financial_life

A framework for analysing financial products in personalized contexts
Apache License 2.0
134 stars 26 forks source link

Error simulation.add_regular() #2

Closed Siecje closed 7 years ago

Siecje commented 7 years ago

I get an error when I run the usage example in the readme.

Traceback (most recent call last):
  File "fin.py", line 12, in <module>
    simulation.add_regular('Income', account, 2000, interval = 'monthly')
  File "C:\Users\cody\Desktop\fin\venv\lib\site-packages\financial_life\financing\accounts.py", line 236, in add_regular
    date_start = validate.valid_date(date_start)
  File "C:\Users\cody\Desktop\fin\venv\lib\site-packages\financial_life\financing\validate.py", line 44, in valid_date
    return Bank_Date.fromtimestamp(date.timestamp())
OverflowError: timestamp out of range
MartinPyka commented 7 years ago

Thanks for the Feedback and sorry for the problem. I will take a look at this tomorrow evening (which is for me in about 24hours ;)). Did you use the latest version from Github or the one from PyPI? Do you run Python3?

Martin

Siecje commented 7 years ago

It happens with both.

MartinPyka commented 7 years ago

I cannot reproduce the error (Python 3.4 on Ubuntu). Are you using Windows? I found a potential source for your error here:

http://grokbase.com/t/python/python-ideas/139gj88mwd/reduce-platform-dependence-of-date-and-time-related-functions

Although it is supposed to be fixed in Python >3.2, I thought maybe it is better to avoid this issue at all by defining the minimum date as 1.1.1971.

Can you checkout the sources, install the package and test the example again?

Siecje commented 7 years ago

I'm using Python 3.5.2 on Windows 10.

When I install the version from GitHub I get a warning and the Main Account and House Credit tables but no charts.

This is the warning

\venv\lib\site-packages\financial_life\financing\accounts.py:646: UserWarning: Difference between current date and next date is 0 and not 1
  warnings.warn('Difference between current date and next date is %i and not 1' % delta)
Siecje commented 7 years ago

I get the same warning and no charts on Ubuntu 16.04

site-packages/financial_life/financing/accounts.py:646: UserWarning: Difference between current date and next date is 0 and not 1
  warnings.warn('Difference between current date and next date is %i and not 1' % delta)
MartinPyka commented 7 years ago

The warning is totally fine but I will consider ommiting it because of the new default settings for simulations.

A show() command was missing in the example to actually display the plots. I never stumbled upon this problem as I am running the simulation in a shell with matplotlib.pyplot.ion().

When you checkout simple_examples.py again and call it with "python3 simple_examples.py" you should now be able to see the plots.

Sorry for the problems but thanks for reporting them!!! I hope, that you can work now with fl!?

Siecje commented 7 years ago

Thanks it works great!