ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Friends
DataCSV Class Reference

Data type to describe Japanese candlesticks : open, high, low and close values. More...

#include <DataStock.h>

Inheritance diagram for DataCSV:
Inheritance graph
[legend]
Collaboration diagram for DataCSV:
Collaboration graph
[legend]

Public Member Functions

 DataCSV ()
 Default constructor, set date and all values to 0. More...
 
 DataCSV (time_t d, type_value_data iopen, type_value_data ihigh, type_value_data ilow, type_value_data iclose)
 Constructor with all arguments explicit. More...
 
 DataCSV (unsigned int)
 Constructor with integer, no effect here but need for MultiData and ListDatStock template. More...
 
 DataCSV (const DataCSV &rhs)
 Copy constructor. More...
 
 DataCSV (DataCSV &&rhs)
 Move copy constructor. More...
 
virtual ~DataCSV ()
 Destructor. More...
 
Assignment operators
DataCSVoperator= (const DataCSV &rhs)
 Normal assignment. More...
 
DataCSVoperator= (DataCSV &&rhs)
 Move assignment. More...
 
Implementation of pure virtual functions for DataCSV
virtual void SetData (const time_t d, const std::vector< type_value_data > &vec)
 Set a full Data : date + value(s) in a vector. More...
 
virtual std::vector
< type_value_data
GetValues () const
 Return the values in a vector, always 4 values: open, high, low, close. More...
 
virtual void SetValues (std::vector< type_value_data > &vec)
 Set the values with the same order. More...
 
virtual type_value_data GetMaximum () const
 Get the maximum value. More...
 
virtual type_value_data GetMinimum () const
 Get the minimum value. More...
 
virtual bool HasChanged (const DataStock &data_to_check) const
 Check if data are different. More...
 
virtual void ExtractCSVLine (std::vector< std::string > &linecsv)
 Extract date and data from a split string. More...
 
void PrintData (const unsigned int verbose=0) const
 User friendly output on screen. More...
 
Specific to DataCSV

Specific getters and setters for candlesticks

type_value_data GetOpen () const
 
type_value_data GetHigh () const
 
type_value_data GetLow () const
 
type_value_data GetClose () const
 
void SetOpen (type_value_data iopen)
 
void SetClose (type_value_data iclose)
 
void SetHigh (type_value_data ihigh)
 
void SetLow (type_value_data ilow)
 
void Reset ()
 Set high and low values respectively to the minimum and maximum possible values for the type. More...
 
void SetValues (const type_value_data iopen, const type_value_data ihigh, const type_value_data ilow, const type_value_data iclose)
 Set all data with explicit arguments. More...
 
void SetData (const time_t d, const type_value_data iopen, const type_value_data ihigh, const type_value_data ilow, const type_value_data iclose)
 Set date and all data with explicit arguments. More...
 
Update this candle with values of an other DataStock
virtual void AdditionData (const DataCSV &new_data)
 With an other candlestick. More...
 
virtual void AdditionData (const SimpleData &new_data)
 As previous, but only one value in new_data. More...
 
- Public Member Functions inherited from DataStock
 DataStock ()
 Default constructor set date to 0. More...
 
 DataStock (time_t d)
 Set the date, used in initialization of derived classes. More...
 
 DataStock (const DataStock &rhs)
 Copy constructor. More...
 
 DataStock (DataStock &&rhs)
 Move copy constructor. More...
 
virtual ~DataStock ()
 Destructor. More...
 
DataStockoperator= (const DataStock &rhs)
 Normal assignment. More...
 
DataStockoperator= (DataStock &&rhs)
 Move assignment. More...
 
time_t GetDate () const
 Get the date data member. More...
 
void SetDate (const time_t d)
 Modify the date. More...
 
std::string GetDateString (const bool bhours=true) const
 Return the date in a string format: "YEAR-MOnth-DAy HH:MM:SS" (2014-11-10 13::25::00) More...
 
struct tm GetDateTm () const
 Get a tm structure of the date. More...
 

Protected Member Functions

Specific to input/output of DataCSV
virtual void helper_operator_write (std::ostream &os) const
 
virtual void helper_operator_read (std::iostream &ios)
 
