Skip to content

Implementing the Client

Henrique Tedeschi edited this page May 29, 2020 · 2 revisions

To implement the client into your project, include the Tradier.Client namespace:

using Tradier.Client;

To instantiate a new client in your program, include the following:

TradierClient client = new TradierClient("<TOKEN>");

On an important note, the client's constructor default setting is to use the Sandbox. To set the client to Production, you need to explicitly set it to Production by including the property useProduction and set it to true:

TradierClient client = new TradierClient("<TOKEN>", useProduction: true);

Note that it is not needed to pass a HttpClient to the client. TradierClient already creates one using the HttpClientFactory helping it to keep control over the requests.

Example

using System.Threading.Tasks;
using Tradier.Client;

namespace MyConsoleApp
{
    class Program
    {
        static async Task Main(string[] args)
        {
            TradierClient clientSandbox = new TradierClient("<TOKEN>");

            TradierClient clientProduction = new TradierClient("<TOKEN>", useProduction: true);
        }
    }
}