<p>In a normal exchange, you have an order book of buys and sells. Usually, they don't cross over, that is, if the highest buy is 219, the lowest sell will be higher than that.</p>

<p>What you're doing is buying at market (aka market order) so any buys you do simply match the lowest sell and any sells you do simply match the highest buy. Whenever the two cross, they are simply filled by each other, so the gap will be there 99% of the time.</p>

<p>What you can do if you want to avoid this is to use limit orders. Generally, though, you have to wait for them to fill as you need price movement in order for that to happen.</p>

CC BY-SA 3.0
2015-02-09T22:27:01.740Z
So basically there's no way to have a "market order based" profitable bot?
Jmlevick
CC BY-SA 3.0
2015-02-09T22:31:27.957Z
Of course you can make one. You just need a strategy that sells higher than when you buy based on price movements. It's just that the prices are stacked in a way as to make that hard.
Jimmy Song
CC BY-SA 3.0
2015-02-09T22:40:55.937Z
Now I know what to do... Thanks! after doing some research and reading your comment I understood the problem well, marking this answer as accepted.
Jmlevick
CC BY-SA 3.0
2015-02-09T21:00:49.027Z
2015-02-09T21:00:49.027Z
Jimmy Song
<p>Recently I recieved <strong>$500 USD</strong> in credits for trading with <strong>Coinsetter</strong>, a NYC based bitcoin exchange, so I decided to use them and coded a bitcoin trading bot for myself (never have done such thing before); The problem I'm having right now is that my bot seem to be "buying higher, selling lower" and I don't know why, you see:</p>

<p>If I go to the bot's logs, I get something like this:</p>

<p><img src="https://i.sstatic.net/mhyDi.png" alt="bot_log"></p>

<p>The prices shown there are the prices at which the <strong>market order</strong> is requested, (giving an invalid price as an argument for the API request supposedly results in a failed order, so I request the <strong>live price</strong> first from coinsetter <strong>twice</strong> before I do a buy/sell operation); BUT if we go to the coinsetter transaction history we have this instead:</p>

<p><img src="https://i.sstatic.net/6v9lZ.png" alt="coinseter_history"></p>

<p>So everytime I do a BUY I pump up the market, and every time I do a sell I dump it, how can this be avoided? I'd prefer buying at the lower prices and selling at the higher ones.</p>

<p>P.S. Another question would be: What you think is the real price at which I'm buying/selling? The price I REQUEST or the price coinsetter tells me at it's history?</p>

<p>Thanks for your advice.</p>

CC BY-SA 4.0
2021-06-18T14:56:11.607Z
It seems inconceivable that trading a couple of hundred bucks you are affecting the market price on any sensible exchange.
Mr. Boy
<exchanges><trading><bots>
How to avoid price pumps & dumps when trading with bot?
Jmlevick
# How to avoid price pumps & dumps when trading with bot?

(Asked by: username_0 on 2015-02-09)

Recently I recieved **$500 USD** in credits for trading with **Coinsetter**, a NYC based bitcoin exchange, so I decided to use them and coded a bitcoin trading bot for myself (never have done such thing before); The problem I'm having right now is that my bot seem to be "buying higher, selling lower" and I don't know why, you see:

If I go to the bot's logs, I get something like this:

![bot_log](https://i.sstatic.net/mhyDi.png)

The prices shown there are the prices at which the **market order** is requested, (giving an invalid price as an argument for the API request supposedly results in a failed order, so I request the **live price** first from coinsetter **twice** before I do a buy/sell operation); BUT if we go to the coinsetter transaction history we have this instead:

![coinseter_history](https://i.sstatic.net/6v9lZ.png)

So everytime I do a BUY I pump up the market, and every time I do a sell I dump it, how can this be avoided? I'd prefer buying at the lower prices and selling at the higher ones.

P.S. Another question would be: What you think is the real price at which I'm buying/selling? The price I REQUEST or the price coinsetter tells me at it's history?

Thanks for your advice.

**Tags:** exchanges, trading, bots

> **Comments:**
> **username_1**: It seems inconceivable that trading a couple of hundred bucks you are affecting the market price on any sensible exchange.  

---

## 1 answers

### Answer by username_2 on 2015-02-09. Score: 2 | Accepted answer

In a normal exchange, you have an order book of buys and sells. Usually, they don't cross over, that is, if the highest buy is 219, the lowest sell will be higher than that.

What you're doing is buying at market (aka market order) so any buys you do simply match the lowest sell and any sells you do simply match the highest buy. Whenever the two cross, they are simply filled by each other, so the gap will be there 99% of the time.

What you can do if you want to avoid this is to use limit orders. Generally, though, you have to wait for them to fill as you need price movement in order for that to happen.

> **Comments:**
> **username_0**: So basically there's no way to have a "market order based" profitable bot?  
> **username_2**: Of course you can make one. You just need a strategy that sells higher than when you buy based on price movements. It's just that the prices are stacked in a way as to make that hard.  
> **username_0**: Now I know what to do... Thanks! after doing some research and reading your comment I understood the problem well, marking this answer as accepted.  

---

