SlideShare a Scribd company logo
1 of 25
Download to read offline
/*
     Cross Platform Core Code.

     Copyright(R) 2001-2002 Balang Software.
     All rights reserved.

     Using:
         class CKData
         class CDRData
         class CBaseData
         class CReport
         class CMinute
         class COutline
         class CStockInfo
         class CStock
*/

#if !defined( __STKLIB_STOCK_H__ )
#define __STKLIB_STOCK_H__

#define STKLIB_DATA_INVALID 0x7FFFFFFF

#define   STKLIB_DAYS_INONEYEAR 240
#define   STKLIB_DAYS_CACHE     60
#define   STKLIB_DAYS_CALCULATE 30
#define   STKLIB_AUTORESUMEDR_DATEBEGIN               20040519
#define   STKLIB_AUTORESUMEDR_LIMIT    11

#define   STKLIB_CODE_MAIN               quot;1A0001quot;
#define   STKLIB_CODE_MAINSZN                quot;399001quot;
#define   STKLIB_CODE_SZZS               quot;1A0001quot;     //
#define   STKLIB_CODE_SZYBL                  quot;1A0009quot;      //       180
#define   STKLIB_CODE_SZAG               quot;1A0002quot;     //        A
#define   STKLIB_CODE_SZBG               quot;1A0003quot;     //        B
#define   STKLIB_CODE_SZNCZ                  quot;399001quot; //
#define   STKLIB_CODE_SZNZZ                  quot;399106quot; //
#define   STKLIB_CODE_SZNCFAZ                quot;399002quot; //            A
#define   STKLIB_CODE_SZNCFBZ                quot;399003quot; //            B
#define   STKLIB_CODE_SZNFIRST           quot;000001quot; //
#define   STKLIB_CODE_SHAFIRST           quot;600000quot; //
#define   STKLIB_CODE_ZLDD               quot;000000quot; //



// some fixed length
#define       STKLIB_MAX_CODE                                   8
#define       STKLIB_MAX_CODE2                                  16 //
#define       STKLIB_MAX_NAME                                   16
#define       STKLIB_MAX_NAMEENU                                80
#define       STKLIB_MAX_SHORTNAME                              16
#define       STKLIB_MAX_DOMAIN                                 32
#define       STKLIB_MAX_PROVINCE                               32

// some enum values

#pragma pack(1)

//
//
//                                         =100

/////////////////////////////////////////////////////////////////////////////////////////////
//

// K                CStock::dataK
typedef struct kdata_t {
     DWORD m_dwMarket;                                                         //                      ,see CStock::StockMarket
     char m_szCode[STKLIB_MAX_CODE];                                           //               ,   '0'

      DWORD m_date;                                      //            Format is XXMMDDHHMM for 5min, Format
is YYYYMMDD for day
      time_t m_time;                                     //               m_date
    0

       float m_fOpen;                             //
       float m_fHigh;                      //
       float m_fLow;                              //
       float m_fClose;                            //
       float m_fVolume;                           //
       float m_fAmount;                           //

       DWORD m_dwAdvance;                                //
       DWORD m_dwDecline;                         //

    DWORD m_dwReserved;
} KDATA, *PKDATA;

//                 CStock::dataDR
typedef struct drdata_t
{
    DWORD m_dwMarket;                                       //                  ,see CStock::StockMarket
    char m_szCode[STKLIB_MAX_CODE];                         //           ,   '0'

      DWORD m_date;                      //          Format is XXMMDDHHMM for 5min, Format
is YYYYMMDD for day
      time_t m_time;                     //               m_date
    0

    float m_fGive;             //
    float m_fPei;                   //
    float m_fPeiPrice;         //        ,         m_fPei!=0.0f
    float m_fProfit;                //

    DWORD m_dwReserved;
} DRDATA, * PDRDATA;

//                      CStock::dataBasetbl
typedef struct basedata_t {
     DWORD m_dwMarket;                                      //                  ,see CStock::StockMarket
     char m_szCode[STKLIB_MAX_CODE2];                       //           ,   '0'

    char m_szDomain[STKLIB_MAX_DOMAIN];                            //
    char m_szProvince[STKLIB_MAX_PROVINCE];                        //

    time_t m_time;                                   //            time_t
    DWORD m_date;                                    //            Format is YYYYMMDD for base data
    LONG m_reporttype;                        //
    float m_fErate_dollar;               //
    float m_fErate_hkdollar;             //

    //
    float m_fRatio_liquidity;            //
    float m_fRatio_quick;                     //
    float m_fVelocity_receivables;       //
    //
    float m_fVelocity_merchandise;       //
    float m_fMain_income;                     //
    float m_fCash_ps;                         //
    //
    float m_fProfit_margin;              //                          %
    float m_fNetasset_yield;             //                      %
    //
    DWORD m_datebegin;                        //                 Format is YYYYMMDD
float m_fShare_count_total;                       //
       float m_fShare_count_a;                           //          A
       float m_fShare_count_b;                           //          B
       float m_fShare_count_h;                           //          H
       float m_fShare_count_national;                    //
       float m_fShare_count_corp;                        //
       float m_fProfit_psud;                                    //
       float m_fAsset;                                          //
       float m_fRatio_holderright;                       //
       float m_fRatio_longdebt;                                 //
       float m_fRatio_debt;                                     //
       //
       float m_fNetasset_ps;                                    //
       float m_fNetasset_ps_regulate;                    //
       float m_fEps;                                            //
       float m_fEps_deduct;                                     //
       float m_fNet_profit;                                     //
       float m_fMain_profit;                                    //
       float m_fTotal_profit;                            //
       //
       float m_fProfit_inc;                              //                             %
       float m_fIncome_inc;                                     //                              %
       float m_fAsset_inc;                               //                         %
       //
       float m_fYield_average;                           //                    %
       float m_fYield_stddev;                            //                    %
       float m_fBeite;                                   //

   DWORD m_dwReserved[4];
}BASEDATA, *PBASEDATA;

//
/////////////////////////////////////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////////////////////////////////////////////
//

//                       CStock::dataReport
typedef struct report_t {
     DWORD m_dwMarket;                                                         //                          ,see CStock::StockMarket
     char m_szCode[STKLIB_MAX_CODE];                                           //                   ,   '0'

       char m_szName[STKLIB_MAX_NAME];                                         //                   ,   '0'
time_t    m_time;                               //

    DWORD m_dwFlag;                                 //

    float m_fLast;                      //
    float m_fOpen;                             //
    float m_fHigh;                      //
    float m_fLow;                              //
    float m_fNew;                              //
    float m_fVolume;                           //
    float m_fAmount;                           //

    float m_fBuyPrice[5];                      //         1,2,3,4
    float m_fBuyVolume[5];              //           1,2,3,4
    float m_fSellPrice[5];              //           1,2,3,4
    float m_fSellVolume[5];             //           1,2,3,4
} REPORT, *PREPORT;

//                      CStock::dataMinute
typedef struct minute_t {
     DWORD m_dwType; // 1 min, 5 min, 15 min, 30 min line

    DWORD m_dwMarket;                                    //                ,see CStock::StockMarket
    char m_szCode[STKLIB_MAX_CODE];                      //         ,   '0'

    time_t m_time;                      //
    float m_fHigh;            //
    float m_fLow;                  //
    float m_fNew;                  //
    float m_fVolume;               //
    float m_fAmount;               //
} MINUTE, *PMINUTE;

//                       CStock::dataOutline
typedef struct outline_t {
     time_t m_time;

    DWORD m_dwShHq;
    DWORD m_dwSzHq;
    DWORD m_dwShPriceUp;
    DWORD m_dwShPriceDown;
    DWORD m_dwSzPriceUp;
    DWORD m_dwSzPriceDown;
DWORD m_dwShWbUp;
    DWORD m_dwShWbDown;
    DWORD m_dwSzWbUp;
    DWORD m_dwSzWbDown;
    DWORD m_dwShStockCount;
    DWORD m_dwSzStockCount;
} OUTLINE, *POUTLINE;

//                      CStock::dataMultisort
//
typedef struct multisort_item_t {
     BYTE m_type;                           // stock's type
     char m_code[6];                  // stock code
     long m_data1;
     long m_data2;
} MULTISORT_ITEM;
typedef struct multisort_t {
     DWORD m_class;                   // 1-        2-       4-5           8-5            16-
      32-
                                            // 64-       128-     256-
     DWORD m_tag;                           // 0xf0 00 06 00
     MULTISORT_ITEM m_stocks[6];
} MULTISORT, *PMULTISORT;

//           CStock::dataCode
typedef struct stockcode {
     DWORD m_dwMarket;                                 //                ,see CStock::StockMarket
     char m_szCode[STKLIB_MAX_CODE2];                  //         ,   '0'
} STOCKCODE, *PSTOCKCODE;

