INNER CODE UNIT · Python

stop

zillionare/zillionare · scripts/export_influx_data.py:22

    stop = datetime(day.year, day.month, day.day, tzinfo=timezone.utc) + timedelta(days=1)
    stop_text = stop.isoformat().replace("+00:00", "Z")

    flux = f'''
from(bucket: "zillionare")
  |> range(start: {start}, stop: {stop_text})
  |> filter(fn: (r) => r._measurement == "stock_bars_1m")
    |> filter(fn: (r) => {FIELD_FILTER})
  |> keep(columns: ["_time", "code", "_field", "_value"])
    |> pivot(rowKey: ["_time", "code"], columnKey: ["_field"], valueColumn: "_value")
    |> keep(columns: ["_time", "code", "amount", "close", "factor", "high", "low", "open", "volume"])
    |> sort(columns: ["_time", "code"])
'''.strip()

    response = requests.post(
        "http://localhost:58086/api/v2/query?org=zillionare",
        headers={
            "Authorization": "Token influx",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…