Integration – Direct

You can query the API with a simple GET request. All that is needed is to send your request to: https://ta.taapi.io with at least the mandatory parameters.

Pros

  • Very easy to get started.

Cons

  • Only Binance supported.
  • Candles only update on candle close.

Getting started

To get started, simply make an HTTPS GET Request or call in your browser:

[GET] https://ta.taapi.io/rsi?secret=MY_SECRET&exchange=binance&symbol=BTC/USDT&interval=1h

A JSON Response is returned:

{
  "value": 69.8259211745199
}

Mandatory Parameters

Using this “Direct” method requires at least the below parameters:

ParameterTypeDescription
secretStringThe secret which is emailed to you when you Request an API key.
exchangeStringThe exchange you want to calculate TA from: [“binance”] . So far TAAPI.IO only supports Binance for this integration method. For other crypto / stock exchanges, please refer to our Client or Manual integration methods.
symbolStringSymbol names are always upper-case, with the coin separated by a forward slash and the market: COIN/MARKET. Example: ‘BTC/USDT’ Bitcoin to Tether, or LTC/BTC Litecoin to Bitcoin.
intervalStringInterval or time frame: Binance have the following time frames or intervals: [“1m”, “3m”, “5m”, “15m”, “30m”, “1h”, “2h”, “4h”, “6h”, “8h”, “12h”, “1d”, “3d”, “1w”, “1M”].

Depending on the indicator you call, there may or may not be more mandatory parameters. Additionally, there may be several other optional paramters, also depending on the indicator. Please refer to the Indicators page for more information.

Optional Parameters

Below is a list of optional parameters that all the indicators will take:

ParameterType
backtrackIntegerThis ‘backtrack’ parameter, removes candles from the data set, and thus calculates the indicator value, x amount of candles back. So, if you’re fetching the RSI on the hourly, and you want to know what the RSI was 5 hours ago, set backtrack=5. Default here is 0, and a max of 50.

Examples

Below you’ll find some examples, how to connect, authenticate and query the API:

NodeJS

// Require taapi (using the NPM client: npm i taapi --save)
const taapi = require("taapi");
 
// Setup client with authentication
const client = taapi.client("MY_SECRET");
 
// Get the BTC/USDT RSI value on the 1 minute time frame from binance
client.getIndicator("rsi", "binance", "BTC/USDT", "1m").then(function(result) {
    console.log("Result: ", result);
});

// --- Or ---

// Require axios: npm i axios
var axios = require('axios');

axios.get('https://ta.taapi.io/rsi', {
  params: {
    secret: MY_SECRET,
    exchange: "binance",
    symbol: "BTC/USDT",
    interval: "1h",
  }
})
.then(function (response) {
  console.log(response.data);
})
.catch(function (error) {
  console.log(error.response.data);
});

PHP

<?php

$endpoint = 'rsi';

$query = http_build_query(array(
  'secret' => 'MY_SECRET',
  'exchange' => 'binance',
  'symbol' => 'BTC/USDT',
  'interval' => '1h'
));

// Define endpoint
$url = "https://ta.taapi.io/{$endpoint}?{$query}";

// create curl resource 
$ch = curl_init(); 

// set url 
curl_setopt($ch, CURLOPT_URL, $url); 

//return the transfer as a string 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

// $output contains the output string 
$output = curl_exec($ch); 

// close curl resource to free up system resources 
curl_close($ch);

// View result
print_r(json_decode($output));

Python

# Import the requests library 
import requests 

# Define indicator
indicator = "rsi"
  
# Define endpoint 
endpoint = f"https://ta.taapi.io/{indicator}"
  
# Define a parameters dict for the parameters to be sent to the API 
parameters = {
    'secret': 'MY_SECRET',
    'exchange': 'binance',
    'symbol': 'BTC/USDT',
    'interval': '1h'
    } 
  
# Send get request and save the response as response object 
response = requests.get(url = endpoint, params = parameters)
  
# Extract data in json format 
result = response.json() 

# Print result
print(result)

Ruby

require 'net/http'
uri = URI("https://ta.taapi.io/rsi?secret=MY_SECRET&exchange=binance&symbol=BTC/USDT&interval=1h")
puts Net::HTTP.get(uri)

Curl

curl "https://ta.taapi.io/rsi?secret=MY_SECRET&exchange=binance&symbol=BTC/USDT&interval=1h"

Note

Using this method means that TAAPI.IO is fetching candle data from the exchanges. The exchanges unfortunately have a habit of suddenly changing their rate-limits based on their load / terms of service etc…, this means that TAAPI.IO will in no way guarantee that there won’t be a problem in our data synchronization, and TAAPI.IO will in no way be held responsible for any result due to miss-calculation of indicator values based on incorrect / or incomplete candle data. Please check out our complete Terms of service. To validate and verify exchange data your-self, please use our Client or Manual integration methods. This being said, we of course do our absolute best to adapt to any changes that the exchanges may have, but we simply cannot legally guarantee 100% error free candles 100% of the time!