Skip to content

Commit 07920f0

Browse files
committed
Auto-generate SDK for CoinAPI Market Data API REST Historical
1 parent f9cb9c0 commit 07920f0

File tree

143 files changed

+5830
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+5830
-65
lines changed

coinapi/market-data-api-rest/sdk/ada/src/client/-clients.adb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,27 @@ package body .Clients is
313313
.Models.Deserialize (Reply, "", Result);
314314
end V_1Symbols_Exchange_Id_Get;
315315

316+
-- Get symbol history for an exchange with pagination.
317+
procedure V_1Symbols_Exchange_Id_History_Get
318+
(Client : in out Client_Type;
319+
Exchange_Id : in Swagger.UString;
320+
Page : in Swagger.Nullable_Integer;
321+
Limit : in Swagger.Nullable_Integer;
322+
Result : out .Models.V1Symbol_Type_Vectors.Vector) is
323+
URI : Swagger.Clients.URI_Type;
324+
Reply : Swagger.Value_Type;
325+
begin
326+
Client.Set_Accept (Media_List_1);
327+
328+
329+
URI.Add_Param ("page", Page);
330+
URI.Add_Param ("limit", Limit);
331+
URI.Set_Path ("/v1/symbols/{exchange_id}/history");
332+
URI.Set_Path_Param ("exchange_id", Exchange_Id);
333+
Client.Call (Swagger.Clients.GET, URI, Reply);
334+
.Models.Deserialize (Reply, "", Result);
335+
end V_1Symbols_Exchange_Id_History_Get;
336+
316337
-- List all symbols
317338
-- Retrieves all symbols with optional filtering.
318339
--

coinapi/market-data-api-rest/sdk/ada/src/client/-clients.ads

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ package .Clients is
149149
Filter_Asset_Id : in Swagger.Nullable_UString;
150150
Result : out .Models.V1Symbol_Type_Vectors.Vector);
151151

152+
-- Get symbol history for an exchange with pagination.
153+
procedure V_1Symbols_Exchange_Id_History_Get
154+
(Client : in out Client_Type;
155+
Exchange_Id : in Swagger.UString;
156+
Page : in Swagger.Nullable_Integer;
157+
Limit : in Swagger.Nullable_Integer;
158+
Result : out .Models.V1Symbol_Type_Vectors.Vector);
159+
152160
-- List all symbols
153161
-- Retrieves all symbols with optional filtering.
154162
--

