sellIronCondor

fun sellIronCondor(symbol: String, lowerWing: Pair<Float, Float>, upperWing: Pair<Float, Float>, limitPrice: Float, quantity: Int, expiry: ZonedDateTime = OptionsCalendar.nextMonthly(), clientOrderId: String = randomString()): PreviewRequest

Sell an iron condor

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 = Orders(session, runtime.production, runtime.verbose)
val accountIdKey = "ACCOUNT_ID_KEY"
val expiry = ZonedDateTime.of(
    LocalDate.of(2021, 10, 15),
    LocalTime.of(16, 0),
    ZoneId.of("America/New_York")
)

val request = sellIronCondor(
    symbol = "ACB",
    lowerWing = Pair(5.5f, 6f),
    upperWing = Pair(6.5f, 7f),
    limitPrice = .36f,
    quantity = 10,
    expiry = expiry
)

service.createPreview(accountIdKey, request)?.let {
    println("Preview of Sell to Open iron condor calls on ACB")
    println(it)
} 
   //sampleEnd
}

Parameters

symbol

The market symbol for the security being sold

lowerWing

A pair of strike prices for the lower wing of the condor

upperWing

A pair of strike prices for the upper wing of the condor

limitPrice

The highest price at which to sell the iron condors

quantity

The number of iron condors to sell

expiry

The date the iron condor will expire

clientOrderId

A reference ID generated by the developer that is used to ensure that a duplicate order is not being submitted. This reference ID may be any value of 20 or less alphanumeric characters but must be unique within the account. This field does not appear in any API responses.

Sources

jvm source
Link copied to clipboard