Ticker.fromJson constructor
Constructs a Ticker instance from a JSON object.
json
is a map containing the ticker data.
Implementation
Ticker.fromJson(Map<String, dynamic> json)
: this.base = Convert.toStr(json['base'], ''),
this.target = Convert.toStr(json['target'], ''),
this.market = ExchangeMarket.fromJson(json['market']),
this.last = Convert.toDouble(json['last'], 0),
this.volume = Convert.toDouble(json['volume'], 0),
this.costToMoveUpUsd = Convert.toDoubleN(json['cost_to_move_up_usd']),
this.costToMoveDownUsd =
Convert.toDoubleN(json['cost_to_move_down_usd']),
this.convertedLast =
Convert.toMapOfStringDouble(json['converted_last'], {}),
this.convertedVolume =
Convert.toMapOfStringDouble(json['converted_volume'], {}),
this.trustScore = Convert.toStr(json['trust_score'], ''),
this.bidAskSpreadPercentage =
Convert.toDouble(json['bid_ask_spread_percentage'], 0),
this.timestamp =
Convert.toDateTime(json['timestamp'], Helpers.defaultDateTime()),
this.lastTradedAt = Convert.toDateTime(
json['last_traded_at'], Helpers.defaultDateTime()),
this.lastFetchAt = Convert.toDateTime(
json['last_fetch_at'], Helpers.defaultDateTime()),
this.isAnomaly = Convert.toBoolean(json['is_anomaly'], false),
this.isStale = Convert.toBoolean(json['is_stale'], false),
this.tradeUrl = Convert.toStr(json['trade_url'], ''),
this.tokenInfoUrl = Convert.toStrN(json['token_info_url']),
this.coinId = Convert.toStr(json['coin_id'], ''),
this.targetCoinId = Convert.toStrN(json['target_coin_id']);