ffeast / finam-export

Python client library to download historical data from finam.ru
Apache License 2.0
102 stars 35 forks source link

Add "-startdate-enddate" to the filename #17

Open vritme opened 3 years ago

vritme commented 3 years ago

When downloading an array of datasets of one contract and the same timeframe, separated, for example, by months in one folder - they will be replacing each other in one file with "contract code - timeframe" filename mask. The only way is to download no more than one query in one folder by one time, and then rename resulting filename before next query with same contract code and timeframe in this folder. Or prepare different folders and set each query to "their own" folder from the beginning, which might be a little bit messy in the end... With years it may be ok, but with months or shorter - so many folder are needed..

Could filename mask be like "SBRF-TICKS-2020-01-01-2020-01-31" or "SBRF-TICKS-2020-01-01-2020-12-31" ? It will automatically solve auto-replacing and losing data therefore, while downloading files in one folder by one commands array in cmd. Also it's much more informative than just "SBRF-TICKS" for all possible periods...

Ps. Thanks so much for brilliant lib ;> @ffeast

ffeast commented 3 years ago

@vritme thanks for your suggestion. It was built like that on purpose so that if you have a trading tool that works with a specific contract you can update the data, open the tool and see up-to-date values without switching to a new filename. To support your case I think there could be an additional option indicating how the resulting file must be named. For example, --destfile="{{contract}}-{{timeframe}}-{{start_date}}-{{end_date}}". Does it make sense? Can you submit a PR?

vritme commented 3 years ago

Yes, an additional option would be perfect solution, so that everyone could specify the variant they need more. Will make pull request.

vritme commented 3 years ago

PR is done. A bit tricky system with forking -> pr in your own fork -> then go in original project and only then you see your pr and able to link it with original project... But I've made it =).