//
#define STKLIB_COMMPACKET_TAG 'KPMC'
typedef struct commpacket_t {
     DWORD m_dwTag;           // = STKLIB_COMMPACKET_TAG
     DWORD m_dwDataType;      // see CStock::DataType
     DWORD m_dwCount;

     union
     {
         REPORT * m_pReport;        //
         MINUTE * m_pMinute;        //
         MULTISORT *  m_pMultisort; //
         OUTLINE * m_pOutline;      //
         KDATA *      m_pKdata;                   //
DRDATA * m_pDrdata;     //
              STOCKCODE * m_pStockcode;                                //
              void *   m_pData;
    };
} COMMPACKET, *PCOMMPACKET;

//
/////////////////////////////////////////////////////////////////////////////////////////////

#pragma pack()



#ifndef STKLIB_API
#define STKLIB_API __declspec(dllimport)
#endif

/***

*/
class STKLIB_API CDRData
{
public:
// Construction
     CDRData();
     CDRData( const CDRData &src );

// Attributes
      int       GetSize() const;
      int       GetUpperBound() const;
      void SetSize(int nNewSize, int nGrowBy = -1);

// Operations
     // Clean up
     void FreeExtra();
     void RemoveAll();

       // Accessing elements
       DRDATAGetAt(int nIndex) const;
       void SetAt(int nIndex, DRDATA newElement);
       DRDATA& ElementAt(int nIndex);

       // Direct Access to the element data (may return NULL)
       const DRDATA* GetData() const;
       DRDATA* GetData();
// Potentially growing the array
       void SetAtGrow(int nIndex, DRDATA newElement);
       int        Add(DRDATA newElement);

       // overloaded operator helpers
       DRDATAoperator[](int nIndex) const;
       DRDATA& operator[](int nIndex);

       // Operations that move elements around
       void InsertAt(int nIndex, DRDATA newElement, int nCount = 1);
       void RemoveAt(int nIndex, int nCount = 1);
       void InsertAt(int nStartIndex, CDRData* pNewArray);
       int       InsertDRDataSort( DRDATA newElement );
       void Sort( );
       CDRData & operator = ( const CDRData &src );
       void Copy( const CDRData &src );
       BOOL IsSameAs( CDRData * psrc );

// Implementation
protected:
     DRDATA* m_pData; // the actual array of data
     int m_nSize;    // # of elements (upperBound - 1)
     int m_nMaxSize; // max allocated
     int m_nGrowBy;     // grow amount

public:
     ~CDRData();
};

/***
       K
*/
class STKLIB_API CKData
{
public:
     // Constructors
     CKData();
     CKData( int ktype, int maindatatype = mdtypeClose );
     CKData( const CKData & src );

       CKData & operator = ( const CKData &src );

       static   BOOL     IsDayOrMin( int nKType );
// Flag values
enum KTypes {
      ktypeNone         = 0x00,
      ktypeMin      =   0x01,
      ktypeMin5         = 0x01,
      ktypeMin15        = 0x02,
      ktypeMin30        = 0x03,
      ktypeMin60        = 0x04,
      ktypeDay      =   0x05,
      ktypeWeek         = 0x06,
      ktypeMonth        = 0x07,
      ktypeMax          = 0x07,
};

enum Formats {
    formatNone          = 0x00,
    formatMin           = 0x01,
    formatOriginal=     0x01,
    formatXDRup         = 0x02,
    formatXDRdown       = 0x03,
    formatMax           = 0x03,
};

enum MaindataTypes {
    mdtypeNone          =   0x00,
    mdtypeMin           =   0x01,
    mdtypeClose         =   0x01,
    mdtypeOpen          =   0x02,
    mdtypeAverage       =   0x03,
    mdtypeMax           =   0x03,
};

// Attributes
int        GetSize() const;
int        GetUpperBound() const;
void SetSize(int nNewSize, int nGrowBy = -1);

// Operations
// Clean up
void FreeExtra();
void RemoveAll();

// Accessing elements
KDATA GetAt(int nIndex) const;
     void SetAt(int nIndex, KDATA newElement);
     KDATA&         ElementAt(int nIndex);

     // Direct Access to the element data (may return NULL)
     const KDATA* GetData() const;
     KDATA* GetData();

     float MaindataAt(int nIndex) const;      //   CKData     nIndex

     BOOL  DateAt(int nIndex,
                    int &nYear, int &nMonth, int &nDay, int &nHour, int &nMinute ) const;
     BOOL LatestDate(
                    int &nYear, int &nMonth, int &nDay, int &nHour, int &nMinute ) const;
     DWORD GetDate(int nIndex );
     DWORD GetDateDay( int nIndex );
     int   GetIndexByDate( DWORD date );
     int   GetAboutIndexByDate( DWORD date );

     // Potentially growing the array
     void SetAtGrow(int nIndex, KDATA newElement);
     int        Add(KDATA newElement);

     // overloaded operator helpers
     KDATA operator[](int nIndex) const;
     KDATA&         operator[](int nIndex);

     // Operations that move elements around
     void InsertAt(int nIndex, KDATA newElement, int nCount = 1);
     void RemoveAt(int nIndex, int nCount = 1);
     void InsertAt(int nStartIndex, CKData* pNewArray);
     int       InsertKDataSort( KDATA newElement );

     // Operation of Analysis
     BOOL IsNewValue( int nIndex, BOOL bTopOrBottom, int nDays );
     BOOL GetMinMaxInfo( int nStart, int nEnd, float * pfMin, float *pfMax );

// Implementation
public:
     virtual ~CKData();

#ifdef _DEBUG
     void AssertValid() const;
     void Dump() const;
#endif

public:
     // Extra operations
     void SetKType( int ktype );
     void AutoSetKType( );
     int        GetKType( );
     int        GetCurFormat( );
     void SetDRData( CDRData &drdata );
     CDRData &GetDRData( );
     void ChangeCurFormat( int format, DWORD dateAutoDRBegin, double dAutoDRLimit );
     void SetMaindataType( int type );
     int        GetMaindataType( );
     void Clear( );

    int      CompareLatestDate( CKData &kd );
    static   int Min5ToMin15( CKData &kdm5, CKData &kdm15 );
    static   int Min5ToMin30( CKData &kdm5, CKData &kdm30 );
    static   int Min5ToMin60( CKData &kdm5, CKData &kdm60 );
    static   int DayToMonth( CKData &kdday, CKData &kdmonth );
    static   int DayToWeek( CKData &kdday, CKData &kdweek );

    DWORD ToDayDate( DWORD date );

    int      MergeKData( CKData * pother );
    int      FullFillKData( CKData & kdataMain, BOOL bFillToEnd );

    BOOL     IsAdjacentDays( int nIndex, int nDays );
    BOOL     GetDiff( double * pValue, DWORD dateCur, int nDays );
    BOOL     GetDiffPercent( double * pValue, DWORD dateCur, int nDays );
    BOOL     GetScope( double * pValue, DWORD dateCur, int nDays );
    BOOL     GetVolumeSum( double * pValue, DWORD dateCur, int nDays );
    BOOL     GetRatioVolume( double * pValue, DWORD dateCur, int nDays );
    BOOL     GetRS( double * pValue, DWORD dateCur, int nDays );
    BOOL     GetMA( double * pValue, int nIndex, int nDays );

protected:
     static int    ConvertKData( CKData &kdSrc, CKData &kdDest, int multiple );
     void CopyData( const CKData &src );
     void LoadDataOriginal( );
     void StoreDataOriginal( );
     void ConvertXDR( BOOL bUP, DWORD dateAutoDRBegin, double dAutoDRLimit );

    static   float GetRatio( float fLastClose, DRDATA & dr );
protected:
     int     m_nKType;
     int     m_nCurFormat;
     int     m_nCurMaindataType;
     CDRData m_drdata;

       struct kdata_t * m_pDataOriginal;
       int m_nSizeOriginal;         // # of elements (upperBound - 1)
       int m_nMaxSizeOriginal; // max allocated
       struct kdata_t * m_pData;
       int m_nSize;       // # of elements (upperBound - 1)
       int m_nMaxSize; // max allocated
       int m_nGrowBy;        // grow amount
};

/***

*/
class STKLIB_API CBaseData
{
public:
// Construction
     CBaseData();
     CBaseData( const CBaseData &src );

// Attributes
      int       GetSize() const;
      int       GetUpperBound() const;
      void SetSize(int nNewSize, int nGrowBy = -1);

// Operations
     // Clean up
     void FreeExtra();
     void RemoveAll();

       // Accessing elements
       BASEDATA GetAt(int nIndex) const;
       void SetAt(int nIndex, BASEDATA newElement);
       BASEDATA& ElementAt(int nIndex);

       // Direct Access to the element data (may return NULL)
       const BASEDATA* GetData() const;
       BASEDATA* GetData();
// Potentially growing the array
       void SetAtGrow(int nIndex, BASEDATA newElement);
       int        Add(BASEDATA newElement);

       // overloaded operator helpers
       BASEDATA operator[](int nIndex) const;
       BASEDATA& operator[](int nIndex);

