Skip to content

Commit

Permalink
support second aggs (#115)
Browse files Browse the repository at this point in the history
* unserialize currencies second aggs

* support subscribing to indices fx and crypto second aggs
  • Loading branch information
aitzkovitz authored Jul 25, 2023
1 parent 75bd92d commit 0fac1d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ constructor(
"Q" -> serializer.decodeFromJsonElement(StocksMessage.Quote.serializer(), frame)
"A", "AM" -> serializer.decodeFromJsonElement(StocksMessage.Aggregate.serializer(), frame)
"C" -> serializer.decodeFromJsonElement(ForexMessage.Quote.serializer(), frame)
"CA" -> serializer.decodeFromJsonElement(ForexMessage.Aggregate.serializer(), frame)
"CA", "CAS" -> serializer.decodeFromJsonElement(ForexMessage.Aggregate.serializer(), frame)
"XQ" -> serializer.decodeFromJsonElement(CryptoMessage.Quote.serializer(), frame)
"XT" -> serializer.decodeFromJsonElement(CryptoMessage.Trade.serializer(), frame)
"XA" -> serializer.decodeFromJsonElement(CryptoMessage.Aggregate.serializer(), frame)
"XA", "XAS" -> serializer.decodeFromJsonElement(CryptoMessage.Aggregate.serializer(), frame)
"XS" -> serializer.decodeFromJsonElement(CryptoMessage.ConsolidatedQuote.serializer(), frame)
"XL2" -> serializer.decodeFromJsonElement(CryptoMessage.Level2Tick.serializer(), frame)
"V" -> serializer.decodeFromJsonElement(IndicesMessage.Value.serializer(), frame)
Expand Down Expand Up @@ -282,4 +282,4 @@ private class WebSocketConnection(
webSocketSession.close()
httpClient.close()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ sealed class PolygonWebSocketChannel(val prefix: String) {
*/
sealed class Forex(channelPrefix: String) : PolygonWebSocketChannel(channelPrefix) {
object Quotes: Forex("C")
object AggPerSecond: Forex("CAS")
object AggPerMinute: Forex("CA")
object Bonds: Forex("BONDS")
object Commodities: Forex("COMMODITIES")
Expand All @@ -47,12 +48,14 @@ sealed class PolygonWebSocketChannel(val prefix: String) {
object Trades : Crypto("XT")
object Quotes : Crypto("XQ")
object Aggregates : Crypto("XA")
object AggPerSecond : Crypto("XAS")
object ConsolidatedQuotes : Crypto("XS")
object Level2Books : Crypto("XL2")
}

sealed class Indices(channelPrefix: String) : PolygonWebSocketChannel(channelPrefix) {
object Aggregates : Stocks("AM")
object AggPerSecond : Stocks("A")
object Value : Indices("V")
}

Expand All @@ -65,4 +68,4 @@ sealed class PolygonWebSocketChannel(val prefix: String) {
* Use this if there's a new channel that this SDK doesn't fully support yet
*/
class Other(channelPrefix: String) : PolygonWebSocketChannel(channelPrefix)
}
}

0 comments on commit 0fac1d6

Please sign in to comment.