### Installing ExchangeSharp CLI on Unix-like Systems (Shell) Source: https://github.com/digitalruby/exchangesharp/blob/main/README.md This command installs the ExchangeSharp command-line interface (CLI) on Unix-like operating systems. It downloads and executes the `install-console.sh` script from the project's GitHub repository, which handles the setup process. ```Shell curl https://github.com/DigitalRuby/ExchangeSharp/raw/main/install-console.sh | sh ``` -------------------------------- ### Installing ExchangeSharp via dotnet CLI (Shell) Source: https://github.com/digitalruby/exchangesharp/blob/main/README.md This command uses the .NET CLI to add the `DigitalRuby.ExchangeSharp` NuGet package to a project. It specifies version `1.2.0`, ensuring a consistent and controlled dependency. ```Shell dotnet add package DigitalRuby.ExchangeSharp --version 1.2.0 ``` -------------------------------- ### Installing ExchangeSharp via NuGet Package Manager (PowerShell) Source: https://github.com/digitalruby/exchangesharp/blob/main/README.md This command, executed in the Visual Studio Package Manager Console, installs the `DigitalRuby.ExchangeSharp` NuGet package. It explicitly targets version `1.2.0`, providing a straightforward way to manage project dependencies within Visual Studio. ```PowerShell PM> Install-Package DigitalRuby.ExchangeSharp -Version 1.2.0 ``` -------------------------------- ### Receiving Ticker Information via WebSockets (C#) Source: https://github.com/digitalruby/exchangesharp/blob/main/README.md This C# example demonstrates how to establish a WebSocket connection to an exchange (Binance in this case) to receive real-time ticker information. It shows how to get an API instance, subscribe to ticker updates, and handle incoming data, with automatic re-connection capabilities. ```C# public static async Task Main(string[] args) { // create a web socket connection to Binance. Note you can Dispose the socket anytime to shut it down. using var api = await ExchangeAPI.GetExchangeAPIAsync(); // the web socket will handle disconnects and attempt to re-connect automatically. using var socket = await api.GetTickersWebSocket(tickers => { Console.WriteLine("{0} tickers, first: {1}", tickers.Count, tickers.First()); }); Console.WriteLine("Press ENTER to shutdown."); Console.ReadLine(true); } ``` -------------------------------- ### Accessing Exchange API Instances (C#) Source: https://github.com/digitalruby/exchangesharp/blob/main/README.md This snippet shows the method used to obtain an instance of an exchange API. Exchange constructors are private, so this asynchronous static method is the primary way to get access to an exchange object, typically used with a generic type parameter specifying the desired exchange. ```C# ExchangeAPI.GetExchangeAPIAsync() ``` -------------------------------- ### Building ExchangeSharp Solution - .NET Core Source: https://github.com/digitalruby/exchangesharp/blob/main/BUILDING.md Compiles the entire ExchangeSharp solution using the .NET Core SDK from the command line. This command builds all projects within the solution file. ```Bash/PowerShell dotnet build ExchangeSharp.sln ``` -------------------------------- ### Displaying ExchangeSharp CLI Help (Shell) Source: https://github.com/digitalruby/exchangesharp/blob/main/README.md This command is used to display all available commands and options for the ExchangeSharp command-line interface. It provides a quick reference for users to understand how to interact with the CLI. ```Shell exchange-sharp --help ``` -------------------------------- ### Publishing ExchangeSharpConsole for Release - .NET Core Source: https://github.com/digitalruby/exchangesharp/blob/main/BUILDING.md Publishes the 'ExchangeSharpConsole' project as a release version to a specified output directory, targeting a specific Runtime Identifier (RID). This creates a self-contained executable for the target platform. ```Bash/PowerShell dotnet publish src/ExchangeSharpConsole -o $PWD/dist -c Release -r ``` -------------------------------- ### Listing All Poloniex Currencies - C# Source: https://github.com/digitalruby/exchangesharp/blob/main/src/ExchangeSharp/Properties/Resources/PoloniexWithdrawalFields-Readme.md This C# snippet demonstrates how to retrieve a comprehensive list of all currencies supported by Poloniex using the `ExchangePoloniexAPI`. It iterates through the returned dictionary to print each currency's symbol and indicates if it's disabled, which is crucial for understanding available and active assets. ```C# var polo = new ExchangePoloniexAPI(); IReadOnlyDictionary syms = polo.GetCurrencies(); foreach (var k in syms) { Console.WriteLine(k.Key + (!k.Value.IsEnabled ? ",0" : string.Empty)); } ``` -------------------------------- ### Overriding WebSocket Implementation for Older Windows (C#) Source: https://github.com/digitalruby/exchangesharp/blob/main/README.md For Windows versions older than 8.1, this C# snippet demonstrates how to override the default WebSocket implementation. It registers a custom WebSocket creator using the `Websocket4Net` NuGet package, allowing the library to function correctly on older systems. ```C# ExchangeSharp.ClientWebSocket.RegisterWebSocketCreator( () => new ExchangeSharpConsole.WebSocket4NetClientWebSocket() ); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.