       // Operations that move elements around
       void InsertAt(int nIndex, BASEDATA newElement, int nCount = 1);
       void RemoveAt(int nIndex, int nCount = 1);
       void InsertAt(int nStartIndex, CBaseData* pNewArray);
       int       InsertBaseDataSort( BASEDATA newElement );
       void Sort( );
       CBaseData & operator = ( const CBaseData &src );
       void Copy( const CBaseData &src );

// Implementation
protected:
     BASEDATA* m_pData; // the actual array of data
     int m_nSize;    // # of elements (upperBound - 1)
     int m_nMaxSize; // max allocated
     int m_nGrowBy;     // grow amount

public:
     ~CBaseData();
};

/***

*/
class STKLIB_API CReport
{
public:
// Construction
     CReport();
     CReport( const CReport &src );

// Attributes
      int       GetSize() const;
      int       GetUpperBound() const;
      void SetSize(int nNewSize, int nGrowBy = -1);
// Operations
     // Clean up
     void FreeExtra();
     void RemoveAll();

    // Accessing elements
    REPORT GetAt(int nIndex) const;
    void SetAt(int nIndex, REPORT newElement);
    REPORT& ElementAt(int nIndex);

    // Direct Access to the element data (may return NULL)
    const REPORT* GetData() const;
    REPORT* GetData();

    // Potentially growing the array
    void SetAtGrow(int nIndex, REPORT newElement);
    int        Add(REPORT newElement);

    // overloaded operator helpers
    REPORT operator[](int nIndex) const;
    REPORT& operator[](int nIndex);

    // Operations that move elements around
    void InsertAt(int nIndex, REPORT newElement, int nCount = 1);
    void RemoveAt(int nIndex, int nCount = 1);
    void InsertAt(int nStartIndex, CReport* pNewArray);
    int       InsertReportSort( REPORT newElement );
    void Sort( );
    void RemoveDirty( );
    CReport & operator = ( const CReport &src );
    void Copy( const CReport &src );

    BOOL       GetMMLD( int nIndex, double *pdVolBuy, double *pdVolSell, double *
pdVolDiff );   //
    BOOL       GetMMLDMinMaxInfo( double *pdMin, double *pdMax );         //

    BOOL StatBuySellEx( float * fSellPrice, float * fSellVolume, float * fBuyPrice, float *
fBuyVolume, int nSize );

// Implementation
protected:
     REPORT* m_pData;       // the actual array of data
     int m_nSize;    // # of elements (upperBound - 1)
     int m_nMaxSize; // max allocated
int m_nGrowBy;      // grow amount

public:
     ~CReport();
};

/***

*/
class STKLIB_API CMinute
{
public:
// Construction
     CMinute();
     CMinute( const CMinute &src );

// Attributes
      int       GetSize() const;
      int       GetUpperBound() const;
      void SetSize(int nNewSize, int nGrowBy = -1);

// Operations
     // Clean up
     void FreeExtra();
     void RemoveAll();

       // Accessing elements
       MINUTE GetAt(int nIndex) const;
       void SetAt(int nIndex, MINUTE newElement);
       MINUTE& ElementAt(int nIndex);

       // Direct Access to the element data (may return NULL)
       const MINUTE* GetData() const;
       MINUTE* GetData();

       // Potentially growing the array
       void SetAtGrow(int nIndex, MINUTE newElement);
       int        Add(MINUTE newElement);

       // overloaded operator helpers
       MINUTE operator[](int nIndex) const;
       MINUTE& operator[](int nIndex);

       // Operations that move elements around
void InsertAt(int nIndex, MINUTE newElement, int nCount = 1);
       void RemoveAt(int nIndex, int nCount = 1);
       void InsertAt(int nStartIndex, CMinute* pNewArray);
       int       InsertMinuteSort( MINUTE newElement );
       void Sort( );
       void RemoveDirty( );
       CMinute & operator = ( const CMinute &src );
       void Copy( const CMinute &src );

       BOOL     StatVolumeInfo( double *pdVolNow, double *pdVolOuter, double *pdVolInner );
       //
       BOOL     GetDiffPercentMin5( double * pValue );
       BOOL     GetLBDKMinMaxInfo( double dVolAverage, double *pdMin, double *pdMax );
       //

       BOOL     GetIndexWave( double *pdWave, int nIndex );

       int      ToKData( CKData & kdata );

// Implementation
protected:
     MINUTE* m_pData; // the actual array of data
     int m_nSize;    // # of elements (upperBound - 1)
     int m_nMaxSize; // max allocated
     int m_nGrowBy;     // grow amount

public:
     ~CMinute();
};

/***

*/
class STKLIB_API COutline
{
public:
// Construction
     COutline();
     COutline( const COutline &src );

// Attributes
      int       GetSize() const;
      int       GetUpperBound() const;
      void SetSize(int nNewSize, int nGrowBy = -1);
// Operations
     // Clean up
     void FreeExtra();
     void RemoveAll();

    // Accessing elements
    OUTLINE        GetAt(int nIndex) const;
    void SetAt(int nIndex, OUTLINE newElement);
    OUTLINE& ElementAt(int nIndex);

    // Direct Access to the element data (may return NULL)
    const OUTLINE* GetData() const;
    OUTLINE* GetData();

    // Potentially growing the array
    void SetAtGrow(int nIndex, OUTLINE newElement);
    int        Add(OUTLINE newElement);

    // overloaded operator helpers
    OUTLINE             operator[](int nIndex) const;
    OUTLINE& operator[](int nIndex);

    // Operations that move elements around
    void InsertAt(int nIndex, OUTLINE newElement, int nCount = 1);
    void RemoveAt(int nIndex, int nCount = 1);
    void InsertAt(int nStartIndex, COutline* pNewArray);
    int       InsertOutlineSort( OUTLINE newElement );
    void Sort( );
    COutline & operator = ( const COutline &src );
    void Copy( const COutline &src );

// Implementation
protected:
     OUTLINE* m_pData; // the actual array of data
     int m_nSize;    // # of elements (upperBound - 1)
     int m_nMaxSize; // max allocated
     int m_nGrowBy;     // grow amount

public:
     ~COutline();
};

class CStDatabase;
/***
                         CStock::dataInfo
*/
class STKLIB_API CStockInfo
{
public:
     CStockInfo( );
     CStockInfo( const CStockInfo &src );

       // Operation
       void Clear( );
       CStockInfo & operator = ( const CStockInfo & si );

       BOOL IsEqualTo( DWORD dwMarket, const char * szCode );
       DWORD GetMarket( );
       void SetMarket( DWORD dwMarket );
       const char * GetStockCode( );
       BOOL SetStockCode( DWORD dwMarket, const char * szCode );
       LONG GetType( );
       void SetType( LONG t );
       void ResolveTypeAndMarket( );
       const char * GetStockName( );
       void SetStockName( const char * szName );
       const char * GetStockNameEnu( );
       void SetStockNameEnu( const char * szNameEnu );
       const char * GetStockNameChs( );
       void SetStockNameChs( const char * szName );
       const char * GetStockShortName( );
       void SetStockShortName( const char *szShortName );
       const char * GetStockDomain( );
       void SetStockDomain( const char * szDomain );
       const char * GetStockProvince( );
       void SetStockProvince( const char * szProvince );

   BOOL StatTechIndex( DWORD dwDate );                 //          Format is
YYYYMMDD
   BOOL StatBaseIndex( DWORD dwDate );                 //          Format is
YYYYMMDD

       // Attributes
       BOOL IsValidStock( );        //
       BOOL IsShangHai( );          //
       BOOL IsShenZhen( );          //
BOOL         IsIndex( );            //
   BOOL         IsBond( );             //
   BOOL         IsBondIndex( );        //
   BOOL         IsFund( );        //
   BOOL         IsRight( );            //
   int          DigitBit( );      //                                             B

   // Variant
   BOOL         GetAverage( double *pValue );    //
   BOOL         GetDiff( double *pValue, DWORD dateCur, int nDays ); //
   BOOL         GetDiffPercent( double *pValue, DWORD dateCur, int nDays ); //
   BOOL         GetScope( double *pValue, DWORD dateCur, int nDays ); //
   BOOL         GetDiffPercentMin5( double *pValue );

   BOOL         GetPE( double * pValue );        //
   BOOL         GetPNetAsset( double *pValue ); //
   BOOL         GetPMainIncome( double * pValue ); //
   BOOL         GetRatioPCash( double * pValue );   //

    BOOL        GetShareCurrency( double * pValue ); //
    BOOL        GetRatioCurrency( double * pValue ); //
    BOOL        GetRatioChangeHand( double * pValue, double dVolume );
    BOOL        GetRatioChangeHand( CKData &kdata, double * pValue, DWORD dateCur, int
nDays );
    BOOL        GetRatioChangeHand( double * pValue, DWORD dateCur, int nDays );     // n

