Implement suggested comments

This commit is contained in:
Aaron Critchley 2021-12-30 00:32:24 +00:00 committed by GitHub
parent d74d773e25
commit a07f5f6d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 9 deletions

View File

@ -61,15 +61,12 @@ market = mango.ensure_market_loaded(context, stub)
market_operations = mango.create_market_operations(context, wallet, account, market, dry_run=False)
print("Orders (initial):\n\t", market_operations.load_orderbook())
print("Initial order book:\n\t", market_operations.load_orderbook())
print("Your current orders:\n\t", market_operations.load_my_orders())
# Check the current price in the devnet SOL-PERP Mango Markets oracle
oracle = MarketOracle(market)
price = oracle.fetch_price(context)
# Go on - try to buy 1 SOL-PERP contract for the current best bid.
# Go on - try to buy 1 SOL-PERP contract for $10.
order = mango.Order.from_basic_info(side=mango.Side.BUY,
price=price.top_bid,
price=decimal.Decimal(10),
quantity=decimal.Decimal(1),
order_type=mango.OrderType.POST_ONLY)
placed_order = market_operations.place_order(order)
@ -78,7 +75,8 @@ print("\n\nPlaced order:\n\t", placed_order)
print("\n\nSleeping for 10 seconds...")
time.sleep(10)
print("\n\nOrders (including our new order):\n", market_operations.load_orderbook())
print("\n\nOrder book (including our new order):\n", market_operations.load_orderbook())
print("Your current orders:\n\t", market_operations.load_my_orders())
cancellation_signatures = market_operations.cancel_order(placed_order)
print("\n\nCancellation signature:\n\t", cancellation_signatures)
@ -86,7 +84,8 @@ print("\n\nCancellation signature:\n\t", cancellation_signatures)
print("\n\nSleeping for 10 seconds...")
time.sleep(10)
print("\n\nOrders (without our order):\n", market_operations.load_orderbook())
print("\n\nOrder book (without our order):\n", market_operations.load_orderbook())
print("Your current orders:\n\t", market_operations.load_my_orders())
```