StarOS: market
Comes with the modem; the robot must be online. Prices are whole drops per unit, as the turn began. See the overview.
| function | does |
|---|---|
market.best_bid(item) |
highest open limit buy, or None |
market.best_ask(item) |
lowest open limit sell, or None |
market.last(item) |
last traded price, or None |
market.sell(item, quantity, price=None, warehouse=None) |
record a sell; None price is a market order |
market.buy(item, quantity, price=None, warehouse=None) |
record a buy |
market.cancel(order_id) |
record a cancel |
market.orders() |
your open orders: id, side, item, quantity, remaining, price, warehouse, standing |
- Orders act for the owner and are placed at the end of the turn. A refusal is a
market_failedevent. - At most 5 orders and cancels a turn together. Each order placed costs 0.001 MT; a refused one costs nothing.
warehouseis a structure id: sell from it, or have the goods delivered to it.Nonemeans the spacecraft hold.
def tick():
ask = market.best_ask("lidar")
if ask != None:
robot.log("lidar for sale at " + str(ask) + " drops")