MatexBaseCoreState.fromJson constructor

MatexBaseCoreState.fromJson(
  1. dynamic json
)

Implementation

factory MatexBaseCoreState.fromJson(dynamic json) {
  var lotDescriptors = json['lotDescriptors'];
  var trend = json['trend'] as int?;
  var method = json['method'] as int?;
  var position = json['position'] as int?;
  var frequency = json['dividendPaymentFrequency'] as int?;

  return MatexBaseCoreState(
    accountCode: json['accountCode'] as String?,
    baseCode: json['baseCode'] as String?,
    counterCode: json['counterCode'] as String?,
    customPrice: json['customPrice'] as double?,
    highPrice: json['highPrice'] as double?,
    lowPrice: json['lowPrice'] as double?,
    precision: json['precision'] as int?,
    trend: trend != null ? MatexTrend.values[trend] : null,
    extensionLevels: json['extensionLevels'] as List<double>?,
    retracementLevels: json['retracementLevels'] as List<double>?,
    counterAccountCurrencyPairExchangeRate:
        json['counterAccountCurrencyPairExchangeRate'] as double?,
    tradingPairExchangeRate: json['tradingPairExchangeRate'] as double?,
    positionSize: json['positionSize'] as double?,
    pipPrecision: json['pipPrecision'] as int?,
    lotDescriptors: lotDescriptors != null
        ? MatexLotDescriptors.fromJson(json['lotDescriptors'])
        : null,
    baseListedSecond: json['baseListedSecond'] as bool?,
    leverage: json['leverage'] as double?,
    closePrice: json['closePrice'] as double?,
    openPrice: json['openPrice'] as double?,
    method: method != null ? MatexPivotPointsMethods.values[method] : null,
    accountSize: json['accountSize'] as double?,
    amountAtRisk: json['amountAtRisk'] as double?,
    riskRatio: json['riskRatio'] as double?,
    entryPrice: json['entryPrice'] as double?,
    position: position != null ? MatexPosition.values[position] : null,
    stopLossPips: json['stopLossPips'] as double?,
    stopLossPrice: json['stopLossPrice'] as double?,
    stopLossAmount: json['stopLossAmount'] as double?,
    takeProfitPips: json['takeProfitPips'] as double?,
    takeProfitPrice: json['takeProfitPrice'] as double?,
    takeProfitAmount: json['takeProfitAmount'] as double?,
    exchangeRateLastUpdateAt: json['exchangeRateLastUpdateAt'] as int?,
    exitPrice: json['exitPrice'] as double?,
    entryFeePercentage: json['entryFeePercentage'] as double?,
    entryFeeAmount: json['entryFeeAmount'] as double?,
    exitFeePercentage: json['exitFeePrecentage'] as double?,
    exitFeeAmount: json['exitFeeAmount'] as double?,
    taxRate: json['taxRate'] as double?,
    priceA: json['priceA'] as double?,
    priceB: json['priceB'] as double?,
    fixedCosts: json['fixedCosts'] as double?,
    exitDiscountAmount: json['exitDiscountAmount'] as double?,
    exitDiscountPercentage: json['exitDiscountPercentage'] as double?,
    entryFeePercentagePerUnit: json['entryFeePercentagePerUnit'] as double?,
    entryFeeAmountPerUnit: json['entryFeeAmountPerUnit'] as double?,
    exitFeePercentagePerUnit: json['exitFeePercentagePerUnit'] as double?,
    exitFeeAmountPerUnit: json['exitFeeAmountPerUnit'] as double?,
    dividendPaymentFrequency:
        frequency != null ? MatexFrequency.values[frequency] : null,
    annualSharePriceIncrease: json['annualSharePriceIncrease'] as double?,
    annualDividendIncrease: json['annualDividendIncrease'] as double?,
    annualContribution: json['annualContribution'] as double?,
    dividendYield: json['dividendYield'] as double?,
    numberOfShares: json['numberOfShares'] as double?,
    sharePrice: json['sharePrice'] as double?,
    yearsToGrow: json['yearsToGrow'] as int?,
    drip: json['drip'] as bool?,
    taxExemptAmountPerYear: json['taxExemptAmountPerYear'] as double?,
    totalDividend: json['totalDividend'] as double?,
    netIncome: json['netIncome'] as double?,
  );
}