Bitcoin Forum
April 23, 2024, 11:27:40 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [ann] Bitstamp PHP API  (Read 2865 times)
xavier (OP)
Sr. Member
****
Offline Offline

Activity: 260
Merit: 250


View Profile
October 14, 2013, 07:12:22 AM
 #1

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!
The Bitcoin network protocol was designed to be extremely flexible. It can be used to create timed transactions, escrow transactions, multi-signature transactions, etc. The current features of the client only hint at what will be possible in the future.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713871660
Hero Member
*
Offline Offline

Posts: 1713871660

View Profile Personal Message (Offline)

Ignore
1713871660
Reply with quote  #2

1713871660
Report to moderator
1713871660
Hero Member
*
Offline Offline

Posts: 1713871660

View Profile Personal Message (Offline)

Ignore
1713871660
Reply with quote  #2

1713871660
Report to moderator
Gimmoroy
Legendary
*
Offline Offline

Activity: 1372
Merit: 1000



View Profile
October 18, 2013, 11:13:31 PM
 #2

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

Huh  AFAIK Bitstamp API doesn't support instant orders. Some artificial limb?
xavier (OP)
Sr. Member
****
Offline Offline

Activity: 260
Merit: 250


View Profile
October 20, 2013, 02:16:09 AM
 #3

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

Huh  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 Cheesy

Cheers!

akaman
Sr. Member
****
Offline Offline

Activity: 247
Merit: 250


View Profile
December 23, 2013, 06:09:16 AM
 #4

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?
zertsekel
Newbie
*
Offline Offline

Activity: 18
Merit: 0


View Profile
November 10, 2014, 10:26:15 AM
 #5

I get "Invalid nonce" error.
Did anyone actually use this project to access Bitstamp Private API?
Smack That Ace
Legendary
*
Offline Offline

Activity: 1764
Merit: 1094


Eid Mubarak


View Profile
November 11, 2014, 11:01:45 PM
 #6

Very Useful if it works .

Will wait for updates.

Duke

carlos
Member
**
Offline Offline

Activity: 107
Merit: 10


View Profile
December 30, 2014, 07:23:58 PM
 #7

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...
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!