Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Quickly Integrate With A Bitcoin Cryptocurrency Exchange API With Delphi 10.2.2 For Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSIntegrating with Bitcoin Cryptocurrency exchange APIs can sound like a daunting task but it was relatively easy to do with Delphi and FireMonkey. Unless you have been living under a rock you probably know that Bitcoin and other cryptocurrency have really seen a surge in value throughout 2017. If you HAVE been living under a rock you can check out this newbies guide to bitcoin and cryptocurrency. GDAX is an exchange owned by the popular Coinbase company. I literally built a REST client that talks to the GDAX API in 5 minutes and was able to start downloading the list of currencies on the exchange and getting price quotes for a currency. This is the first step to building an automated trading client, bot, or AI for cryptocurrencies. In addition to that because I used FireMonkey that same app client will deploy to Android, IOS, Mac, and Windows with a single code base and single UI.

You can check out the documentation for GDAX for yourself to see the rest of the REST API end points. I grabbed the products endpoint and the products book endpoint and used those two endpoints in the REST Debugger to quickly and easily download the data and LiveBind it to controls in my Delphi client. The first /products/ API I used directly because it doesn’t have any parameters. Once you select one of the cryptocurrency pairs at runtime it will use that for the next request to the /products/{currency}/book endpoint. The variable there can be set using code like the below and then it will automatically be filled in when the RESTRequest is executed (it is of type pkURLSEGMENT). The “/products/{currency}/book” string goes in the Resource property of the TRESTRequest component. I ended up only writing three lines of code for the whole app.

//
//
procedure TForm1.Button1Click(Sender: TObject);
begin
RESTRequest1.Execute;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
RESTRequest2.Params.ParameterByName('currency').Value := Edit1.Text;
RESTRequest2.Execute;
end;

I also applied the Jet premium style (which gives the dark look to the client). As you can see in the screenshot I am also running the new dark theme in Delphi 10.2.2. It is really easy to get started using Delphi as a platform for creating your own bitcoin cryptocurrency AI bot GUI apps. You could also use Python on the back and just have Delphi execute your various Python commands if you already have a command line based Python cryptocurrency trading bot.

Download the full source code for the GDAX Quotes Bitcoin cryptocurrency REST API client app source code for Delphi 10.2.2 on Android and IOS.

 

Exit mobile version