-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathForexExample.java
More file actions
42 lines (33 loc) · 1.21 KB
/
ForexExample.java
File metadata and controls
42 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* FCS API - Forex Example
* Get your API key at: https://fcsapi.com
*
* This example only uses the Forex module (FcsForex)
* Other modules (Crypto, Stock) are not loaded
*
* Run: javac -cp ".:../../lib/*" ForexExample.java && java -cp ".:../../lib/*" ForexExample
*/
package examples;
import com.fcsapi.FcsApi;
import com.fcsapi.FcsForex;
import java.util.Map;
public class ForexExample {
public static void main(String[] args) {
// Initialize API - only Forex module will be used
FcsApi fcsapi = new FcsApi();
// Access only Forex module
FcsForex forex = fcsapi.getForex();
System.out.println("=== Symbols List ===\n");
Map<String, Object> result = forex.getSymbolsList("forex", "spot", null);
System.out.println(result);
System.out.println("\n\n=== Latest Price ===\n");
result = forex.getLatestPrice("FX:EURUSD");
System.out.println(result);
System.out.println("\n\n=== Historical Data ===\n");
result = forex.getHistory("EURUSD", "1D", 5);
System.out.println(result);
System.out.println("\n\n=== Profile ===\n");
result = forex.getProfile("EUR");
System.out.println(result);
}
}