Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Lykegenes on February 22, 2014, 08:06:22 PM



Title: Using BTC-e API to place orders
Post by: Lykegenes on February 22, 2014, 08:06:22 PM
Hi!

I'm trying to figure out exactly how the BTCe API works. What i want to do is to make sure my trade is executed right away.

Let's say i have 1000$ and i want to buy all the BTC i can. There is 1 BTC for sale @ 500$, and 5 BTC @ 501$. Which one of these scenarios is what will happen?
1) Can i just tell the API to buy 1 BTC @ 1000$, or 0.1@10000? (and in reality, it will buy 1@500, and the rest @501, or whatever price is the lowest?)
2) Or do i have to make two orders? (one @500, one @501)? What if someone sells @500.5? What if someone buys these coins @500 before i place my order?


Basically, i just don't want to have to handle partially filled orders. Option 1 is the easiest, but i want to be sure it can work this way  ;)

Thanks!


Title: Re: Using BTC-e API to place orders
Post by: immerzl on February 28, 2014, 09:07:25 PM
You will always buy the "cheapest" sales first. So in your example, if you give an order to buy 6 BTC @ 510$, you will get 1 BTC @ 500$ and 5 BTC @ 501. So you will pay 3005$ in total for 6 BTC.