mt5_to_amibroker.py 698 B

1234567891011121314151617181920212223242526272829303132
  1. import os
  2. import codecs
  3. import datetime
  4. import dataset
  5. #fw=codecs.open('c:/tmp/halfday.csv','w','utf-8')
  6. fw=codecs.open('c:/tmp/hour.csv','w','utf-8')
  7. fw.write('aaa\n')
  8. fw.write('aaa\n')
  9. #fr=codecs.open('c:/tmp/h12.csv','r','utf-8')
  10. #fr=codecs.open('c:/tmp/m30.csv','r','utf-8')
  11. fr=codecs.open('c:/tmp/h1.csv','r','utf-8')
  12. lines=fr.readlines()[1:]
  13. fr.close()
  14. for l in lines:
  15. elmts=l.split('\t')
  16. o=int(float(elmts[2])*10000)
  17. h=int(float(elmts[3])*10000)
  18. l=int(float(elmts[4])*10000)
  19. c=int(float(elmts[5])*10000)
  20. dt=elmts[0].replace('.','/')+" "+elmts[1]+","+str(o)+","+str(h)+","+str(l)+","+str(c)+',0,\n'
  21. entry=dt
  22. fw.write(entry)
  23. print(entry)
  24. fw.close()