Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Fast specialized XML trade parser

This parser consumes equity trades in a proprietory format and turns them into Lua dictionaries. The primary feature of this parser is speed. It can do 200 MB/sec on a single CPU core.

Example input:

<root>
    <value1>
        <Type>Integer</Type>
        <Value>1</Value>
    </value1>
    <value2>
        <Type>Double</Type>
        <Value>1.2345</Value>
    </value2>
    <value3>
        <Type>Boolean</Type>
        <Value>true</Value>
    </value3>
    <value4>
        <Type>String</Type>
        <Value>Строка в UTF-8</Value>
    </value4>
    <value5>
        <Type>DateTime</Type>
        <Value>2017-03-05T00:00:00+03:00</Value>
    </value5>
    <a_list>
      <item>foo</item>
      <item>bar</item>
      <item>qux</item>
    </a_list>
</root>

Example output:

{
  "root": {
    "value1": 1,
    "value2": 1.2345,
    "value3": true,
    "value4": "Строка в UTF-8",
    "value5": 1488661200,
    "a_list": [
      "foo",
      "bar",
      "qux"
    ]
  }
}

Usage

local parser = require('tradeparser')
local json = require('json')

local xmltext = io.open("example.xml", "r"):read("*a")

local root = parser.parse(xmltext)
print(json.encode(root))

About

Fast specialized XML trade parser

Resources

Releases

No releases published

Packages

No packages published