Methods summary
public
|
#
__construct( string $apiKey, string $apiSecret )
BinanceApiContainer constructor.
BinanceApiContainer constructor.
Parameters
- $apiKey
- The API key from Binance.
- $apiSecret
- The API secret from Binance.
|
public
string
|
|
public
string
|
|
public
Psr\Http\Message\ResponseInterface
|
#
ping( )
Test connectivity to the Rest API.
Test connectivity to the Rest API.
Returns
Psr\Http\Message\ResponseInterface
Link
|
public
Psr\Http\Message\ResponseInterface
|
#
getServerTime( )
Test connectivity to the Rest API and get the current server time.
Test connectivity to the Rest API and get the current server time.
Returns
Psr\Http\Message\ResponseInterface
Link
|
public
Psr\Http\Message\ResponseInterface
|
#
getOrderBook( array $params )
Returns the order book for the market.
Returns the order book for the market.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "symbol" The symbol to search for. (required)
int "limit" The number of results returned from the query. (max value 100)
|
public
Psr\Http\Message\ResponseInterface
|
#
getAggTrades( array $params )
Returns compressed, aggregate trades.
Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
Returns compressed, aggregate trades.
Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Throws
Exception
Link
Option
string "symbol" The symbol to search for. (required)
int "fromId" ID to get aggregate trades from INCLUSIVE.
int "startTime" Timestamp in milliseconds to get aggregate trades from INCLUSIVE.
int "endTime" Timestamp in milliseconds to get aggregate trades until INCLUSIVE.
int "limit" The number of results returned from the query. (max value 500)
|
public
Psr\Http\Message\ResponseInterface
|
#
getKlines( array $params )
Returns kline/candlesticks bars for a symbol.
Klines are uniquely identified by their open time.
Returns kline/candlesticks bars for a symbol.
Klines are uniquely identified by their open time.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "symbol" The symbol to search for. (required)
string "interval" Kline intervals enum. (required)
int "startTime" Timestamp in milliseconds to get aggregate trades from INCLUSIVE.
int "endTime" Timestamp in milliseconds to get aggregate trades until INCLUSIVE.
int "limit" The number of results returned from the query. (max value 500)
|
public
Psr\Http\Message\ResponseInterface
|
#
getTwentyFourTickerPrice( array $params )
Returns 24 hour price change statistics.
Returns 24 hour price change statistics.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "symbol" The symbol to search for. (required)
|
public
Psr\Http\Message\ResponseInterface
|
#
getTickers( )
Returns latest price for all symbols.
Returns latest price for all symbols.
Returns
Psr\Http\Message\ResponseInterface
Link
|
public
Psr\Http\Message\ResponseInterface
|
#
getBookTickers( )
Returns price/qty on the order book for all symbols.
Returns price/qty on the order book for all symbols.
Returns
Psr\Http\Message\ResponseInterface
Link
|
public
Psr\Http\Message\ResponseInterface
|
#
postOrder( array $params )
Send in a new order.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "symbol" The symbol to search for. (required)
string "side" Order side enum. (required)
string "type" Order type enum. (required)
string "timeInForce" Time in force enum. (required)
double "quantity" Desired quantity. (required)
double "price" Asking price. (required)
string "newClientOrderId" A unique id for the order. Automatically generated by default.
double "stopPrice" Used with STOP orders.
double "icebergQty" Used with icebergOrders.
int "timestamp" A UNIX timestamp. (required)
|
public
Psr\Http\Message\ResponseInterface
|
#
postOrderTest( array $params )
Test new order creation and signature/recvWindow long.
Creates and validates a new order but does not send it into the matching engine.
Test new order creation and signature/recvWindow long.
Creates and validates a new order but does not send it into the matching engine.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "symbol" The symbol to search for. (required)
string "side" Order side enum. (required)
string "type" Order type enum. (required)
string "timeInForce" Time in force enum. (required)
double "quantity" Desired quantity. (required)
double "price" Asking price. (required)
string "newClientOrderId" A unique id for the order. Automatically generated by default.
double "stopPrice" Used with STOP orders.
double "icebergQty" Used with icebergOrders.
int "timestamp" A UNIX timestamp. (required)
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
|
public
Psr\Http\Message\ResponseInterface
|
#
getOrder( array $params )
Check an order's status.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Throws
Exception
Link
Option
string "symbol" The symbol to search for. (required)
int "orderId" The order ID.
string "origClientOrderId" The original client order ID.
int "timestamp" A UNIX timestamp. (required)
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
|
public
Psr\Http\Message\ResponseInterface
|
#
cancelOrder( array $params )
Cancel an active order.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Throws
Exception
Link
Option
string "symbol" The symbol to search for. (required)
int "orderId" The order ID.
string "origClientOrderId" The original client order ID.
string "newClientOrderId" Used to uniquely identify this cancel. Automatically generated by default.
int "timestamp" A UNIX timestamp. (required)
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
|
public
Psr\Http\Message\ResponseInterface
|
#
getOpenOrders( array $params )
Returns all open orders on a symbol.
Returns all open orders on a symbol.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "symbol" The symbol to search for. (required)
int "timestamp" A UNIX timestamp. (required)
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
|
public
Psr\Http\Message\ResponseInterface
|
#
getOrders( array $params )
Returns all account orders; active, canceled, or filled.
Returns all account orders; active, canceled, or filled.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "symbol" The symbol to search for. (required)
int "orderId" The order ID.
int "timestamp" A UNIX timestamp. (required)
int "limit" The request limit, max value 500, min value 1.
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
|
public
Psr\Http\Message\ResponseInterface
|
#
getAccount( array $params )
Returns current account information.
Returns current account information.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
int "timestamp" A UNIX timestamp. (required)
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
|
public
Psr\Http\Message\ResponseInterface
|
#
getTrades( array $params )
Returns trades for a specific account and symbol.
Returns trades for a specific account and symbol.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "symbol" The symbol to search for. (required)
int "fromId" The order ID.
int "timestamp" A UNIX timestamp. (required)
int "limit" The number of results returned from the query. (max value 500)
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
|
public
Psr\Http\Message\ResponseInterface
|
#
withdraw( array $params )
Submit a withdraw request.
Submit a withdraw request.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "asset" The requested asset. (required)
string "address" The request address. (required)
double "amount" The request amount. (required)
string "name" Description of the address.
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
int "timestamp" A UNIX timestamp. (required)
|
public
Psr\Http\Message\ResponseInterface
|
#
getDepositHistory( array $params )
Fetch deposit history.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "asset" The requested asset.
enum "status" Enum as WAPI_DEPOSIT_STATUS_*.
int "startTime" Timestamp in milliseconds.
int "endTime" Timestamp in milliseconds.
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
int "timestamp" A UNIX timestamp. (required)
|
public
Psr\Http\Message\ResponseInterface
|
#
getWithdrawHistory( array $params )
Fetch withdraw history.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "asset" The requested asset.
enum "status" Enum as WAPI_WITHDRAW_STATUS_*.
int "startTime" Timestamp in milliseconds.
int "endTime" Timestamp in milliseconds.
int "recvWindow" The number of milliseconds after timestamp the request is valid for.
int "timestamp" A UNIX timestamp. (required)
|
public
Psr\Http\Message\ResponseInterface
|
#
startUserDataStream( )
Start a new user data stream.
Start a new user data stream.
Returns
Psr\Http\Message\ResponseInterface
Link
|
public
Psr\Http\Message\ResponseInterface
|
#
keepaliveUserDataStream( array $params )
PING a user data stream to prevent a time out.
PING a user data stream to prevent a time out.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "listenKey" The key for the user's data steam. (required)
|
public
Psr\Http\Message\ResponseInterface
|
#
closeUserDataStream( array $params )
Close out a user data stream.
Close out a user data stream.
Parameters
- $params
- The data to send.
Returns
Psr\Http\Message\ResponseInterface
Link
Option
string "listenKey" The key for the user's data steam. (required)
|
public
|
#
depthWebsocket( array $params )
Websocket url for depth endpoint.
Websocket url for depth endpoint.
Parameters
- $params
- The data to send.
Link
Option
string "symbol" The symbol to search for. (required)
|
public
|
#
klineWebsocket( array $params )
Websocket url for kline endpoint.
Websocket url for kline endpoint.
Parameters
- $params
- The data to send.
Link
Option
string "symbol" The symbol to search for. (required)
string "interval" Kline intervals enum. (required)
|
public
|
#
tradesWebsocket( array $params )
Websocket url for trades endpoint.
Websocket url for trades endpoint.
Parameters
- $params
- The data to send.
Link
Option
string "symbol" The symbol to search for. (required)
|
public
|
#
userWebsocket( array $params )
Websocket url for user data endpoint.
Websocket url for user data endpoint.
Parameters
- $params
- The data to send.
Link
Option
string "listenKey" The key for the user's data steam. (required)
|