   BOOL         GetRatioVolume( double * pValue, DWORD dateCur, int nDays );         // n

   BOOL         GetRS( double * pValue, DWORD dateCur, int nDays );                         // n

   BOOL         GetSellBuyRatio( double *pdRatio, double *pdDiff );                  //



   BOOL         GetMarketValue( double * pValue ); //
   BOOL         GetMarketValueA( double * pValue ); // A
   BOOL         GetMarketValueB( double * pValue ); // B

   BOOL         GetXiapu( double * pValue );     //

protected:
     // data from codetable
     DWORD m_dwMarket;                                     //                               ,see
CStock::StockMarket
     char m_szCode[STKLIB_MAX_CODE2];                      //         ,   '0'
LONG m_type;                            // see CStock::StockType
     char m_szName[STKLIB_MAX_NAME];         //
     char m_szNameEnu[STKLIB_MAX_NAMEENU];         //
     char m_szShortname[STKLIB_MAX_SHORTNAME];     //

     char m_szDomain[STKLIB_MAX_DOMAIN];                    //
     char m_szProvince[STKLIB_MAX_PROVINCE];                //

public:

   DWORD m_datetech;            //        Format is XXMMDDHHMM for 5min, Format is
YYYYMMDD for day

     float m_fLast;             //
     float m_fOpen;                  //
     float m_fHigh;             //
     float m_fLow;                   //
     float m_fClose;                 //

     float m_fVolume;                //        ( )
     float m_fAmount;                //        ( )

     DWORD m_dwAdvance;                   //
     DWORD m_dwDecline;              //

     float m_fBuyPrice[5];
     float m_fBuyVolume[5];
     float m_fSellPrice[5];
     float m_fSellVolume[5];

public:
     CKData        m_kdata;      //              AfxGetProfile().GetCacheDays()   K
     CBaseData     m_basedata;            //
     CMinute       m_minute;              //     5          MINUTE
     REPORT        m_reportLatest;        //              REPORT

public:
     // From Base Data
     DWORD m_datebase;                               //     Format is YYYYMMDD for base data
     LONG m_reporttype;
     float m_fErate_dollar;               //
     float m_fErate_hkdollar;             //
//
       float m_fRatio_liquidity;        //
       float m_fRatio_quick;                     //
       float m_fVelocity_receivables;   //
       //
       float m_fVelocity_merchandise;   //
       float m_fMain_income;                     //
       float m_fCash_ps;                         //
       //
       float m_fProfit_margin;          //                        %
       float m_fNetasset_yield;         //                    %
       //
       DWORD m_datebegin;                        //           Format is YYYYMMDD
       float m_fShare_count_total;      //
       float m_fShare_count_a;          //            A
       float m_fShare_count_b;          //            B
       float m_fShare_count_h;          //            H
       float m_fShare_count_national;   //
       float m_fShare_count_corp;       //
       float m_fProfit_psud;                     //
       float m_fAsset;                           //
       float m_fRatio_holderright;      //                    %
       float m_fRatio_longdebt;                  //               %
       float m_fRatio_debt;                      //               %
       //
       float m_fNetasset_ps;                     //
       float m_fNetasset_ps_regulate;   //
       float m_fEps;                             //
       float m_fEps_deduct;                      //
       float m_fNet_profit;                      //
       float m_fMain_profit;                     //
       float m_fTotal_profit;           //
       //
       float m_fProfit_inc;             //                        %
       float m_fIncome_inc;                      //                   %
       float m_fAsset_inc;              //                    %
       //
       float m_fYield_average;          //                %
       float m_fYield_stddev;           //                %
       float m_fBeite;                  //
};

/***
                                             K
*/
class CStock
{
public:
     // Constructors
     CStock( );
     CStock( CStDatabase * pDatabase );
     CStock( CStDatabase * pDatabase, DWORD dwMarket, const char * code );
     virtual ~CStock();

    // Flag values
    enum StockMarket {
          marketUnknown     =   'UKNW', //
          marketSHSE        =   'ESHS', //
          marketSZSE        =   'ESZS', //
          marketCYSE        =   'ESYC', //
          marketCHNA        =   'ANHC', //
          marketHKEX        =   'XEKH', //
          marketTBSE        =   'ESBT', //
          marketTKSE        =   'EST',  //
          marketLSE         =   'ESL',  //
          marketFLKFSE      =   'FKLF', //
          marketNYSE        =   'ESYN', //
          marketNASDAQ      =   'QDSN', //
    };

    enum DataType {
        dataUnknown         = 0x00,          //
        dataInfo        =   0x01,       //
        dataK               = 0x02,          // K
        dataDR              = 0x03,          //
        dataBasetable   =   0x04,       //
        dataBasetext    =   0x05,       // F10
        dataNews        =   0x06,       //
        dataReport          = 0x07,          //
        dataMinute          = 0x08,          //
        dataOutline         = 0x09,          //
        dataCode        =   0x0A,       //
        dataMultisort   =   0x0B,       //
        dataDetail          = 0x0C,          //
    };

    enum StockType {
        typeNone     =      0x00,
typeshIndex       =   0x10,   //
     typeshA           =   0x11,   //   A
     typeshB           =   0x12,   //   B
     typeshBond        =   0x13,   //
     typeshRight       =   0x14,   //
     typeshBonus       =   0x15,   //
     typeshAdmeasure   =   0x16,   //
     typeshInfo        =   0x1F,   //
     typeszIndex       =   0x20,   //       0x20
     typeszA           =   0x21,   //   A   0x21
     typeszB           =   0x22,   //   B   0x22
     typeszBond        =   0x23,   //       0x23
     typeszRight       =   0x24,   //       0x24
     typeszBonus       =   0x25,   //       0x25
     typeszAdmeasure   =   0x26,   //       0x26
     typeszInfo        =   0x2F,   //            0x2f
     typeGeneralInfo   =   0x05,   //          0x05
};

enum StockTypeMark {
    markShanghai = 0x10,  //
    markShenzhen = 0x20,  //
    markGeneralInfo = 0x05,        //
};

enum ReportType {
    reportUnknown      = 0x00,     //
    reportQuarter =    0x01, //
    reportMid          = 0x02,     //
    reportQuarter3 =   0x03, //
    reportAnnals =     0x04, //
};

enum MultisortType {
    classRise     = 0x01,   //
    classFall     = 0x02,   //
    claddRiseMin5     = 0x04,    // 5
    classFallMin5 = 0x08,   // 5
    classBSRatioAsc = 0x10,      //
    classBSRatioDesc= 0x20, //
    classDiff     = 0x40,   //
    classVolRatio = 0x80,   //
    classAmount       = 0x100, //
};
static    double GetReportFactor( int nReportType );

    // Attributes
    void SetDatabase( CStDatabase * pDatabase );
    CStDatabase * GetDatabase( );
    void SetStockCode( DWORD dwMarket, const char * szCode );
    const char * GetStockCode( );
    BOOL SetStockInfo( CStockInfo * pInfo );
    CStockInfo & GetStockInfo( );
    CKData &           GetKData( int ktype );
    CKData &           GetKDataMonth( );
    CKData &           GetKDataWeek( );
    CKData &           GetKDataDay( );
    CKData &           GetKDataMin60( );
    CKData &           GetKDataMin30( );
    CKData &           GetKDataMin15( );
    CKData &           GetKDataMin5( );
    CDRData &          GetDRData( );
    CReport &          GetReport( );
    CMinute &          GetMinute( );
    COutline &         GetOutline( );
    char *        GetBaseTextPtr( );
    int                GetBaseTextLength( );
    BOOL               AllocBaseTextMem( int nNewLength );

    // Operations
    void Clear( );
    int       PrepareData( int nDataType = dataInfo, int nKType = CKData::ktypeDay, BOOL
bReload = FALSE );
    int       PrepareBaseInfo( BOOL bReload = FALSE );
    int       ExtractKData( int nKType, BOOL bForced );
    int       MergeBaseText( CStock &stock );
    int       MergeKData( CStock &stock, int nKType );
    int       MergeDRData( CStock &stock );
    int       StoreDRData( );

protected:
     void SetKDataTypes( );

protected:
     CStDatabase * m_pDatabase;
     CStockInfo m_stockinfo;
CKData      m_kdMonth;
     CKData      m_kdWeek;
     CKData      m_kdDay;
     CKData      m_kdMin60;
     CKData      m_kdMin30;
     CKData      m_kdMin15;
     CKData      m_kdMin5;
     CDRData     m_drData;
     CReport     m_report;
     CMinute     m_minute;
     COutline m_outline;
     int         m_nBaseTextLen;
     char *      m_pBaseText;
};



#ifdef    _SP_ENABLE_INLINES
#define _STOCK_INLINE inline
#include quot;Stock.inlquot;
#undef _STOCK_INLINE
#endif

#endif   //__STKLIB_STOCK_H__

More Related Content

Viewers also liked

