Skip to content

Commit

Permalink
Update CryptoService.cs to bybit v5 api
Browse files Browse the repository at this point in the history
  • Loading branch information
omgitsjan authored Sep 9, 2024
1 parent 6c2b9d6 commit 47c92f9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions DiscordBot/Services/CryptoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task<Tuple<bool, string>> GetCryptoPriceAsync(string symbol = "BTC"
}

string requestUrl = _byBitApiUrl + symbol + physicalCurrency;
Console.WriteLine(requestUrl);
Console.WriteLine("Sending Reqeust to: " + requestUrl);
HttpResponse response = await httpService.GetResponseFromUrl(requestUrl);

if (!response.IsSuccessStatusCode)
Expand All @@ -41,7 +41,7 @@ public async Task<Tuple<bool, string>> GetCryptoPriceAsync(string symbol = "BTC"
try
{
JObject json = JObject.Parse(response.Content ?? "{}");
string? respString = json["result"]?[0]?["last_price"]?.Value<string>();
string? respString = json["result"]?["list"]?[0]?["lastPrice"]?.Value<string>();
bool success = respString != null;

if (!success)
Expand All @@ -59,4 +59,4 @@ public async Task<Tuple<bool, string>> GetCryptoPriceAsync(string symbol = "BTC"
}
}
}
}
}

0 comments on commit 47c92f9

Please sign in to comment.