Documentation for GetExtraDataEx()

Hi Tomasz,

I see that a new Plugin API function was added in version 6.20.1:

Plugin API: added GetExtraDataEx to support pad&align (see Release Notes)

http://www.amibroker.com/devlog/2017/02/17/amibroker-6-20-1-release-candidate/

I have not been able to find any documentation for GetExtraDataEx. Are the release notes available without downloading and installing the older version, or is it documented elsewhere?

Thanks,
Alan

I just got back to my PC after some work-related travel. I see that the current release notes include version 6.20.1. That should be enough to get me started.

Thanks,
Alan

Yes, it is documented in Release Notes.

GetExtraDataEx to support pad&align

struct ExtraData
{
    int nStructSize;
    int nArraySize;
    int nPeriodicity;
    DATE_TIME_INT *anTimestamps;
    void* ( *pfAlloc )( size_t nSize );
};

typedef Variant( * GetExtraDataPtr )( LPCTSTR pszTicker, LPCTSTR pszName, int nArraySize, int nPeriodicity, void * ( *pfAlloc )( size_t nSize ) );

/////////////
PLUGINAPI AmiVar GetExtraDataEx( LPCTSTR pszTicker, LPCTSTR pszName, struct ExtraData *pData )
{
    AmiVar var;

    var.type = VAR_ARRAY;
    var.array = ( float * )pData->pfAlloc( pData->nArraySize * sizeof( float ) );

    for( int i = 0; i < pData->nArraySize; i++ )
    {
        AmiDate dt;

        dt.Date = pData->anTimestamps[ i ];

		// this simple example produces DateNums synced with current selection
        var.array[ i ] = ( dt.PackDate.Year - 1900 ) * 10000 + dt.PackDate.Month * 100 + dt.PackDate.Day;
    }

    return var;
}

IMPORTANT NOTE:
Contrary to legacy GetExtraData call which is always called only from UI thread, a new function - GetExtraDataEx can be called from both UI and worker (non-UI) threads

1 Like