Что нового

Ошибка Response 400

OlgaAdel

Новичок
Сообщения
4
Репутация
0
Добрый день. подскажите пожалуйста в скрипте выскакивает ошибка Response 400, не могу понять в чем дело. Вот такой скрипт.

Global $hColorOpen = 0x2962FF
Global $hColorClose = 0xFF1744

AdlibRegister('_Loop', 900000*60000) ; calls the function every 900 000*60 000 ms
OnAutoItExitRegister('_UnRegister') ; unregister the callback function when the script ends

_Loop()

Func _Loop()
Local $iSearch

Do
$iSearch = PixelSearch (1350, 210, 1474, 625, $hColorOpen)
if @error <> 1 Then
_oHTTPOpen ()
EndIf
$iSearch = PixelSearch (1350, 210, 1474, 625, $hColorClose)
if @error <> 1 Then
_oHTTPClose ()
EndIf
Sleep (1000)
Until 1 <> 1
EndFunc

Func _UnRegister()
AdlibUnRegister('_Loop')
EndFunc

Func _oHTTPOpen ()

; The data to be sent
$sPD = '{' & _
'"name": "TET LONG",' & _
'"secret": "epuhxsrrcxh",' & _
'"side": "buy",' & _
'"symbol": "{{btcusdt}}",' & _
'"open": {' & _
'"amountType": "balance",' & _
'"amount": "35"' & _
'},' & _
'"sl": {' & _
'"ofs": "0.7"' & _
'},' & _
'"tp": {' & _
'"orders": {' & _
'"0": {' & _
'"ofs": "1",' & _
'"piece": "25.0"' & _
'},' & _
'"1": {' & _
'"ofs": "2",' & _
'"piece": "25.0"' & _
'},' & _
'"2": {' & _
'"ofs": "3",' & _
'"piece": "25.0"' & _
'},'& _
'"3": {'& _
'"ofs": "6",'& _
'"piece": "25.0"'& _
'}'& _
'}'& _
'}' & _
'}'

; Creating the object
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "https://hook.finandy.com/MMG-moThfD-AtB4wK", False)
$oHTTP.SetRequestHeader("Content-Type", "application/json")

; Performing the Request
$oHTTP.Send($sPD)

; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

If $oStatusCode <> 200 then
MsgBox(4096, "Response code", $oStatusCode)
EndIf

; Saves the body response regardless of the Response code
$file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
FileWrite($file, $oReceived)
FileClose($file)

EndFunc


Func _oHTTPClose ()

; The data to be sent
$sPD = '{' & _
'"name": "TET LONG",' & _
'"secret": "epuhxsrrcxh",' & _
'"side": "sell",' & _
'"symbol": "{{btcusdt}}",' & _
'}'
; Creating the object
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "https://hook.finandy.com/MMG-moThfD-AtB4wK", False)
$oHTTP.SetRequestHeader("Content-Type", "application/json")

; Performing the Request
$oHTTP.Send($sPD)

; Download the body response if any, and get the server status response code.
$oReceived = $oHTTP.ResponseText
$oStatusCode = $oHTTP.Status

If $oStatusCode <> 200 then
MsgBox(4096, "Response code", $oStatusCode)
EndIf

; Saves the body response regardless of the Response code
$file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists
FileWrite($file, $oReceived)
FileClose($file)

EndFunc
 
Верх