coinapi/market-data-api-rest/sdk/android/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Class | Method | HTTP request | Description
9898
*MetadataApi* | [**v1ExchangesGet**](docs/MetadataApi.md#v1ExchangesGet) | **GET** /v1/exchanges | List all exchanges
9999
*MetadataApi* | [**v1ExchangesIconsSizeGet**](docs/MetadataApi.md#v1ExchangesIconsSizeGet) | **GET** /v1/exchanges/icons/{size} | List of icons for the exchanges
100100
*MetadataApi* | [**v1SymbolsExchangeIdGet**](docs/MetadataApi.md#v1SymbolsExchangeIdGet) | **GET** /v1/symbols/{exchange_id} | List of symbols for the exchange
101+
*MetadataApi* | [**v1SymbolsExchangeIdHistoryGet**](docs/MetadataApi.md#v1SymbolsExchangeIdHistoryGet) | **GET** /v1/symbols/{exchange_id}/history | Get symbol history for an exchange with pagination.
101102
*MetadataApi* | [**v1SymbolsGet**](docs/MetadataApi.md#v1SymbolsGet) | **GET** /v1/symbols | List all symbols
102103
*MetadataApi* | [**v1SymbolsMapExchangeIdGet**](docs/MetadataApi.md#v1SymbolsMapExchangeIdGet) | **GET** /v1/symbols/map/{exchange_id} | List symbol mapping for the exchange
103104
*MetricsV1Api* | [**v1MetricsAssetCurrentGet**](docs/MetricsV1Api.md#v1MetricsAssetCurrentGet) | **GET** /v1/metrics/asset/current | Current metrics for given asset

coinapi/market-data-api-rest/sdk/android/docs/MetadataApi.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Method | HTTP request | Description
1313
[**v1ExchangesGet**](MetadataApi.md#v1ExchangesGet) | **GET** /v1/exchanges | List all exchanges
1414
[**v1ExchangesIconsSizeGet**](MetadataApi.md#v1ExchangesIconsSizeGet) | **GET** /v1/exchanges/icons/{size} | List of icons for the exchanges
1515
[**v1SymbolsExchangeIdGet**](MetadataApi.md#v1SymbolsExchangeIdGet) | **GET** /v1/symbols/{exchange_id} | List of symbols for the exchange
16+
[**v1SymbolsExchangeIdHistoryGet**](MetadataApi.md#v1SymbolsExchangeIdHistoryGet) | **GET** /v1/symbols/{exchange_id}/history | Get symbol history for an exchange with pagination.
1617
[**v1SymbolsGet**](MetadataApi.md#v1SymbolsGet) | **GET** /v1/symbols | List all symbols
1718
[**v1SymbolsMapExchangeIdGet**](MetadataApi.md#v1SymbolsMapExchangeIdGet) | **GET** /v1/symbols/map/{exchange_id} | List symbol mapping for the exchange
1819

@@ -426,6 +427,54 @@ Name | Type | Description | Notes
426427
- **Accept**: text/plain, application/json, text/json, application/x-msgpack
427428

428429

430+
## v1SymbolsExchangeIdHistoryGet
431+
432+
> List<V1Symbol> v1SymbolsExchangeIdHistoryGet(exchangeId, page, limit)
433+
434+
Get symbol history for an exchange with pagination.
435+
436+
### Example
437+
438+
```java
439+
// Import classes:
440+
//import org.openapitools.client.api.MetadataApi;
441+
442+
MetadataApi apiInstance = new MetadataApi();
443+
String exchangeId = null; // String | The ID of the exchange.
444+
Integer page = 1; // Integer | The page number.
445+
Integer limit = 100; // Integer | Number of records to return.
446+
try {
447+
List<V1Symbol> result = apiInstance.v1SymbolsExchangeIdHistoryGet(exchangeId, page, limit);
448+
System.out.println(result);
449+
} catch (ApiException e) {
450+
System.err.println("Exception when calling MetadataApi#v1SymbolsExchangeIdHistoryGet");
451+
e.printStackTrace();
452+
}
453+
```
454+
455+
### Parameters
456+
457+
458+
Name | Type | Description | Notes
459+
------------- | ------------- | ------------- | -------------
460+
**exchangeId** | **String**| The ID of the exchange. | [default to null]
461+
**page** | **Integer**| The page number. | [optional] [default to 1]
462+
**limit** | **Integer**| Number of records to return. | [optional] [default to 100]
463+
464+
### Return type
465+
466+
[**List&lt;V1Symbol&gt;**](V1Symbol.md)
467+
468+
### Authorization
469+
470+
[APIKey](../README.md#APIKey), [JWT](../README.md#JWT)
471+
472+
### HTTP request headers
473+
474+
- **Content-Type**: Not defined
475+
- **Accept**: text/plain, application/json, text/json, application/x-msgpack
476+
477+
429478
## v1SymbolsGet
430479

431480
> List&lt;V1Symbol&gt; v1SymbolsGet(filterSymbolId, filterExchangeId, filterAssetId)

coinapi/market-data-api-rest/sdk/android/src/main/java/org/openapitools/client/api/MetadataApi.java

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,139 @@ public void v1SymbolsExchangeIdGet (String exchangeId, String filterSymbolId, St
11471147
queryParams.addAll(ApiInvoker.parameterToPairs("", "filter_asset_id", filterAssetId));
11481148

11491149

1150+
String[] contentTypes = {
1151+
1152+
};
1153+
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
1154+
1155+
if (contentType.startsWith("multipart/form-data")) {
1156+
// file uploading
1157+
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
1158+
1159+
1160+
HttpEntity httpEntity = localVarBuilder.build();
1161+
postBody = httpEntity;
1162+
} else {
1163+
// normal form params
1164+
}
1165+
1166+
String[] authNames = new String[] { "APIKey", "JWT" };
1167+
1168+
try {
1169+
apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames,
1170+
new Response.Listener<String>() {
1171+
@Override
1172+
public void onResponse(String localVarResponse) {
1173+
try {
1174+
responseListener.onResponse((List<V1Symbol>) ApiInvoker.deserialize(localVarResponse, "array", V1Symbol.class));
1175+
} catch (ApiException exception) {
1176+
errorListener.onErrorResponse(new VolleyError(exception));
1177+
}
1178+
}
1179+
}, new Response.ErrorListener() {
1180+
@Override
1181+
public void onErrorResponse(VolleyError error) {
1182+
errorListener.onErrorResponse(error);
1183+
}
1184+
});
1185+
} catch (ApiException ex) {
1186+
errorListener.onErrorResponse(new VolleyError(ex));
1187+
}
1188+
}
1189+
/**
1190+
* Get symbol history for an exchange with pagination.
1191+
*
1192+
* @param exchangeId The ID of the exchange.
1193+
* @param page The page number.
1194+
* @param limit Number of records to return.
1195+
* @return List<V1Symbol>
1196+
*/
1197+
public List<V1Symbol> v1SymbolsExchangeIdHistoryGet (String exchangeId, Integer page, Integer limit) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
1198+
Object postBody = null;
1199+
// verify the required parameter 'exchangeId' is set
1200+
if (exchangeId == null) {
1201+
VolleyError error = new VolleyError("Missing the required parameter 'exchangeId' when calling v1SymbolsExchangeIdHistoryGet",
1202+
new ApiException(400, "Missing the required parameter 'exchangeId' when calling v1SymbolsExchangeIdHistoryGet"));
1203+
}
1204+
1205+
// create path and map variables
1206+
String path = "/v1/symbols/{exchange_id}/history".replaceAll("\\{" + "exchange_id" + "\\}", apiInvoker.escapeString(exchangeId.toString()));
1207+
1208+
// query params
1209+
List<Pair> queryParams = new ArrayList<Pair>();
1210+
// header params
1211+
Map<String, String> headerParams = new HashMap<String, String>();
1212+
// form params
1213+
Map<String, String> formParams = new HashMap<String, String>();
1214+
queryParams.addAll(ApiInvoker.parameterToPairs("", "page", page));
1215+
queryParams.addAll(ApiInvoker.parameterToPairs("", "limit", limit));
1216+
String[] contentTypes = {
1217+
};
1218+
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
1219+
1220+
if (contentType.startsWith("multipart/form-data")) {
1221+
// file uploading
1222+
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
1223+
HttpEntity httpEntity = localVarBuilder.build();
1224+
postBody = httpEntity;
1225+
} else {
1226+
// normal form params
1227+
}
1228+
1229+
String[] authNames = new String[] { "APIKey", "JWT" };
1230+
1231+
try {
1232+
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
1233+
if (localVarResponse != null) {
1234+
return (List<V1Symbol>) ApiInvoker.deserialize(localVarResponse, "array", V1Symbol.class);
1235+
} else {
1236+
return null;
1237+
}
1238+
} catch (ApiException ex) {
1239+
throw ex;
1240+
} catch (InterruptedException ex) {
1241+
throw ex;
1242+
} catch (ExecutionException ex) {
1243+
if (ex.getCause() instanceof VolleyError) {
1244+
VolleyError volleyError = (VolleyError)ex.getCause();
1245+
if (volleyError.networkResponse != null) {
1246+
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
1247+
}
1248+
}
1249+
throw ex;
1250+
} catch (TimeoutException ex) {
1251+
throw ex;
1252+
}
1253+
}
1254+
1255+
/**
1256+
* Get symbol history for an exchange with pagination.
1257+
*
1258+
* @param exchangeId The ID of the exchange. * @param page The page number. * @param limit Number of records to return.
1259+
*/
1260+
public void v1SymbolsExchangeIdHistoryGet (String exchangeId, Integer page, Integer limit, final Response.Listener<List<V1Symbol>> responseListener, final Response.ErrorListener errorListener) {
1261+
Object postBody = null;
1262+
1263+
// verify the required parameter 'exchangeId' is set
1264+
if (exchangeId == null) {
1265+
VolleyError error = new VolleyError("Missing the required parameter 'exchangeId' when calling v1SymbolsExchangeIdHistoryGet",
1266+
new ApiException(400, "Missing the required parameter 'exchangeId' when calling v1SymbolsExchangeIdHistoryGet"));
1267+
}
1268+
1269+
// create path and map variables
1270+
String path = "/v1/symbols/{exchange_id}/history".replaceAll("\\{format\\}","json").replaceAll("\\{" + "exchange_id" + "\\}", apiInvoker.escapeString(exchangeId.toString()));
1271+
1272+
// query params
1273+
List<Pair> queryParams = new ArrayList<Pair>();
1274+
// header params
1275+
Map<String, String> headerParams = new HashMap<String, String>();
1276+
// form params
1277+
Map<String, String> formParams = new HashMap<String, String>();
1278+
1279+
queryParams.addAll(ApiInvoker.parameterToPairs("", "page", page));
1280+
queryParams.addAll(ApiInvoker.parameterToPairs("", "limit", limit));
1281+
1282+
11501283
String[] contentTypes = {
11511284

11521285
};

coinapi/market-data-api-rest/sdk/apex/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Class | Method | HTTP request | Description
8080
*OASMetadataApi* | [**v1ExchangesGet**](OASMetadataApi.md#v1ExchangesGet) | **GET** /v1/exchanges | List all exchanges
8181
*OASMetadataApi* | [**v1ExchangesIconsSizeGet**](OASMetadataApi.md#v1ExchangesIconsSizeGet) | **GET** /v1/exchanges/icons/{size} | List of icons for the exchanges
8282
*OASMetadataApi* | [**v1SymbolsExchangeIdGet**](OASMetadataApi.md#v1SymbolsExchangeIdGet) | **GET** /v1/symbols/{exchange_id} | List of symbols for the exchange
83+
*OASMetadataApi* | [**v1SymbolsExchangeIdHistoryGet**](OASMetadataApi.md#v1SymbolsExchangeIdHistoryGet) | **GET** /v1/symbols/{exchange_id}/history | Get symbol history for an exchange with pagination.
8384
*OASMetadataApi* | [**v1SymbolsGet**](OASMetadataApi.md#v1SymbolsGet) | **GET** /v1/symbols | List all symbols
8485
*OASMetadataApi* | [**v1SymbolsMapExchangeIdGet**](OASMetadataApi.md#v1SymbolsMapExchangeIdGet) | **GET** /v1/symbols/map/{exchange_id} | List symbol mapping for the exchange
8586
*OASMetricsV1Api* | [**v1MetricsAssetCurrentGet**](OASMetricsV1Api.md#v1MetricsAssetCurrentGet) | **GET** /v1/metrics/asset/current | Current metrics for given asset

coinapi/market-data-api-rest/sdk/apex/force-app/main/default/classes/OASMetadataApi.cls

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,38 @@ public class OASMetadataApi {
260260
List<OASV1Symbol>.class
261261
);
262262
}
263+
/**
264+
* Get symbol history for an exchange with pagination.
265+
*
266+
* @param exchangeId The ID of the exchange. (required)
267+
* @param page The page number. (optional, default to 1)
268+
* @param r_limit Number of records to return. (optional, default to 100)
269+
* @return List<OASV1Symbol>
270+
* @throws OAS.ApiException if fails to make API call
271+
*/
272+
public List<OASV1Symbol> v1SymbolsExchangeIdHistoryGet(Map<String, Object> params) {
273+
client.assertNotNull(params.get('exchangeId'), 'exchangeId');
274+
List<OAS.Param> query = new List<OAS.Param>();
275+
276+
// cast query params to verify their expected type
277+
query.addAll(client.makeParam('page', (Integer) params.get('page')));
278+
query.addAll(client.makeParam('limit', (Integer) params.get('r_limit')));
279+
280+
List<OAS.Param> form = new List<OAS.Param>();
281+
282+
return (List<OASV1Symbol>) client.invoke(
283+
'GET', '/v1/symbols/{exchange_id}/history', '',
284+
query, form,
285+
new Map<String, Object>{
286+
'exchange_id' => (String) params.get('exchangeId')
287+
},
288+
new Map<String, Object>(),
289+
new List<String>{ 'text/plain', 'application/json', 'text/json', 'application/x-msgpack' },
290+
new List<String>(),
291+
new List<String> { 'APIKey', 'JWT' },
292+
List<OASV1Symbol>.class
293+
);
294+
}
263295
/**
264296
* List all symbols
265297
* Retrieves all symbols with optional filtering.\n \n:::info\n&quot;price_precision&quot; and &quot;size_precision&quot; are data precisions and are not always the same precisions used for trading eg. for the &quot;BINANCE&quot; exchanges.\n:::\n \n:::info\nYou should not assume that the market data will be always within the resolution provided by the &quot;price_precision&quot; and &quot;size_precision&quot;. The fact that the precision values can be derived from a posterior implies the fact that this data could be delayed, also it can be changed by the data source without notice and we will immediately deliver data with the new precision while could not update the precision values in this endpoint immediately.\n:::\n \n### Symbol identifier\n \nOur symbol identifier is created using a pattern that depends on symbol type.\n \nType | &#x60;symbol_id&#x60; pattern\n--------- | ---------\nSPOT | &#x60;{exchange_id}_SPOT_{asset_id_base}_{asset_id_quote}&#x60;\nFUTURES | &#x60;{exchange_id}_FTS_{asset_id_base}_{asset_id_quote}_{YYMMDD of future_delivery_time}&#x60;\nOPTION | &#x60;{exchange_id}_OPT_{asset_id_base}_{asset_id_quote}_{YYMMDD of option_expiration_time}_{option_strike_price}_{option_type_is_call as C/P}&#x60;\nPERPETUAL | &#x60;{exchange_id}_PERP_{asset_id_base}_{asset_id_quote}&#x60;\nINDEX | &#x60;{exchange_id}_IDX_{index_id}&#x60;\nCREDIT | &#x60;{exchange_id}_CRE_{asset_id_base}&#x60;\nCONTACT | &#x60;{exchange_id}_COT_{contract_id}&#x60;\n \n:::info\nIn the unlikely event when the &quot;symbol_id&quot; for more than one market is the same. We will append the additional term (prefixed with the &quot;_&quot;) at the end of the duplicated identifiers to differentiate them.\n:::info\n \n### Symbol types list (enumeration of &#x60;symbol_type&#x60; output variable)\n \nType | Name | Description\n-------- | - | -----------\nSPOT | FX Spot | Agreement to exchange one asset for another one *(e.g. Buy BTC for USD)*\nFUTURES | Futures contract | FX Spot derivative contract where traders agree to trade fx spot at predetermined future time\nOPTION | Option contract | FX Spot derivative contract where traders agree to trade right to require buy or sell of fx spot at agreed price on exercise date\nPERPETUAL | Perpetual contract | FX Spot derivative contract where traders agree to trade fx spot continously without predetermined future delivery time\nINDEX | Index | Statistical composite that measures changes in the economy or markets.\nCREDIT | Credit/Funding | Margin funding contract. Order book displays lending offers and borrow bids. Price represents the daily rate.\nCONTRACT | Contract | Represents other types of financial instruments *(e.g. spreads, interest rate swap)*\n \n### Additional output variables for &#x60;symbol_type &#x3D; INDEX&#x60;\n \nVariable | Description\n--------- | -----------\nindex_id | Index identifier\nindex_display_name | Human readable name of the index *(optional)*\nindex_display_description | Description of the index *(optional)*\n \n### Additional output variables for &#x60;symbol_type &#x3D; FUTURES&#x60;\n \nVariable | Description\n--------- | -----------\nfuture_delivery_time | Predetermined time of futures contract delivery date in ISO 8601\nfuture_contract_unit | Contact size *(eg. 10 BTC if &#x60;future_contract_unit&#x60; &#x3D; &#x60;10&#x60; and &#x60;future_contract_unit_asset&#x60; &#x3D; &#x60;BTC&#x60;)*\nfuture_contract_unit_asset | Identifier of the asset used to denominate the contract unit\n \n### Additional output variables for &#x60;symbol_type &#x3D; PERPETUAL&#x60;\n \nVariable | Description\n--------- | -----------\nfuture_contract_unit | Contact size *(eg. 10 BTC if &#x60;future_contract_unit&#x60; &#x3D; &#x60;10&#x60; and &#x60;future_contract_unit_asset&#x60; &#x3D; &#x60;BTC&#x60;)*\nfuture_contract_unit_asset | Identifier of the asset used to denominate the contract unit\n \n### Additional output variables for &#x60;symbol_type &#x3D; OPTION&#x60;\n \nVariable | Description\n--------- | -----------\noption_type_is_call | Boolean value representing option type. &#x60;true&#x60; for Call options, &#x60;false&#x60; for Put options\noption_strike_price | Price at which option contract can be exercised\noption_contract_unit | Base asset amount of underlying spot which single option represents\noption_exercise_style | Option exercise style. Can be &#x60;EUROPEAN&#x60; or &#x60;AMERICAN&#x60;\noption_expiration_time | Option contract expiration time in ISO 8601\n \n### Additional output variables for &#x60;symbol_type &#x3D; CONTRACT&#x60;\n \nVariable | Description\n--------- | -----------\ncontract_delivery_time | Predetermined time of contract delivery date in ISO 8601\ncontract_unit | Contact size *(eg. 10 BTC if &#x60;contract_unit&#x60; &#x3D; &#x60;10&#x60; and &#x60;contract_unit_asset&#x60; &#x3D; &#x60;BTC&#x60;)*\ncontract_unit_asset | Identifier of the asset used to denominate the contract unit\ncontract_id | Identifier of contract by the exchange

0 commit comments

Comments
 (0)