|
@@ -23,6 +23,7 @@ def main() -> None:
|
|
|
return
|
|
return
|
|
|
|
|
|
|
|
check_cxos()
|
|
check_cxos()
|
|
|
|
|
+ return
|
|
|
|
|
|
|
|
markets: dict[str, list[Market]] = collections.defaultdict(list)
|
|
markets: dict[str, list[Market]] = collections.defaultdict(list)
|
|
|
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
|
|
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
|
|
@@ -43,32 +44,15 @@ def main() -> None:
|
|
|
print()
|
|
print()
|
|
|
|
|
|
|
|
def check_cxos() -> None:
|
|
def check_cxos() -> None:
|
|
|
- orders: typing.Sequence[ExchangeOrder] = cache.get('https://rest.fnar.net/cxos/' + config.username,
|
|
|
|
|
- headers={'Authorization': config.fio_api_key})
|
|
|
|
|
- summary: typing.Mapping[tuple[str, str], ExchangeSummary] = {
|
|
|
|
|
- (summary['MaterialTicker'], summary['ExchangeCode']): summary
|
|
|
|
|
- for summary in cache.get('https://rest.fnar.net/exchange/all')
|
|
|
|
|
- }
|
|
|
|
|
- for order in orders:
|
|
|
|
|
- if order['Status'] == 'FILLED':
|
|
|
|
|
- continue
|
|
|
|
|
- state = summary[order['MaterialTicker'], order['ExchangeCode']]
|
|
|
|
|
- if order['OrderType'] == 'BUYING' and state['Bid'] is not None and state['Bid'] > order['Limit']:
|
|
|
|
|
- print('outbid on', f'{order["MaterialTicker"]}.{order["ExchangeCode"]}')
|
|
|
|
|
- elif order['OrderType'] == 'SELLING' and state['Ask'] is not None and state['Ask'] < order['Limit']:
|
|
|
|
|
- print('undercut on', f'{order["MaterialTicker"]}.{order["ExchangeCode"]}')
|
|
|
|
|
- print()
|
|
|
|
|
-
|
|
|
|
|
warehouses: typing.Sequence[Warehouse] = cache.get('https://rest.fnar.net/sites/warehouses/' + config.username,
|
|
warehouses: typing.Sequence[Warehouse] = cache.get('https://rest.fnar.net/sites/warehouses/' + config.username,
|
|
|
headers={'Authorization': config.fio_api_key})
|
|
headers={'Authorization': config.fio_api_key})
|
|
|
for warehouse in warehouses:
|
|
for warehouse in warehouses:
|
|
|
- if warehouse['LocationNaturalId'] in config.market.ignore_warehouses:
|
|
|
|
|
- continue
|
|
|
|
|
storage: Storage = cache.get(f'https://rest.fnar.net/storage/{config.username}/{warehouse["StoreId"]}',
|
|
storage: Storage = cache.get(f'https://rest.fnar.net/storage/{config.username}/{warehouse["StoreId"]}',
|
|
|
headers={'Authorization': config.fio_api_key})
|
|
headers={'Authorization': config.fio_api_key})
|
|
|
- if storage['WeightLoad'] > 0 or storage['VolumeLoad'] > 0:
|
|
|
|
|
- print('warehouse', warehouse['LocationNaturalId'], 'is not empty')
|
|
|
|
|
- print()
|
|
|
|
|
|
|
+ for item in storage['StorageItems']:
|
|
|
|
|
+ threshold = config.market.mm_items.get(item['MaterialTicker'])
|
|
|
|
|
+ if threshold is not None and item['MaterialAmount'] > threshold:
|
|
|
|
|
+ print(f'{item["MaterialAmount"] - threshold} {item["MaterialTicker"]} at {warehouse["LocationNaturalId"]}')
|
|
|
|
|
|
|
|
def analyze_raw_price(price: RawPrice) -> Market | None:
|
|
def analyze_raw_price(price: RawPrice) -> Market | None:
|
|
|
if (traded := price['AverageTraded7D']) is None or traded < 100:
|
|
if (traded := price['AverageTraded7D']) is None or traded < 100:
|