2021-06-25 02:33:40 -07:00
|
|
|
#!/usr/bin/env pyston3
|
|
|
|
|
|
|
|
import argparse
|
|
|
|
import logging
|
|
|
|
import os
|
|
|
|
import os.path
|
|
|
|
import sys
|
|
|
|
|
|
|
|
sys.path.insert(0, os.path.abspath(
|
|
|
|
os.path.join(os.path.dirname(__file__), "..")))
|
|
|
|
import mango # nopep8
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description="Shows all orders on the given market owned by the current wallet.")
|
|
|
|
mango.Context.add_command_line_parameters(parser)
|
|
|
|
mango.Wallet.add_command_line_parameters(parser)
|
|
|
|
parser.add_argument("--market", type=str, required=True, help="market symbol to buy (e.g. ETH/USDC)")
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
logging.getLogger().setLevel(args.log_level)
|
|
|
|
logging.warning(mango.WARNING_DISCLAIMER_TEXT)
|
|
|
|
|
|
|
|
context = mango.Context.from_command_line_parameters(args)
|
|
|
|
wallet = mango.Wallet.from_command_line_parameters_or_raise(args)
|
|
|
|
|
|
|
|
market_symbol = args.market.upper()
|
|
|
|
market = context.market_lookup.find_by_symbol(market_symbol)
|
|
|
|
if market is None:
|
|
|
|
raise Exception(f"Could not find market {market_symbol}")
|
|
|
|
|
2021-07-14 06:03:51 -07:00
|
|
|
market_operations = mango.create_market_operations(context, wallet, False, market)
|
2021-06-25 02:33:40 -07:00
|
|
|
orders = market_operations.load_my_orders()
|
|
|
|
print(f"{len(orders)} order(s) to show.")
|
|
|
|
for order in orders:
|
|
|
|
print(order)
|