Imports System.Collections.Generic
Imports System.Threading.Tasks
Private Class ResponseObject
Public Property code As String
Public Property data As List(Of LendingData)
Private Class LendingData
Public Property dailyIntRate As String
Public Property term As Integer
Public Property size As String
Dim fileName = "C:\Users\[username]\Documents\USDT APY.csv"
Result = GetAPYAsync.GetAwaiter().GetResult()
Text = Result + "," + (CDec(Result) * 365).ToString() + "," + Date.Now
Console.WriteLine("Errored: " + ex.Message)
Threading.Thread.Sleep(3600000)
Private Async Function GetAPYAsync() As Task(Of String)
Dim KuCoinAPIURL = "https://api.kucoin.com"
Dim Endpoint = "/api/v1/margin/market?currency=USDT"
Dim Client As New Http.HttpClient
Dim RestResponse As Http.HttpResponseMessage = Await Client.GetAsync(KuCoinAPIURL + Endpoint)
Return Newtonsoft.Json.JsonConvert.DeserializeObject(Of ResponseObject)(Await RestResponse.Content.ReadAsStringAsync()).data(0).dailyIntRate