polygon-io / client-jvm

The official JVM client library SDK, written in Kotlin, for accessing the Polygon REST and WebSocket API.
50 stars 33 forks source link

Universal Snapshot missing field #150

Open upMKuhn opened 9 months ago

upMKuhn commented 9 months ago

Hello,

The universal snapshot endpoint returns the Ticker symbol. This is not reflected sadly in the API. So I am forced as a workaround to call the search ticker endpoint in order to get the ticker Symbol followed by a call to get the ticker details. It would be nice if I could avoid this unnecessary call to the API, by adding this field to the model.

Thanks :)

justinpolygon commented 9 months ago

Hey @upMKuhn, thanks for reporting this. Is this an issue with the API itself or the JVM client library missing a field in the results? What field are you looking for from ticker details that you want included in the universal snapshot? Basically, I'm wondering if this is a feature request or a bug.

upMKuhn commented 9 months ago

Hello @justinpolygon

it is a bug in the JVM client. In summary, the field ticker is exposed in the API, but not in the client. See:

        {
            "market_status": "early_trading",
            "name": "Agilent Technologies Inc.",
            "ticker": "A",
            "type": "stocks",
            "session": {
                "change": 4.95,
                "change_percent": 3.843,
                "early_trading_change": 0.21,
                "early_trading_change_percent": 0.163,
                "late_trading_change": 0,
                "late_trading_change_percent": 0,
                "close": 133.74,
                "high": 134.04,
                "low": 128.77,
                "open": 129.09,
                "volume": 1731449,
                "previous_close": 128.79,
                "price": 133.74
            }
        },
upMKuhn commented 9 months ago
@Serializable
data class Snapshot (
    // Common: fields that apply to most/all of the asset types.
    val error: String? = null,
    val message: String? = null,
    val market_status: String? = null,
    val name: String? = null,
    val type: String? = null, // Type of the asset: stocks, options, fx, crypto, indices.
    @SerialName("session") val session: SnapshotSession? = null,

    // fmv is only available on Business plans, see docs for details.
    @SerialName("fmv") val fmv: Double? = null,

    // Quote is only returned if your current plan includes quotes.
    @SerialName("last_quote") val lastQuote: Quote? = null,

    // Trade is only returned if your current plan includes trades.
    @SerialName("last_trade") val lastTrade: SnapshotsTrade? = null,

    // Options
    @SerialName("break_even_price") val breakEvenPrice: Double? = null,
    @SerialName("details") val optionDetails: SnapshotContractDetails? = null,
    @SerialName("greeks") val optionGreeks: SnapshotGreeks? = null,
    @SerialName("implied_volatility") val impliedVolatility: Double? = null,
    @SerialName("open_interest") val openInterest: Double? = null,
    @SerialName("underlying_asset") val underlyingAsset: SnapshotUnderlyingAsset? = null,

    // Indices
    @SerialName("value") val value: Double? = null,
)
upMKuhn commented 9 months ago

There is the name, but not the ticker. The ticker details are null.

image