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

ConvertOHLC does not seem to work correctly. #18

Open
bramvbilsen opened this issue Nov 4, 2018 · 0 comments
Open

ConvertOHLC does not seem to work correctly. #18

bramvbilsen opened this issue Nov 4, 2018 · 0 comments

Comments

@bramvbilsen
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant