Skip to content

Latest commit

 

History

History
467 lines (371 loc) · 19 KB

AnalyticsApi.md

File metadata and controls

467 lines (371 loc) · 19 KB

AnalyticsApi

All URIs are relative to https://api.builtbybit.com

Method HTTP request Description
getV2Analytics GET /v2/analytics Fetch a list of analytics definitions
getV2AnalyticsFunnel GET /v2/analytics/funnel Fetch an analytics funnel
getV2AnalyticsGraph GET /v2/analytics/graph Fetch analytics graph data
getV2AnalyticsPie GET /v2/analytics/pie Fetch an analytics pie chart
getV2AnalyticsSingle GET /v2/analytics/single Fetch a single analytics value
getV2AnalyticsTable GET /v2/analytics/table Fetch an analytics table

getV2Analytics

GetV2Analytics200Response getV2Analytics()

Fetch a list of analytics definitions

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.AnalyticsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.builtbybit.com");
    
    // Configure API key authorization: token
    ApiKeyAuth token = (ApiKeyAuth) defaultClient.getAuthentication("token");
    token.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //token.setApiKeyPrefix("Token");

    AnalyticsApi apiInstance = new AnalyticsApi(defaultClient);
    try {
      GetV2Analytics200Response result = apiInstance.getV2Analytics();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AnalyticsApi#getV2Analytics");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

This endpoint does not need any parameter.

Return type

GetV2Analytics200Response

Authorization

token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getV2AnalyticsFunnel

GetV2AnalyticsFunnel200Response getV2AnalyticsFunnel(analytic, period, filters, startDate, endDate)

Fetch an analytics funnel

Only analytics with `funnel` = true are supported.

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.AnalyticsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.builtbybit.com");
    
    // Configure API key authorization: token
    ApiKeyAuth token = (ApiKeyAuth) defaultClient.getAuthentication("token");
    token.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //token.setApiKeyPrefix("Token");

    AnalyticsApi apiInstance = new AnalyticsApi(defaultClient);
    String analytic = "analytic_example"; // String | The ID of the analytic to fetch.
    String period = "period_example"; // String | The time period to fetch data over.
    List filters = new List(); // List | A set of filters which may be used for the analytic.
    String startDate = "startDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    String endDate = "endDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    try {
      GetV2AnalyticsFunnel200Response result = apiInstance.getV2AnalyticsFunnel(analytic, period, filters, startDate, endDate);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AnalyticsApi#getV2AnalyticsFunnel");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
analytic String The ID of the analytic to fetch.
period String The time period to fetch data over. [optional]
filters List A set of filters which may be used for the analytic. [optional]
startDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]
endDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]

Return type

GetV2AnalyticsFunnel200Response

Authorization

token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
4XX -

getV2AnalyticsGraph

GetV2AnalyticsGraph200Response getV2AnalyticsGraph(analytics, period, grouping, filters, startDate, endDate)

Fetch analytics graph data

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.AnalyticsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.builtbybit.com");
    
    // Configure API key authorization: token
    ApiKeyAuth token = (ApiKeyAuth) defaultClient.getAuthentication("token");
    token.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //token.setApiKeyPrefix("Token");

    AnalyticsApi apiInstance = new AnalyticsApi(defaultClient);
    List analytics = new List(); // List | A list of analytic IDs to fetch data for.
    String period = "period_example"; // String | The time period to fetch data over.
    String grouping = "daily"; // String | How data points are grouped over the period.
    List filters = new List(); // List | A set of filters which may be used for the analytics.
    String startDate = "startDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    String endDate = "endDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    try {
      GetV2AnalyticsGraph200Response result = apiInstance.getV2AnalyticsGraph(analytics, period, grouping, filters, startDate, endDate);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AnalyticsApi#getV2AnalyticsGraph");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
analytics List A list of analytic IDs to fetch data for. [optional]
period String The time period to fetch data over. [optional]
grouping String How data points are grouped over the period. [optional] [default to daily] [enum: daily, weekly, monthly]
filters List A set of filters which may be used for the analytics. [optional]
startDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]
endDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]

Return type

GetV2AnalyticsGraph200Response

Authorization

token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getV2AnalyticsPie