Walmart by VIPLAV SINGH , ITS GHAZIABAD
Walmart by VIPLAV SINGH , ITS GHAZIABADWalmart by VIPLAV SINGH , ITS GHAZIABAD
Walmart by VIPLAV SINGH , ITS GHAZIABADviplove singh
 
יתירות הטכנולוגיה
יתירות הטכנולוגיהיתירות הטכנולוגיה
יתירות הטכנולוגיהManny Rosenblum
 
Colors and advertising
Colors and advertisingColors and advertising
Colors and advertisingMohamed Nassar
 
Marketing To Subcultures
Marketing To SubculturesMarketing To Subcultures
Marketing To SubculturesMohamed Nassar
 
Dove Campaign For Real Beauty
Dove Campaign For Real BeautyDove Campaign For Real Beauty
Dove Campaign For Real BeautyMohamed Nassar
 
Non Traditional Advertising
Non Traditional AdvertisingNon Traditional Advertising
Non Traditional AdvertisingMohamed Nassar
 
Parfum De Toamna
Parfum De ToamnaParfum De Toamna
Parfum De Toamnamonicaolaru
 
Presentation2
Presentation2Presentation2
Presentation2bordin04
 
Integracion De La Tec En El Arte
Integracion De La Tec En El ArteIntegracion De La Tec En El Arte
Integracion De La Tec En El ArteJosé Ferrer
 

Viewers also liked (13)

Walmart by VIPLAV SINGH , ITS GHAZIABAD
Walmart by VIPLAV SINGH , ITS GHAZIABADWalmart by VIPLAV SINGH , ITS GHAZIABAD
Walmart by VIPLAV SINGH , ITS GHAZIABAD
 
יתירות הטכנולוגיה
יתירות הטכנולוגיהיתירות הטכנולוגיה
יתירות הטכנולוגיה
 
Colors and advertising
Colors and advertisingColors and advertising
Colors and advertising
 
Product Placement
Product PlacementProduct Placement
Product Placement
 
Guerrilla
GuerrillaGuerrilla
Guerrilla
 
Marketing To Subcultures
Marketing To SubculturesMarketing To Subcultures
Marketing To Subcultures
 
Dove Campaign For Real Beauty
Dove Campaign For Real BeautyDove Campaign For Real Beauty
Dove Campaign For Real Beauty
 
Shock advertising
Shock advertising  Shock advertising
Shock advertising
 
Non Traditional Advertising
Non Traditional AdvertisingNon Traditional Advertising
Non Traditional Advertising
 
Parfum De Toamna
Parfum De ToamnaParfum De Toamna
Parfum De Toamna
 
Presentation2
Presentation2Presentation2
Presentation2
 
Raitaiprachakom
RaitaiprachakomRaitaiprachakom
Raitaiprachakom
 
Integracion De La Tec En El Arte
Integracion De La Tec En El ArteIntegracion De La Tec En El Arte
Integracion De La Tec En El Arte
 

Similar to Cstock

Flex lexer.h -c++-- flexlexer.h -- define interfaces f
Flex lexer.h  -c++-- flexlexer.h -- define interfaces fFlex lexer.h  -c++-- flexlexer.h -- define interfaces f
Flex lexer.h -c++-- flexlexer.h -- define interfaces faman39650
 
Cvim half precision floating point
Cvim half precision floating pointCvim half precision floating point
Cvim half precision floating pointtomoaki0705
 
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docxproject4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docxwkyra78
 
Final Case Study Churn (Autosaved)
Final Case Study Churn (Autosaved)Final Case Study Churn (Autosaved)
Final Case Study Churn (Autosaved)Marreddy P
 
C programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdfC programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdfflashfashioncasualwe
 
Treatment, Architecture and Threads
Treatment, Architecture and ThreadsTreatment, Architecture and Threads
Treatment, Architecture and ThreadsMathias Seguy
 

Similar to Cstock (7)

Flex lexer.h -c++-- flexlexer.h -- define interfaces f
Flex lexer.h  -c++-- flexlexer.h -- define interfaces fFlex lexer.h  -c++-- flexlexer.h -- define interfaces f
Flex lexer.h -c++-- flexlexer.h -- define interfaces f
 
Cvim half precision floating point
Cvim half precision floating pointCvim half precision floating point
Cvim half precision floating point
 
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docxproject4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
project4-ast.DS_Storeproject4-astast.c#include symbolTa.docx
 
Final Case Study Churn (Autosaved)
Final Case Study Churn (Autosaved)Final Case Study Churn (Autosaved)
Final Case Study Churn (Autosaved)
 
sas aeroplan sample
sas aeroplan samplesas aeroplan sample
sas aeroplan sample
 
C programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdfC programming tweak needed for a specific program.This is the comp.pdf
C programming tweak needed for a specific program.This is the comp.pdf
 
Treatment, Architecture and Threads
Treatment, Architecture and ThreadsTreatment, Architecture and Threads
Treatment, Architecture and Threads
 

