Skip to content

Commit

Permalink
Fixing IOC order example
Browse files Browse the repository at this point in the history
  • Loading branch information
poly-rodr committed Jun 24, 2022
1 parent 9381a1b commit c7cd5e0
Showing 1 changed file with 4 additions and 42 deletions.
46 changes: 4 additions & 42 deletions examples/marketOrderIOC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,62 +21,24 @@ async function main() {

const NO_TOKEN = "1343197538147866997676250008839231694243646439454152539053893078719042421992"

await clobClient.postOrder(await clobClient.createLimitOrder({
tokenID: NO_TOKEN,
price: 0.5,
side: Side.BUY,
size: 100,
}));
await clobClient.postOrder(await clobClient.createLimitOrder({
tokenID: NO_TOKEN,
price: 0.5,
side: Side.BUY,
size: 100,
}));
await clobClient.postOrder(await clobClient.createLimitOrder({
tokenID: NO_TOKEN,
price: 0.4,
side: Side.BUY,
size: 100,
size: 200,
}));
await clobClient.postOrder(await clobClient.createLimitOrder({
tokenID: NO_TOKEN,
price: 0.4,
price: 0.45,
side: Side.BUY,
size: 100,
size: 250,
}));

// FOK, error expected
const fok_order = await clobClient.createMarketOrder({
tokenID: NO_TOKEN,
side: Side.SELL,
size: 500,
timeInForce: "FOK"
})
console.log(`FOK market order: `);
console.log(fok_order);

console.log(await clobClient.postOrder(fok_order));

// Create a IOC market sell that will fail because the slippage check
const ioc_slippage_check_order = await clobClient.createMarketOrder({
tokenID: NO_TOKEN,
side: Side.SELL,
size: 500,
worstPrice: 0.5,
timeInForce: "IOC"
});
console.log(`IOC market order: `);
console.log(ioc_slippage_check_order);

console.log(await clobClient.postOrder(ioc_slippage_check_order));


// Create a IOC market sell that will match
const ioc_order = await clobClient.createMarketOrder({
tokenID: NO_TOKEN,
side: Side.SELL,
size: 250,
size: 500,
worstPrice: 0.45,
timeInForce: "IOC"
});
Expand Down

0 comments on commit c7cd5e0

Please sign in to comment.