Skip to content

Instantly share code, notes, and snippets.

View gelinger777's full-sized avatar

Gelinger Media gelinger777

  • www.gelinger.at
  • Vienna
View GitHub Profile
@bbc4468
bbc4468 / influx_schema.sql
Last active December 30, 2021 20:49
Influx DB Schema for OHLC
create database price_history_db
CREATE CONTINUOUS QUERY "cq_1m" ON "price_history_db" BEGIN SELECT MIN(price) as low, MAX(price) as high, FIRST(price) as open, LAST(price) as close, SUM(size) as volume INTO "price_1m" FROM "trade" GROUP BY time(1m), symbol END
CREATE CONTINUOUS QUERY "cq_5m" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_5m" FROM "price_1m" GROUP BY time(5m), symbol END
CREATE CONTINUOUS QUERY "cq_15m" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_15m" FROM "price_5m" GROUP BY time(15m), symbol END
CREATE CONTINUOUS QUERY "cq_1h" ON "price_history_db" BEGIN SELECT MIN(low) as low, MAX(high) as high, FIRST(open) as open, LAST(close) as close, SUM(volume) as volume INTO "price_1h" FROM "price_15m" GROUP BY time(1h), symbol END
CREATE CONTINUOUS QUERY "cq_6h" ON "price_history_db" BEGIN SELECT
@benallard
benallard / xml_split.py
Last active March 5, 2024 05:28
Small python script to split huge XML files into parts. It takes one or two parameters. The first is always the huge XML file, and the second the size of the wished chunks in Kb (default to 1Mb) (0 spilt wherever possible) The generated files are called like the original one with an index between the filename and the extension like that: bigxml.…
#!/usr/bin/env python
import os
import xml.parsers.expat
from xml.sax.saxutils import escape
from optparse import OptionParser
from math import log10
# How much data we process at a time
@kgaughan
kgaughan / checkeuvat.py
Created April 14, 2011 10:08
Checking an EU VAT number using the VIES SOAP interface
from suds.client import Client
client = Client('http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl')
# Returns a dict-like object with the fields 'countryCode', 'vatNumber',
# 'requestDate', 'valid' (boolean), 'name', and 'address'.
result = client.service.checkVat('IE', '6390845P')