Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. I have the following logical problem developing an app. I need to do several key operations that need to be executed only once. Lets say I need to print something on a fiscal printer. I have several records stored on the database. I send one command to the printer and the result is ok (was printed successfully). I save on that specific line the fact that was printed ok, so if the program is somehow stopped, on resume that line is already printed and will be skipped from sent to printer. However if I cannot write in the database the answer (the program crash) on resume the line will be printed again. This operation is obvious not an atomic operation. So I need one protocol to ensure this functionality. Is there any? Many thanks
  2. Hi all Did anyone have any piece of code working with binance API? I found myself in need of an "hello word" example and I did not find it on the intenet. Anyone can help me to understand that I am thinking correct or not please. I have the following code Code: procedure TfrmMain.btnInfoClick(Sender: TObject); var workStream : TStringStream; workResponse : TStringStream; responseObject : ISuperObject; serverTIME : Int64; begin mDEBUG.Lines.Clear; try workStream := TStringStream.Create; workResponse := TStringStream.Create; restCLIENT_MAIN.ResetToDefaults; restREQUEST_MAIN.ResetToDefaults; restRESPONSE_MAIN.ResetToDefaults; restCLIENT_MAIN.BaseURL := API_URL; serverTIME := GetAPI_TIME; restREQUEST_MAIN.Resource := '/sapi/v1/broker/info'; restREQUEST_MAIN.ResourceSuffix := '?timestamp=' + serverTIME.ToString + '&signature=' + SECRET_KEY; restREQUEST_MAIN.Method := TRESTRequestMethod.rmGET; restREQUEST_MAIN.AddParameter('Content-Type', 'application/json'); restREQUEST_MAIN.AddParameter('X-MBX-APIKEY', CLIENT_KEY); restREQUEST_MAIN.Execute; workResponse := TStringStream.Create(restRESPONSE_MAIN.JSONText); responseObject := TSuperObject.ParseStream(workResponse, True); if responseObject <> nil then begin mDEBUG.Lines.Add(responseObject.AsString); end else begin mDEBUG.Lines.Add(restRESPONSE_MAIN.Content); end; finally mDEBUG.Lines.Add(''); mDEBUG.Lines.Add('restCLIENT_MAIN.BaseURL:' + restCLIENT_MAIN.BaseURL); mDEBUG.Lines.Add('restREQUEST_MAIN.Resource:' + restREQUEST_MAIN.Resource); mDEBUG.Lines.Add('restREQUEST_MAIN.ResourceSuffix:' + restREQUEST_MAIN.ResourceSuffix); FreeAndNil(workStream); FreeAndNil(workResponse); end; end; the result is Code: {"msg":"API-key format invalid.","code":-2014} but the postman give me a different error. (timestamp difference) What I am missing? Anyone can help me with some hints?