UNPKG

pmarket-cli

Version:
18 lines (17 loc) 692 B
import { PolymarketService } from "../services/polymarket.service"; import { Strategy } from "./strategy"; import { Side } from "@polymarket/clob-client"; export class SellStrategy implements Strategy { constructor(private polymarketService: PolymarketService) { } async execute(options: { sell: string[] }): Promise<void> { const token_id = options.sell[0]; const amountOfTokens = +options.sell[1]; const price = +options.sell[2]; try { const order = await this.polymarketService.marketOrder(token_id, Side.SELL, amountOfTokens, price); console.log(order); } catch (e) { console.error(e); } } }