Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 00:04:08 +0000



Post From: create .scid files

[2014-06-22 17:12:58]
ganz - Posts: 1048
maxpi

hi

in case you prefer more simple solution


#!/usr/bin/python
import struct

filename = 'my1chart.scid'

datetime = 41800
price = 1.3535
volume = 1

output = open(filename, 'wb')

header = b'SCID8\x00\x00\x00(\x00\x00\x00\x01\x00'
output.write(header)

for i in range(21): output.write(b'\x00\x00')

record = struct.pack('d4f4L', datetime, price, price, price, price, volume, volume, volume, volume)
output.write(record)

output.close()


biblio:

https://docs.python.org/2/library/struct.html

http://gebloggendings.files.wordpress.com/2012/07/struct.pdf
Date Time Of Last Edit: 2014-06-22 17:17:25