viewPortfolio

fun viewPortfolio(accountIdKey: String, sortBy: PortfolioSortBy? = null, sortOrder: TransactionSortOrder? = null, marketSession: MarketSession? = null, totalsRequired: Boolean? = null, lotsRequired: Boolean? = null, count: Int? = null): Portfolio?

View the portfolio for an account

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 = Accounts(session, runtime.production, runtime.verbose)

service.list()?.let {
    it.first().accountIdKey.let { accountIdKey ->
        service.viewPortfolio(accountIdKey)?.let {
            println("View portfolio")
            println(it)
        }
    }
} 
   //sampleEnd
}

Parameters

accountIdKey

The unique account key

sortBy

Field to sort by

sortOrder

Sort order for results, defaults to TransactionSortOrder.DESC

marketSession

Market session, defaults to MarketSession.REGULAR

totalsRequired

Returns the total values of the portfolio, defaults to false

lotsRequired

Returns lot positions of the portfolio, defaults to false

count

Number of transactions to return in the response, defaults to 50, used for paging

Sources

jvm source
Link copied to clipboard