Support Board
Date/Time: Sat, 23 Nov 2024 18:00:32 +0000
Post From: Python for Sierra Chart
[2014-07-06 12:32:55] |
ganz - Posts: 1048 |
Hi All I'm not a programmer so this is my simple solution to get data from *.scid and store it to *.hdf5 in order to pandas it later #!/usr/bin/python3 import struct import datetime as dt import sys import pandas as pd import numpy as np inputfile = open(sys.argv[1],'rb') dt.timedelta(microseconds=1) with inputfile as f: f.read(56) df_src=[] ts_src=[] while True: tick=f.read(40) if not tick: break src = struct.unpack('d4f4L', tick) ts_tmp=dt.datetime(1899, 12, 30) + dt.timedelta(src[0]) ts_src.append(ts_tmp) df_tmp=[src[4],src[7],src[8]] df_src.append(df_tmp) tubus = pd.HDFStore('tubus.h5') df=pd.DataFrame(df_src, index=ts_src, columns=['Price', 'bidVol', 'askVol']) df.to_hdf('tubus.h5','df') print(df.index) print(df.head()) print(tubus) tubus.close() 1. how to run it: ~/>python3 this_script.py chart.scid 2. the script parses *.scid and creates the df DataFrame (TimeSeries): Price, bidVol, askVol 3. the script creates HDF5 file tubus.h5 and stores df for 500MB.scid it takes 48s on i5/hugeRAM/HDD Date Time Of Last Edit: 2014-07-06 12:34:11
|