/**** Local functions definitions. ****/ static TA_RetCode doAdjustments( TA_DecodingParam *localDecodingParam, TA_String *yahooName, TA_PrivateYahooHandle *yahooHandle, const char *overideServerAddr, TA_ParamForAddData *paramForAddData ) { TA_RetCode retCode; TA_WebPage *webPage; TA_Stream *stream; TA_StreamAccess *streamAccess; TA_AdjustDataParse adjustDataParse; adjustDataParse.paramForAddData = paramForAddData; adjustDataParse.yahooHandle = yahooHandle; /* Get the split/value adjustments from the Yahoo! web site */ retCode = TA_WebPageAllocFromYahooName( localDecodingParam, TA_StringToChar(yahooName), overideServerAddr, &webPage, paramForAddData ); if( retCode != TA_SUCCESS ) return retCode; /* Parse the dividend/split information */ stream = webPage->content; streamAccess = TA_StreamAccessAlloc( stream ); if( !streamAccess ) { TA_WebPageFree( webPage ); return TA_ALLOC_ERR; } retCode = TA_StreamAccessSearch( streamAccess, "Monthly" ); if( retCode == TA_SUCCESS ) { retCode = TA_StreamAccessSearch( streamAccess, "Last" ); if( retCode == TA_SUCCESS ) { /* Find the table of data. */ retCode = TA_StreamAccessSearch( streamAccess, "yfnc_datamodoutline1" );; if( retCode == TA_SUCCESS ) { retCode = TA_StreamAccessGetHTMLTable( streamAccess, 200, processAdjustmentTable, &adjustDataParse ); } } } TA_StreamAccessFree( streamAccess ); TA_WebPageFree( webPage ); return retCode; }
static TA_RetCode parseMarketPage( TA_Libc *libHandle, const TA_DecodingParam *decodingParam, TA_StreamAccess *streamAccess, TA_YahooMarketPage *marketPage ) { TA_RetCode retCode; TA_MarketPageParseOpaqueData paramData; (void)libHandle; paramData.decodingParam = decodingParam; paramData.marketPage = marketPage; retCode = TA_StreamAccessSearch( streamAccess, "Create New View" ); if( retCode != TA_SUCCESS ) return retCode; /* Parse the table. */ retCode = TA_StreamAccessGetHTMLTable( streamAccess, 100, processMarketPageTable, ¶mData ); if( retCode != TA_SUCCESS ) return retCode; return TA_SUCCESS; }