Ex-Master Core
Usage
let exchange = new Exchange(client, dashboard);
async function update(): Promise<void> {
await exchange.tick();
let descriptors = ...;
await exchange.update(descriptors);
}
Order update procedure
Active (assumed) orders are stored locally.
- Sort order descriptors based on their priority
- Cancel order with the same label and update calculated money/stock.
- Check money/stock:
- If the the remaining money/stock is sufficient for the updated order, create the new order.
- Else if there are active orders with lower priority, cancel the order with closest lower priority and do this step again.
- Else throw an error or print a warning message.
Priority
Order priority
Cancel order priority