Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 00:53:47 +0000



Post From: create .scid files

[2014-07-02 18:08:41]
ganz - Posts: 1048
maxpi

this is another simple way using Lua


local lib = require"struct"
local unpack = unpack or table.unpack  

function fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end

local hBinaryOutput = assert(io.open("./test.scid", "wb"))
if (hBinaryOutput) then  
    
    header = fromhex("5343494438000000280000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
    hBinaryOutput:write(header)
    
    local vol  = 5
    local price  = 250
    local dt  = 41822.125
    
    record = lib.pack("dffffLLLL", dt, price, price, price, price, vol, vol, vol, vol)
    
    hBinaryOutput:write(record)        
    hBinaryOutput:close()    
end

http://www.inf.puc-rio.br/~roberto/struct/

Date Time Of Last Edit: 2014-07-02 18:09:01