-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add IBinanceApi.GetSystemStatusAsync
Update base endpoint URL. Add BinanceStatus enum type. Set HttpClient timeout to 60 seconds (was: default 100 seconds). Update sample application.
- Loading branch information
Showing
8 changed files
with
120 additions
and
29 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace BinanceConsoleApp.Controllers | ||
{ | ||
internal class GetStatus : IHandleCommand | ||
{ | ||
public async Task<bool> HandleAsync(string command, CancellationToken token = default) | ||
{ | ||
if (!command.StartsWith("status ", StringComparison.OrdinalIgnoreCase)) | ||
return false; | ||
|
||
var args = command.Split(' '); | ||
|
||
if (args.Length > 1 && args[1].Equals("account", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
var status = await Program.Api.GetAccountStatusAsync(Program.User, token); | ||
|
||
lock (Program.ConsoleSync) | ||
{ | ||
Console.WriteLine(); | ||
Console.WriteLine($"Account Status: \"{status}\""); | ||
} | ||
} | ||
else if (args.Length > 1 && args[1].Equals("system", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
var status = await Program.Api.GetSystemStatusAsync(token); | ||
|
||
lock (Program.ConsoleSync) | ||
{ | ||
Console.WriteLine(); | ||
Console.WriteLine($"System Status: \"{status}\""); | ||
} | ||
} | ||
else | ||
{ | ||
lock (Program.ConsoleSync) | ||
{ | ||
Console.WriteLine($"Specify either 'account' or 'system' for status."); | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace Binance | ||
{ | ||
public enum BinanceStatus | ||
{ | ||
/// <summary> | ||
/// Normal operation. | ||
/// </summary> | ||
Normal, | ||
|
||
/// <summary> | ||
/// System maintenance. | ||
/// </summary> | ||
Maintenance | ||
} | ||
} |
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