- Openclerk\Currencies\SimpleExchange
- Exchange\Bitstamp
class Exchange \ Bitstamp
- All implemented interfaces:
- Exchange, ExchangeInformation
Implements some basic implementations of an Exchange. Assumes there is a single API call that can be used to list all exchanges and get all rates - #fetchAllRates(). (from SimpleExchange)
An Exchange does not provide conversion functionality; this can be done naively with #getLastTrade.
This is the base interface; other interfaces will provide additional functionality as necessary. (from Exchange)
Method Summary
Name | Description |
---|---|
fetchAllRates(Logger $logger) | Return a list of rates for each supported market, e.g. array(array('currency1' => 'usd', 'currency2' => 'btc', 'last_trade' => 1, 'bid' => 2), ...) |
getCode() | |
getName() | |
getURL() |
Inherited Method Summary
Name | Description |
---|---|
fetchAsk($currency1, $currency2, Logger $logger) |
Get the lowest price that a seller is willing to accept for trading the given pair (also known as the buy price), or null if there is none. (from SimpleExchange)
|
fetchBid($currency1, $currency2, Logger $logger) |
Get the highest price that a buyer is willing to accept for trading the given pair (also known as the sell price), or null if there is none. (from SimpleExchange)
|
fetchLastTrade($currency1, $currency2, Logger $logger) |
Get the last traded value for the given currency pair, or null if there is none. (from SimpleExchange)
|
fetchMarkets(Logger $logger) | Each of these pairs represents a market, e.g. 'btc', 'usd' These pairs can be in any (a, b) order, because we should (in theory) be able to swap last/bid/ask as necessary. (from SimpleExchange) |
fetchRates($currency1, $currency2, Logger $logger) |
Fetch all rates for a given currency, returns an array of (last_trade, bid, ask, volume). Some fields may not be present for a given exchange. volume is the last 24h volume. May also return additional fields. (from SimpleExchange)
|
throttle(Logger $logger) |
This allows all exchanges to optionally throttle multiple repeated requests based on a runtime configuration value. The throttle time is selected from either the exchanges_NAME_throttle or exchanges_throttle config values, or three seconds; which is the time in seconds to wait between repeated requests. (from SimpleExchange)
|
public function fetchAllRates(Logger $logger)
Return a list of rates for each supported market, e.g. array(array('currency1' => 'usd', 'currency2' => 'btc', 'last_trade' => 1, 'bid' => 2), ...) (from fetchAllRates)
- See:
public function getCode()
- Returns:
a unique string representing this exchange; must be lowercase and 1-32 characters
public function getName()
- Returns:
the full name of the exchange
public function getURL()
- Returns:
the URL of the exchange, ornull