GetV2AnalyticsPie200Response getV2AnalyticsPie(analytic, period, filters, startDate, endDate)

Fetch an analytics pie chart

Only analytics with `pie` = true are supported.

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.AnalyticsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.builtbybit.com");
    
    // Configure API key authorization: token
    ApiKeyAuth token = (ApiKeyAuth) defaultClient.getAuthentication("token");
    token.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //token.setApiKeyPrefix("Token");

    AnalyticsApi apiInstance = new AnalyticsApi(defaultClient);
    String analytic = "analytic_example"; // String | The ID of the analytic to fetch.
    String period = "period_example"; // String | The time period to fetch data over.
    List filters = new List(); // List | A set of filters which may be used for the analytic.
    String startDate = "startDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    String endDate = "endDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    try {
      GetV2AnalyticsPie200Response result = apiInstance.getV2AnalyticsPie(analytic, period, filters, startDate, endDate);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AnalyticsApi#getV2AnalyticsPie");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
analytic String The ID of the analytic to fetch.
period String The time period to fetch data over. [optional]
filters List A set of filters which may be used for the analytic. [optional]
startDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]
endDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]

Return type

GetV2AnalyticsPie200Response

Authorization

token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
4XX -

getV2AnalyticsSingle

GetV2AnalyticsSingle200Response getV2AnalyticsSingle(analytics, period, filters, startDate, endDate)

Fetch a single analytics value

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.AnalyticsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.builtbybit.com");
    
    // Configure API key authorization: token
    ApiKeyAuth token = (ApiKeyAuth) defaultClient.getAuthentication("token");
    token.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //token.setApiKeyPrefix("Token");

    AnalyticsApi apiInstance = new AnalyticsApi(defaultClient);
    List analytics = new List(); // List | A list of analytic IDs to fetch data for.
    String period = "period_example"; // String | The time period to fetch data over.
    List filters = new List(); // List | A set of filters which may be used for the analytics.
    String startDate = "startDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    String endDate = "endDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    try {
      GetV2AnalyticsSingle200Response result = apiInstance.getV2AnalyticsSingle(analytics, period, filters, startDate, endDate);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AnalyticsApi#getV2AnalyticsSingle");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
analytics List A list of analytic IDs to fetch data for. [optional]
period String The time period to fetch data over. [optional]
filters List A set of filters which may be used for the analytics. [optional]
startDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]
endDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]

Return type

GetV2AnalyticsSingle200Response

Authorization

token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -

getV2AnalyticsTable

GetV2AnalyticsTable200Response getV2AnalyticsTable(analytic, period, filters, startDate, endDate, page, perPage)

Fetch an analytics table

Only analytics with `table` = true are supported.

Example

// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.auth.*;
import org.openapitools.client.models.*;
import org.openapitools.client.api.AnalyticsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.builtbybit.com");
    
    // Configure API key authorization: token
    ApiKeyAuth token = (ApiKeyAuth) defaultClient.getAuthentication("token");
    token.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //token.setApiKeyPrefix("Token");

    AnalyticsApi apiInstance = new AnalyticsApi(defaultClient);
    String analytic = "analytic_example"; // String | The ID of the analytic to fetch.
    String period = "period_example"; // String | The time period to fetch data over.
    List filters = new List(); // List | A set of filters which may be used for the analytic.
    String startDate = "startDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    String endDate = "endDate_example"; // String | Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'.
    Integer page = 56; // Integer | The page number/offset to return items for.
    Integer perPage = 25; // Integer | The number of items per page to return.
    try {
      GetV2AnalyticsTable200Response result = apiInstance.getV2AnalyticsTable(analytic, period, filters, startDate, endDate, page, perPage);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AnalyticsApi#getV2AnalyticsTable");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
analytic String The ID of the analytic to fetch.
period String The time period to fetch data over. [optional]
filters List A set of filters which may be used for the analytic. [optional]
startDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]
endDate String Only respected when 'period' = 'custom_range', in the format 'YYYY-MM-DD'. [optional]
page Integer The page number/offset to return items for. [optional]
perPage Integer The number of items per page to return. [optional] [default to 25]

Return type

GetV2AnalyticsTable200Response

Authorization

token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
4XX -