lib/DbPlugin.h

Go to the documentation of this file.
00001 /*
00002  *  Qtstalker stock charter
00003  *
00004  *  Copyright (C) 2001-2007 Stefan S. Stratigakos
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019  *  USA.
00020  */
00021 
00022 #ifndef DBPLUGIN_HPP
00023 #define DBPLUGIN_HPP
00024 
00025 #include <qstring.h>
00026 #include <qdatetime.h>
00027 #include <qdict.h>
00028 #include "BarData.h"
00029 #include "Bar.h"
00030 #include "DBBase.h"
00031 #include "DBIndex.h"
00032 
00033 class DbPlugin : public DBBase
00034 {
00035   public:
00036   
00037     enum DbType
00038     {
00039       Stock1,
00040       Futures1,
00041       Spread1,
00042       Index1,
00043       CC1
00044     };
00045 
00046     typedef struct
00047     {
00048       double open;
00049       double high;
00050       double low;
00051       double close;
00052       double volume;
00053       int oi;
00054     } DBBar;
00055   
00056     DbPlugin ();
00057     virtual ~DbPlugin ();
00058     void setBarLength (BarData::BarLength);
00059     void setBarRange (int);
00060     void getHelpFile (QString &);
00061     void getLastBar (Bar &);
00062     void getFirstBar (Bar &);
00063     void getAllBars (BarData *);
00064     void setBar (Bar &);
00065     void getBar (DBBar &, QString &, Bar &);
00066     DbPlugin::DbType getType (QString &);
00067     void getPrevBar (QDateTime &, Bar &);
00068     void getNextBar (QDateTime &, Bar &);
00069     void getSearchBar (QDateTime &, Bar &);
00070     void dump (QString &d, bool f);
00071     void setType (DbPlugin::DbType);
00072     bool open (QString &, DBIndex *);
00073     void getHistory (BarData *, QDateTime &);
00074     int dbPrefDialog ();
00075     bool createNewStock ();
00076     bool createNewFutures ();
00077     bool createNewIndex (DBIndex *);
00078     bool createNewSpread (DBIndex *);
00079     bool createNewCC (DBIndex *);
00080     int stockPref ();
00081     int futuresPref ();
00082     int indexPref ();
00083     int spreadPref ();
00084     int ccPref ();
00085     void getIndexHistory (BarData *, QDateTime &);
00086     void loadIndexData (QString &, QDict<Bar> &, QDateTime &, float, int, BarData::BarLength);
00087     void getSpreadHistory (BarData *, QDateTime &);
00088     void getCCHistory (BarData *, QDateTime &);
00089 
00090   protected:
00091     int barRange;
00092     BarData::BarLength barLength;
00093     QString helpFile;
00094     DbPlugin::DbType type;
00095     DBIndex *chartIndex;
00096 };
00097 
00098 #endif
00099 
00100