<p>What was your purchase amount set at? 0.03120000??</p>

<p>It would appear that you tried to buy at 0.03120000</p>

<p>however as there was a sell order already placed at 0.03116670 you filled that order first, then completed your buy with the rest of the amount at the 0.03120000</p>

CC BY-SA 3.0
2018-04-24T08:57:21.467Z
1,77 but it bought 1,79 amount of currency. So your answer helped me a lot, thanks. In the order book didn't be offer to complete exactly that amount. I bought aproximetely amount.
mrberner
CC BY-SA 3.0
2018-04-24T10:24:14.153Z
Another question is that which price should be chosen as opening price? if my offer would have 3 resultingTrades, I can each amount add together and have control over it. But I have three diffrent rates.
mrberner
CC BY-SA 3.0
2018-04-24T10:42:08.413Z
Your opening price is set by you when u make the buy order at that amount. If someone posts a lower offer you will fill these orders first, but this will not be seen as an opening price.  I believe you only have control over the amount u specify to buy at (ie your opening price)
Fuzzybear
CC BY-SA 3.0
2018-04-24T11:26:10.980Z
hmm, I set opening price through passing it to function from this wrapper [here](https://github.com/s4w3d0ff/python-poloniex)
There is `buy(amount, rate, orderType)`
Of course I can control amount, and opening price from resultingTrades, but there will be different rates depend on how much trade will fill my entire amount.
Rate from response on successful trade is necessary to achieve provided strategy. But you said that I only have control over amount, true because not always my rate and amount will be available in order book.
mrberner
CC BY-SA 3.0
2018-04-23T14:33:42.343Z
2018-04-23T14:33:42.343Z
Fuzzybear
<p>Hi I have a question about buy method. Recently I received successful message from Poloniex
I run once buy order method with option immediateOrCancel.
I get two trades instead of the expected one.</p>

<pre><code>{'orderNumber': '269159954730', 'amountUnfilled': '0.00000000', 'resultingTrades': [{'total': '0.00323034', 'tradeID': '16775174', 'amount': '0.10364748', 'rate': '0.03116670', 'date': '2018-04-22 10:59:11', 'type': 'buy'}, {'total': '0.05271018', 'tradeID': '16775175', 'amount': '1.68942915', 'rate': '0.03120000', 'date': '2018-04-22 10:59:11', 'type': 'buy'}]}
</code></pre>

<p>Could someone help me with that or say why it's happend?</p>

<api><currencies>
How to buy with Poloniex API?
mrberner
# How to buy with Poloniex API?

(Asked by: username_0 on 2018-04-23)

Hi I have a question about buy method. Recently I received successful message from Poloniex
I run once buy order method with option immediateOrCancel.
I get two trades instead of the expected one.

```
{'orderNumber': '269159954730', 'amountUnfilled': '0.00000000', 'resultingTrades': [{'total': '0.00323034', 'tradeID': '16775174', 'amount': '0.10364748', 'rate': '0.03116670', 'date': '2018-04-22 10:59:11', 'type': 'buy'}, {'total': '0.05271018', 'tradeID': '16775175', 'amount': '1.68942915', 'rate': '0.03120000', 'date': '2018-04-22 10:59:11', 'type': 'buy'}]}

```

Could someone help me with that or say why it's happend?

**Tags:** api, currencies


---

## 1 answers

### Answer by username_1 on 2018-04-23. Score: 1

What was your purchase amount set at? 0.03120000??

It would appear that you tried to buy at 0.03120000

however as there was a sell order already placed at 0.03116670 you filled that order first, then completed your buy with the rest of the amount at the 0.03120000

> **Comments:**
> **username_0**: 1,77 but it bought 1,79 amount of currency. So your answer helped me a lot, thanks. In the order book didn't be offer to complete exactly that amount. I bought aproximetely amount.  
> **username_0**: Another question is that which price should be chosen as opening price? if my offer would have 3 resultingTrades, I can each amount add together and have control over it. But I have three diffrent rates.  
> **username_1**: Your opening price is set by you when u make the buy order at that amount. If someone posts a lower offer you will fill these orders first, but this will not be seen as an opening price.  I believe you only have control over the amount u specify to buy at (ie your opening price)  
> **username_0**: hmm, I set opening price through passing it to function from this wrapper [here](https://github.com/s4w3d0ff/python-poloniex) There is `buy(amount, rate, orderType)` Of course I can control amount, and opening price from resultingTrades, but there will be different rates depend on how much trade will fill my entire amount. Rate from response on successful trade is necessary to achieve provided strategy. But you said that I only have control over amount, true because not always my rate and amount will be available in order book.  

---

