📄 stock.h
字号:
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 StatDealInfo( CSPDWordArray & adwPrice, CSPDWordArray & adwVolume, double * pdMaxVolume ); // 统计价量关系,返回值中的价格需乘以0.001
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)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -