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
(PowerBuilder) Bitfinex v2 REST Submit OrderSubmit an order. For more information, see https://docs.bitfinex.com/reference#rest-auth-submit-order
integer li_rc oleobject loo_Http integer li_Success oleobject loo_Crypt string ls_ApiPath string ls_ApiKey string ls_ApiSecret oleobject loo_Dt oleobject loo_SbNonce string ls_Nonce oleobject loo_Json string ls_Body oleobject loo_SbSignature string ls_Sig oleobject loo_Resp // This example assumes the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if loo_Crypt = create oleobject // Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0 li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2") ls_ApiPath = "v2/auth/w/order/submit" ls_ApiKey = "MY_API_KEY" ls_ApiSecret = "MY_API_SECRET" loo_Dt = create oleobject // Use "Chilkat_9_5_0.CkDateTime" for versions of Chilkat < 10.0.0 li_rc = loo_Dt.ConnectToNewObject("Chilkat.CkDateTime") loo_Dt.SetFromCurrentSystemTime() loo_SbNonce = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbNonce.ConnectToNewObject("Chilkat.StringBuilder") loo_SbNonce.Append(loo_Dt.GetAsUnixTimeStr(0)) loo_SbNonce.Append("000") ls_Nonce = loo_SbNonce.GetAsString() loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.UpdateString("type","LIMIT") loo_Json.UpdateString("symbol","tBTCUSD") loo_Json.UpdateString("price","15") loo_Json.UpdateString("amount","0.001") loo_Json.UpdateInt("flags",0) ls_Body = loo_Json.Emit() loo_SbSignature = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbSignature.ConnectToNewObject("Chilkat.StringBuilder") loo_SbSignature.Append("/api/") loo_SbSignature.Append(ls_ApiPath) loo_SbSignature.Append(ls_Nonce) loo_SbSignature.Append(ls_Body) loo_Crypt.EncodingMode = "hex_lower" loo_Crypt.HashAlgorithm = "sha384" loo_Crypt.MacAlgorithm = "hmac" loo_Crypt.SetMacKeyString(ls_ApiSecret) ls_Sig = loo_Crypt.MacStringENC(loo_SbSignature.GetAsString()) loo_Http.SetRequestHeader("bfx-apikey",ls_ApiKey) loo_Http.SetRequestHeader("bfx-signature",ls_Sig) loo_Http.SetRequestHeader("bfx-nonce",ls_Nonce) loo_Resp = loo_Http.PostJson2("https://api.bitfinex.com/v2/auth/w/order/submit","application/json",ls_Body) if loo_Http.LastMethodSuccess = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_Crypt destroy loo_Dt destroy loo_SbNonce destroy loo_Json destroy loo_SbSignature return end if Write-Debug "Response body:" Write-Debug loo_Resp.BodyStr destroy loo_Resp destroy loo_Http destroy loo_Crypt destroy loo_Dt destroy loo_SbNonce destroy loo_Json destroy loo_SbSignature |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.