### Getting Started: Fetching Balances Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-api-rest/sdk/php/README.md This example demonstrates how to initialize the BalancesApi client and fetch balances for a specific exchange. It includes basic error handling. ```php v1BalancesGet($exchange_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling BalancesApi->v1BalancesGet: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Getting Started with BalancesApi Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-cloud-mgmt-api/sdk/php/README.md This example demonstrates how to initialize the BalancesApi and retrieve balances for a specific exchange. Ensure you have installed the SDK and included the autoloader. ```php v1BalancesGet($exchange_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling BalancesApi->v1BalancesGet: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Getting Started with Perl SDK Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-api-rest/sdk/perl/README.md This example demonstrates how to initialize the BalancesApi client and fetch balances for a specific exchange. Ensure the SDK is placed in the 'lib' directory. ```perl #!/usr/bin/perl use lib 'lib'; use strict; use warnings; # load the API package use WWW::OpenAPIClient::BalancesApi; use WWW::OpenAPIClient::OrdersApi; use WWW::OpenAPIClient::PositionsApi; # load the models use WWW::OpenAPIClient::Object::Balance; use WWW::OpenAPIClient::Object::BalanceDataInner; use WWW::OpenAPIClient::Object::Fills; use WWW::OpenAPIClient::Object::MessageError; use WWW::OpenAPIClient::Object::MessageReject; use WWW::OpenAPIClient::Object::OrdSide; use WWW::OpenAPIClient::Object::OrdStatus; use WWW::OpenAPIClient::Object::OrdType; use WWW::OpenAPIClient::Object::OrderCancelAllRequest; use WWW::OpenAPIClient::Object::OrderCancelSingleRequest; use WWW::OpenAPIClient::Object::OrderExecutionReport; use WWW::OpenAPIClient::Object::OrderExecutionReportAllOf; use WWW::OpenAPIClient::Object::OrderHistory; use WWW::OpenAPIClient::Object::OrderNewSingleRequest; use WWW::OpenAPIClient::Object::Position; use WWW::OpenAPIClient::Object::PositionDataInner; use WWW::OpenAPIClient::Object::RejectReason; use WWW::OpenAPIClient::Object::TimeInForce; use WWW::OpenAPIClient::Object::ValidationError; # for displaying the API response data use Data::Dumper; my $api_instance = WWW::OpenAPIClient::BalancesApi->new( ); my $exchange_id = KRAKEN; # string | Filter the balances to the specific exchange. eval { my $result = $api_instance->v1_balances_get(exchange_id => $exchange_id); print Dumper($result); }; if ($@) { warn "Exception when calling BalancesApi->v1_balances_get: $@\n"; } ``` -------------------------------- ### PHP SDK Getting Started Example Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/indexes-api-rest/sdk/php/README.md This example demonstrates how to configure API key or JWT authorization and make a request to the IndexInputDataApi. Replace 'YOUR_API_KEY' or 'YOUR_ACCESS_TOKEN' with your actual credentials. ```php setApiKey('Authorization', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer'); // Configure Bearer (JWT) authorization: JWT $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new OpenAPI\Client\Api\IndexInputDataApi( // If you want use custom http client, pass your client which implements `GuzzleHttp ClientInterface`. // This is optional, `GuzzleHttp Client` will be used as default. new GuzzleHttp Client(), $config ); $index_definition_id = 'index_definition_id_example'; // string try { $result = $apiInstance->v1IndexdefInputDataIndexDefinitionIdAllGet($index_definition_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling IndexInputDataApi->v1IndexdefInputDataIndexDefinitionIdAllGet: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Getting Started with SEC API Perl SDK Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/sec-api-rest/sdk/perl/README.md This example shows how to set up the SDK, instantiate the DownloadApi client, and make a call to download a file. Ensure your API key is configured. ```perl #!/usr/bin/perl use lib 'lib'; use strict; use warnings; # load the API package use WWW::OpenAPIClient::DownloadApi; use WWW::OpenAPIClient::ExtractorApi; use WWW::OpenAPIClient::FilingsApi; use WWW::OpenAPIClient::FullTextApi; use WWW::OpenAPIClient::XBRLConverterApi; # load the models use WWW::OpenAPIClient::Object::DTOExtractorType; use WWW::OpenAPIClient::Object::DTOFilingMetadataDto; use WWW::OpenAPIClient::Object::DTOFilingSortBy; use WWW::OpenAPIClient::Object::DTOSecFilingResultDto; use WWW::OpenAPIClient::Object::MvcProblemDetails; use WWW::OpenAPIClient::Object::MvcValidationProblemDetails; # for displaying the API response data use Data::Dumper; my $api_instance = WWW::OpenAPIClient::DownloadApi->new( # Configure API key authorization: APIKey api_key => {'Authorization' => 'YOUR_API_KEY'}, # uncomment below to setup prefix (e.g. Bearer) for API key, if needed #api_key_prefix => {'Authorization' => 'Bearer'}, ); my $accession_no = "accession_no_example"; # string | SEC filing accession number in format: 0000000000-00-000000 my $file_name = "file_name_example"; # string | Name of the file to download from the filing eval { $api_instance->v1_download_get(accession_no => $accession_no, file_name => $file_name); }; if ($@) { warn "Exception when calling DownloadApi->v1_download_get: $@\n"; } ``` -------------------------------- ### Run JavaScript Example Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk-handcrafted/javascript-rest/readme.md Navigate to the SDK folder, install dependencies, and run the JavaScript example using Node.js. ```bash cd /path/to/sdk/folder npm install node ./example_javascript.js ``` -------------------------------- ### Getting Started with the JavaScript SDK Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk/javascript/README.md This snippet demonstrates how to install the SDK, configure API key or JWT authentication, and make a basic call to get a specific exchange rate. ```APIDOC ## Getting Started Please follow the [installation](#installation) instruction and execute the following JS code: ```javascript var CoinApiMarketDataRestApi = require('coin_api_market_data_rest_api'); var defaultClient = CoinApiMarketDataRestApi.ApiClient.instance; // Configure API key authorization: APIKey var APIKey = defaultClient.authentications['APIKey']; APIKey.apiKey = "YOUR API KEY" // Configure Bearer (JWT) access token for authorization: JWT var JWT = defaultClient.authentications['JWT']; JWT.accessToken = "YOUR ACCESS TOKEN" var api = new CoinApiMarketDataRestApi.ExchangeRatesApi() var assetIdBase = "assetIdBase_example"; // {String} Requested exchange rate base asset identifier (from the Metadata -> Assets) var assetIdQuote = "assetIdQuote_example"; // {String} Requested exchange rate quote asset identifier (from the Metadata -> Assets) var opts = { 'time': "time_example" // {String} Time at which exchange rate is calculated (optional, if not supplied then current rate is returned) }; var callback = function(error, data, response) { if (error) { console.error(error); } else { console.log('API called successfully. Returned data: ' + data); } }; api.getSpecificRate(assetIdBase, assetIdQuote, opts, callback); ``` ``` -------------------------------- ### Setup and Run Go WebSocket Example Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-ws/sdk/go-ws/README.md Prepare your workspace, fetch the SDK, and run the main example file. Remember to replace the placeholder API key. ```bash cd /path/to/workspace export GOPATH=/path/to/workspace go get -u github.com/CoinAPI/coinapi-sdk/data-api/go-ws wget -v https://raw.githubusercontent.com/coinapi/coinapi-sdk/master/go-ws/main.go # update api key inside main.go go run ./main.go ``` -------------------------------- ### Get Balances with Ruby SDK Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-api-rest/sdk/ruby/README.md Example of how to initialize the SDK and fetch balances for a specific exchange. Ensure the gem is installed and required. ```ruby # Load the gem require 'openapi_client' api_instance = OpenapiClient::BalancesApi.new opts = { exchange_id: 'KRAKEN' # String | Filter the balances to the specific exchange. } begin #Get balances result = api_instance.v1_balances_get(opts) p result rescue OpenapiClient::ApiError => e puts "Exception when calling BalancesApi->v1_balances_get: #{e}" end ``` -------------------------------- ### Python SDK Setup and Usage Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/currencies-api-rest-historical/sdk/python/api_bricks_currencies_api_rest_historical_README.md Demonstrates how to initialize the API client, configure authentication using an API key, and make a request to get a specific exchange rate. Ensure you have the necessary dependencies installed and your API key is set as an environment variable. ```python import api_bricks_currencies_api_rest_historical from api_bricks_currencies_api_rest_historical.rest import ApiException from pprint import pprint import os # Defining the host is optional and defaults to https://api-historical.fx.finfeedapi.com # See configuration.py for a list of all supported configuration parameters. configuration = api_bricks_currencies_api_rest_historical.Configuration( host = "https://api-historical.fx.finfeedapi.com" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure API key authorization: APIKey configuration.api_key['APIKey'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['APIKey'] = 'Bearer' # Enter a context with an instance of the API client with api_bricks_currencies_api_rest_historical.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = api_bricks_currencies_api_rest_historical.ExchangeRatesApi(api_client) asset_id_base = 'asset_id_base_example' # str | Requested exchange rate base asset identifier (from the Metadata -> Assets) asset_id_quote = 'asset_id_quote_example' # str | Requested exchange rate quote asset identifier (from the Metadata -> Assets) time = 'time_example' # str | Time at which exchange rate is calculated (optional, if not supplied then current rate is returned) (optional) try: # Get specific rate api_response = api_instance.get_specific_rate(asset_id_base, asset_id_quote, time=time) print("The response of ExchangeRatesApi->get_specific_rate:\n") pprint(api_response) except ApiException as e: print("Exception when calling ExchangeRatesApi->get_specific_rate: %s\n" % e) ``` -------------------------------- ### Getting Started with OpenAPI Dart Dio Client SDK Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/sec-api-rest/sdk/dart-dio/README.md After installation, import the library and instantiate the API client to make requests. This example shows how to download a file using the DownloadApi. ```dart import 'package:openapi/openapi.dart'; final api = Openapi().getDownloadApi(); final String accessionNo = accessionNo_example; // String | SEC filing accession number in format: 0000000000-00-000000 final String fileName = fileName_example; // String | Name of the file to download from the filing try { api.v1DownloadGet(accessionNo, fileName); } catch on DioException (e) { print("Exception when calling DownloadApi->v1DownloadGet: $e\n"); } ``` -------------------------------- ### Run Go REST SDK Examples Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk-handcrafted/go-rest/README.MD Follow these steps to set up your environment and run the Go REST SDK examples. Ensure you have Go installed and update the API key in main.go. ```bash cd /path/to/workspace export GOPATH=/path/to/workspace go get -u github.com/CoinAPI/coinapi-sdk/data-api/go-rest/v1 wget -v https://raw.githubusercontent.com/coinapi/coinapi-sdk/master/go-rest/main.go # update api key inside main.go go run ./main.go ``` -------------------------------- ### Getting Started with CoinAPI Indexes API (Perl) Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/indexes-api-rest/sdk/perl/README.md This example demonstrates how to initialize the SDK, configure API key authorization, and make a call to retrieve all input data for a specific index definition ID. Ensure the SDK is placed in the 'lib' folder and your API key is correctly configured. ```perl #!/usr/bin/perl use lib 'lib'; use strict; use warnings; # load the API package use WWW::OpenAPIClient::IndexInputDataApi; use WWW::OpenAPIClient::IndexesApi; use WWW::OpenAPIClient::MetadataApi; use WWW::OpenAPIClient::MultiAssetWeightsApi; use WWW::OpenAPIClient::PeriodsApi; # load the models use WWW::OpenAPIClient::Object::ModelsExchange; use WWW::OpenAPIClient::Object::ModelsIndexDefinitionInputData; use WWW::OpenAPIClient::Object::ModelsIndexDefinitionSnapshotEntry; use WWW::OpenAPIClient::Object::ModelsIndexIdentifier; use WWW::OpenAPIClient::Object::ModelsIndexMultiAssetWeight; use WWW::OpenAPIClient::Object::ModelsIndexTimeseriesItem; use WWW::OpenAPIClient::Object::ModelsIndexValue; use WWW::OpenAPIClient::Object::ModelsIndexValueComponent; use WWW::OpenAPIClient::Object::ModelsTimeseriesPeriod; # for displaying the API response data use Data::Dumper; my $api_instance = WWW::OpenAPIClient::IndexInputDataApi->new( # Configure API key authorization: APIKey api_key => {'Authorization' => 'YOUR_API_KEY'}, # uncomment below to setup prefix (e.g. Bearer) for API key, if needed #api_key_prefix => {'Authorization' => 'Bearer'}, ); my $index_definition_id = "index_definition_id_example"; # string | eval { my $result = $api_instance->v1_indexdef_input_data_index_definition_id_all_get(index_definition_id => $index_definition_id); print Dumper($result); }; if ($@) { warn "Exception when calling IndexInputDataApi->v1_indexdef_input_data_index_definition_id_all_get: $@\n"; } ``` -------------------------------- ### Running CoinAPI Python WebSocket SDK Examples Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-ws/sdk/python-ws/README.md Instructions to clone the repository, set up your API key, install the necessary library, and execute the Python example script. ```bash git clone https://github.com/coinapi/coinapi-sdk/ cd coinapi-sdk/data-api/python-ws # edit examples.py, fill your API key inside of it pip install websocket-client python examples.py ``` -------------------------------- ### Getting Started with Exchange Rates API Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/currencies-api-rest-realtime/sdk/php/README.md This example demonstrates how to initialize the API client and fetch a specific exchange rate. It shows configuration for API key and JWT authentication, and how to call the `getSpecificRate` method. ```php setApiKey('Authorization', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer'); // Configure Bearer (JWT) authorization: JWT $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new OpenAPI\Client\Api\ExchangeRatesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp ClientInterface`. // This is optional, `GuzzleHttp Client` will be used as default. new GuzzleHttp Client(), $config ); $asset_id_base = 'asset_id_base_example'; // string | Requested exchange rate base asset identifier (from the Metadata -> Assets) $asset_id_quote = 'asset_id_quote_example'; // string | Requested exchange rate quote asset identifier (from the Metadata -> Assets) try { $result = $apiInstance->getSpecificRate($asset_id_base, $asset_id_quote); print_r($result); } catch (Exception $e) { echo 'Exception when calling ExchangeRatesApi->getSpecificRate: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Running C++ REST SDK Examples Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk-handcrafted/cpp-rest/README.MD Follow these steps to clone the repository, install dependencies, update your API key, build, and run the C++ REST SDK examples. ```bash cd /path/to/workspace git clone https://github.com/coinapi/coinapi-sdk cd coinapi-sdk/data-api/cpp-rest apt-get install libcpprest-dev # update your API key inside coin_api_test.cpp make ./coin_api_test ``` -------------------------------- ### Compile and Run TypeScript Examples Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk-handcrafted/typescript-rest/readme.md Follow these steps to compile and run the TypeScript examples. Ensure you have Node.js and npm installed. Navigate to the SDK folder, install dependencies, compile the TypeScript file, and then execute the generated JavaScript file. ```bash cd /path/to/sdk/folder npm install tsc ./example_typescript.ts node ./example_typescript.js ``` -------------------------------- ### Run Compiled TypeScript Example Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk-handcrafted/javascript-rest/readme.md Navigate to the SDK folder, install dependencies, and run the TypeScript example using Node.js. ```bash cd /path/to/sdk/folder npm install node ./example_typescript.js ``` -------------------------------- ### Local Development Setup Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/exchange-rates-api-rest-historical/sdk/javascript/README.md For local development, install dependencies, link the library globally, and then link it to your project. Finally, build the module. ```shell npm install npm link npm link /path/to/ npm run build ``` -------------------------------- ### PHP Example for internalRatelimitWshelloIpGet Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/currencies-api-rest-realtime/sdk/php/docs/Api/RateLimitApi.md Demonstrates how to instantiate the RateLimitApi client and call the `internalRatelimitWshelloIpGet` method. Includes setup for API key and JWT authentication. ```php setApiKey('Authorization', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI Client Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer'); // Configure Bearer (JWT) authorization: JWT $config = OpenAPI Client Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new OpenAPI Client Api RateLimitApi( // If you want use custom http client, pass your client which implements `GuzzleHttp ClientInterface`. // This is optional, `GuzzleHttp Client` will be used as default. new GuzzleHttp Client(), $config ); try { $apiInstance->internalRatelimitWshelloIpGet(); } catch (Exception $e) { echo 'Exception when calling RateLimitApi->internalRatelimitWshelloIpGet: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Get Balances Example Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-api-rest/sdk/dart-dio/README.md This example demonstrates how to initialize the SDK and fetch balances for a specific exchange. It includes error handling for Dio exceptions. ```dart import 'package:openapi/openapi.dart'; final api = Openapi().getBalancesApi(); final String exchangeId = KRAKEN; // String | Filter the balances to the specific exchange. try { final response = await api.v1BalancesGet(exchangeId); print(response); } catch on DioError (e) { print("Exception when calling BalancesApi->v1BalancesGet: $e\n"); } ``` -------------------------------- ### Get Balances Example Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-api-rest/sdk/csharp-netcore/README.md Example of how to instantiate the BalancesApi and retrieve balances for a specific exchange. Includes error handling for API exceptions. ```csharp using System.Collections.Generic; using System.Diagnostics; using CoinAPI.EMS.REST.V1.Api; using CoinAPI.EMS.REST.V1.Client; using CoinAPI.EMS.REST.V1.Model; namespace Example { public class Example { public static void Main() { Configuration config = new Configuration(); config.BasePath = "https://ems-gateway-aws-eu-central-1-dev.coinapi.io"; var apiInstance = new BalancesApi(config); var exchangeId = KRAKEN; // string | Filter the balances to the specific exchange. (optional) try { // Get balances List result = apiInstance.V1BalancesGet(exchangeId); Debug.WriteLine(result); } catch (ApiException e) { Debug.Print("Exception when calling BalancesApi.V1BalancesGet: " + e.Message ); Debug.Print("Status Code: "+ e.ErrorCode); Debug.Print(e.StackTrace); } } } } ``` -------------------------------- ### Getting Started with CoinAPI PHP SDK Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/exchange-rates-api-rest-realtime/sdk/php/README.md Initialize the SDK, configure API key or access token, and make a request to get a specific exchange rate. Ensure you replace placeholders with your actual API key or access token. ```php Assets) $asset_id_quote = 'asset_id_quote_example'; // string | Requested exchange rate quote asset identifier (from the Metadata -> Assets) try { $result = $apiInstance->getSpecificRate($asset_id_base, $asset_id_quote); print_r($result); } catch (Exception $e) { echo 'Exception when calling ExchangeRatesApi->getSpecificRate: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Install Python SDK via Setuptools Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-cloud-mgmt-api/sdk/python/README.md Install the Python SDK using Setuptools by running the setup.py script. Installation can be for the current user or all users. ```sh python setup.py install --user ``` ```sh sudo python setup.py install ``` -------------------------------- ### Setup Environment and API Key Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/stock-api-rest/tutorials/Visualize-Intraday-Bid-and-Ask-Prices-using-Level-1-Quotes.ipynb Imports necessary libraries and sets up the API key for authentication with FinFeedAPI. Replace 'YOUR_API_KEY_HERE' with your actual key. ```python import requests import json import matplotlib.pyplot as plt # Replace with your real FinFeedAPI key API_KEY = "YOUR_API_KEY_HERE" headers = { "Authorization": API_KEY } ``` -------------------------------- ### CMakeLists.txt - Basic Setup Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-cloud-mgmt-api/sdk/c/CMakeLists.txt Includes optional packing modules and initializes source and header file variables to null. ```cmake include(Packing.cmake OPTIONAL) # Setting file variables to null set(SRCS "") set(HDRS "") ``` -------------------------------- ### R Example: Get Exchange Metrics Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk/r/docs/MetricsV1Api.md This R code snippet demonstrates how to use the V1MetricsExchangeListingGet function to retrieve exchange metrics. Ensure you have the 'openapi' package installed and your API key configured. ```R library(openapi) # Listing of all supported exchange metrics # # prepare function argument(s) var_exchange_id <- "exchange_id_example" # character | The exchange identifier (from the Metadata -> Exchanges) var_metric_id <- "metric_id_example" # character | The metric identifier (from the Metrics -> Listing) (Optional) api_instance <- MetricsV1Api$new() # Configure API key authorization: APIKey api_instance$api_client$api_keys["Authorization"] <- Sys.getenv("API_KEY") # Configure HTTP bearer authorization: JWT # api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN") # to save the result into a file, simply add the optional `data_file` parameter, e.g. # result <- api_instance$V1MetricsExchangeListingGet(var_exchange_id, metric_id = var_metric_iddata_file = "result.txt") result <- api_instance$V1MetricsExchangeListingGet(var_exchange_id, metric_id = var_metric_id) dput(result) ``` -------------------------------- ### Get Balances using BalancesApi Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-cloud-mgmt-api/sdk/python/docs/apis/tags/BalancesApi.md Retrieves current currency balances from all or a single exchange. Ensure the `openapi_client` library is installed and configured. This example demonstrates passing an optional `exchange_id` query parameter. ```python import openapi_client from openapi_client.apis.tags import balances_api from openapi_client.model.balances import Balances from openapi_client.model.message_reject import MessageReject from pprint import pprint # Defining the host is optional and defaults to https://ems-gateway-aws-eu-central-1-dev.coinapi.io # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( host = "https://ems-gateway-aws-eu-central-1-dev.coinapi.io" ) # Enter a context with an instance of the API client with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = balances_api.BalancesApi(api_client) # example passing only optional values query_params = { 'exchange_id': "KRAKEN", } try: # Get balances api_response = api_instance.v1_balances_get( query_params=query_params, ) pprint(api_response) except openapi_client.ApiException as e: print("Exception when calling BalancesApi->v1_balances_get: %s\n" % e) ``` -------------------------------- ### PHP Example: Get Exchange Metrics Listing Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk/php/docs/Api/MetricsV1Api.md Demonstrates how to instantiate the MetricsV1Api client and call the v1MetricsExchangeListingGet method to fetch exchange metrics. Includes setup for API key or JWT authentication. ```php setApiKey('Authorization', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer'); // Configure Bearer (JWT) authorization: JWT $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new OpenAPI\Client\Api\MetricsV1Api( // If you want use custom http client, pass your client which implements `GuzzleHttp ClientInterface`. // This is optional, `GuzzleHttp Client` will be used as default. new GuzzleHttp Client(), $config ); $exchange_id = 'exchange_id_example'; // string | The exchange identifier (from the Metadata -> Exchanges) $metric_id = 'metric_id_example'; // string | The metric identifier (from the Metrics -> Listing) try { $result = $apiInstance->v1MetricsExchangeListingGet($exchange_id, $metric_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling MetricsV1Api->v1MetricsExchangeListingGet: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Get Order History (R) Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-api-rest/sdk/r/docs/OrdersApi.md Fetches the history of order changes within a specified date range. Requires start and end date parameters. Ensure the 'openapi' library is installed and loaded. ```r library(openapi) # History of order changes # # prepare function argument(s) var_time_start <- "2022-05-01T00:00:00" # character | Start date var_time_end <- "2022-05-01T12:00:00" # character | End date api_instance <- OrdersApi$new() # to save the result into a file, simply add the optional `data_file` parameter, e.g. # result <- api_instance$V1OrdersHistoryGet(var_time_start, var_time_enddata_file = "result.txt") result <- api_instance$V1OrdersHistoryGet(var_time_start, var_time_end) dput(result) ``` -------------------------------- ### Get Current Quote for a Symbol Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk/go/docs/QuotesAPI.md Fetches the current quote for a given symbol identifier. Ensure the symbol ID is valid and present in the metadata. This example demonstrates basic API client setup and execution. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) func main() { symbolId := "symbolId_example" // string | The symbol identifier (from the Metadata -> Symbols) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.QuotesAPI.V1QuotesSymbolIdCurrentGet(context.Background(), symbolId).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `QuotesAPI.V1QuotesSymbolIdCurrentGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `V1QuotesSymbolIdCurrentGet`: V1QuoteTrade fmt.Fprintf(os.Stdout, "Response from `QuotesAPI.V1QuotesSymbolIdCurrentGet`: %v\n", resp) } ``` -------------------------------- ### Full Example Usage Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/exchange-rates-api-rest-realtime/sdk/haskell-http-client/README.md A comprehensive example demonstrating how to set up the manager, configuration, authentication, construct a request, and dispatch it. ```APIDOC ## Example Usage ### Description This example illustrates a complete workflow for using the Haskell HTTP Client SDK, from initializing network managers and configurations to dispatching a request with authentication and optional parameters. ### Code Example ```haskell mgr <- newManager defaultManagerSettings config0 <- withStdoutLogging =<< newConfig let config = config0 `addAuthMethod` AuthOAuthFoo "secret-key" let addFooRequest = addFoo (ContentType MimeJSON) (Accept MimeXML) (ParamBar paramBar) (ParamQux paramQux) modelBaz `applyOptionalParam` FooId 1 `applyOptionalParam` FooName "name" `setHeader` [("qux_header","xxyy")] addFooResult <- dispatchMime mgr config addFooRequest ``` ``` -------------------------------- ### Initialize and Use Download API Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/sec-api-rest/sdk/javascript/README.md Demonstrates how to initialize the SDK, configure API key or JWT authentication, and make a call to the download API. Ensure you replace 'YOUR API KEY' and 'YOUR ACCESS TOKEN' with your actual credentials. ```javascript var FinFeedApiSecRestApi = require('fin_feed_api_sec_rest_api'); var defaultClient = FinFeedApiSecRestApi.ApiClient.instance; // Configure API key authorization: APIKey var APIKey = defaultClient.authentications['APIKey']; APIKey.apiKey = "YOUR API KEY" // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) //APIKey.apiKeyPrefix['Authorization'] = "Token" // Configure Bearer (JWT) access token for authorization: JWT var JWT = defaultClient.authentications['JWT']; JWT.accessToken = "YOUR ACCESS TOKEN" var api = new FinFeedApiSecRestApi.DownloadApi() var accessionNo = "accessionNo_example"; // {String} SEC filing accession number in format: 0000000000-00-000000 var fileName = "fileName_example"; // {String} Name of the file to download from the filing var callback = function(error, data, response) { if (error) { console.error(error); } else { console.log('API called successfully.'); } }; api.v1DownloadGet(accessionNo, fileName, callback); ``` -------------------------------- ### Getting Started: Fetching Specific Exchange Rate Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/currencies-api-rest-historical/sdk/php/README.md This example demonstrates how to configure the API key and fetch a specific historical exchange rate using the ExchangeRatesApi. Replace 'YOUR_API_KEY' with your actual API key. ```php setApiKey('X-CoinAPI-Key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-CoinAPI-Key', 'Bearer'); $apiInstance = new OpenAPI\Client\Api\ExchangeRatesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ ClientInterface`. // This is optional, `GuzzleHttp\ Client` will be used as default. new GuzzleHttp\Client(), $config ); $asset_id_base = 'asset_id_base_example'; // string | Requested exchange rate base asset identifier (from the Metadata -> Assets) $asset_id_quote = 'asset_id_quote_example'; // string | Requested exchange rate quote asset identifier (from the Metadata -> Assets) $time = 'time_example'; // string | Time at which exchange rate is calculated (optional, if not supplied then current rate is returned) try { $result = $apiInstance->getSpecificRate($asset_id_base, $asset_id_quote, $time); print_r($result); } catch (Exception $e) { echo 'Exception when calling ExchangeRatesApi->getSpecificRate: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Getting Started with OpenAPIClient-php API Call Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/stock-api-rest/sdk/php/README.md This example demonstrates how to configure API key or JWT authorization and make a request to the v1ExchangesGet endpoint using the MetadataApi. Ensure you replace 'YOUR_API_KEY' or 'YOUR_ACCESS_TOKEN' with your actual credentials. ```php setApiKey('Authorization', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer'); // Configure Bearer (JWT) authorization: JWT $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new OpenAPI\Client\Api\MetadataApi( // If you want use custom http client, pass your client which implements `GuzzleHttp ClientInterface`. // This is optional, `GuzzleHttp Client` will be used as default. new GuzzleHttp Client(), $config ); try { $result = $apiInstance->v1ExchangesGet(); print_r($result); } catch (Exception $e) { echo 'Exception when calling MetadataApi->v1ExchangesGet: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Get Balances with Python SDK Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/ems-api-rest/sdk/python/docs/apis/tags/BalancesApi.md Demonstrates how to retrieve currency balances from a specified exchange using the `v1_balances_get` method. Ensure you have the `openapi_client` library installed and configured. This example shows how to pass optional query parameters like `exchange_id`. ```python import openapi_client from openapi_client.apis.tags import balances_api from openapi_client.model.balances import Balances from openapi_client.model.message_reject import MessageReject from pprint import pprint # Defining the host is optional and defaults to https://ems-gateway-aws-eu-central-1-dev.coinapi.io # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( host = "https://ems-gateway-aws-eu-central-1-dev.coinapi.io" ) # Enter a context with an instance of the API client with openapi_client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = balances_api.BalancesApi(api_client) # example passing only optional values query_params = { 'exchange_id': "KRAKEN", } try: # Get balances api_response = api_instance.v1_balances_get( query_params=query_params, ) pprint(api_response) except openapi_client.ApiException as e: print("Exception when calling BalancesApi->v1_balances_get: %s\n" % e) ``` -------------------------------- ### Initialize and Use FinFeedAPI Client Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/sec-api-rest/sdk/apex/README.md Demonstrates how to initialize the FinFeedAPI client and make a download request. Includes basic exception handling. ```java OASDownloadApi api = new OASDownloadApi(); OASClient client = api.getClient(); Map params = new Map{ 'accessionNo' => 'null', 'fileName' => 'null' }; try { // cross your fingers api.v1DownloadGet(params); } catch (OAS.ApiException e) { // ...handle your exceptions } ``` -------------------------------- ### Get Historical OHLCV Data by Exchange Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/market-data-api-rest/sdk/go/docs/OHLCVAPI.md Retrieves historical OHLCV data for a specific exchange. Requires exchange ID, period ID, start time, and end time. Ensure correct context and API client setup. ```go package main import ( "context" "fmt" "os" openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID" ) func main() { exchangeId := "exchangeId_example" // string | Exchange identifier of requested timeseries (from the Metadata -> Exchanges) periodId := "periodId_example" // string | Identifier of requested timeseries period (e.g. `5SEC` or `1DAY`) timeStart := "timeStart_example" // string | Timeseries starting time in ISO 8601 timeEnd := "timeEnd_example" // string | Timeseries ending time in ISO 8601 configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) resp, r, err := apiClient.OHLCVAPI.V1OhlcvExchangesExchangeIdHistoryGet(context.Background(), exchangeId).PeriodId(periodId).TimeStart(timeStart).TimeEnd(timeEnd).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `OHLCVAPI.V1OhlcvExchangesExchangeIdHistoryGet``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } // response from `V1OhlcvExchangesExchangeIdHistoryGet`: []OhlcvExchangeTimeseriesItem fmt.Fprintf(os.Stdout, "Response from `OHLCVAPI.V1OhlcvExchangesExchangeIdHistoryGet`: %v\n", resp) } ``` -------------------------------- ### Example Usage Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/finfeedapi/currencies-api-rest-historical/sdk/haskell-http-client/README.md A complete example demonstrating how to set up the client, configure authentication, construct a request, and dispatch it. ```APIDOC ## Example Usage ### Description This example illustrates a typical workflow for using the Haskell HTTP Client SDK, including manager creation, configuration, authentication setup, request construction, and dispatching. ### Code Example ```haskell import Network.HTTP.Client (newManager, defaultManagerSettings) import qualified FinFeedAPICurrenciesHistoricalREST.Client as API import FinFeedAPICurrenciesHistoricalREST.Core (newConfig, withStdoutLogging) import FinFeedAPICurrenciesHistoricalREST.Model (ParamBar(..), ParamQux(..), FooModel, FooName(..), FooId(..)) import FinFeedAPICurrenciesHistoricalREST.MimeTypes (ContentType(..), Accept(..), MimeJSON, MimeXML) main :: IO () main = do -- 1. Create a Manager mgr <- newManager defaultManagerSettings -- 2. Configure the API client with logging and authentication config0 <- withStdoutLogging =<< newConfig let config = config0 `API.addAuthMethod` API.AuthOAuthFoo "secret-key" -- Example authentication -- 3. Construct an API request let addFooRequest = API.addFoo (ContentType MimeJSON) -- Content Type (Accept MimeXML) -- Accept Header (ParamBar paramBarValue) -- Required Path/Query Parameter (ParamQux paramQuxValue) -- Required Path/Query Parameter modelBaz -- Request Body `API.applyOptionalParam` FooId 123 -- Optional Parameter `API.applyOptionalParam` FooName "example name" -- Optional Parameter `API.setHeader` [("custom_header", "custom_value")] -- Custom Header -- 4. Dispatch the request addFooResult <- API.dispatchMime mgr config addFooRequest -- Process the result (addFooResult would be of a type like Either APIError ResponseType) print addFooResult -- Dummy values for demonstration paramBarValue :: String paramBarValue = "bar" paramQuxValue :: Int paramQuxValue = 42 modelBaz :: FooModel modelBaz = undefined -- Replace with actual FooModel construction ``` ``` -------------------------------- ### Get Current Index Snapshot - Scala Akka Example Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/indexes-api-rest/sdk/scala-akka/docs/IndexesApi.md Demonstrates how to retrieve the current snapshot of an index definition. Includes setup for API key and JWT authentication, client instantiation, and asynchronous response handling for success and API errors. ```scala // Import classes: import org.openapitools.client.core._ import org.openapitools.client.core.CollectionFormats._ import org.openapitools.client.core.ApiKeyLocations._ import akka.actor.ActorSystem import scala.concurrent.Future import scala.util.{Failure, Success} object Example extends App { implicit val system: ActorSystem = ActorSystem() import system.dispatcher // Configure API key authorization: APIKey implicit val APIKey: ApiKeyValue = ApiKeyValue("YOUR API KEY") // Configure HTTP bearer authorization: JWT implicit val JWT: BearerToken = BearerToken("BEARER TOKEN") val apiInvoker = ApiInvoker() val apiInstance = IndexesApi("https://rest-api.indexes.coinapi.io") val indexDefinitionId: String = indexDefinitionId_example // String | val request = apiInstance.v1IndexesIndexDefinitionIdCurrentSnapshotGet(indexDefinitionId) val response = apiInvoker.execute(request) response.onComplete { case Success(ApiResponse(code, content, headers)) => System.out.println(s"Status code: $code}") System.out.println(s"Response headers: ${headers.mkString(", ")}") System.out.println(s"Response body: $content") case Failure(error @ ApiError(code, message, responseContent, cause, headers)) => System.err.println("Exception when calling IndexesApi#v1IndexesIndexDefinitionIdCurrentSnapshotGet") System.err.println(s"Status code: $code}") System.err.println(s"Reason: $responseContent") System.err.println(s"Response headers: ${headers.mkString(", ")}") error.printStackTrace(); case Failure(exception) => System.err.println("Exception when calling IndexesApi#v1IndexesIndexDefinitionIdCurrentSnapshotGet") exception.printStackTrace(); } } ``` -------------------------------- ### Python SDK Example: Get Historical Index Snapshot Source: https://github.com/api-bricks/api-bricks-sdk/blob/master/coinapi/indexes-api-rest/sdk/python/api_bricks_coinapi_indexes_api_rest/docs/IndexesApi.md Demonstrates how to retrieve historical index values for a specific index definition ID using the Python SDK. Includes setup for API key or JWT authentication and error handling. ```python import api_bricks_coinapi_indexes_api_rest from api_bricks_coinapi_indexes_api_rest.models.models_index_definition_snapshot_entry import ModelsIndexDefinitionSnapshotEntry from api_bricks_coinapi_indexes_api_rest.rest import ApiException from pprint import pprint import os # Defining the host is optional and defaults to https://rest-api.indexes.coinapi.io # See configuration.py for a list of all supported configuration parameters. configuration = api_bricks_coinapi_indexes_api_rest.Configuration( host = "https://rest-api.indexes.coinapi.io" ) # The client must configure the authentication and authorization parameters # in accordance with the API server security policy. # Examples for each auth method are provided below, use the example that # satisfies your auth use case. # Configure API key authorization: APIKey configuration.api_key['APIKey'] = os.environ["API_KEY"] # Uncomment below to setup prefix (e.g. Bearer) for API key, if needed # configuration.api_key_prefix['APIKey'] = 'Bearer' # Configure Bearer authorization (JWT): JWT # Note: If using JWT, you would typically re-initialize configuration or merge settings. # For simplicity, this example shows setting it directly. In a real app, manage configurations carefully. # configuration = api_bricks_coinapi_indexes_api_rest.Configuration( # access_token = os.environ["BEARER_TOKEN"] # ) # Enter a context with an instance of the API client with api_bricks_coinapi_indexes_api_rest.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = api_bricks_coinapi_indexes_api_rest.IndexesApi(api_client) index_definition_id = 'index_definition_id_example' # str | time = '2013-10-20T19:20:30+01:00' # datetime | (optional) try: # Historical Index Values for index definition api_response = api_instance.v1_indexes_index_definition_id_history_snapshot_get(index_definition_id, time=time) print("The response of IndexesApi->v1_indexes_index_definition_id_history_snapshot_get:\n") pprint(api_response) except Exception as e: print("Exception when calling IndexesApi->v1_indexes_index_definition_id_history_snapshot_get: %s\n" % e) ```