Skip to content
This repository was archived by the owner on Feb 12, 2023. It is now read-only.
This repository was archived by the owner on Feb 12, 2023. It is now read-only.

ConvertOHLC does not seem to work correctly. #18

@bramvbilsen

Description

@bramvbilsen

I have some (dummy) candlestick data with an interval of 30mins:

const orig = [
    {
        open: 1.11399,
        high: 1.11399,
        low: 1.11389,
        close: 1.11389,
        time: 1435701600
    },
    {
        open: 1.11389,
        high: 1.83321,
        low: 1.10213,
        close: 1.76,
        time: 1437501600
    }
];

I am trying to convert that to 1 hour candlesticks. I assume it should return an array of 1 candlestick because my original data set has 2 candles of 30 minutes. I convert it as follows:

function convertTo1HOhlc(candlesticks) {
    return analytics.convertOHLC(candlesticks, 3600);
}

console.log(convertTo1HOhlc(orig));

That outputs the following:

[ { open: 1.11399,
    low: 1.11389,
    high: 1.11399,
    close: 1.11389,
    time: 1435701600 },
  { open: 1.11389,
    low: 1.10213,
    high: 1.83321,
    close: 1.76,
    time: 1437501600 } ]

This does not look correct to me.
Is this a bug? Or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions