Ejemplo n.º 1
0
void CSplitterCellHistory::_SetupSetDateTime(
    const COARlocus &Locus,
    const COARmessages &Msg,
    const set<wxDateTime> &setDateTime,
    set<wxDateTime> *psetKeep)
{
    wxString sNotes;
    wxString sNotesLast;
    wxDateTime dt;
    wxDateTime dtLast((time_t)0);
    vector<const COARallele *> vpAllele;
    set<wxDateTime>::const_iterator itr;
    const vector<int> *pvnAlerts = Locus.GetAlerts();
    bool bKeep;

    psetKeep->clear();
    dtLast.Set((time_t) 0);
    psetKeep->insert(dtLast);

    if(setDateTime.size())
    {
        sNotesLast = Locus.GetNotes(&dtLast);
        for(itr = setDateTime.begin(); itr != setDateTime.end(); ++itr)
        {
            bKeep = false;
            dt = *itr;
            Locus.GetAllelesByTime(&vpAllele,&dt);
            for(vector<const COARallele *>::const_iterator itra
                    = vpAllele.begin();
                    (itra != vpAllele.end()) && (!bKeep);
                    ++itra)
            {
                if((*itra)->GetUpdateTime() > dtLast)
                {
                    bKeep = true;
                }
            }

            // check for a newer message change
            if(!bKeep)
            {
                bKeep = _CheckMessageUpdate(Msg,pvnAlerts, dtLast, &dt);
            }

            sNotes = Locus.GetNotes(&dt);
            if(sNotes != sNotesLast)
            {
                sNotesLast = sNotes;
                bKeep = true;
            }
            if(bKeep)
            {
                // something changed between this time (dt) and the
                // previous (dtLast), so keep this time
                psetKeep->insert(dt);
                dtLast = dt;
            }
        }
    }
}
Ejemplo n.º 2
0
void CalSettings::loadSpecial(const QUrl& url, const QColor& color)
{
    if (url.isEmpty())
    {
        qCDebug(DIGIKAM_GENERAL_LOG) << "Loading calendar from file failed: No valid url provided!";
        return;
    }

    KCalCore::MemoryCalendar::Ptr memCal(new KCalCore::MemoryCalendar(QString::fromLatin1("UTC")));
    KCalCore::FileStorage::Ptr fileStorage(new KCalCore::FileStorage(memCal, url.toLocalFile(), new KCalCore::ICalFormat));

    qCDebug(DIGIKAM_GENERAL_LOG) << "Loading calendar from file " << url.toLocalFile();

    if (!fileStorage->load())
    {
        qCDebug(DIGIKAM_GENERAL_LOG) << "Failed!";
    }
    else
    {
        CalSystem calSys;
        QDate     qFirst, qLast;

        qFirst = calSys.date(params.year, 1, 1);
        qLast  = calSys.date(params.year + 1, 1, 1);
        qLast  = qLast.addDays(-1);

        KDateTime dtFirst(qFirst);
        KDateTime dtLast(qLast);
        KDateTime dtCurrent;

        int counter                = 0;
        KCalCore::Event::List list = memCal->rawEvents(qFirst, qLast);

        foreach(const KCalCore::Event::Ptr event, list)
        {
            qCDebug(DIGIKAM_GENERAL_LOG) << event->summary() << endl << "--------";
            counter++;

            if (event->recurs())
            {
                KCalCore::Recurrence* const recur = event->recurrence();

                for (dtCurrent = recur->getNextDateTime(dtFirst.addDays(-1));
                     (dtCurrent <= dtLast) && dtCurrent.isValid();
                     dtCurrent = recur->getNextDateTime(dtCurrent))
                {
                    addSpecial(dtCurrent.date(), Day(color, event->summary()));
                }
            }
            else
            {
                addSpecial(event->dtStart().date(), Day(color, event->summary()));
            }
        }

        qCDebug(DIGIKAM_GENERAL_LOG) << "Loaded " << counter << " events";
        memCal->close();
        fileStorage->close();
    }
Ejemplo n.º 3
0
void SignalGenerator::Run( void ) {

  ou::tf::cboe::OptionExpiryDates_t expiries;
  ou::tf::cboe::vUnderlyinginfo_t vui;

  pt::ptime dtLast( gregorian::date( 2019,  3, 29 ), pt::time_duration( 23, 59, 59 ) );  // use date of last bar to retrieve

  std::cout << "SignalGenerator parsing cboe spreadsheet ..." << std::endl;

  try {
    ou::tf::cboe::ReadCboeWeeklyOptions( expiries, vui );
  }
  catch(...) {
  }

  typedef ou::tf::cboe::vUnderlyinginfo_t::const_iterator vUnderlyinginfo_citer_t;

  std::cout << "SignalGenerator pre-processing cboe spreadsheet ..." << std::endl;

  for ( vUnderlyinginfo_citer_t iter = vui.begin(); vui.end() != iter; ++iter ) {
//    std::cout <<
//	    iter->sSymbol
//	    << "," << iter->bAdded
//	    << "," << iter->bStandardWeekly
//	    << "," << iter->bExpandedWeekly
//	    << "," << iter->bEOW
//	    << "," << iter->sProductType
//	    << "," << iter->sDescription
//	    << std::endl;

//    if ( ( "Equity" == iter->sProductType ) || ( "ETF" == iter->sProductType ) ) {
      //ScanBars( iter->sSymbol );
      BarSummary bs;
      bs.sType = iter->sProductType;
      m_mapSymbol.insert( mapSymbol_t::value_type( iter->sSymbol, bs ) );
//    }
  }

  std::cout << "SignalGenerator running eod and building output spreadsheet ..." << std::endl;

  if ( 0 != m_mapSymbol.size() ) {
    ScanBars( dtLast );
  }

  std::cout << "SignalGenerator Complete" << std::endl;

}