Skip to main content

Tradetron API Integration: Enhancing Your Trading Arsenal

Tradetron, a SaaS-based application, has dramatically simplified automated trading. It lets you craft strategies, test them, and then execute live trades through your broker’s interface. But what if you’ve been algorithmic trading with tools like Amibroker, TradingView, or Python? The good news is, with Tradetron API Integration, you can harness your existing strategies on the Tradetron platform for enhanced automation.

Recommended Reading: Discovering Top Strategies in Tradetron Marketplace

Understanding Tradetron APIs

Tradetron’s API interface is refreshingly straightforward. Each strategy you create gets an API OAuth token, allowing programmatic access from third-party applications like Amibroker. You can easily generate this token from the strategies page.

Tradetron-API-Integration1

Tradetron-API-Integration2

Here’s how a typical API link looks:

https://api.tradetron.tech/api?auth-token=a1a76057-bfd8-4922-96d2-0b6e0c3ee195&key=position&value=1

The key and value in the URL are crucial. For instance, in the above URL, the key is “position” with a value of “1”. Triggering this API from an external source stores the ‘key’ as a runtime variable in that strategy, influencing your trading conditions.

Below is an example of a strategy logic that buys Nifty futures when the “position” variable is set to 1:

Tradetron-API-Integration3

Tradetron-API-Integration4

In essence, Tradetron API Integration lets you code strategy rules externally, sending only signal commands to Tradetron as runtime variables.

Further Reading: Amibroker vs Tradetron: A Comprehensive Comparison

How to Activate Tradetron APIs

Activating Tradetron APIs varies with each application.

In Amibroker, the InternetOpenURL() function can be used to call any API.

				
					ih = InternetOpenURL( "https://api.tradetron.tech/api?auth-token=a1a76057-bfd8-4922-96d2-0b6e0c3ee195&key=position&value=1" );

printf( "API Response: " );

if( ih )

{

     while( ( str = InternetReadString( ih ) ) != "" )

  {

         printf( "%s", str );

  }

     InternetClose( ih );

}
				
			
For strategies in Python, here’s a sample code to invoke the Tradetron API:
				
					import requests

import json

url = "https://api.tradetron.tech/api?auth-token=45eaad8f-6506-4559-8276-beba0720d4fe&key=position&value=1"

payload = ""

headers = {

  'Authorization': 'Bearer 9436e843-e5d9-42b1-b24a-2a4592320103',

  'Content-Type': 'application/json'

}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)
				
			

From TradingView, API calls can be made via webhook alerts, sending HTTP post requests to Tradetron. See the example below:

Tradetron-API-Integration5.

Learn more about these integrations at these links:

TradingView Integration  |  Amibroker Integration

Pros and Cons of Integrating APIs with Tradetron

Advantages:

  • Build complex strategies using Amibroker, Python, etc., and integrate them with Tradetron for robust automation.
  • Seamlessly integrate any third-party application using lightweight REST APIs.

Disadvantages:

  • API integration might introduce a few milliseconds of latency, impacting the speed of strategy execution.

Concluding Insights

Tradetron has transformed the landscape for retail traders, enabling sophisticated algorithmic trading systems. With API integration, you can exploit Tradetron’s robust execution capabilities while maintaining strategy logic externally. This opens up a world of possibilities, pushing the boundaries of what you can achieve in trading.

Ready to start your journey? Begin with Tradetron today.