336 lines
8.5 KiB
Dart
336 lines
8.5 KiB
Dart
class StockDetailsModel {
|
|
String? status;
|
|
int? statusCode;
|
|
String? message;
|
|
Data? data;
|
|
|
|
StockDetailsModel({this.status, this.statusCode, this.message, this.data});
|
|
|
|
StockDetailsModel.fromJson(Map<String, dynamic> json) {
|
|
status = json['status'];
|
|
statusCode = json['status_code'];
|
|
message = json['message'];
|
|
data = json['data'] != null ? Data.fromJson(json['data']) : null;
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['status'] = status;
|
|
data['status_code'] = statusCode;
|
|
data['message'] = message;
|
|
if (this.data != null) {
|
|
data['data'] = this.data!.toJson();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Data {
|
|
StockInfo? stockData;
|
|
OptionChain? optionChain;
|
|
CandleStick? candleStick;
|
|
|
|
Data({this.stockData, this.optionChain, this.candleStick});
|
|
|
|
Data.fromJson(Map<String, dynamic> json) {
|
|
stockData = json['stock_data'] != null
|
|
? StockInfo.fromJson(json['stock_data'])
|
|
: null;
|
|
optionChain = json['option_chain'] != null
|
|
? OptionChain.fromJson(json['option_chain'])
|
|
: null;
|
|
candleStick = json['candle_stick'] != null
|
|
? CandleStick.fromJson(json['candle_stick'])
|
|
: null;
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
if (stockData != null) {
|
|
data['stock_data'] = stockData!.toJson();
|
|
}
|
|
if (optionChain != null) {
|
|
data['option_chain'] = optionChain!.toJson();
|
|
}
|
|
if (candleStick != null) {
|
|
data['candle_stick'] = candleStick!.toJson();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class StockInfo {
|
|
Ohlc? ohlc;
|
|
String? timestamp;
|
|
String? instrumentToken;
|
|
String? symbol;
|
|
double? lastPrice;
|
|
int? volume;
|
|
double? averagePrice;
|
|
int? oi;
|
|
double? netChange;
|
|
int? totalBuyQuantity;
|
|
int? totalSellQuantity;
|
|
double? lowerCircuitLimit;
|
|
double? upperCircuitLimit;
|
|
String? lastTradeTime;
|
|
int? oiDayHigh;
|
|
int? oiDayLow;
|
|
|
|
StockInfo(
|
|
{this.ohlc,
|
|
this.timestamp,
|
|
this.instrumentToken,
|
|
this.symbol,
|
|
this.lastPrice,
|
|
this.volume,
|
|
this.averagePrice,
|
|
this.oi,
|
|
this.netChange,
|
|
this.totalBuyQuantity,
|
|
this.totalSellQuantity,
|
|
this.lowerCircuitLimit,
|
|
this.upperCircuitLimit,
|
|
this.lastTradeTime,
|
|
this.oiDayHigh,
|
|
this.oiDayLow});
|
|
|
|
StockInfo.fromJson(Map<String, dynamic> json) {
|
|
ohlc = json['ohlc'] != null ? Ohlc.fromJson(json['ohlc']) : null;
|
|
timestamp = json['timestamp'];
|
|
instrumentToken = json['instrument_token'];
|
|
symbol = json['symbol'];
|
|
lastPrice = json['last_price'];
|
|
volume = json['volume'];
|
|
averagePrice = json['average_price'];
|
|
oi = json['oi'];
|
|
netChange = json['net_change'];
|
|
totalBuyQuantity = json['total_buy_quantity'];
|
|
totalSellQuantity = json['total_sell_quantity'];
|
|
lowerCircuitLimit = json['lower_circuit_limit'];
|
|
upperCircuitLimit = json['upper_circuit_limit'];
|
|
lastTradeTime = json['last_trade_time'];
|
|
oiDayHigh = json['oi_day_high'];
|
|
oiDayLow = json['oi_day_low'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
if (ohlc != null) {
|
|
data['ohlc'] = ohlc!.toJson();
|
|
}
|
|
data['timestamp'] = timestamp;
|
|
data['instrument_token'] = instrumentToken;
|
|
data['symbol'] = symbol;
|
|
data['last_price'] = lastPrice;
|
|
data['volume'] = volume;
|
|
data['average_price'] = averagePrice;
|
|
data['oi'] = oi;
|
|
data['net_change'] = netChange;
|
|
data['total_buy_quantity'] = totalBuyQuantity;
|
|
data['total_sell_quantity'] = totalSellQuantity;
|
|
data['lower_circuit_limit'] = lowerCircuitLimit;
|
|
data['upper_circuit_limit'] = upperCircuitLimit;
|
|
data['last_trade_time'] = lastTradeTime;
|
|
data['oi_day_high'] = oiDayHigh;
|
|
data['oi_day_low'] = oiDayLow;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Ohlc {
|
|
double? open;
|
|
double? high;
|
|
double? low;
|
|
double? close;
|
|
|
|
Ohlc({this.open, this.high, this.low, this.close});
|
|
|
|
Ohlc.fromJson(Map<String, dynamic> json) {
|
|
open = json['open'].toDouble();
|
|
high = json['high'].toDouble();
|
|
low = json['low'].toDouble();
|
|
close = json['close'].toDouble();
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['open'] = open;
|
|
data['high'] = high;
|
|
data['low'] = low;
|
|
data['close'] = close;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class OptionChain {
|
|
String? status;
|
|
List<Data2>? data2;
|
|
|
|
OptionChain({this.status, this.data2});
|
|
|
|
OptionChain.fromJson(Map<String, dynamic> json) {
|
|
status = json['status'];
|
|
if (json['data2'] != null) {
|
|
data2 = <Data2>[];
|
|
json['data2'].forEach((v) {
|
|
data2!.add(Data2.fromJson(v));
|
|
});
|
|
}
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['status'] = status;
|
|
if (data2 != null) {
|
|
data['data2'] = data2!.map((v) => v.toJson()).toList();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Data2 {
|
|
String? name;
|
|
String? segment;
|
|
String? exchange;
|
|
String? expiry;
|
|
bool? weekly;
|
|
String? instrumentKey;
|
|
String? exchangeToken;
|
|
String? tradingSymbol;
|
|
int? tickSize;
|
|
int? lotSize;
|
|
String? instrumentType;
|
|
int? freezeQuantity;
|
|
String? underlyingKey;
|
|
String? underlyingType;
|
|
String? underlyingSymbol;
|
|
int? strikePrice;
|
|
int? minimumLot;
|
|
|
|
Data2(
|
|
{this.name,
|
|
this.segment,
|
|
this.exchange,
|
|
this.expiry,
|
|
this.weekly,
|
|
this.instrumentKey,
|
|
this.exchangeToken,
|
|
this.tradingSymbol,
|
|
this.tickSize,
|
|
this.lotSize,
|
|
this.instrumentType,
|
|
this.freezeQuantity,
|
|
this.underlyingKey,
|
|
this.underlyingType,
|
|
this.underlyingSymbol,
|
|
this.strikePrice,
|
|
this.minimumLot});
|
|
|
|
Data2.fromJson(Map<String, dynamic> json) {
|
|
name = json['name'];
|
|
segment = json['segment'];
|
|
exchange = json['exchange'];
|
|
expiry = json['expiry'];
|
|
weekly = json['weekly'];
|
|
instrumentKey = json['instrument_key'];
|
|
exchangeToken = json['exchange_token'];
|
|
tradingSymbol = json['trading_symbol'];
|
|
tickSize = json['tick_size'];
|
|
lotSize = json['lot_size'];
|
|
instrumentType = json['instrument_type'];
|
|
freezeQuantity = json['freeze_quantity'];
|
|
underlyingKey = json['underlying_key'];
|
|
underlyingType = json['underlying_type'];
|
|
underlyingSymbol = json['underlying_symbol'];
|
|
strikePrice = json['strike_price'];
|
|
minimumLot = json['minimum_lot'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['name'] = name;
|
|
data['segment'] = segment;
|
|
data['exchange'] = exchange;
|
|
data['expiry'] = expiry;
|
|
data['weekly'] = weekly;
|
|
data['instrument_key'] = instrumentKey;
|
|
data['exchange_token'] = exchangeToken;
|
|
data['trading_symbol'] = tradingSymbol;
|
|
data['tick_size'] = tickSize;
|
|
data['lot_size'] = lotSize;
|
|
data['instrument_type'] = instrumentType;
|
|
data['freeze_quantity'] = freezeQuantity;
|
|
data['underlying_key'] = underlyingKey;
|
|
data['underlying_type'] = underlyingType;
|
|
data['underlying_symbol'] = underlyingSymbol;
|
|
data['strike_price'] = strikePrice;
|
|
data['minimum_lot'] = minimumLot;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class CandleStick {
|
|
List<Candles>? candles;
|
|
|
|
CandleStick({this.candles});
|
|
|
|
CandleStick.fromJson(Map<String, dynamic> json) {
|
|
if (json['candles'] != null) {
|
|
candles = <Candles>[];
|
|
json['candles'].forEach((v) {
|
|
candles!.add(Candles.fromJson(v));
|
|
});
|
|
}
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
if (candles != null) {
|
|
data['candles'] = candles!.map((v) => v.toJson()).toList();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Candles {
|
|
String? timestamp;
|
|
double? open;
|
|
double? high;
|
|
double? low;
|
|
double? close;
|
|
int? volume;
|
|
int? openInterest;
|
|
|
|
Candles(
|
|
{this.timestamp,
|
|
this.open,
|
|
this.high,
|
|
this.low,
|
|
this.close,
|
|
this.volume,
|
|
this.openInterest});
|
|
|
|
Candles.fromJson(Map<String, dynamic> json) {
|
|
timestamp = json['timestamp'];
|
|
open = json['open'];
|
|
high = json['high'];
|
|
low = json['low'];
|
|
close = json['close'];
|
|
volume = json['volume'];
|
|
openInterest = json['open_interest'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['timestamp'] = timestamp;
|
|
data['open'] = open;
|
|
data['high'] = high;
|
|
data['low'] = low;
|
|
data['close'] = close;
|
|
data['volume'] = volume;
|
|
data['open_interest'] = openInterest;
|
|
return data;
|
|
}
|
|
}
|