File tree Expand file tree Collapse file tree 2 files changed +13
-23
lines changed
Expand file tree Collapse file tree 2 files changed +13
-23
lines changed Original file line number Diff line number Diff line change 22from decimal import Decimal
33from typing import Optional
44
5- from constant import ADDITIONAL_CHAIN_FORMAT_DECIMALS , Denom
5+ from pyinjective . constant import ADDITIONAL_CHAIN_FORMAT_DECIMALS , Denom
66from pyinjective .core .token import Token
77
88
9- @dataclass
9+ @dataclass ( eq = True , frozen = True )
1010class SpotMarket :
1111 id : str
1212 status : str
@@ -34,7 +34,7 @@ def price_to_chain_format(self, human_readable_value: Decimal) -> Decimal:
3434
3535 return extended_chain_formatted_value
3636
37- @dataclass
37+ @dataclass ( eq = True , frozen = True )
3838class DerivativeMarket :
3939 id : str
4040 status : str
@@ -92,7 +92,7 @@ def calculate_margin_in_chain_format(
9292
9393 return extended_chain_formatted_margin
9494
95- @dataclass
95+ @dataclass ( eq = True , frozen = True )
9696class BinaryOptionMarket :
9797 id : str
9898 status : str
Original file line number Diff line number Diff line change 1+ from dataclasses import dataclass
12from decimal import Decimal
23
3-
4+ @ dataclass ( eq = True , frozen = True )
45class Token :
5-
6- def __init__ (
7- self ,
8- name : str ,
9- symbol : str ,
10- denom : str ,
11- address : str ,
12- decimals : int ,
13- logo : str ,
14- updated : int ,
15- ):
16- self .name = name
17- self .symbol = symbol
18- self .denom = denom
19- self .address = address
20- self .decimals = decimals
21- self .logo = logo
22- self .updated = updated
6+ name : str
7+ symbol : str
8+ denom : str
9+ address : str
10+ decimals : int
11+ logo : str
12+ updated : int
2313
2414 def chain_formatted_value (self , human_readable_value : Decimal ) -> Decimal :
2515 return human_readable_value * Decimal (f"1e{ self .decimals } " )
You can’t perform that action at this time.
0 commit comments