- Openclerk\Currencies\SecurityExchange
interface Openclerk\Currencies \ SecurityExchange
- All known implementing classes:
- SimpleSecurityExchange
A SecurityExchange is very similar to a currency Exchange, except instead of (currency, currency) rates, we have security rates, and each security can be denominated in a separate currency, and each SecurityExchange can define its own Securitys.
Method Summary
Name | Description |
---|---|
fetchAllRates(Logger $logger) | Return a list of rates for each supported market, e.g. array(array('currency' => 'usd', 'security' => 'asicminer', 'last_trade' => 1, 'bid' => 2), ...) |
fetchAsk($security, Logger $logger) |
Get the lowest price that a seller is willing to accept for trading the given security (also known as the buy price), or null if there is none. |
fetchBid($security, Logger $logger) |
Get the highest price that a buyer is willing to accept for trading the given security (also known as the sell price), or null if there is none. |
fetchLastTrade($security, Logger $logger) |
Get the last traded value for the given security, or null if there is none. |
fetchName($security, Logger $logger) |
Get the name of the given security, or null if there is none. |
fetchRates($security, Logger $logger) | Fetch all rates for a given security, returns an array of (last_trade, bid, ask, volume, available, security, currency). |
fetchSecurities(Logger $logger) | Fetch all securities that this security exchange currently supports. Currency codes are 3-character codes and must be globally unique. Security codes are any length and are unique only to a certain SecurityExchange. |
fetchSecurityCurrency($security, Logger $logger) | Get the 3-character code of the currency this security code is traded in. |
getCode() | |
getName() |
public function fetchAllRates(Logger $logger)
Return a list of rates for each supported market, e.g. array(array('currency' => 'usd', 'security' => 'asicminer', 'last_trade' => 1, 'bid' => 2), ...)
- See:
public function fetchAsk($security, Logger $logger)
Get the lowest price that a seller is willing to accept for trading the given security (also known as the buy price), or
null
if there is none.
public function fetchBid($security, Logger $logger)
Get the highest price that a buyer is willing to accept for trading the given security (also known as the sell price), or
null
if there is none.
public function fetchLastTrade($security, Logger $logger)
Get the last traded value for the given security, or
null
if there is none.
public function fetchName($security, Logger $logger)
Get the name of the given security, or
null
if there is none.
public function fetchRates($security, Logger $logger)
Fetch all rates for a given security, returns an array of (last_trade, bid, ask, volume, available, security, currency).
Some fields may not be present for a given exchange.
volume
is the last 24h volume.May also return additional fields, e.g. high/low/vwap
- Returns:
A list of rates for the currency pair- Throws:
SecurityExchangeRateException - if there are no rates for the given security
public function fetchSecurities(Logger $logger)
Fetch all securities that this security exchange currently supports. Currency codes are 3-character codes and must be globally unique. Security codes are any length and are unique only to a certain SecurityExchange.
- Returns:
an array of (security, currency)
public function fetchSecurityCurrency($security, Logger $logger)
Get the 3-character code of the currency this security code is traded in.
- Throws:
SecurityExchangeRateException - if this isn't a valid security code for this exchange
public function getCode()
- Returns:
a unique string representing this security exchange; must be lowercase and 1-32 characters
public function getName()
- Returns:
the full name of the security exchange