Closed poly-rodr closed 1 year ago
let order = await clobClient.createMarketBuyOrder({ tokenID: YES, price: 0.6, amount: 100, }); console.log("Created Order", order); console.log("price", Number(order.makerAmount) / Number(order.takerAmount)); console.log();
Created Order { salt: '742226133259', maker: '...', signer: '...', taker: '...', tokenId: '1343197538147866997676250008839231694243646439454152539053893078719042421992', makerAmount: '100000000', takerAmount: '166666600', expiration: '0', nonce: '0', feeRateBps: '0', side: 0, signatureType: 0, signature: '...' } price 0.600000240000096
Price is not $0.6, it is a bit higher.
As we take the user's size and price, round to 2 decimals and multiply them, 6 decimals are enough to produce a set of maker and taker amount at the exact price.
let order = await clobClient.createOrder({ tokenID: "123", price: 0.11, size: 21.33, side: Side.BUY, feeRateBps: 100, nonce: 0, }); console.log("Created Order", order); console.log("price", Number(order.makerAmount) / Number(order.takerAmount)); console.log();
Created Order { salt: '183925133846', maker: '...', signer: '...', taker: '...', tokenId: '1343197538147866997676250008839231694243646439454152539053893078719042421992', makerAmount: '2346300', takerAmount: '21330000', expiration: '0', nonce: '0', feeRateBps: '100', side: 0, signatureType: 0, signature: '...' } price 0.11
Market orders
Generation
Order generated
Price is not $0.6, it is a bit higher.
Limit order
Generation
As we take the user's size and price, round to 2 decimals and multiply them, 6 decimals are enough to produce a set of maker and taker amount at the exact price.
Order generated