@polymarket/clob-client
v4.11.0
Published
Typescript client for Polymarket's CLOB
Downloads
6,046
Readme
Polymarket CLOB Client
Typescript client for the Polymarket CLOB
Usage
const host = process.env.CLOB_API_URL || "http://localhost:8080";
const signer = new ethers.Wallet(`${process.env.PK}`);
const creds: ApiKeyCreds = {
key: `${process.env.CLOB_API_KEY}`,
secret: `${process.env.CLOB_SECRET}`,
passphrase: `${process.env.CLOB_PASS_PHRASE}`,
};
// Initialize the clob client
// NOTE: the signer must be approved on the CTFExchange contract
const clobClient = new ClobClient(host, signer, creds);
// Create a buy order for 100 NO for 0.50c
const order = await clobClient.createOrder({
tokenId: "52114319501245915516055106046884209969926127482827954674443846427813813222426",
price: 0.5,
side: Side.Buy,
size: 100,
feeRateBps: "0",
});
// Send it to the server
const resp = await clobClient.postOrder(order);
See examples for more information