Browse Source

market: fix individual ticker mode

I wasn't passing the midpoint price
raylu 2 weeks ago
parent
commit
fe2001933e
1 changed files with 5 additions and 3 deletions
  1. 5 3
      market.py

+ 5 - 3
market.py

@@ -9,16 +9,18 @@ import cache
 from config import config
 
 def main() -> None:
+	raw_prices: list[RawPrice] = cache.get('https://refined-prun.github.io/refined-prices/all.json')
+
 	if len(sys.argv) > 1:
 		exchange_tickers = sys.argv[1:]
 		for ticker in exchange_tickers:
-			a = analyze_price_chart(ticker, 0)
-			print(f'{ticker}: bids filled = {a.bids_filled:6}, asks filled = {a.asks_filled:6}, profit per interval = {a.profit_per_interval:10}')
+			(price,) = (p for p in raw_prices if p['FullTicker'] == ticker)
+			a = analyze_price_chart(ticker, (price['Bid'] + price['Ask']) / 2) # pyright: ignore[reportOperatorIssue]
+			print(f'{ticker}: bids filled = {a.bids_filled:6.0f}, asks filled = {a.asks_filled:6.0f}, profit per interval = {a.profit_per_interval:10.1f}')
 		return
 
 	check_cxos()
 
-	raw_prices: list[RawPrice] = cache.get('https://refined-prun.github.io/refined-prices/all.json')
 	markets: dict[str, list[Market]] = collections.defaultdict(list)
 	for price in raw_prices:
 		if (traded := price['AverageTraded7D']) is None or traded < 100: