API key

IMPORTANT!
1. After a pair of API keys has been created, the client may, using the Tradernet API methods, exploit the platform's trading functionality without opening a security session by SMS - the session is opened when the server is correctly accessed using the key.
2. If a pair of individual API keys is transferred to a third party, all responsibility rests with the client, in the Account of which the pair of API keys was generated.

To use Tradernet online trading system, you need a pair of keys to sign outbound messages.

Log in to be able to view your keys and generate new ones

Using an API key, you can access API v2 commands (for a complete list of available commands, refer to Public API client section)

The main purpose of v2 is to make the platform's trading functionality available without opening a security session by SMS - the session is opened when the server is correctly accessed using the key.

Signature generation for sending a request WITHOUT using the PublicApiClient library, which we recommend to use for most clients

1. All requests are sent in POST format.

2. All requests are sent to the endpoint URL for API V2: tradernet.com/api/v2

3. All requests must contain an X-NtApi-Sig title, which is the message signature.

3.1 The signature is calculated using the sha256 algorithm, where the string of the form key = value & key2 = value2 is used as the signature line.

3.2 Used as a key for generating the signature is a secret API key, which can be generated at «Tradernet API» → «API key»

3.3 Test signature. Suppose you have an array of data that you want to send, and a secret key:

        $aQ = ['key'=>'value', 'key2'=>'value2'];
        $API_SECRET = '123';
    

The string for forming a signature will look like this:

        key=value&key2=value2
    

Creating signature:

        sign = hash_hmac('sha256', 'key=value&key2=value2', '123')
    

Signature and request header will be equal to:

        f2cbb400e9fcb40a1ab38cc987e2887ee88278731d83a4df4c65d38ae1d7cbee

        X-NtApi-Sig: f2cbb400e9fcb40a1ab38cc987e2887ee88278731d83a4df4c65d38ae1d7cbee
    

4. Each request must contain mandatory parameter apiKey – user’s public API key

As an example, or to start working with the Tradernet API, you may examine our libraries posted on the page Public API client.