Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) Bitfinex v2 REST Submit OrderSubmit an order. For more information, see https://docs.bitfinex.com/reference#rest-auth-submit-order
; This example assumes the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oHttp = ObjCreate("Chilkat.Http") Local $bSuccess $oCrypt = ObjCreate("Chilkat.Crypt2") Local $sApiPath = "v2/auth/w/order/submit" Local $sApiKey = "MY_API_KEY" Local $sApiSecret = "MY_API_SECRET" $oDt = ObjCreate("Chilkat.CkDateTime") $oDt.SetFromCurrentSystemTime() $oSbNonce = ObjCreate("Chilkat.StringBuilder") $oSbNonce.Append($oDt.GetAsUnixTimeStr(False)) $oSbNonce.Append("000") Local $sNonce = $oSbNonce.GetAsString() $oJson = ObjCreate("Chilkat.JsonObject") $oJson.UpdateString("type","LIMIT") $oJson.UpdateString("symbol","tBTCUSD") $oJson.UpdateString("price","15") $oJson.UpdateString("amount","0.001") $oJson.UpdateInt("flags",0) Local $sBody = $oJson.Emit() $oSbSignature = ObjCreate("Chilkat.StringBuilder") $oSbSignature.Append("/api/") $oSbSignature.Append($sApiPath) $oSbSignature.Append($sNonce) $oSbSignature.Append($sBody) $oCrypt.EncodingMode = "hex_lower" $oCrypt.HashAlgorithm = "sha384" $oCrypt.MacAlgorithm = "hmac" $oCrypt.SetMacKeyString($sApiSecret) Local $sig = $oCrypt.MacStringENC($oSbSignature.GetAsString()) $oHttp.SetRequestHeader "bfx-apikey",$sApiKey $oHttp.SetRequestHeader "bfx-signature",$sig $oHttp.SetRequestHeader "bfx-nonce",$sNonce Local $oResp = $oHttp.PostJson2("https://api.bitfinex.com/v2/auth/w/order/submit","application/json",$sBody) If ($oHttp.LastMethodSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf ConsoleWrite("Response body:" & @CRLF) ConsoleWrite($oResp.BodyStr & @CRLF) |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.