|
|
@@ -35,13 +35,14 @@ def main() -> None:
|
|
|
bid_fill_ratio = bids_filled / (bids_filled + asks_filled)
|
|
|
if bid_fill_ratio < 0.05 or bid_fill_ratio > 0.95:
|
|
|
continue
|
|
|
+ max_profit = (price['Ask'] - price['Bid']) * min(bids_filled, asks_filled)
|
|
|
markets.append(Market(price['FullTicker'], bid=price['Bid'], ask=price['Ask'], spread=spread, traded=traded,
|
|
|
- bids_filled=bids_filled, asks_filled=asks_filled))
|
|
|
- markets.sort(key=lambda m: (m.ask - m.bid) * min(m.bids_filled, m.asks_filled), reverse=True)
|
|
|
+ bids_filled=bids_filled, asks_filled=asks_filled, max_profit=max_profit))
|
|
|
+ markets.sort(reverse=True)
|
|
|
|
|
|
- print(f'{"mat":^8} {"bid":^5} {"ask":^5} spread {"traded":^7} bids filled asks filled')
|
|
|
+ print(f'{"mat":^8} {"bid":^5} {"ask":^5} spread {"traded":^7} bids filled asks filled max profit')
|
|
|
for m in markets:
|
|
|
- print(f'{m.full_ticker:>8} {m.bid:5} {m.ask:5} {m.spread*100: 5.0f}% {m.traded:7.0f} {m.bids_filled:10.0f} {m.asks_filled:10.0f}')
|
|
|
+ print(f'{m.full_ticker:>8} {m.bid:5} {m.ask:5} {m.spread*100: 5.0f}% {m.traded:7.0f} {m.bids_filled:10.0f} {m.asks_filled:10.0f} {m.max_profit:10.0f}')
|
|
|
|
|
|
def check_cxos() -> None:
|
|
|
orders: typing.Sequence[ExchangeOrder] = cache.get('https://rest.fnar.net/cxos/' + config.username,
|
|
|
@@ -133,6 +134,10 @@ class Market:
|
|
|
traded: float
|
|
|
bids_filled: float
|
|
|
asks_filled: float
|
|
|
+ max_profit: float
|
|
|
+
|
|
|
+ def __lt__(self, o) -> bool:
|
|
|
+ return self.max_profit < o.max_profit
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
main()
|