Celeborn2BeAlive / bitmex-xbtusd-history

OHLCV history of XBTUSD bitmex contract, with python scripts to update it.
20 stars 9 forks source link

CSV output #1

Closed snapo closed 5 years ago

snapo commented 5 years ago

I am trying to get a single csv file of the 1m data, i already merged it with your merge.py script and now try to read it with the reader.py ... unfortunately the reader.py does not output anything. As from the json that got merged i see i would have to add a timestamp per step or is there a more easy way to convert the merged.json file to a CSV with time,open,high,low,close ?

Celeborn2BeAlive commented 5 years ago

Hi @snapo

Sorry I did'nt notice that you put an issue on this repository (don't know why i did not receive an email...). I've just pushed a new script csv_convert.py that does what you ask. The usage is: python csv_convert.py 'timeframe_database' 'output_file' [--date]

ragupathis commented 5 years ago

Hi, I can able to run csv_convert.py script and I got the combined data(date, open, close, high, low, volume) in separate CSV file. But the problem is, the data in a new CSV file are not sorted based on the date. For example, I want the data to be in this order... Date 2018-06-10 2018-06-11 2018-06-12 . . . . 2018-06-17

But when I generate the new CSV from the python script, the date order goes like 2018-06-10 2018-04-25 2018-07-29 2017-08-12.

Is there any solution for this scenario?

Celeborn2BeAlive commented 5 years ago

Crap, I did not test this enough. Does the problem also occur with timestamps ? It should not be too hard to fix the code, but I'm on vacation so I don't have access to a computer. Also I have stopped updating this repository (I may even delete it in the near future) because I developped a better version that is able to fetch all instruments from bitmex, binance and coinbase pro and that saves csv files directly instead of json, you can find it here: https://github.com/Celeborn2BeAlive/cryptobigbro/ And I have a bot that executes it regularly which push data to various repositories of this github account: https://github.com/cryptobigbro (one repo for each instrument). Have fun with it !

snapo commented 5 years ago

Hey @Celeborn2BeAlive , thank you a lot... the new one looks quite cleaner :-) Thanks a lot for the work. For me therefore the issue is solved.

ragupathis commented 5 years ago

Crap, I did not test this enough. Does the problem also occur with timestamps ? It should not be too hard to fix the code, but I'm on vacation so I don't have access to a computer. Also I have stopped updating this repository (I may even delete it in the near future) because I developped a better version that is able to fetch all instruments from bitmex, binance and coinbase pro and that saves csv files directly instead of json, you can find it here: https://github.com/Celeborn2BeAlive/cryptobigbro/ And I have a bot that executes it regularly which push data to various repositories of this github account: https://github.com/cryptobigbro (one repo for each instrument). Have fun with it !

I modified the python script file to fetch the separate CSV files in name-wise order so so the problem solved now.

Code for filename in sorted(os.listdir(args.timeframe_database)):

Thanks for your good work and it is great.