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?
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.
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