# -*- coding: utf-8 -*-

"""
coingeckopublicapiv3

This file was automatically generated by APIMATIC v3.0 (
 https://www.apimatic.io ).
"""
from coingeckopublicapiv3.api_helper import APIHelper


class DerivativesTickersList(object):

    """Implementation of the 'DerivativesTickersList' model.

    Attributes:
        market (str): derivative market name
        symbol (str): derivative ticker symbol
        index_id (str): derivative underlying asset
        price (str): derivative ticker price
        price_percentage_change_24_h (float): derivative ticker price
            percentage change in 24 hours
        contract_type (str): derivative contract type
        index (float): derivative underlying asset price
        basis (float): difference of derivative price and index price
        spread (float): derivative bid ask spread
        funding_rate (float): derivative funding rate
        open_interest (float): derivative open interest
        volume_24_h (float): derivative volume in 24 hours
        last_traded_at (float): derivative last updated time
        expired_at (str): The model property of type str.

    """

    # Create a mapping from Model property names to API property names
    _names = {
        "market": 'market',
        "symbol": 'symbol',
        "index_id": 'index_id',
        "price": 'price',
        "price_percentage_change_24_h": 'price_percentage_change_24h',
        "contract_type": 'contract_type',
        "index": 'index',
        "basis": 'basis',
        "spread": 'spread',
        "funding_rate": 'funding_rate',
        "open_interest": 'open_interest',
        "volume_24_h": 'volume_24h',
        "last_traded_at": 'last_traded_at',
        "expired_at": 'expired_at'
    }

    _optionals = [
        'market',
        'symbol',
        'index_id',
        'price',
        'price_percentage_change_24_h',
        'contract_type',
        'index',
        'basis',
        'spread',
        'funding_rate',
        'open_interest',
        'volume_24_h',
        'last_traded_at',
        'expired_at',
    ]

    _nullables = [
        'expired_at',
    ]

    def __init__(self,
                 market=APIHelper.SKIP,
                 symbol=APIHelper.SKIP,
                 index_id=APIHelper.SKIP,
                 price=APIHelper.SKIP,
                 price_percentage_change_24_h=APIHelper.SKIP,
                 contract_type=APIHelper.SKIP,
                 index=APIHelper.SKIP,
                 basis=APIHelper.SKIP,
                 spread=APIHelper.SKIP,
                 funding_rate=APIHelper.SKIP,
                 open_interest=APIHelper.SKIP,
                 volume_24_h=APIHelper.SKIP,
                 last_traded_at=APIHelper.SKIP,
                 expired_at=APIHelper.SKIP):
        """Constructor for the DerivativesTickersList class"""

        # Initialize members of the class
        if market is not APIHelper.SKIP:
            self.market = market 
        if symbol is not APIHelper.SKIP:
            self.symbol = symbol 
        if index_id is not APIHelper.SKIP:
            self.index_id = index_id 
        if price is not APIHelper.SKIP:
            self.price = price 
        if price_percentage_change_24_h is not APIHelper.SKIP:
            self.price_percentage_change_24_h = price_percentage_change_24_h 
        if contract_type is not APIHelper.SKIP:
            self.contract_type = contract_type 
        if index is not APIHelper.SKIP:
            self.index = index 
        if basis is not APIHelper.SKIP:
            self.basis = basis 
        if spread is not APIHelper.SKIP:
            self.spread = spread 
        if funding_rate is not APIHelper.SKIP:
            self.funding_rate = funding_rate 
        if open_interest is not APIHelper.SKIP:
            self.open_interest = open_interest 
        if volume_24_h is not APIHelper.SKIP:
            self.volume_24_h = volume_24_h 
        if last_traded_at is not APIHelper.SKIP:
            self.last_traded_at = last_traded_at 
        if expired_at is not APIHelper.SKIP:
            self.expired_at = expired_at 

    @classmethod
    def from_dictionary(cls,
                        dictionary):
        """Creates an instance of this model from a dictionary

        Args:
            dictionary (dictionary): A dictionary representation of the object
            as obtained from the deserialization of the server's response. The
            keys MUST match property names in the API description.

        Returns:
            object: An instance of this structure class.

        """

        if not isinstance(dictionary, dict) or dictionary is None:
            return None

        # Extract variables from the dictionary
        market = dictionary.get("market") if dictionary.get("market") else APIHelper.SKIP
        symbol = dictionary.get("symbol") if dictionary.get("symbol") else APIHelper.SKIP
        index_id = dictionary.get("index_id") if dictionary.get("index_id") else APIHelper.SKIP
        price = dictionary.get("price") if dictionary.get("price") else APIHelper.SKIP
        price_percentage_change_24_h = dictionary.get("price_percentage_change_24h") if dictionary.get("price_percentage_change_24h") else APIHelper.SKIP
        contract_type = dictionary.get("contract_type") if dictionary.get("contract_type") else APIHelper.SKIP
        index = dictionary.get("index") if dictionary.get("index") else APIHelper.SKIP
        basis = dictionary.get("basis") if dictionary.get("basis") else APIHelper.SKIP
        spread = dictionary.get("spread") if dictionary.get("spread") else APIHelper.SKIP
        funding_rate = dictionary.get("funding_rate") if dictionary.get("funding_rate") else APIHelper.SKIP
        open_interest = dictionary.get("open_interest") if dictionary.get("open_interest") else APIHelper.SKIP
        volume_24_h = dictionary.get("volume_24h") if dictionary.get("volume_24h") else APIHelper.SKIP
        last_traded_at = dictionary.get("last_traded_at") if dictionary.get("last_traded_at") else APIHelper.SKIP
        expired_at = dictionary.get("expired_at") if "expired_at" in dictionary.keys() else APIHelper.SKIP
        # Return an object of this model
        return cls(market,
                   symbol,
                   index_id,
                   price,
                   price_percentage_change_24_h,
                   contract_type,
                   index,
                   basis,
                   spread,
                   funding_rate,
                   open_interest,
                   volume_24_h,
                   last_traded_at,
                   expired_at)

    def __repr__(self):
        return (f'{self.__class__.__name__}('
                f'market={(self.market if hasattr(self, "market") else None)!r}, '
                f'symbol={(self.symbol if hasattr(self, "symbol") else None)!r}, '
                f'index_id={(self.index_id if hasattr(self, "index_id") else None)!r}, '
                f'price={(self.price if hasattr(self, "price") else None)!r}, '
                f'price_percentage_change_24_h={(self.price_percentage_change_24_h if hasattr(self, "price_percentage_change_24_h") else None)!r}, '
                f'contract_type={(self.contract_type if hasattr(self, "contract_type") else None)!r}, '
                f'index={(self.index if hasattr(self, "index") else None)!r}, '
                f'basis={(self.basis if hasattr(self, "basis") else None)!r}, '
                f'spread={(self.spread if hasattr(self, "spread") else None)!r}, '
                f'funding_rate={(self.funding_rate if hasattr(self, "funding_rate") else None)!r}, '
                f'open_interest={(self.open_interest if hasattr(self, "open_interest") else None)!r}, '
                f'volume_24_h={(self.volume_24_h if hasattr(self, "volume_24_h") else None)!r}, '
                f'last_traded_at={(self.last_traded_at if hasattr(self, "last_traded_at") else None)!r}, '
                f'expired_at={(self.expired_at if hasattr(self, "expired_at") else None)!r})')

    def __str__(self):
        return (f'{self.__class__.__name__}('
                f'market={(self.market if hasattr(self, "market") else None)!s}, '
                f'symbol={(self.symbol if hasattr(self, "symbol") else None)!s}, '
                f'index_id={(self.index_id if hasattr(self, "index_id") else None)!s}, '
                f'price={(self.price if hasattr(self, "price") else None)!s}, '
                f'price_percentage_change_24_h={(self.price_percentage_change_24_h if hasattr(self, "price_percentage_change_24_h") else None)!s}, '
                f'contract_type={(self.contract_type if hasattr(self, "contract_type") else None)!s}, '
                f'index={(self.index if hasattr(self, "index") else None)!s}, '
                f'basis={(self.basis if hasattr(self, "basis") else None)!s}, '
                f'spread={(self.spread if hasattr(self, "spread") else None)!s}, '
                f'funding_rate={(self.funding_rate if hasattr(self, "funding_rate") else None)!s}, '
                f'open_interest={(self.open_interest if hasattr(self, "open_interest") else None)!s}, '
                f'volume_24_h={(self.volume_24_h if hasattr(self, "volume_24_h") else None)!s}, '
                f'last_traded_at={(self.last_traded_at if hasattr(self, "last_traded_at") else None)!s}, '
                f'expired_at={(self.expired_at if hasattr(self, "expired_at") else None)!s})')
