Bitcoin Forum

Economy => Service Discussion => Topic started by: hail on February 25, 2014, 12:48:11 PM



Title: Help with Bitstamp API
Post by: hail on February 25, 2014, 12:48:11 PM
i found bitstamp live trade stream api in this forum post,

my code:

Code:
var pusher = new Pusher('de504dc5763aeef9ff52');

var trades_channel = pusher.subscribe('live_trades');
trades_channel.bind('trade',  function(data) {
   console.debug(data);

and it is works,
it returns trade data like this:

Code:
amount: 0.30628
id: 3764896
price: 492.23


but it didn't return trade type. how to get?


Title: Re: Help with Bitstamp API
Post by: spin on February 25, 2014, 02:32:45 PM
Never used this but doesn't a trade go both ways.  It is both an ask and a bid?


Title: Re: Help with Bitstamp API
Post by: hail on February 25, 2014, 03:27:19 PM
just want know the trade is bid or ask.


Title: Re: Help with Bitstamp API
Post by: spin on February 25, 2014, 03:49:57 PM
That's my point.  I'm assuming this feed gives you executed trades?  If so each trade is matching of a bid and ask at a volume and price.  So it's both, or am I misinterpreting something?


Title: Re: Help with Bitstamp API
Post by: hail on February 25, 2014, 04:54:06 PM
don't troll!!!!


if someone buy bitcoin at given price, then the trade type is bid!!! otherwise ask!




Title: Re: Help with Bitstamp API
Post by: spin on February 25, 2014, 09:24:00 PM
If someone bought at a price then someone else sold at the same price.  Bitstamp matches buy and sell orders to create trades.  Thus each trade consists of a matched buy and sell order (or parts thereof).  Thus your trade doesn't tell you if it was a bid or ask because it's a matched pair.

I won't post again because you ask for help yet you won't take it when it's given...


Title: Re: Help with Bitstamp API
Post by: hail on February 26, 2014, 05:57:01 AM
If someone bought at a price then someone else sold at the same price.  Bitstamp matches buy and sell orders to create trades.  Thus each trade consists of a matched buy and sell order (or parts thereof).  Thus your trade doesn't tell you if it was a bid or ask because it's a matched pair.

I won't post again because you ask for help yet you won't take it when it's given...
it is different because the sequence, someone first place an order, then someone buy from the order list,it is called a bid.