Skip to content
André Dumas edited this page Sep 17, 2014 · 5 revisions

WikiAPI ReferenceData Structures

TechanJS expects data to be of a specific structure. All data arrays are assumed to be sorted in ascending date order:

var data = data.sort(function(a, b) { 
  return d3.ascending(a.date, b.date); 
});

Data Plots

OHLC & Volume

[
    {
        date: new Date(2014, 2, 11),
        open: 12.3,
        high: 12.45,
        low: 12.22,
        close: 12.25
        volume: 1987289
    },
    {
        date: new Date(2014, 2, 12),
        open: 12.35,
        high: 12.40,
        low: 12.10,
        close: 12.25
        volume: 2325432
    }    
]

Applicable to:

Moving Averages

[
    {
        date: new Date(2014, 2, 11),
        value: 12.3
    },
    {
        date: new Date(2014, 2, 12),
        value: 12.35
    }    
]

Applicable to:

MACD

[
    { 
        date: new Date(2014, 3, 5), 
        macd: 0.11, 
        signal: 0.27, 
        difference: -0.16, 
        zero: 0 
    },
    { 
        date: new Date(2014, 3, 6), 
        macd: -0.12, 
        signal: -0.09, 
        difference: -0.02, 
        zero: 0 
    }
]

Applicable to:

RSI

[
    { 
        date: new Date(2014, 3, 5), 
        rsi: 60, 
        overbought: 70, 
        oversold: 30, 
        middle: 0 
    },
    { 
        date: new Date(2014, 3, 6), 
        rsi: 34.95, 
        overbought: 70, 
        oversold: 30, 
        middle: 0 
    }
]

Applicable to:

Annotations

Axis

[
    {
        value: 34.5
    }
]

Applicable to:

Interactive

Supstance

Note: Start and end dates are currently not used, but probably will be in future

[
    { 
        start: new Date(2014, 2, 11), 
        end: new Date(2014, 5, 9), 
        value: 63.64 
    },
    { 
        start: new Date(2013, 10, 21), 
        end: new Date(2014, 2, 17), 
        value: 55.50 
    }
]

Applicable to:

Trendline

[
    { 
        start: { 
            date: new Date(2014, 2, 11), 
            value: 72.50 
        }, 
        end: { 
            date: new Date(2014, 5, 9), 
            value: 63.34 
        } 
     },
    { 
        start: { 
            date: new Date(2013, 10, 21), 
            value: 43 
        }, 
        end: { 
            date: new Date(2014, 2, 17), 
            value: 70.50 
        } 
    }
]

Applicable to:

Clone this wiki locally