- Protected Member Functions inherited from DataStock
int helper_operator_read_base (std::iostream &ios)
 Helper function for operator<< for reading date from input streams. More...
 
void helper_operator_write_base (std::ostream &os) const
 Helper function for operator>> for writing date to output. More...
 

Private Attributes

4 values to describe a candlestick
type_value_data open
 
type_value_data high
 
type_value_data low
 
type_value_data close
 

Friends

bool operator== (const DataCSV &lhs, const DataCSV &rhs)
 Compare all fields, date and values. More...
 

Additional Inherited Members

- Protected Attributes inherited from DataStock
time_t date
 All data have a date associated. More...
 

Detailed Description

Data type to describe Japanese candlesticks : open, high, low and close values.

Definition at line 502 of file DataStock.h.

Constructor & Destructor Documentation

DataCSV::DataCSV ( )

Default constructor, set date and all values to 0.

Definition at line 626 of file DataStock.cpp.

DataCSV::DataCSV ( time_t  d,
type_value_data  iopen,
type_value_data  ihigh,
type_value_data  ilow,
type_value_data  iclose 
)

Constructor with all arguments explicit.

Definition at line 633 of file DataStock.cpp.

DataCSV::DataCSV ( unsigned  int)

Constructor with integer, no effect here but need for MultiData and ListDatStock template.

Definition at line 641 of file DataStock.cpp.

DataCSV::DataCSV ( const DataCSV rhs)

Copy constructor.

Definition at line 645 of file DataStock.cpp.

References close, high, low, and open.

DataCSV::DataCSV ( DataCSV &&  rhs)

Move copy constructor.

Definition at line 658 of file DataStock.cpp.

References close, high, low, and open.

virtual DataCSV::~DataCSV ( )
inlinevirtual

Destructor.

Definition at line 524 of file DataStock.h.

Member Function Documentation

void DataCSV::AdditionData ( const DataCSV new_data)
virtual

With an other candlestick.

Update Low and High values according to the new_data

Parameters
new_dataupdate low/high values with these new values

Definition at line 843 of file DataStock.cpp.

References high, and low.

Referenced by ListDataStock_Utils::TransformTimeScale().

Here is the caller graph for this function:

void DataCSV::AdditionData ( const SimpleData new_data)
virtual

As previous, but only one value in new_data.

Definition at line 853 of file DataStock.cpp.

References SimpleData::GetValue(), high, and low.

Here is the call graph for this function:

void DataCSV::ExtractCSVLine ( std::vector< std::string > &  vec)
virtual

Extract date and data from a split string.

Deprecated:
keep only for test performance comparison. Use operators<< >> now.
Parameters
vecvector of string containing the date and the value(s)

Implements DataStock.

Definition at line 782 of file DataStock.cpp.

References SetData(), and Utils::StringToTime_t().

Here is the call graph for this function:

type_value_data DataCSV::GetClose ( ) const
inline

Definition at line 555 of file DataStock.h.

References close.

Referenced by HasChanged(), and helper_operator_write().

Here is the caller graph for this function:

type_value_data DataCSV::GetHigh ( ) const
inline

Definition at line 553 of file DataStock.h.

References high.

Referenced by GetMaximum(), and helper_operator_write().

Here is the caller graph for this function:

type_value_data DataCSV::GetLow ( ) const
inline

Definition at line 554 of file DataStock.h.

References low.

Referenced by GetMinimum(), and helper_operator_write().

Here is the caller graph for this function:

virtual type_value_data DataCSV::GetMaximum ( ) const
inlinevirtual

Get the maximum value.

Implements DataStock.

Definition at line 541 of file DataStock.h.

References GetHigh().

Here is the call graph for this function:

virtual type_value_data DataCSV::GetMinimum ( ) const
inlinevirtual

Get the minimum value.

Implements DataStock.

Definition at line 542 of file DataStock.h.

References GetLow().

Here is the call graph for this function:

type_value_data DataCSV::GetOpen ( ) const
inline

Definition at line 552 of file DataStock.h.

References open.

Referenced by helper_operator_write(), and ListDataStock_Utils::TransformTimeScale().

Here is the caller graph for this function:

std::vector< type_value_data > DataCSV::GetValues ( ) const
virtual

Return the values in a vector, always 4 values: open, high, low, close.

