Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(C# UWP/WinRT) 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. Chilkat.Http http = new Chilkat.Http(); bool success; Chilkat.Crypt2 crypt = new Chilkat.Crypt2(); string apiPath = "v2/auth/w/order/submit"; string apiKey = "MY_API_KEY"; string apiSecret = "MY_API_SECRET"; Chilkat.CkDateTime dt = new Chilkat.CkDateTime(); dt.SetFromCurrentSystemTime(); Chilkat.StringBuilder sbNonce = new Chilkat.StringBuilder(); sbNonce.Append(dt.GetAsUnixTimeStr(false)); sbNonce.Append("000"); string nonce = sbNonce.GetAsString(); Chilkat.JsonObject json = new Chilkat.JsonObject(); json.UpdateString("type","LIMIT"); json.UpdateString("symbol","tBTCUSD"); json.UpdateString("price","15"); json.UpdateString("amount","0.001"); json.UpdateInt("flags",0); string body = json.Emit(); Chilkat.StringBuilder sbSignature = new Chilkat.StringBuilder(); sbSignature.Append("/api/"); sbSignature.Append(apiPath); sbSignature.Append(nonce); sbSignature.Append(body); crypt.EncodingMode = "hex_lower"; crypt.HashAlgorithm = "sha384"; crypt.MacAlgorithm = "hmac"; crypt.SetMacKeyString(apiSecret); string sig = crypt.MacStringENC(sbSignature.GetAsString()); http.SetRequestHeader("bfx-apikey",apiKey); http.SetRequestHeader("bfx-signature",sig); http.SetRequestHeader("bfx-nonce",nonce); Chilkat.HttpResponse resp = await http.PostJson2Async("https://api.bitfinex.com/v2/auth/w/order/submit","application/json",body); if (http.LastMethodSuccess == false) { Debug.WriteLine(http.LastErrorText); return; } Debug.WriteLine("Response body:"); Debug.WriteLine(resp.BodyStr); |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.