optionChains

fun optionChains(symbol: String, expiryDate: GregorianCalendar? = null, strike: Float? = null, distance: Int? = null, includeWeekly: Boolean? = null, category: OptionCategory? = null, chainType: OptionType? = null, priceType: PriceType? = null): OptionChainResponse?

Retrieves one or many options chains for specified options

Samples

import com.seansoper.batil.OptionsCalendar
import com.seansoper.batil.brokers.etrade.auth.Authorization
import com.seansoper.batil.brokers.etrade.services.Accounts
import com.seansoper.batil.brokers.etrade.services.Alerts
import com.seansoper.batil.brokers.etrade.services.Market
import com.seansoper.batil.brokers.etrade.services.Orders
import com.seansoper.batil.brokers.etrade.services.TransactionSortOrder
import com.seansoper.batil.brokers.etrade.services.orderPreview.buyButterflyCalls
import com.seansoper.batil.brokers.etrade.services.orderPreview.buyBuyWrite
import com.seansoper.batil.brokers.etrade.services.orderPreview.buyCallOptionMarket
import com.seansoper.batil.brokers.etrade.services.orderPreview.buyCallSpread
import com.seansoper.batil.brokers.etrade.services.orderPreview.buyCondorPuts
import com.seansoper.batil.brokers.etrade.services.orderPreview.buyEquityLimit
import com.seansoper.batil.brokers.etrade.services.orderPreview.sellCallOptionMarket
import com.seansoper.batil.brokers.etrade.services.orderPreview.sellEquityLimit
import com.seansoper.batil.brokers.etrade.services.orderPreview.sellIronCondor
import com.seansoper.batil.config.ClientConfig
import com.seansoper.batil.config.GlobalConfig
import java.time.LocalDate
import java.time.LocalTime
import java.time.ZoneId
import java.time.ZonedDateTime
import java.util.GregorianCalendar
fun main() { 
   //sampleStart 
   val configuration = GlobalConfig.parse(runtime)
val client = Authorization(configuration, runtime.production, runtime.verbose)
val session = client.renewSession() ?: client.createSession()
val service = Market(session, runtime.production, runtime.verbose)
val date = OptionsCalendar.nextMonthly()
val result =
    service.optionChains("AAPL", GregorianCalendar(date.year, date.month.value, date.dayOfMonth), 131f, 1)

result?.let {
    println(it)
} 
   //sampleEnd
}

Parameters

symbol

The market symbol for the instrument. Example: AAPL

expiryDate

Retrieve the options chain for a specific date.

strike

The chains fetched will have strike prices near this value.

distance

The amount of strikes on either side to return. Example: Assuming an options chain increments by 5 while retrieving the 130 strike, a distance value of 2 means 120, 125, 130, 135, 140 would all be returned.

includeWeekly

Whether to include weekly options, default is false.

category

Default is STANDARD.

chainType

Default is CALLPUT.

priceType

Default is ATNM.

Sources

jvm source
Link copied to clipboard