lib/BarData.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 BARDATA_HPP
00023 #define BARDATA_HPP
00024 
00025 #include <qvaluelist.h>
00026 #include <qdict.h>
00027 #include <qstringlist.h>
00028 #include <qdatetime.h>
00029 #include "Bar.h"
00030 #include "PlotLine.h"
00031 
00032 class BarData
00033 {
00034   public:
00035     typedef struct
00036     {
00037       int x;
00038     } X;
00039 
00040     enum BarType
00041     {
00042       Daily,
00043       Tick
00044     };
00045 
00046     enum InputType
00047     {
00048       Open,
00049       High,
00050       Low,
00051       Close,
00052       Volume,
00053       OpenInterest,
00054       Day,
00055       Week,
00056       Month,
00057       DayOfWeek
00058     };
00059 
00060     enum BarLength
00061     {
00062       Minute1,
00063       Minute5,
00064       Minute10,
00065       Minute15,
00066       Minute30,
00067       Minute60,
00068       DailyBar,
00069       WeeklyBar,
00070       MonthlyBar
00071     };
00072     
00073     BarData (QString &);
00074     ~BarData ();
00075     int count ();
00076     void getDate (int, QDateTime &);
00077     double getOpen (int);
00078     double getHigh (int);
00079     double getLow (int);
00080     double getClose (int);
00081     double getVolume (int);
00082     double getOI (int);
00083     void prepend (Bar &bar);
00084     void prependRaw (Bar &bar);
00085     void appendRaw (Bar &bar);
00086     int getX (QDateTime &);
00087     double getMax ();
00088     double getMin ();
00089     void createDateList ();
00090     void setBarType (BarData::BarType);
00091     BarData::BarType getBarType ();
00092     void getInputFields (QStringList &);
00093     PlotLine * getInput (BarData::InputType);
00094     BarData::InputType getInputType (QString &);
00095     void getBarLengthList (QStringList &);
00096     void getBar (int, Bar &);
00097     void setMinMax ();
00098     void clear();
00099     void setBarLength (BarData::BarLength);
00100     BarData::BarLength getBarLength ();
00101     void setStartEndDates (QDateTime &);
00102     void setBar (int, Bar &);
00103     void getSymbol (QString &);
00104     
00105   protected:
00106     QValueList<Bar> barList;
00107     QDict<X> dateList;
00108     double high;
00109     double low;
00110     BarData::BarType barType;
00111     BarData::BarLength barLength;
00112     QDateTime startDate;
00113     QDateTime endDate;
00114     Bar currentBar;
00115     QString symbol;
00116 };
00117 
00118 #endif