All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.barchart.ondemand.api.responses.FuturesOptions Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package com.barchart.ondemand.api.responses;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;

public class FuturesOptions extends ResponseBase {

	@JsonProperty("results")
	public List results = new ArrayList();

	public Collection all() {
		if (results == null) {
			return new ArrayList();
		}
		return Collections.unmodifiableCollection(results);
	}

	public Collection calls() {

		final List results = new ArrayList();
		for (FuturesOption f : all()) {
			if (f.getType() != null && f.getType().equalsIgnoreCase("call")) {
				results.add(f);
			}
		}

		return results;
	}

	public Collection puts() {

		final List results = new ArrayList();
		for (FuturesOption f : all()) {
			if (f.getType() != null && f.getType().equalsIgnoreCase("put")) {
				results.add(f);
			}
		}

		return results;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy