Search code examples
javaarraystime-seriestrading

Java and Dukascopy history download


first of all I want to make clear I’m still a noob with Java so please forgive my naivness.

What I’m trying to achieve

I would like to download historical data from dukascopy, which offer a free service to do that, trough a Java program and export all data to a csv.

As you may see, Dukascopy has a web app to download all data manually, my point in having a program is that I need to automate this.

What I tried

There’s an API created by Dukascopy, basically I downloaded a Maven project and from there I was able to see all the functions aviable. Unfortunately I did not found any function that allow to download data, there’s only strategy testing and trading orders submission (remember I’m a noob, maybe I didn’t see the method). Anyway, this is the API I’m referring to: https://www.dukascopy.com/wiki/en/development/get-started-api/development-environment/use-in-eclipse

Then, I went back to the history downloaded web app and I found this: https://www.dukascopy.com/trading-tools/api/documentation/quotes This would be perfect, the functions has all I need, problem is: how do I use that url? I don’t understand how I should use that url in Java to download data. Is anyone familiar with this and can provide further help? Thanks.

Thanks for reading.


Solution

  • What you are looking at is a RESTful service provided by dukascopy. This is a very quick and dirty explanation, but should help push you in the right direction for your own learning.

    REST services allow people and clients to make requests directly to a backend server and will respond with the requested data. Every time you visit a webpage, you make a GET request to the server that hosts the webpage and the webpage responds with a visual representation of that data they provide. REST services allow you to make similar requests, with many different methods to shape your request and expected response.

    There are plenty of tools to consume RESTful services. You can use Spring to code your own client, or you can use a client that is already setup for consuming these services, such as SoapUI or Postman. I personally recommend postman for exploring an api before you start writing actual java code.

    There is a large list of APIs that you can practice coding against as well. Many of them are simple, and some even provide instructions on how to use them.

    APIs are the backbone of the internet and a great place to start your learning.

    Here's a fun exercise. Try writing a program that will email you a new dad joke every day.

    Good Luck and have fun.