Derivative.fromJson constructor

Derivative.fromJson(
  1. Map<String, dynamic> json
)

Constructs a Derivative instance from a JSON map.

json is a map containing the data to initialize the instance.

Implementation

Derivative.fromJson(Map<String, dynamic> json)
    : this.market = Convert.toStr(json['market'], ''),
      this.symbol = Convert.toStr(json['symbol'], ''),
      this.indexId = Convert.toStr(json['index_id'], ''),
      this.price = Convert.toDouble(json['price'], 0),
      this.pricePercentageChange24h =
          Convert.toDouble(json['price_percentage_change_24h'], 0),
      this.contractType = Convert.toStr(json['contract_type'], ''),
      this.index = Convert.toDoubleN(json['index']),
      this.basis = Convert.toDouble(json['basis'], 0),
      this.spread = Convert.toDoubleN(json['spread']),
      this.fundingRate = Convert.toDouble(json['funding_rate'], 0),
      this.openInterest = Convert.toDouble(json['open_interest'], 0),
      this.volume24h = Convert.toDouble(json['volume_24h'], 0),
      this.lastTradedAt = Convert.toDateTime(
          json['last_traded_at'], Helpers.defaultDateTime()),
      this.expiredAt = Convert.toDateTimeN(json['expired_at']);