Эх сурвалжийг харах

market: filter to mats that traded with a spread

raylu 3 долоо хоног өмнө
parent
commit
1e429f26d1
1 өөрчлөгдсөн 6 нэмэгдсэн , 0 устгасан
  1. 6 0
      market.py

+ 6 - 0
market.py

@@ -13,6 +13,10 @@ def main() -> None:
 			continue
 		if price['Bid'] is None or price['Ask'] is None:
 			continue
+		if (high := price['HighYesterday']) is None or (low := price['LowYesterday']) is None:
+			continue
+		if (high - low) / high < 0.1:
+			continue
 		spread = (price['Ask'] - price['Bid']) / price['Ask']
 		if spread < 0.15:
 			continue
@@ -27,6 +31,8 @@ class RawPrice(typing.TypedDict):
 	FullTicker: str
 	Bid: float | None
 	Ask: float | None
+	HighYesterday: float | None
+	LowYesterday: float | None
 	AverageTraded7D: float | None # averaged daily traded volume over last 7 days
 
 @dataclasses.dataclass(eq=False, slots=True)