Trading Bot
Control Logic
class TradeAgent {
constructor(key, spread, levels) {
}
async cancelAll() {
}
async runMarket(market) {
}
async runOnce() {
for (const m of this.quantaMarket) {
console.log("running for market ", m.ticker);
await this.runMarket(m)
}
}
async run() {
const self = this;
await sleep(1000);
await self.cancelAll();
setInterval(async () => {
await self.runOnce();
}, 8000)
}
}
new TradeAgent(process.env.KEY, 0.05, 5).run()Creating the Client
Connecting to the websocket
Retrieving account information
Send Limit Order
Signing and Broadcasting
Cancel order
Putting it together
Source code on Github
Last updated
Was this helpful?