Bitcoin Forum

Bitcoin => Project Development => Topic started by: xavier on October 14, 2013, 07:12:22 AM



Title: [ann] Bitstamp PHP API
Post by: xavier on October 14, 2013, 07:12:22 AM
A bitstamp PHP API

available on https://github.com/willmoss/bitstamp-php-api

The intention is to make it easier to trade BTC on Bitstamp from PHP scripts.

Included methods:

bitstamp_query - Query any of the Bitstamp API methods

ticker - Get current Bitstamp ticker

eurusd - Get Bitstamp EUR/USD rate

buyBTC/sellBTC - Buy or Sell BTC at current market price

Example:

$bs = new Bitstamp("KEY","SECRET","CLIENT_ID");

print_r($bs->ticker()); // show bid,ask & other price stats

$bs->buyBTC(10); // buy 10 bitcoins at ask price

$bs->bitstamp_query("buy", array('amount'=>'34','price'=>'90')); // place a limit order to buy 34 bitcoin at $90

Directions:

To install, place in your PHP directory and include into your files.

When you construct the method, you include your API_KEY, SECRET and CLIENT_ID, that can be found on the Bitstamp website.

Next steps:
Add more specialized methods for creating limit orders
Add methods for withdrawal, deposit & redeeming bitstamp codes
Add support for Ripple trading

enjoy!


Title: Re: [ann] Bitstamp PHP API
Post by: Gimmoroy on October 18, 2013, 11:13:31 PM
Quote
buyBTC/sellBTC - Buy or Sell BTC at current market price

???  AFAIK Bitstamp API doesn't support instant orders. Some artificial limb?


Title: Re: [ann] Bitstamp PHP API
Post by: xavier on October 20, 2013, 02:16:09 AM
Quote
buyBTC/sellBTC - Buy or Sell BTC at current market price

???  AFAIK Bitstamp API doesn't support instant orders. Some artificial limb?

Hi -

You're right, it doesn't.

The buy/sell methods place a limit order at the current ask/bid price. It's assumed that this is as good as a market order.

When they add market order, we will happily incorporate this to the API :D

Cheers!



Title: Re: [ann] Bitstamp PHP API
Post by: akaman on December 23, 2013, 06:09:16 AM
Thank you for the convenience!

Your implementation seems, however, dated in parts.

The ticker() method does not work, perhaps because it cannot be accessed via API calls (there's a public address for it).

The eurusd() method also does not work, again because it is no longer (?) supported by the API.

Otherwise, the code seems kosher. I'll use it. BTC tip address?


Title: Re: [ann] Bitstamp PHP API
Post by: zertsekel on November 10, 2014, 10:26:15 AM
I get "Invalid nonce" error.
Did anyone actually use this project to access Bitstamp Private API?


Title: Re: [ann] Bitstamp PHP API
Post by: Smack That Ace on November 11, 2014, 11:01:45 PM
Very Useful if it works .

Will wait for updates.

Duke


Title: Re: [ann] Bitstamp PHP API
Post by: carlos on December 30, 2014, 07:23:58 PM
Dear Bitstamp!
We regularly fetch prices from various exchanges using standard https protocol. So its really sad for us that we have found that you are updating your http api ticker only each 15 or so seconds... Is there any chance that you will update it more often..? You are currently the only exception that publishes old prices. Update per second is industry standard currently. I'm pretty sure that any good IT professional can implement it for you. You can e.g. write the file each second and cache it for 1 second so that any requests in the 1 second time frame gets the cached version. I'm pretty sure it won't impact your server performance.
I'm sure many sites would love it..!
Thank you!
carlos

p.s. I know there is websocket version of api, we just prefer the standard https...