com.konfigthis.client.model.ActionStrictWithOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of snaptrade-java-sdk Show documentation
Show all versions of snaptrade-java-sdk Show documentation
Connect brokerage accounts to your app for live positions and trading
This library was generated by https://konfigthis.com
/*
* SnapTrade
* Connect brokerage accounts to your app for live positions and trading
*
* The version of the OpenAPI document: 1.0.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by Konfig (https://konfigthis.com).
* Do not edit the class manually.
*/
package com.konfigthis.client.model;
import java.util.Objects;
import java.util.Arrays;
import io.swagger.annotations.ApiModel;
import com.google.gson.annotations.SerializedName;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
/**
* The action describes the intent or side of a trade. This is either `BUY` or `SELL` for Equity symbols or `BUY_TO_OPEN`, `BUY_TO_CLOSE`, `SELL_TO_OPEN` or `SELL_TO_CLOSE` for Options.
*/
@JsonAdapter(ActionStrictWithOptions.Adapter.class)public enum ActionStrictWithOptions {
BUY("BUY"),
SELL("SELL"),
BUY_TO_OPEN("BUY_TO_OPEN"),
BUY_TO_CLOSE("BUY_TO_CLOSE"),
SELL_TO_OPEN("SELL_TO_OPEN"),
SELL_TO_CLOSE("SELL_TO_CLOSE");
private String value;
ActionStrictWithOptions(String value) {
this.value = value;
}
public String getValue() {
return value;
}
@Override
public String toString() {
return String.valueOf(value);
}
public static ActionStrictWithOptions fromValue(String value) {
for (ActionStrictWithOptions b : ActionStrictWithOptions.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
public static class Adapter extends TypeAdapter {
@Override
public void write(final JsonWriter jsonWriter, final ActionStrictWithOptions enumeration) throws IOException {
jsonWriter.value(enumeration.getValue());
}
@Override
public ActionStrictWithOptions read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return ActionStrictWithOptions.fromValue(value);
}
}
}