blankly-finance / blankly

🚀 💸 Easily build, backtest and deploy your algo in just a few lines of code. Trade stocks, cryptos, and forex across exchanges w/ one package.
https://package.blankly.finance
GNU Lesser General Public License v3.0
2.09k stars 266 forks source link

get file extension using pathlib #226

Closed femtotrader closed 1 year ago

femtotrader commented 1 year ago

https://github.com/blankly-finance/blankly/blob/41f5294d3bad3937a887355530afb450df87de85/blankly/data/data_reader.py#L269

is not a very "clean" way of getting file extension.

maybe you should consider using pathlib

https://docs.python.org/3/library/pathlib.html and .suffixes attribute

an older way of doing may be to use os.path.splitext

EmersonDove commented 1 year ago

Oh yeah probably would be better - happy to accept a contribution.

cleaning up the exception would also be nice to do something like assert <condition>, "The file path did not have a csv ending..."