Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to make an order with the market.indexPrice ? #210

Open
slashbinslashnoname opened this issue Nov 16, 2022 · 1 comment
Open

Unable to make an order with the market.indexPrice ? #210

slashbinslashnoname opened this issue Nov 16, 2022 · 1 comment

Comments

@slashbinslashnoname
Copy link

slashbinslashnoname commented Nov 16, 2022

How to get the price for long or short ?

To pass an order i'm using getMarket.indexPrice but order cannot pass without using a multiplier (0.1%)


	const accounts = await getAccounts();
	console.log(accounts);

	const market = await getMarket("MATIC-USD");
	console.log(market);

then

const order = await placeOrder(
	"MATIC-USD",
	"BUY",
	"MARKET",
	"FOK",
	false,
	parseInt(accounts[0].freeCollateral / market.indexPrice).toString(),
	(market.indexPrice * 1.002).toFixed(size),
	plus30m
);
console.log(order);

What can I use as price to a market order ?

Transaction is systematically expired

@kungla
Copy link

kungla commented Dec 20, 2022

Probably because it can round it down below market price. You can try something like that, it worked for me:
Math.round(market.indexPrice * 1.001) + 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants