Advertisement
Guest User

Untitled

a guest
Apr 24th, 2021
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. from decimal import Decimal
  2. from typing import Union
  3.  
  4. class Coin:
  5.     """
  6.    Custom coin data structure class that holds coin data and allows set access for each variable from outside functions
  7.  
  8.     Arguments:
  9.    - arg: type, description
  10.    # ...
  11.    """
  12.     bsc_url: str
  13.     eth_url: str
  14.     tracker_url: str
  15.     coin_type: str
  16.     contract: Union[str, object]
  17.     quantity: Decimal
  18.     # ...
  19.  
  20.     # You SHOULD be explicit
  21.     def __init__(self, bs_url, eth_url, coin_type, contract, quantity):
  22.         self.bs_url = "https://charts.bogged.finance/?token="
  23.         self.eth_url = "https://www.dextools.io/app/uniswap/pair-explorer/"
  24.         self.tracker_url = quanity
  25.         self.coin_type = coin_type
  26.         self.contract = contract
  27.         self.quantity = quantity
  28.  
  29.     # But it allowed to use kwargs
  30.     def __init__(self, **kwargs):
  31.         self.bs_url = "https://charts.bogged.finance/?token="
  32.         self.eth_url = "https://www.dextools.io/app/uniswap/pair-explorer/"
  33.         self.tracker_url = kwargs.get("tracker_url")
  34.         self.coin_type = kwargs.get("coin_type")
  35.         self.contract = kwargs.get("contract")
  36.         self.quantity = kwargs.get("quantity")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement