MCPcopy Index your code
hub / github.com/ccxt/ccxt / parseTicker

Method parseTicker

java/lib/src/main/java/io/github/ccxt/exchanges/OkxCore.java:2233–2314  ·  view source on GitHub ↗
(Object ticker, Object... optionalArgs)

Source from the content-addressed store, hash-verified

2231 }
2232
2233 public Object parseTicker(Object ticker, Object... optionalArgs)
2234 {
2235 //
2236 // {
2237 // "instType":"SWAP",
2238 // "instId":"BTC-USDT-SWAP",
2239 // "markPx":"200",
2240 // "ts":"1597026383085"
2241 // }
2242 //
2243 // {
2244 // "instType": "SPOT",
2245 // "instId": "ETH-BTC",
2246 // "last": "0.07319",
2247 // "lastSz": "0.044378",
2248 // "askPx": "0.07322",
2249 // "askSz": "4.2",
2250 // "bidPx": "0.0732",
2251 // "bidSz": "6.050058",
2252 // "open24h": "0.07801",
2253 // "high24h": "0.07975",
2254 // "low24h": "0.06019",
2255 // "volCcy24h": "11788.887619",
2256 // "vol24h": "167493.829229",
2257 // "ts": "1621440583784",
2258 // "sodUtc0": "0.07872",
2259 // "sodUtc8": "0.07345"
2260 // }
2261 // {
2262 // instId: 'LTC-USDT',
2263 // idxPx: '65.74',
2264 // open24h: '65.37',
2265 // high24h: '66.15',
2266 // low24h: '64.97',
2267 // sodUtc0: '65.68',
2268 // sodUtc8: '65.54',
2269 // ts: '1728467346900'
2270 // },
2271 //
2272 Object market = Helpers.getArg(optionalArgs, 0, null);
2273 Object instType = this.safeString(ticker, "instType");
2274 Object marketType = null;
2275 if (Helpers.isTrue(!Helpers.isEqual(instType, null)))
2276 {
2277 marketType = ((Helpers.isTrue((Helpers.isEqual(instType, "SPOT"))))) ? "spot" : "swap";
2278 }
2279 Object timestamp = this.safeInteger(ticker, "ts");
2280 Object marketId = this.safeString(ticker, "instId");
2281 market = this.safeMarket(marketId, market, "-", marketType);
2282 Object symbol = Helpers.GetValue(market, "symbol");
2283 Object last = this.safeString(ticker, "last");
2284 Object open = this.safeString(ticker, "open24h");
2285 Object spot = this.safeBool(market, "spot", false);
2286 Object quoteVolume = ((Helpers.isTrue(spot))) ? this.safeString(ticker, "volCcy24h") : null;
2287 Object baseVolume = this.safeString(ticker, "vol24h");
2288 Object high = this.safeString(ticker, "high24h");
2289 Object low = this.safeString(ticker, "low24h");
2290 return this.safeTicker(new java.util.HashMap<String, Object>() {{

Callers 3

fetchTickerMethod · 0.95
fetchMarkPriceMethod · 0.95
handleTickerMethod · 0.95

Calls 10

getArgMethod · 0.95
isTrueMethod · 0.95
isEqualMethod · 0.95
safeMarketMethod · 0.95
GetValueMethod · 0.95
safeStringMethod · 0.45
safeIntegerMethod · 0.45
safeBoolMethod · 0.45
safeTickerMethod · 0.45
iso8601Method · 0.45

Tested by

no test coverage detected