00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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