Stockpoint: API documentation
Api key preparation
Remove "key" parameter from array prepared for sending.
Sort array using keys in reverse order.
Сonvert the elements of the array into a string. Use dot as a separator.
Add user`s email specified during registration.
Supplement result with the user's secret key (can be found in the user's personal account). Get the hash of the finished string using the sha256 method.
An example of creating a key:
<?php
$email = "[email protected]";
$api_key = "f3zmvfzgewrg22_N7rQZL7XByWgY_wGyL";
$method = "buyLimit";
$post_data = [
"direction_id" = 1,
"count" = 10,
"value" = 2,
"user" = $email
];
krsort($post_data);
$post = implode(".", $post_data);
$post .= ".".$email;
$post_data["key"] = hash_hmac("sha256", $post, $api_key);
$post_data - array ready to send.
?>
returnCurrencies
Returns currencies list
Request with required key
and user
parameters. Parameters are string values. user
is user's email.
POST https://stockpoint.io/api/returnCurrencies
Example of response:
POST https://stockpoint.io/api/returnCurrencies HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "",
"status": 1,
"data": {
"USD": {
"id": "1",
"full_name": "American Dollar",
"filter": "1",
"sign": "$"
},
"BTC": {
"id": "2",
"full_name": "Bitcoin",
"filter": "2",
"sign": "BTC"
}
}
returnTools
Returns list of tools
Request with required key
and user
parameters. Parameters are string values. user
is user's email.
POST https://stockpoint.io/api/returnTools
Example of response:
POST https://stockpoint.io/api/returnTools HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "",
"status": 1,
"data": {
"BTC_USD": {
"id": "1",
"direction": "BTC / USD",
"price": "10 000.00",
"currency_2_id": "1",
"currency_1_id": "2",
"change24h": 0,
"volume": "20"
},
"USD_EUR": {
"id": "16",
"direction": "USD / EUR",
"price": "0.90",
"currency_2_id": "9",
"currency_1_id": "1",
"change24h": 0,
"volume": "78"
}
}
returnUserBalances
Returns user's balance.
Request with required key
and user
parameters. Parameters are string values. user
is user's email.
POST https://stockpoint.io/api/returnUserBalances
Example of response:
POST https://stockpoint.io/api/returnUserBalances HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "",
"status": 1,
"data": {
"USD": {
"assets": "USD",
"full_name": "American Dollar",
"sign": "$",
"balance": "60097.16",
"balance_in_order": 0
},
"RUB": {
"assets": "RUB",
"full_name": "RUB",
"sign": "₽",
"balance": "597.2",
"balance_in_order": 121
},
}
buyLimit
Placing a buy limit order on Stockpoint.
Request with required Int parameters:direction_id
, count
, value
and required String parameters key
and user
. user
is user's email.
POST https://stockpoint.io/api/buyLimit
Example of successful response:
POST https://stockpoint.io/api/buyLimit HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "Successful creation of a buy order",
"status": 1,
"data": {
"direction_id": 1,
"count": 300000000,
"value": 20000000000,
"user_account_id": 161,
"create_time": 1565099192,
"hash": "85446dE2d804692cc55064db3dA6f8e43bc98251"
}
}
sellLimit
Placing a limit sell order.
Request with required Int parameters:direction_id
, count
, value
and required String parameters key
and user
. user
is user's email.
POST https://stockpoint.io/api/sellLimit
Example of successful response:
POST https://stockpoint.io/api/sellLimit HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "Successful creation of a sell order",
"status": 1,
"data": {
"direction_id": 1,
"count": 300000000,
"value": 200100000000,
"user_account_id": 162,
"create_time": 1565099668,
"hash": "131574e37FC1e349d71eBB45500bc2BB81198425"
}
}
buyMarket
Placing a market buy order.
You can place two types of orders:
1. By amount of currency you want to buy
Is requested with required Int parameters:direction_id
, count
and required String parameters key
and user
parameters. user
is user's email.
2. By total sum, you want to spend on buying currency
Is requested with required Int parameters:direction_id
, amount
and required String parameters key
and user
parameters. user
is user's email.
POST https://stockpoint.io/api/buyMarket
Example of successful response:
POST https://stockpoint.io/api/buyMarket HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "Successful creation of a buy order",
"status": 1,
"data": {
"direction_id": 1,
"count": 300000000,
"value": 20000000000,
"user_account_id": 161,
"create_time": 1565099192,
"hash": "85446dE2d804692cc55064db3dA6f8e43bc98251"
}
}
sellMarket
Placing a market sell order.
You can place two types of orders:
1. By amount of currency you want to sell
Is requested with required Int parameters:direction_id
, count
and required String parameters key
and user
parameters. user
is user's email.
2. By total sum, you want to spend on selling currency
Is requested with required Int parameters:direction_id
, amount
and required String parameters key
and user
parameters. user
is user's email.
POST https://stockpoint.io/api/byMarket
Example of successful response:
POST https://stockpoint.io/api/byMarket HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "Successful creation of a sell order",
"status": 1,
"data": {
"direction_id": 1,
"count": 300000000,
"value": 200100000000,
"user_account_id": 162,
"create_time": 1565099668,
"hash": "131574e37FC1e349d71eBB45500bc2BB81198425"
}
}
orderBook
Returns best asks and bids
Is requested with required Int parameters:direction_id
, quantity
and required String parameters key
and user
parameters. user
is user's email.
POST https://stockpoint.io/api/orderBook
Example of response:
POST https://stockpoint.io/api/orderBook HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "",
"status": 1,
"data": {
"asks": [
{
"count": "100000000",
"value": "20500000000",
"direction_id": "1",
"create_time": "1564149844"
},
],
"bids": [
{
"count": "600000000",
"value": "20000000000",
"direction_id": "1",
"create_time": "1563970866"
}
]
}
}
closeOrder
Returns currencies list
Request with required hash
, key
and user
parameters. Parameters are string values. user
is user's email.
POST https://stockpoint.io/api/closeOrder
Example of response:
POST https://stockpoint.io/api/closeOrder HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"error": "Successful closing of the order.",
"status": 1,
"data": []
}