-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update application internals regarding Amberdata change.
- Loading branch information
Conor Flynn
committed
Nov 29, 2022
1 parent
b7c284c
commit 6455738
Showing
6 changed files
with
69 additions
and
39 deletions.
There are no files selected for viewing
Binary file modified
BIN
-4 Bytes
(100%)
Data Engine/Documents/Internal Manual/Packet Spreadsheet.xlsx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 47 additions & 33 deletions
80
DeFi-Data-Engine/Testing Environment/src/test/misc/Testing1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,56 @@ | ||
| package test.misc; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.io.IOException; | ||
|
|
||
| import org.json.JSONArray; | ||
| import org.json.JSONObject; | ||
|
|
||
| import okhttp3.OkHttpClient; | ||
| import okhttp3.Request; | ||
|
|
||
| public class Testing1 { | ||
|
|
||
| /* lis() returns the length of the longest | ||
| increasing subsequence in arr[] of size n */ | ||
| static int lis(int arr[], int n) | ||
| { | ||
| int lis[] = new int[n]; | ||
| int i, j, max = 0; | ||
|
|
||
| /* Initialize LIS values for all indexes */ | ||
| for (i = 0; i < n; i++) | ||
| lis[i] = 1; | ||
|
|
||
| /* Compute optimized LIS values in | ||
| bottom up manner */ | ||
| for (i = 1; i < n; i++) | ||
| for (j = 0; j < i; j++) | ||
| if (arr[i] > arr[j] && lis[i] < lis[j] + 1) { | ||
| lis[i] = lis[j] + 1; | ||
| System.out.println(Arrays.toString(lis)); | ||
| } | ||
|
|
||
| /* Pick maximum of all LIS values */ | ||
| for (i = 0; i < n; i++) | ||
| if (max < lis[i]) | ||
| max = lis[i]; | ||
|
|
||
| return max; | ||
| } | ||
|
|
||
| public static void main(String args[]) | ||
| { | ||
| int arr[] = { 10, 22, 9, 33, 21, 50, 41, 60 }; | ||
| int n = arr.length; | ||
| System.out.println("Length of lis is " + lis(arr, n) | ||
| + "\n"); | ||
| String url = String.format("https://web3api.io/api/v2/defi/lending/aavev2/protocol?startDate=%s&endDate=%s", | ||
| "2022-09-01T01:00:00", | ||
| "2022-09-02T01:00:00" | ||
| + "&size=999"); | ||
|
|
||
| recursiveCall(url); | ||
| System.out.println("Exit"); | ||
| System.exit(0); | ||
| } | ||
|
|
||
| public static void recursiveCall(String url) { | ||
| System.out.println(url); | ||
| OkHttpClient client = new OkHttpClient(); | ||
|
|
||
| Request request = new Request.Builder() | ||
| .url(url) | ||
| .get() | ||
| .addHeader("accept", "application/json") | ||
| .addHeader("x-api-key", "UAK7ed69235426c360be22bfc2bde1809b6") | ||
| .build(); | ||
|
|
||
| okhttp3.Response response; | ||
| try { | ||
| response = client.newCall(request).execute(); | ||
| JSONObject json = new JSONObject(response.body().string()); | ||
|
|
||
| JSONObject payload = json.getJSONObject("payload"); | ||
| JSONArray arr = payload.getJSONArray("data"); | ||
| for(int i = 0; i < arr.length(); i++) { | ||
| System.out.println(arr.get(i).toString()); | ||
| } | ||
| System.out.println(arr.length()); | ||
| if(arr.length() >= 999) { | ||
| JSONObject metadata = payload.getJSONObject("metadata"); | ||
| if(metadata.has("next")) | ||
| recursiveCall(metadata.getString("next")+"&size=999"); | ||
| } | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } | ||
| } | ||
| } |