dev-master
9999999-dev https://github.com/dirkolbrich/stockfighter-phpA wrapper for the stockfighter api
MIT
The Requires
The Development Requires
by Dirk Olbrich
Wallogit.com
2017 © Pedro Peláez
A wrapper for the stockfighter api
My take on an API wrapper for stockfighter.io, (*1)
It utilizes two base classes:, (*2)
StockfighterApi.php, which is the minimal wrapper around the REST API of stockfighter.io. It returns the raw json response. See the stockfighter API documentation. You can use this base class for you own implemantation., (*3)
Stockfighter.php is the actual game wrapper around the API. It depends on StockfighterApi.php. The system keeps track of your orders and your account with a list of the transactions, the inventory and your balance., (*4)
Install via composer:, (*5)
"require": {
"dirkolbrich/stockfighter": "*"
}
To only use the base API class. Provide your API key during instantiation:, (*6)
use DirkOlbrich\Stockfighter\StockfighterApi; $apiKey = "your API key provided by stockfighter.io"; $api = new StockfighterApi($apiKey);
The followings functions are available:
- heartbeat() - check if the REST API is up
- venueHeartbeat($venue) - check if the venue is up
- venues() - get all available venues
- stocks($venue) - get all available stocks on a specific venue
- orders($account, $venue) - get all orders on a specific venue
- stockOrders($account, $venue, $stock) - get all orders for a specific stock on a specific venue
- orderbook($venue, $stock) - get the orderbook of a specific stock on a specific venue
- quote($venue, $stock) - get the last quote of a specific stock on a specific venue
- order($venue, $stock, $order) - place an order, the $orderparam must be a string specified by the REST API
- cancel($venue, $stock, $orderId) - cancel an order
- orderStatus($venue, $stock, $orderId) - get the status of an order, (*7)
Requests to the Game Master are available as well (self-explanatory):
- levels() - not implemented by the REST API yet
- start($level)
- restart($instanceId)
- stop($instanceId)
- resume($instanceId)
- levelStatus($instanceId) - get the status of the level, (*8)
Or use the Stockfighter system:, (*9)
use DirkOlbrich\Stockfighter\Stockfighter; $apiKey = "your API key provided by stockfighter.io"; $sf = new Stockfighter($apiKey);
So far, it uses these dependencies., (*10)
"require": {
"guzzlehttp/guzzle": "~6.0",
}
A wrapper for the stockfighter api
MIT