Recently uploaded

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Recently uploaded (20)

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Cstock

  • 1. /* Cross Platform Core Code. Copyright(R) 2001-2002 Balang Software. All rights reserved. Using: class CKData class CDRData class CBaseData class CReport class CMinute class COutline class CStockInfo class CStock */ #if !defined( __STKLIB_STOCK_H__ ) #define __STKLIB_STOCK_H__ #define STKLIB_DATA_INVALID 0x7FFFFFFF #define STKLIB_DAYS_INONEYEAR 240 #define STKLIB_DAYS_CACHE 60 #define STKLIB_DAYS_CALCULATE 30 #define STKLIB_AUTORESUMEDR_DATEBEGIN 20040519 #define STKLIB_AUTORESUMEDR_LIMIT 11 #define STKLIB_CODE_MAIN quot;1A0001quot; #define STKLIB_CODE_MAINSZN quot;399001quot; #define STKLIB_CODE_SZZS quot;1A0001quot; // #define STKLIB_CODE_SZYBL quot;1A0009quot; // 180 #define STKLIB_CODE_SZAG quot;1A0002quot; // A #define STKLIB_CODE_SZBG quot;1A0003quot; // B #define STKLIB_CODE_SZNCZ quot;399001quot; // #define STKLIB_CODE_SZNZZ quot;399106quot; // #define STKLIB_CODE_SZNCFAZ quot;399002quot; // A #define STKLIB_CODE_SZNCFBZ quot;399003quot; // B #define STKLIB_CODE_SZNFIRST quot;000001quot; // #define STKLIB_CODE_SHAFIRST quot;600000quot; // #define STKLIB_CODE_ZLDD quot;000000quot; // // some fixed length
  • 2. #define STKLIB_MAX_CODE 8 #define STKLIB_MAX_CODE2 16 // #define STKLIB_MAX_NAME 16 #define STKLIB_MAX_NAMEENU 80 #define STKLIB_MAX_SHORTNAME 16 #define STKLIB_MAX_DOMAIN 32 #define STKLIB_MAX_PROVINCE 32 // some enum values #pragma pack(1) // // // =100 ///////////////////////////////////////////////////////////////////////////////////////////// // // K CStock::dataK typedef struct kdata_t { DWORD m_dwMarket; // ,see CStock::StockMarket char m_szCode[STKLIB_MAX_CODE]; // , '0' DWORD m_date; // Format is XXMMDDHHMM for 5min, Format is YYYYMMDD for day time_t m_time; // m_date 0 float m_fOpen; // float m_fHigh; // float m_fLow; // float m_fClose; // float m_fVolume; // float m_fAmount; // DWORD m_dwAdvance; // DWORD m_dwDecline; // DWORD m_dwReserved; } KDATA, *PKDATA; // CStock::dataDR typedef struct drdata_t
  • 3. { DWORD m_dwMarket; // ,see CStock::StockMarket char m_szCode[STKLIB_MAX_CODE]; // , '0' DWORD m_date; // Format is XXMMDDHHMM for 5min, Format is YYYYMMDD for day time_t m_time; // m_date 0 float m_fGive; // float m_fPei; // float m_fPeiPrice; // , m_fPei!=0.0f float m_fProfit; // DWORD m_dwReserved; } DRDATA, * PDRDATA; // CStock::dataBasetbl typedef struct basedata_t { DWORD m_dwMarket; // ,see CStock::StockMarket char m_szCode[STKLIB_MAX_CODE2]; // , '0' char m_szDomain[STKLIB_MAX_DOMAIN]; // char m_szProvince[STKLIB_MAX_PROVINCE]; // time_t m_time; // time_t DWORD m_date; // Format is YYYYMMDD for base data LONG m_reporttype; // float m_fErate_dollar; // float m_fErate_hkdollar; // // float m_fRatio_liquidity; // float m_fRatio_quick; // float m_fVelocity_receivables; // // float m_fVelocity_merchandise; // float m_fMain_income; // float m_fCash_ps; // // float m_fProfit_margin; // % float m_fNetasset_yield; // % // DWORD m_datebegin; // Format is YYYYMMDD
  • 4. float m_fShare_count_total; // float m_fShare_count_a; // A float m_fShare_count_b; // B float m_fShare_count_h; // H float m_fShare_count_national; // float m_fShare_count_corp; // float m_fProfit_psud; // float m_fAsset; // float m_fRatio_holderright; // float m_fRatio_longdebt; // float m_fRatio_debt; // // float m_fNetasset_ps; // float m_fNetasset_ps_regulate; // float m_fEps; // float m_fEps_deduct; // float m_fNet_profit; // float m_fMain_profit; // float m_fTotal_profit; // // float m_fProfit_inc; // % float m_fIncome_inc; // % float m_fAsset_inc; // % // float m_fYield_average; // % float m_fYield_stddev; // % float m_fBeite; // DWORD m_dwReserved[4]; }BASEDATA, *PBASEDATA; // ///////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// // // CStock::dataReport typedef struct report_t { DWORD m_dwMarket; // ,see CStock::StockMarket char m_szCode[STKLIB_MAX_CODE]; // , '0' char m_szName[STKLIB_MAX_NAME]; // , '0'
  • 5. time_t m_time; // DWORD m_dwFlag; // float m_fLast; // float m_fOpen; // float m_fHigh; // float m_fLow; // float m_fNew; // float m_fVolume; // float m_fAmount; // float m_fBuyPrice[5]; // 1,2,3,4 float m_fBuyVolume[5]; // 1,2,3,4 float m_fSellPrice[5]; // 1,2,3,4 float m_fSellVolume[5]; // 1,2,3,4 } REPORT, *PREPORT; // CStock::dataMinute typedef struct minute_t { DWORD m_dwType; // 1 min, 5 min, 15 min, 30 min line DWORD m_dwMarket; // ,see CStock::StockMarket char m_szCode[STKLIB_MAX_CODE]; // , '0' time_t m_time; // float m_fHigh; // float m_fLow; // float m_fNew; // float m_fVolume; // float m_fAmount; // } MINUTE, *PMINUTE; // CStock::dataOutline typedef struct outline_t { time_t m_time; DWORD m_dwShHq; DWORD m_dwSzHq; DWORD m_dwShPriceUp; DWORD m_dwShPriceDown; DWORD m_dwSzPriceUp; DWORD m_dwSzPriceDown;
  • 6. DWORD m_dwShWbUp; DWORD m_dwShWbDown; DWORD m_dwSzWbUp; DWORD m_dwSzWbDown; DWORD m_dwShStockCount; DWORD m_dwSzStockCount; } OUTLINE, *POUTLINE; // CStock::dataMultisort // typedef struct multisort_item_t { BYTE m_type; // stock's type char m_code[6]; // stock code long m_data1; long m_data2; } MULTISORT_ITEM; typedef struct multisort_t { DWORD m_class; // 1- 2- 4-5 8-5 16- 32- // 64- 128- 256- DWORD m_tag; // 0xf0 00 06 00 MULTISORT_ITEM m_stocks[6]; } MULTISORT, *PMULTISORT; // CStock::dataCode typedef struct stockcode { DWORD m_dwMarket; // ,see CStock::StockMarket char m_szCode[STKLIB_MAX_CODE2]; // , '0' } STOCKCODE, *PSTOCKCODE; // #define STKLIB_COMMPACKET_TAG 'KPMC' typedef struct commpacket_t { DWORD m_dwTag; // = STKLIB_COMMPACKET_TAG DWORD m_dwDataType; // see CStock::DataType DWORD m_dwCount; union { REPORT * m_pReport; // MINUTE * m_pMinute; // MULTISORT * m_pMultisort; // OUTLINE * m_pOutline; // KDATA * m_pKdata; //
  • 7. DRDATA * m_pDrdata; // STOCKCODE * m_pStockcode; // void * m_pData; }; } COMMPACKET, *PCOMMPACKET; // ///////////////////////////////////////////////////////////////////////////////////////////// #pragma pack() #ifndef STKLIB_API #define STKLIB_API __declspec(dllimport) #endif /*** */ class STKLIB_API CDRData { public: // Construction CDRData(); CDRData( const CDRData &src ); // Attributes int GetSize() const; int GetUpperBound() const; void SetSize(int nNewSize, int nGrowBy = -1); // Operations // Clean up void FreeExtra(); void RemoveAll(); // Accessing elements DRDATAGetAt(int nIndex) const; void SetAt(int nIndex, DRDATA newElement); DRDATA& ElementAt(int nIndex); // Direct Access to the element data (may return NULL) const DRDATA* GetData() const; DRDATA* GetData();
  • 8. // Potentially growing the array void SetAtGrow(int nIndex, DRDATA newElement); int Add(DRDATA newElement); // overloaded operator helpers DRDATAoperator[](int nIndex) const; DRDATA& operator[](int nIndex); // Operations that move elements around void InsertAt(int nIndex, DRDATA newElement, int nCount = 1); void RemoveAt(int nIndex, int nCount = 1); void InsertAt(int nStartIndex, CDRData* pNewArray); int InsertDRDataSort( DRDATA newElement ); void Sort( ); CDRData & operator = ( const CDRData &src ); void Copy( const CDRData &src ); BOOL IsSameAs( CDRData * psrc ); // Implementation protected: DRDATA* m_pData; // the actual array of data int m_nSize; // # of elements (upperBound - 1) int m_nMaxSize; // max allocated int m_nGrowBy; // grow amount public: ~CDRData(); }; /*** K */ class STKLIB_API CKData { public: // Constructors CKData(); CKData( int ktype, int maindatatype = mdtypeClose ); CKData( const CKData & src ); CKData & operator = ( const CKData &src ); static BOOL IsDayOrMin( int nKType );
  • 9. // Flag values enum KTypes { ktypeNone = 0x00, ktypeMin = 0x01, ktypeMin5 = 0x01, ktypeMin15 = 0x02, ktypeMin30 = 0x03, ktypeMin60 = 0x04, ktypeDay = 0x05, ktypeWeek = 0x06, ktypeMonth = 0x07, ktypeMax = 0x07, }; enum Formats { formatNone = 0x00, formatMin = 0x01, formatOriginal= 0x01, formatXDRup = 0x02, formatXDRdown = 0x03, formatMax = 0x03, }; enum MaindataTypes { mdtypeNone = 0x00, mdtypeMin = 0x01, mdtypeClose = 0x01, mdtypeOpen = 0x02, mdtypeAverage = 0x03, mdtypeMax = 0x03, }; // Attributes int GetSize() const; int GetUpperBound() const; void SetSize(int nNewSize, int nGrowBy = -1); // Operations // Clean up void FreeExtra(); void RemoveAll(); // Accessing elements
  • 10. KDATA GetAt(int nIndex) const; void SetAt(int nIndex, KDATA newElement); KDATA& ElementAt(int nIndex); // Direct Access to the element data (may return NULL) const KDATA* GetData() const; KDATA* GetData(); float MaindataAt(int nIndex) const; // CKData nIndex BOOL DateAt(int nIndex, int &nYear, int &nMonth, int &nDay, int &nHour, int &nMinute ) const; BOOL LatestDate( int &nYear, int &nMonth, int &nDay, int &nHour, int &nMinute ) const; DWORD GetDate(int nIndex ); DWORD GetDateDay( int nIndex ); int GetIndexByDate( DWORD date ); int GetAboutIndexByDate( DWORD date ); // Potentially growing the array void SetAtGrow(int nIndex, KDATA newElement); int Add(KDATA newElement); // overloaded operator helpers KDATA operator[](int nIndex) const; KDATA& operator[](int nIndex); // Operations that move elements around void InsertAt(int nIndex, KDATA newElement, int nCount = 1); void RemoveAt(int nIndex, int nCount = 1); void InsertAt(int nStartIndex, CKData* pNewArray); int InsertKDataSort( KDATA newElement ); // Operation of Analysis BOOL IsNewValue( int nIndex, BOOL bTopOrBottom, int nDays ); BOOL GetMinMaxInfo( int nStart, int nEnd, float * pfMin, float *pfMax ); // Implementation public: virtual ~CKData(); #ifdef _DEBUG void AssertValid() const; void Dump() const;
  • 11. #endif public: // Extra operations void SetKType( int ktype ); void AutoSetKType( ); int GetKType( ); int GetCurFormat( ); void SetDRData( CDRData &drdata ); CDRData &GetDRData( ); void ChangeCurFormat( int format, DWORD dateAutoDRBegin, double dAutoDRLimit ); void SetMaindataType( int type ); int GetMaindataType( ); void Clear( ); int CompareLatestDate( CKData &kd ); static int Min5ToMin15( CKData &kdm5, CKData &kdm15 ); static int Min5ToMin30( CKData &kdm5, CKData &kdm30 ); static int Min5ToMin60( CKData &kdm5, CKData &kdm60 ); static int DayToMonth( CKData &kdday, CKData &kdmonth ); static int DayToWeek( CKData &kdday, CKData &kdweek ); DWORD ToDayDate( DWORD date ); int MergeKData( CKData * pother ); int FullFillKData( CKData & kdataMain, BOOL bFillToEnd ); BOOL IsAdjacentDays( int nIndex, int nDays ); BOOL GetDiff( double * pValue, DWORD dateCur, int nDays ); BOOL GetDiffPercent( double * pValue, DWORD dateCur, int nDays ); BOOL GetScope( double * pValue, DWORD dateCur, int nDays ); BOOL GetVolumeSum( double * pValue, DWORD dateCur, int nDays ); BOOL GetRatioVolume( double * pValue, DWORD dateCur, int nDays ); BOOL GetRS( double * pValue, DWORD dateCur, int nDays ); BOOL GetMA( double * pValue, int nIndex, int nDays ); protected: static int ConvertKData( CKData &kdSrc, CKData &kdDest, int multiple ); void CopyData( const CKData &src ); void LoadDataOriginal( ); void StoreDataOriginal( ); void ConvertXDR( BOOL bUP, DWORD dateAutoDRBegin, double dAutoDRLimit ); static float GetRatio( float fLastClose, DRDATA & dr );
  • 12. protected: int m_nKType; int m_nCurFormat; int m_nCurMaindataType; CDRData m_drdata; struct kdata_t * m_pDataOriginal; int m_nSizeOriginal; // # of elements (upperBound - 1) int m_nMaxSizeOriginal; // max allocated struct kdata_t * m_pData; int m_nSize; // # of elements (upperBound - 1) int m_nMaxSize; // max allocated int m_nGrowBy; // grow amount }; /*** */ class STKLIB_API CBaseData { public: // Construction CBaseData(); CBaseData( const CBaseData &src ); // Attributes int GetSize() const; int GetUpperBound() const; void SetSize(int nNewSize, int nGrowBy = -1); // Operations // Clean up void FreeExtra(); void RemoveAll(); // Accessing elements BASEDATA GetAt(int nIndex) const; void SetAt(int nIndex, BASEDATA newElement); BASEDATA& ElementAt(int nIndex); // Direct Access to the element data (may return NULL) const BASEDATA* GetData() const; BASEDATA* GetData();
  • 13. // Potentially growing the array void SetAtGrow(int nIndex, BASEDATA newElement); int Add(BASEDATA newElement); // overloaded operator helpers BASEDATA operator[](int nIndex) const; BASEDATA& operator[](int nIndex); // Operations that move elements around void InsertAt(int nIndex, BASEDATA newElement, int nCount = 1); void RemoveAt(int nIndex, int nCount = 1); void InsertAt(int nStartIndex, CBaseData* pNewArray); int InsertBaseDataSort( BASEDATA newElement ); void Sort( ); CBaseData & operator = ( const CBaseData &src ); void Copy( const CBaseData &src ); // Implementation protected: BASEDATA* m_pData; // the actual array of data int m_nSize; // # of elements (upperBound - 1) int m_nMaxSize; // max allocated int m_nGrowBy; // grow amount public: ~CBaseData(); }; /*** */ class STKLIB_API CReport { public: // Construction CReport(); CReport( const CReport &src ); // Attributes int GetSize() const; int GetUpperBound() const; void SetSize(int nNewSize, int nGrowBy = -1);
  • 14. // Operations // Clean up void FreeExtra(); void RemoveAll(); // Accessing elements REPORT GetAt(int nIndex) const; void SetAt(int nIndex, REPORT newElement); REPORT& ElementAt(int nIndex); // Direct Access to the element data (may return NULL) const REPORT* GetData() const; REPORT* GetData(); // Potentially growing the array void SetAtGrow(int nIndex, REPORT newElement); int Add(REPORT newElement); // overloaded operator helpers REPORT operator[](int nIndex) const; REPORT& operator[](int nIndex); // Operations that move elements around void InsertAt(int nIndex, REPORT newElement, int nCount = 1); void RemoveAt(int nIndex, int nCount = 1); void InsertAt(int nStartIndex, CReport* pNewArray); int InsertReportSort( REPORT newElement ); void Sort( ); void RemoveDirty( ); CReport & operator = ( const CReport &src ); void Copy( const CReport &src ); BOOL GetMMLD( int nIndex, double *pdVolBuy, double *pdVolSell, double * pdVolDiff ); // BOOL GetMMLDMinMaxInfo( double *pdMin, double *pdMax ); // BOOL StatBuySellEx( float * fSellPrice, float * fSellVolume, float * fBuyPrice, float * fBuyVolume, int nSize ); // Implementation protected: REPORT* m_pData; // the actual array of data int m_nSize; // # of elements (upperBound - 1) int m_nMaxSize; // max allocated
  • 15. int m_nGrowBy; // grow amount public: ~CReport(); }; /*** */ class STKLIB_API CMinute { public: // Construction CMinute(); CMinute( const CMinute &src ); // Attributes int GetSize() const; int GetUpperBound() const; void SetSize(int nNewSize, int nGrowBy = -1); // Operations // Clean up void FreeExtra(); void RemoveAll(); // Accessing elements MINUTE GetAt(int nIndex) const; void SetAt(int nIndex, MINUTE newElement); MINUTE& ElementAt(int nIndex); // Direct Access to the element data (may return NULL) const MINUTE* GetData() const; MINUTE* GetData(); // Potentially growing the array void SetAtGrow(int nIndex, MINUTE newElement); int Add(MINUTE newElement); // overloaded operator helpers MINUTE operator[](int nIndex) const; MINUTE& operator[](int nIndex); // Operations that move elements around
  • 16. void InsertAt(int nIndex, MINUTE newElement, int nCount = 1); void RemoveAt(int nIndex, int nCount = 1); void InsertAt(int nStartIndex, CMinute* pNewArray); int InsertMinuteSort( MINUTE newElement ); void Sort( ); void RemoveDirty( ); CMinute & operator = ( const CMinute &src ); void Copy( const CMinute &src ); BOOL StatVolumeInfo( double *pdVolNow, double *pdVolOuter, double *pdVolInner ); // BOOL GetDiffPercentMin5( double * pValue ); BOOL GetLBDKMinMaxInfo( double dVolAverage, double *pdMin, double *pdMax ); // BOOL GetIndexWave( double *pdWave, int nIndex ); int ToKData( CKData & kdata ); // Implementation protected: MINUTE* m_pData; // the actual array of data int m_nSize; // # of elements (upperBound - 1) int m_nMaxSize; // max allocated int m_nGrowBy; // grow amount public: ~CMinute(); }; /*** */ class STKLIB_API COutline { public: // Construction COutline(); COutline( const COutline &src ); // Attributes int GetSize() const; int GetUpperBound() const; void SetSize(int nNewSize, int nGrowBy = -1);
  • 17. // Operations // Clean up void FreeExtra(); void RemoveAll(); // Accessing elements OUTLINE GetAt(int nIndex) const; void SetAt(int nIndex, OUTLINE newElement); OUTLINE& ElementAt(int nIndex); // Direct Access to the element data (may return NULL) const OUTLINE* GetData() const; OUTLINE* GetData(); // Potentially growing the array void SetAtGrow(int nIndex, OUTLINE newElement); int Add(OUTLINE newElement); // overloaded operator helpers OUTLINE operator[](int nIndex) const; OUTLINE& operator[](int nIndex); // Operations that move elements around void InsertAt(int nIndex, OUTLINE newElement, int nCount = 1); void RemoveAt(int nIndex, int nCount = 1); void InsertAt(int nStartIndex, COutline* pNewArray); int InsertOutlineSort( OUTLINE newElement ); void Sort( ); COutline & operator = ( const COutline &src ); void Copy( const COutline &src ); // Implementation protected: OUTLINE* m_pData; // the actual array of data int m_nSize; // # of elements (upperBound - 1) int m_nMaxSize; // max allocated int m_nGrowBy; // grow amount public: ~COutline(); }; class CStDatabase;
  • 18. /*** CStock::dataInfo */ class STKLIB_API CStockInfo { public: CStockInfo( ); CStockInfo( const CStockInfo &src ); // Operation void Clear( ); CStockInfo & operator = ( const CStockInfo & si ); BOOL IsEqualTo( DWORD dwMarket, const char * szCode ); DWORD GetMarket( ); void SetMarket( DWORD dwMarket ); const char * GetStockCode( ); BOOL SetStockCode( DWORD dwMarket, const char * szCode ); LONG GetType( ); void SetType( LONG t ); void ResolveTypeAndMarket( ); const char * GetStockName( ); void SetStockName( const char * szName ); const char * GetStockNameEnu( ); void SetStockNameEnu( const char * szNameEnu ); const char * GetStockNameChs( ); void SetStockNameChs( const char * szName ); const char * GetStockShortName( ); void SetStockShortName( const char *szShortName ); const char * GetStockDomain( ); void SetStockDomain( const char * szDomain ); const char * GetStockProvince( ); void SetStockProvince( const char * szProvince ); BOOL StatTechIndex( DWORD dwDate ); // Format is YYYYMMDD BOOL StatBaseIndex( DWORD dwDate ); // Format is YYYYMMDD // Attributes BOOL IsValidStock( ); // BOOL IsShangHai( ); // BOOL IsShenZhen( ); //
  • 19. BOOL IsIndex( ); // BOOL IsBond( ); // BOOL IsBondIndex( ); // BOOL IsFund( ); // BOOL IsRight( ); // int DigitBit( ); // B // Variant BOOL GetAverage( double *pValue ); // BOOL GetDiff( double *pValue, DWORD dateCur, int nDays ); // BOOL GetDiffPercent( double *pValue, DWORD dateCur, int nDays ); // BOOL GetScope( double *pValue, DWORD dateCur, int nDays ); // BOOL GetDiffPercentMin5( double *pValue ); BOOL GetPE( double * pValue ); // BOOL GetPNetAsset( double *pValue ); // BOOL GetPMainIncome( double * pValue ); // BOOL GetRatioPCash( double * pValue ); // BOOL GetShareCurrency( double * pValue ); // BOOL GetRatioCurrency( double * pValue ); // BOOL GetRatioChangeHand( double * pValue, double dVolume ); BOOL GetRatioChangeHand( CKData &kdata, double * pValue, DWORD dateCur, int nDays ); BOOL GetRatioChangeHand( double * pValue, DWORD dateCur, int nDays ); // n BOOL GetRatioVolume( double * pValue, DWORD dateCur, int nDays ); // n BOOL GetRS( double * pValue, DWORD dateCur, int nDays ); // n BOOL GetSellBuyRatio( double *pdRatio, double *pdDiff ); // BOOL GetMarketValue( double * pValue ); // BOOL GetMarketValueA( double * pValue ); // A BOOL GetMarketValueB( double * pValue ); // B BOOL GetXiapu( double * pValue ); // protected: // data from codetable DWORD m_dwMarket; // ,see CStock::StockMarket char m_szCode[STKLIB_MAX_CODE2]; // , '0'
  • 20. LONG m_type; // see CStock::StockType char m_szName[STKLIB_MAX_NAME]; // char m_szNameEnu[STKLIB_MAX_NAMEENU]; // char m_szShortname[STKLIB_MAX_SHORTNAME]; // char m_szDomain[STKLIB_MAX_DOMAIN]; // char m_szProvince[STKLIB_MAX_PROVINCE]; // public: DWORD m_datetech; // Format is XXMMDDHHMM for 5min, Format is YYYYMMDD for day float m_fLast; // float m_fOpen; // float m_fHigh; // float m_fLow; // float m_fClose; // float m_fVolume; // ( ) float m_fAmount; // ( ) DWORD m_dwAdvance; // DWORD m_dwDecline; // float m_fBuyPrice[5]; float m_fBuyVolume[5]; float m_fSellPrice[5]; float m_fSellVolume[5]; public: CKData m_kdata; // AfxGetProfile().GetCacheDays() K CBaseData m_basedata; // CMinute m_minute; // 5 MINUTE REPORT m_reportLatest; // REPORT public: // From Base Data DWORD m_datebase; // Format is YYYYMMDD for base data LONG m_reporttype; float m_fErate_dollar; // float m_fErate_hkdollar; //
  • 21. // float m_fRatio_liquidity; // float m_fRatio_quick; // float m_fVelocity_receivables; // // float m_fVelocity_merchandise; // float m_fMain_income; // float m_fCash_ps; // // float m_fProfit_margin; // % float m_fNetasset_yield; // % // DWORD m_datebegin; // Format is YYYYMMDD float m_fShare_count_total; // float m_fShare_count_a; // A float m_fShare_count_b; // B float m_fShare_count_h; // H float m_fShare_count_national; // float m_fShare_count_corp; // float m_fProfit_psud; // float m_fAsset; // float m_fRatio_holderright; // % float m_fRatio_longdebt; // % float m_fRatio_debt; // % // float m_fNetasset_ps; // float m_fNetasset_ps_regulate; // float m_fEps; // float m_fEps_deduct; // float m_fNet_profit; // float m_fMain_profit; // float m_fTotal_profit; // // float m_fProfit_inc; // % float m_fIncome_inc; // % float m_fAsset_inc; // % // float m_fYield_average; // % float m_fYield_stddev; // % float m_fBeite; // }; /*** K
  • 22. */ class CStock { public: // Constructors CStock( ); CStock( CStDatabase * pDatabase ); CStock( CStDatabase * pDatabase, DWORD dwMarket, const char * code ); virtual ~CStock(); // Flag values enum StockMarket { marketUnknown = 'UKNW', // marketSHSE = 'ESHS', // marketSZSE = 'ESZS', // marketCYSE = 'ESYC', // marketCHNA = 'ANHC', // marketHKEX = 'XEKH', // marketTBSE = 'ESBT', // marketTKSE = 'EST', // marketLSE = 'ESL', // marketFLKFSE = 'FKLF', // marketNYSE = 'ESYN', // marketNASDAQ = 'QDSN', // }; enum DataType { dataUnknown = 0x00, // dataInfo = 0x01, // dataK = 0x02, // K dataDR = 0x03, // dataBasetable = 0x04, // dataBasetext = 0x05, // F10 dataNews = 0x06, // dataReport = 0x07, // dataMinute = 0x08, // dataOutline = 0x09, // dataCode = 0x0A, // dataMultisort = 0x0B, // dataDetail = 0x0C, // }; enum StockType { typeNone = 0x00,
  • 23. typeshIndex = 0x10, // typeshA = 0x11, // A typeshB = 0x12, // B typeshBond = 0x13, // typeshRight = 0x14, // typeshBonus = 0x15, // typeshAdmeasure = 0x16, // typeshInfo = 0x1F, // typeszIndex = 0x20, // 0x20 typeszA = 0x21, // A 0x21 typeszB = 0x22, // B 0x22 typeszBond = 0x23, // 0x23 typeszRight = 0x24, // 0x24 typeszBonus = 0x25, // 0x25 typeszAdmeasure = 0x26, // 0x26 typeszInfo = 0x2F, // 0x2f typeGeneralInfo = 0x05, // 0x05 }; enum StockTypeMark { markShanghai = 0x10, // markShenzhen = 0x20, // markGeneralInfo = 0x05, // }; enum ReportType { reportUnknown = 0x00, // reportQuarter = 0x01, // reportMid = 0x02, // reportQuarter3 = 0x03, // reportAnnals = 0x04, // }; enum MultisortType { classRise = 0x01, // classFall = 0x02, // claddRiseMin5 = 0x04, // 5 classFallMin5 = 0x08, // 5 classBSRatioAsc = 0x10, // classBSRatioDesc= 0x20, // classDiff = 0x40, // classVolRatio = 0x80, // classAmount = 0x100, // };
  • 24. static double GetReportFactor( int nReportType ); // Attributes void SetDatabase( CStDatabase * pDatabase ); CStDatabase * GetDatabase( ); void SetStockCode( DWORD dwMarket, const char * szCode ); const char * GetStockCode( ); BOOL SetStockInfo( CStockInfo * pInfo ); CStockInfo & GetStockInfo( ); CKData & GetKData( int ktype ); CKData & GetKDataMonth( ); CKData & GetKDataWeek( ); CKData & GetKDataDay( ); CKData & GetKDataMin60( ); CKData & GetKDataMin30( ); CKData & GetKDataMin15( ); CKData & GetKDataMin5( ); CDRData & GetDRData( ); CReport & GetReport( ); CMinute & GetMinute( ); COutline & GetOutline( ); char * GetBaseTextPtr( ); int GetBaseTextLength( ); BOOL AllocBaseTextMem( int nNewLength ); // Operations void Clear( ); int PrepareData( int nDataType = dataInfo, int nKType = CKData::ktypeDay, BOOL bReload = FALSE ); int PrepareBaseInfo( BOOL bReload = FALSE ); int ExtractKData( int nKType, BOOL bForced ); int MergeBaseText( CStock &stock ); int MergeKData( CStock &stock, int nKType ); int MergeDRData( CStock &stock ); int StoreDRData( ); protected: void SetKDataTypes( ); protected: CStDatabase * m_pDatabase; CStockInfo m_stockinfo;
  • 25. CKData m_kdMonth; CKData m_kdWeek; CKData m_kdDay; CKData m_kdMin60; CKData m_kdMin30; CKData m_kdMin15; CKData m_kdMin5; CDRData m_drData; CReport m_report; CMinute m_minute; COutline m_outline; int m_nBaseTextLen; char * m_pBaseText; }; #ifdef _SP_ENABLE_INLINES #define _STOCK_INLINE inline #include quot;Stock.inlquot; #undef _STOCK_INLINE #endif #endif //__STKLIB_STOCK_H__