pytr-org / pytr

Use TradeRepublic in terminal and mass download all documents
https://pypi.org/project/pytr/
MIT License
420 stars 74 forks source link

Permission error for export_transactions #26

Closed Johannes0941 closed 2 years ago

Johannes0941 commented 2 years ago

Description of the bug When calling the export_transactions function, I get a permission denied error. Probably the input and ouput should be something else. Could you please clearify that and maybe add it in the code documentation. Thank you very much!

Error log

(base) C:\Users\49176\Documents\trade_republic>pytr export_transactions C:\Users\49176\Documents\trade_republic C:\Users\49176\Documents\trade_republic
Traceback (most recent call last):
  File "C:\Users\49176\anaconda3\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\49176\anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\49176\anaconda3\Scripts\pytr.exe\__main__.py", line 7, in <module>
  File "C:\Users\49176\anaconda3\lib\site-packages\pytr\main.py", line 168, in main
    export_transactions(args.input, args.output, args.lang)
  File "C:\Users\49176\anaconda3\lib\site-packages\pytr\utils.py", line 174, in export_transactions
    with open(input_path, encoding='utf-8') as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\49176\\Documents\\trade_republic'

After calling the function I added the folder previously generated by dl_docs and the same folder, to save the document there. Are these principally the right steps?

C0D3D3V commented 2 years ago

try to use it like: pytr export_transactions C:\Users\49176\Documents\path\to\other_events.json C:\Users\49176\Documents\export\path\to\results.csv

Johannes0941 commented 2 years ago

Thank you! Now I understood what the function does. However I found that dl_docs already creates such a file, so maybe dl_docs should be positioned a bit clearer, as it seems to me this would be the most important function for most Parquet/ Portfolio Performance users. Also I guess you need to download the docs anyway before being able to export the transactions, so maybe the extended functionality of dl_docs made this method obsolete?

In my initial understanding the method would have created a method of all buy and sell actions of stocks directly, but now when reading the description I understand that it only considers bank transerfs to the account.

But as Parquet has a very good batch importing of pdf´s, this missing funtionality was not really a problem after all.

marzzzello commented 2 years ago

I updated the help messages in the new version to make things clearer. The export_transactions command is currently not really needed as dl_docs does the same after the documents are downloaded. But if you want to change the language of the exported csv file the command is quite useful (yes the csv for Portfolio Performance is language dependent, don't ask me why). Maybe there will be more options in the future.

P.S. Thanks for your donation!