Перейти к содержимому

интернет-биржа

Форумы


barlone

Регистрация: 14 сен 2015
Не в сети Активность: июн 19 2023 09:32
*****

Мои сообщения

В теме: Предложения по совершенствованию INDX

08 июня 2018 - 13:45

Звуки, пуки... :) Обычное оповещение в кипер сделать (по желанию, естественно), все очень просто. Вот оповещение о входе же сделали.

Так а верхняя галка в настройках - это не оно?


В теме: Too many requests

06 июня 2018 - 07:12

Вставил паузы по секунде после каждого запроса, все равно регулярно выскакивает Too many requests


В теме: INDX API. Програмные интерфейсы INDX

05 марта 2018 - 16:16

Строку запроса вставил как константу, полученную на стринице https://api.indx.ru/...les/balance.htm

 

Вы в строке запроса что-то потеряли. Она начинается с символа {


В теме: INDX API. Програмные интерфейсы INDX

22 февраля 2018 - 08:49

Что-то странное происходит с балансом: после покупки/продажи цифра в wmz обновляется с большой задержкой, хотя число нот в портфеле - сразу. А еще потом при последовательных запросах цифра в wmz меняется туда-сюда между старым значением и обновленным.


В теме: INDX API. Програмные интерфейсы INDX

21 февраля 2018 - 19:44

Вот как-то так:

<?php
class indx {

 var $login;
 var $pass;
 var $wmid;
 var $culture;
 var $client;

 function indx($login, $pass, $wmid, $culture = 'en-EN')
 {

	$this->login = $login;
	$this->pass = $pass;
	$this->wmid = $wmid;
	$this->culture = $culture;
 	$this->client = curl_init('https://api.indx.ru/');
	curl_setopt($this->client, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($this->client, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($this->client, CURLOPT_SSL_VERIFYHOST, 2);
	curl_setopt($this->client, CURLOPT_SSL_VERIFYPEER, '');
	curl_setopt($this->client, CURLOPT_TIMEOUT, 15);
	curl_setopt($this->client, CURLOPT_CONNECTTIMEOUT, 15);
	curl_setopt($this->client, CURLOPT_HTTPHEADER, array('Content-Type: text/json; charset=UTF-8'));
	curl_setopt($this->client, CURLOPT_POST, 1);
 }

 function Tools()
 {
	$sign = base64_encode(hash('sha256',$this->login.';'.$this->pass.';'.$this->culture,true));
	curl_setopt($this->client, CURLOPT_URL, 'https://api.indx.ru/api/v2/trade/Tools');
	curl_setopt($this->client, CURLOPT_POSTFIELDS, '{"ApiContext":{"Login":"'.$this->login.'","Wmid":"'.$this->wmid.'","Culture":"'.$this->culture.'","Signature":"'.$sign.'"}}'); 
	return json_decode(curl_exec($this->client));
 }

 function Balance()
 {
	$sign = base64_encode(hash('sha256',$this->login.';'.$this->pass.';'.$this->culture.';'.$this->wmid,true));
	curl_setopt($this->client, CURLOPT_URL, 'https://api.indx.ru/api/v2/trade/Balance');
	curl_setopt($this->client, CURLOPT_POSTFIELDS, '{"ApiContext":{"Login":"'.$this->login.'","Wmid":"'.$this->wmid.'","Culture":"'.$this->culture.'","Signature":"'.$sign.'"}}'); 
	return json_decode(curl_exec($this->client));
 }

 function OfferMy()
 {
	$sign = base64_encode(hash('sha256',$this->login.';'.$this->pass.';'.$this->culture.';'.$this->wmid,true));
	curl_setopt($this->client, CURLOPT_URL, 'https://api.indx.ru/api/v2/trade/OfferMy');
	curl_setopt($this->client, CURLOPT_POSTFIELDS, '{"ApiContext":{"Login":"'.$this->login.'","Wmid":"'.$this->wmid.'","Culture":"'.$this->culture.'","Signature":"'.$sign.'"}}'); 
	return json_decode(curl_exec($this->client));
 }

 function OfferList($ID)
 {
	$sign = base64_encode(hash('sha256',$this->login.';'.$this->pass.';'.$this->culture.';'.$this->wmid.';'.$ID,true));
	curl_setopt($this->client, CURLOPT_URL, 'https://api.indx.ru/api/v2/trade/OfferList');
	curl_setopt($this->client, CURLOPT_POSTFIELDS, '{"ApiContext":{"Login":"'.$this->login.'","Wmid":"'.$this->wmid.'","Culture":"'.$this->culture.'","Signature":"'.$sign.'"},"Trading":{"ID":'.$ID.'}}');
	return json_decode(curl_exec($this->client));
 }

 function HistoryTrading($ID, $DateStart, $DateEnd)
 {
	$sign = base64_encode(hash('sha256',$this->login.';'.$this->pass.';'.$this->culture.';'.$this->wmid.';'.$ID.';'.$DateStart.';'.$DateEnd,true));
	curl_setopt($this->client, CURLOPT_URL, 'https://api.indx.ru/api/v2/trade/HistoryTrading');
	curl_setopt($this->client, CURLOPT_POSTFIELDS, '{"ApiContext":{"Login":"'.$this->login.'","Wmid":"'.$this->wmid.'","Culture":"'.$this->culture.'","Signature":"'.$sign.'"},"Trading":{"ID":'.$ID.',"DateStart":"'.$DateStart.'","DateEnd":"'.$DateEnd.'"}}');
	return json_decode(curl_exec($this->client));
 }

 function HistoryTransaction($ID, $DateStart, $DateEnd)
 {
	$sign = base64_encode(hash('sha256',$this->login.';'.$this->pass.';'.$this->culture.';'.$this->wmid.';'.$ID.';'.$DateStart.';'.$DateEnd,true));
	curl_setopt($this->client, CURLOPT_URL, 'https://api.indx.ru/api/v2/trade/HistoryTransaction');
	curl_setopt($this->client, CURLOPT_POSTFIELDS, '{"ApiContext":{"Login":"'.$this->login.'","Wmid":"'.$this->wmid.'","Culture":"'.$this->culture.'","Signature":"'.$sign.'"},"Trading":{"ID":'.$ID.',"DateStart":"'.$DateStart.'","DateEnd":"'.$DateEnd.'"}}');
	return json_decode(curl_exec($this->client));
 }

 function OfferAdd($ID, $Price, $IsBid /* true - покупка, false - продажа */, $Count = 1, $IsAnonymous = true)
 {
	$sign = base64_encode(hash('sha256',$this->login.';'.$this->pass.';'.$this->culture.';'.$this->wmid.';'.$ID,true));
	curl_setopt($this->client, CURLOPT_URL, 'https://api.indx.ru/api/v2/trade/OfferAdd');
	curl_setopt($this->client, CURLOPT_POSTFIELDS, '{"ApiContext":{"Login":"'.$this->login.'","Wmid":"'.$this->wmid.'","Culture":"'.$this->culture.'","Signature":"'.$sign.'"},"Offer":{"ID":'.$ID.',"Count":'.$Count.',"IsAnonymous":'.($IsAnonymous?'true':'false').',"IsBid":'.($IsBid?'true':'false').',"Price":'.$Price.'}}');
	return json_decode(curl_exec($this->client));
 }

 function OfferDelete($offerID)
 {
	$sign = base64_encode(hash('sha256',$this->login.';'.$this->pass.';'.$this->culture.';'.$this->wmid.';'.$offerID,true));
	curl_setopt($this->client, CURLOPT_URL, 'https://api.indx.ru/api/v2/trade/OfferDelete');
	curl_setopt($this->client, CURLOPT_POSTFIELDS, '{"ApiContext":{"Login":"'.$this->login.'","Wmid":"'.$this->wmid.'","Culture":"'.$this->culture.'","Signature":"'.$sign.'"},"OfferID":'.$offerID.'}'); 
	return json_decode(curl_exec($this->client));
 }

}