// StockQuoteAPI.h: interface for the CStockQuoteAPI class. // // (c)1998-2025 Codejock Software, All Rights Reserved. // // THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE // RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN // CONSENT OF CODEJOCK SOFTWARE. // // THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED // IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO // YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A // SINGLE COMPUTER. // // CONTACT INFORMATION: // support@codejock.com // http://www.codejock.com // ////////////////////////////////////////////////////////////////////// #if !defined(__STOCKQUOTEAPI_H__) # define __STOCKQUOTEAPI_H__ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 //============================================================================ // Summary: CStockQuoteAPI is access stock ticker details like company name, // sector, industry, stock quotes and price history. //============================================================================ class CStockQuoteAPI { public: // ---------------------------------------------------------------------- // Summary: Default constuctor, handles initialization for the class. // ---------------------------------------------------------------------- CStockQuoteAPI(); // ---------------------------------------------------------------------- // Summary: Destructor, handles cleanup and de-allocation. // ---------------------------------------------------------------------- virtual ~CStockQuoteAPI(); // ---------------------------------------------------------------------- // Summary: Call this method to retreive the stock price history for the // currently loaded ticker resource. // Input: nDays - Specifies the number of days to retrieve stock price // history for. // Returns: A CStringArray containing stock price history for the // currently loaded ticker resource. // ---------------------------------------------------------------------- CStringArray& GetHistory(int nDays); // ---------------------------------------------------------------------- // Summary: Call this method to retrieve the latest stock quote for the // ticker specifed by nResID. // Input: nResID - Resource ID for the ticker to load daily stock prices for. // Returns: A comma delimited array of values for the specified ticker. You // can use AfxExtractSubString to retrieve each item, can be one of // the following values: // 0 - Date // 1 - Open // 2 - High // 3 - Low // 4 - Close // 5 - Volume // Example: CString strArrQuote = m_quote.GetQuote(IDR_CSV_MSFT); // AfxExtractSubString(m_strDate, strArrQuote, 0, ','); // ---------------------------------------------------------------------- LPCTSTR GetQuote(int nResID); // ---------------------------------------------------------------------- // Summary: Call this method to retreive the Company, Sector and Industry // details for the specified strTicker. // Input: strTicker - Specifies the ticker to retrieve details for. // iIndex - Indentifies which value to extract, can be one of // the following values: // 1 - Retrieve company name. // 2 - Retreive sector name. // 3 - Retreive industry name. // Returns: A CString value containing the details identified by iIndex. // ---------------------------------------------------------------------- BOOL GetTickerInfo(CString strTicker, CString& strCompany, CString& strSector, CString& strIndustry); // ---------------------------------------------------------------------- // Summary: Call this method to extract the date from the specified quote // string array. // Input: arrQuote - String array containing financial information for a // particular ticker symbol. // Returns: A CString value containing the date from the quote string array. // ---------------------------------------------------------------------- CString GetDate(CString arrQuote); // ---------------------------------------------------------------------- // Summary: Call this method to extract the day's low from the specified // quote string array. // Input: arrQuote - String array containing financial information for a // particular ticker symbol. // Returns: A double value containing the low from the quote string array. // ---------------------------------------------------------------------- double GetLow(CString arrQuote); // ---------------------------------------------------------------------- // Summary: Call this method to extract the day's high from the specified // quote string array. // Input: arrQuote - String array containing financial information for a // particular ticker symbol. // Returns: A double value containing the high from the quote string array. // ---------------------------------------------------------------------- double GetHigh(CString arrQuote); // ---------------------------------------------------------------------- // Summary: Call this method to extract the day's open from the specified // quote string array. // Input: arrQuote - String array containing financial information for a // particular ticker symbol. // Returns: A double value containing the open from the quote string array. // ---------------------------------------------------------------------- double GetOpen(CString arrQuote); // ---------------------------------------------------------------------- // Summary: Call this method to extract the day's close from the specified // quote string array. // Input: arrQuote - String array containing financial information for a // particular ticker symbol. // Returns: A double value containing the close from the quote string array. // ---------------------------------------------------------------------- double GetClose(CString arrQuote); // ---------------------------------------------------------------------- // Summary: Call this method to extract the day's volume from the specified // quote string array. // Input: arrQuote - String array containing financial information for a // particular ticker symbol. // Returns: A int value containing the volume from the quote string array. // ---------------------------------------------------------------------- int GetVolume(CString arrQuote); private: // ---------------------------------------------------------------------- // Initializes ticker array that contains details for each company. // ---------------------------------------------------------------------- void InitTickerArray(); // ---------------------------------------------------------------------- // Retreives the buffer as a CString object from the specified resource ID. // ---------------------------------------------------------------------- BOOL LoadBuffer(int nResID, CString& rString); // ---------------------------------------------------------------------- // Converts the file buffer sepcified by lpszBuffer to a CStringArray. // ---------------------------------------------------------------------- BOOL ReadBuffer(LPCTSTR lpszBuffer, CStringArray& rArray); CStringArray m_arrTickers; // Array of available ticker symbols. CStringArray m_arrQuote; // Array of available quote data. CStringArray m_arrHistory; // Array of available quote history. }; #endif // !defined(__STOCKQUOTEAPI_H__)