Beispiel #1
0
bool CCtpmmdZitContainer::NewData(DataObjectPtr dop)
{
    char* buf = (char*)dop->GetData();
    size_t len = dop->GetDataLength();

    if ((DataObject::MARKET_DATA_TYPE)(*(int*)buf) == DataObject::MARKET_DATA_TYPE_CTPMMD) {
        buf += sizeof(int), len -= sizeof(int);
        CTPMMD* ctpmmd = (CTPMMD*)buf;
        if (_data_len > (size_t)ctpmmd->fIndex) {
            _curpos = (size_t)ctpmmd->fIndex;
            memcpy(_ctpmmd + _curpos, ctpmmd, sizeof(CTPMMD));
#           ifdef _DEBUG
            /*CTPMMD* pctpmmd = _ctpmmd + _curpos;
            MYTRACE(L"CTPMMD %.02f %.02f %.02f %.02f %.02f %.02f %.02f\n",
                pctpmmd->fIndex,
                pctpmmd->m_time,
                pctpmmd->LastPrice,
                pctpmmd->Volume,
                pctpmmd->relVolume,
                pctpmmd->OpenInterest,
                pctpmmd->relInterest);*/
#           endif //_DEBUG
            _world.renew_world(_ctpmmd + _curpos);
            ++_count;
        } else {
            //shift to left
            //but not now
        }
        return true;
    }
    return false;
}
Beispiel #2
0
bool CZitdataContainer::NewData(DataObjectPtr dop)
{
    char* buf = (char*)dop->GetData();
    size_t len = dop->GetDataLength();

    if ((DataObject::MARKET_DATA_TYPE)(*(int*)buf) == DataObject::EUCLID_CALUC_TO_TRANSMIT) {
        buf += sizeof(int), len -= sizeof(int);

        return _zit_data.AppendData(buf, len);
    }
    return false;
}