Implements DataStock.

Definition at line 771 of file DataStock.cpp.

References close, high, low, and open.

bool DataCSV::HasChanged ( const DataStock data_to_check) const
virtual

Check if data are different.

To compare all fields use operator==
Exact implementation is different for each derived class:

Todo:
check why DataCSV compares dates also, not the others why not use == now
case of double dispatching for DataCSV when compared with SimpleData, makes more general ?
Returns
true if values are considered different

Implements DataStock.

Definition at line 809 of file DataStock.cpp.

References GetClose(), DataStock::GetDate(), and DataStock::GetDateString().

Here is the call graph for this function:

DataCSV & DataCSV::operator= ( const DataCSV rhs)

Normal assignment.

Definition at line 677 of file DataStock.cpp.

References close, high, low, open, and DataStock::operator=().

Here is the call graph for this function:

DataCSV & DataCSV::operator= ( DataCSV &&  rhs)

Move assignment.

Definition at line 697 of file DataStock.cpp.

References close, high, low, open, and DataStock::operator=().

Here is the call graph for this function:

void DataCSV::PrintData ( const unsigned int  verbose = 0) const
virtual

User friendly output on screen.

verbose level:

  • 0 : default, print all data in one line, format with comma
  • 1 : add a header before the line

    Parameters
    verboselevel of output

Implements DataStock.

Definition at line 861 of file DataStock.cpp.

References FDS::WCOL.

void DataCSV::Reset ( )

Set high and low values respectively to the minimum and maximum possible values for the type.

To use before adding data with DataCSV::AdditionData and insure than new data are correctly used

Definition at line 724 of file DataStock.cpp.

References high, and low.

void DataCSV::SetClose ( type_value_data  iclose)
inline

Definition at line 557 of file DataStock.h.

References close.

void DataCSV::SetData ( const time_t  d,
const std::vector< type_value_data > &  vec 
)
virtual

Set a full Data : date + value(s) in a vector.

Implements DataStock.

Definition at line 754 of file DataStock.cpp.

References close, DataStock::date, high, low, and open.

Referenced by ExtractCSVLine(), GetListDataFromPyList(), and wrap_UpdateCSV().

Here is the caller graph for this function:

void DataCSV::SetData ( const time_t  d,
const type_value_data  iopen,
const type_value_data  ihigh,
const type_value_data  ilow,
const type_value_data  iclose 
)

Set date and all data with explicit arguments.

Definition at line 744 of file DataStock.cpp.

References close, DataStock::date, high, low, and open.

void DataCSV::SetHigh ( type_value_data  ihigh)
inline

Definition at line 558 of file DataStock.h.

References high.

void DataCSV::SetLow ( type_value_data  ilow)
inline

Definition at line 559 of file DataStock.h.

References low.

void DataCSV::SetOpen ( type_value_data  iopen)
inline

Definition at line 556 of file DataStock.h.

References open.

void DataCSV::SetValues ( std::vector< type_value_data > &  vec)
virtual

Set the values with the same order.

Implements DataStock.

Definition at line 763 of file DataStock.cpp.

References close, high, low, and open.

Referenced by helper_operator_read().

Here is the caller graph for this function:

void DataCSV::SetValues ( const type_value_data  iopen,
const type_value_data  ihigh,
const type_value_data  ilow,
const type_value_data  iclose 
)

Set all data with explicit arguments.

Definition at line 735 of file DataStock.cpp.

References close, high, low, and open.

Friends And Related Function Documentation

bool operator== ( const DataCSV lhs,
const DataCSV rhs 
)
friend

Compare all fields, date and values.

Definition at line 922 of file DataStock.cpp.

Field Documentation

type_value_data DataCSV::close
private

Definition at line 507 of file DataStock.h.

Referenced by DataCSV(), GetClose(), GetValues(), operator=(), operator==(), SetClose(), SetData(), and SetValues().

type_value_data DataCSV::high
private
type_value_data DataCSV::low
private
type_value_data DataCSV::open
private

Definition at line 507 of file DataStock.h.

Referenced by DataCSV(), GetOpen(), GetValues(), operator=(), operator==(), SetData(), SetOpen(), and SetValues().


The documentation for this class was generated from the following files: