[R-SIG-Finance] Quantmod's getFin() functionality broken?

Jeffrey Ryan jeffrey.ryan at lemnica.com
Thu Feb 23 20:16:03 CET 2012


Hi Devin (cc'ing the list back in),

On Thu, Feb 23, 2012 at 1:07 PM, Devin Newman <devinlnewman at gmail.com> wrote:
> Jeffrey,
>
> I would agree except that what is assigned to the variable is only a string
> of characters. Is there something I am doing wrong?
>
>> getSymbols("GS")
> [1] "GS"
>> str(GS)
> An ‘xts’ object from 2007-01-03 to 2012-02-22 containing:
>   Data: num [1:1295, 1:6] 201 200 198 199 204 ...
>  - attr(*, "dimnames")=List of 2
>   ..$ : NULL
>   ..$ : chr [1:6] "GS.Open" "GS.High" "GS.Low" "GS.Close" ...
>   Indexed by objects of class: [Date] TZ:
>   xts Attributes:
> List of 2
>  $ src    : chr "yahoo"
>  $ updated: POSIXct[1:1], format: "2012-02-23 14:02:41"
>
>
>> GS.f <- getFinancials('GS')
> Warning message:
> In readLines(tmp) :
>   incomplete final line found on
> '/var/folders/rf/pz5jmyzd1q9833s7h6r5lpzr0000gn/T//RtmpwUJi6G/file2e02463e31e'
>> GS.f
> [1] "GS.f"
>> str(GS.f)
>  chr "GS.f"
>> viewFin(GS.f)
> Error in viewFin(GS.f) : ‘x’ must be of type ‘financials’
>

Ah, the 'real' error you saw but didn't pass along the first time.
Likely an older version of quantmod - as the one I am using (the one
from R-forge) is working.

Try install.packages("quantmod", repos="http://r-forge.r-project.org")

Best,
Jeff

> getFin("GS")
[1] "GS.f"
Warning message:
In readLines(tmp) :
  incomplete final line found on
'/var/folders/vk/vk7l7h-xFauxrClyj6pEJU+++TI/-Tmp-//Rtmpulwo2L/file3e652376'
> viewFin(GS.f)
Annual Balance Sheet for GS
                                             2010-12-31 2009-12-31 2008-12-26
Cash & Equivalents                             34038.00   33841.00   13805.00
Short Term Investments                               NA         NA         NA
Cash and Short Term Investments                39788.00   38291.00   13805.00
Accounts Receivable - Trade, Net               78140.00   67900.00   86377.00
Receivables - Other                                  NA         NA         NA
Total Receivables, Net                         78140.00   67900.00   86377.00
Total Inventory                                      NA         NA         NA
Prepaid Expenses                                     NA         NA         NA
Other Current Assets, Total                          NA         NA         NA
Total Current Assets                                 NA         NA         NA
Property/Plant/Equipment, Total - Gross        18976.00   18660.00   19209.00
Accumulated Depreciation, Total                -7870.00   -7280.00   -6620.00
Goodwill, Net                                   3495.00    3543.00    3526.00
Intangibles, Net                                2027.00    1377.00    1620.00
Long Term Investments                         713059.00  678104.00  869279.00
Other Long Term Assets, Total                  59970.00   44600.00  121890.00
Total Assets                                  911332.00  848942.00 1112225.00
Accounts Payable                              190504.00  185634.00  245725.00
Accrued Expenses                                9089.00   11170.00    4968.00
Notes Payable/Short Term Debt                  80680.00   60681.00   68675.00
Current Port. of LT Debt/Capital Leases        25396.00   17928.00   24274.00
Other Current liabilities, Total               40611.00   43440.00   35249.00
Total Current Liabilities                            NA         NA         NA
Long Term Debt                                188247.00  196288.00  203977.00
Capital Lease Obligations                            NA         NA         NA
Total Long Term Debt                          188247.00  196288.00  203977.00
Total Debt                                    294323.00  274897.00  296926.00
Deferred Income Tax                                  NA         NA         NA
Minority Interest                                872.00     960.00    1102.00
Other Liabilities, Total                      293927.00  257284.00  459324.00
Total Liabilities                             833976.00  778228.00 1049171.00
Redeemable Preferred Stock, Total                    NA         NA         NA
Preferred Stock - Non Redeemable, Net           6957.00    6957.00   16483.00
Common Stock, Total                             7714.00    6253.00    9470.00
Additional Paid-In Capital                     42103.00   39770.00   31070.00
Retained Earnings (Accumulated Deficit)        57163.00   50252.00   38579.00
Treasury Stock - Common                       -36295.00  -32156.00  -32176.00
Other Equity, Total                             -286.00    -362.00    -372.00
Total Equity                                   77356.00   70714.00   63054.00
Total Liabilities & Shareholders' Equity  911332.00  848942.00 1112225.00
Shares Outs - Common Stock Primary Issue             NA         NA         NA
Total Common Shares Outstanding                  507.53     515.11     442.55
                                             2008-11-28
Cash & Equivalents                             15740.00
Short Term Investments                               NA
Cash and Short Term Investments                15740.00
Accounts Receivable - Trade, Net               90564.00
Receivables - Other                                  NA
Total Receivables, Net                         90564.00
Total Inventory                                      NA
Prepaid Expenses                                     NA
Other Current Assets, Total                          NA
Total Current Assets                                 NA
Property/Plant/Equipment, Total - Gross        17343.00
Accumulated Depreciation, Total                -6550.00
Goodwill, Net                                   3523.00
Intangibles, Net                                1529.00
Long Term Investments                         642595.00
Other Long Term Assets, Total                 115023.00
Total Assets                                  884547.00
Accounts Payable                              253843.00
Accrued Expenses                                4646.00
Notes Payable/Short Term Debt                  68877.00
Current Port. of LT Debt/Capital Leases        26281.00
Other Current liabilities, Total               30508.00
Total Current Liabilities                            NA
Long Term Debt                                185678.00
Capital Lease Obligations                            NA
Total Long Term Debt                          185678.00
Total Debt                                    280836.00
Deferred Income Tax                                  NA
Minority Interest                               1127.00
Other Liabilities, Total                      244830.00
Total Liabilities                             820178.00
Redeemable Preferred Stock, Total                    NA
Preferred Stock - Non Redeemable, Net          16471.00
Common Stock, Total                             9291.00
Additional Paid-In Capital                     31071.00
Retained Earnings (Accumulated Deficit)        39913.00
Treasury Stock - Common                       -32175.00
Other Equity, Total                             -202.00
Total Equity                                   64369.00
Total Liabilities & Shareholders' Equity  884547.00
Shares Outs - Common Stock Primary Issue             NA
Total Common Shares Outstanding                  442.54
attr(,"col_desc")
[1] "As of 2010-12-31" "As of 2009-12-31" "As of 2008-12-26" "As of 2008-11-28"


> The errors I get when trying to view the data that getFinancials is supposed
> to provide makes me think the function isn't working properly.
>
> Kind regards,
> Devin
>
> On Thu, Feb 23, 2012 at 1:52 PM, Jeffrey Ryan <jeffrey.ryan at lemnica.com>
> wrote:
>>
>> Warning != Error
>>
>> This is a result of google not using the correct end of line in the
>> page, and/or R stripping/missing it.
>>
>> Either way, it doesn't matter - as it is a harmless warning.
>>
>> HTH
>> Jeff
>>
>> On Thu, Feb 23, 2012 at 12:49 PM, Devin Newman <devinlnewman at gmail.com>
>> wrote:
>> > Hello r-sig-finance!
>> >
>> > This is my first post to the list, so I hope you can bear what might be
>> > a
>> > silly question. Previously, I've had no trouble using quantmod's
>> > getFin()
>> > function to pull data. However, lately it hasn't been working. I think
>> > one
>> > of the functions called within getFin to clean up the data isn't working
>> > as
>> > intended.
>> >
>> >> AAPL <- getFin('AAPL', src="google")
>> > Warning message:
>> > In readLines(tmp) :
>> >  incomplete final line found on
>> >
>> > '/var/folders/rf/pz5jmyzd1q9833s7h6r5lpzr0000gn/T//RtmpwUJi6G/file2e051531243'
>> >
>> >> AAPL <- getFin('AAPL', src="yahoo")
>> > Warning message:
>> > In readLines(tmp) :
>> >  incomplete final line found on
>> >
>> > '/var/folders/rf/pz5jmyzd1q9833s7h6r5lpzr0000gn/T//RtmpwUJi6G/file2e024d4166b'
>> >
>> > Regardless of 'src' I get equivalent errors, "incomplete final line".
>> > Rather than immediately dive in and troubleshoot the code (although
>> > perusing through it was a great lesson in how to write R), I was hoping
>> > to
>> > share my issue here to see if others had similar problems, as I don't
>> > think
>> > this is merely the result of a formatting change on google/yahoo
>> > finance.
>> >
>> > Any help would be appreciated.
>> >
>> > Kind regards,
>> > Devin Newman
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> > _______________________________________________
>> > R-SIG-Finance at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> > -- Subscriber-posting only. If you want to post, subscribe first.
>> > -- Also note that this is not the r-help list where general R questions
>> > should go.
>>
>>
>>
>> --
>> Jeffrey Ryan
>> jeffrey.ryan at lemnica.com
>>
>> www.lemnica.com
>> www.esotericR.com
>>
>> R/Finance 2012: Applied Finance with R
>> www.RinFinance.com
>>
>> See you in Chicago!!!!
>
>



-- 
Jeffrey Ryan
jeffrey.ryan at lemnica.com

www.lemnica.com
www.esotericR.com

R/Finance 2012: Applied Finance with R
www.RinFinance.com

See you in Chicago!!!!



More information about the R-SIG-Finance mailing list