Skip to content

Commit 77c4b92

Browse files
jrburljoshuaulrich
authored andcommitted
Update Bid & Ask fields to handle missing entries
Similar to Vol & OI changes implemented previously. There are requests that are failing due to the bid & ask fields not having any info. This change solves.
1 parent daf4cdb commit 77c4b92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/getOptionChain.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ getOptionChain.yahoo <- function(Symbols, Exp, ...)
2424
d <- with(x, data.frame(Strike=strike,
2525
Last=lastprice,
2626
Chg=change,
27-
Bid=bid,
28-
Ask=ask,
27+
Bid= if("bid" %in% names(x)) {bid} else {NA},
28+
Ask= if("ask" %in% names(x)) {ask} else {NA},
2929
Vol= if("volume" %in% names(x)) {volume} else {NA},
3030
OI= if("openinterest" %in% names(x)) {openinterest} else {NA},
3131
LastTradeTime= if("lasttradedate" %in% names(x)) {lasttradedate} else {NA},

0 commit comments

Comments
 (0)