33[ ![ Latest Stable Version] [ packagist-image ]] [ packagist-url ]
44[ ![ Github Issues] [ github-issues-image ]] [ github-issues-url ]
55
6- An unofficial lightweight PHP API client for the [ IX-API] ( https://ix-api.net ) .
6+ A lightweight PHP API client for the [ IX-API] ( https://ix-api.net ) .
77
88## Installation
99
1010To install, run ` composer require dant89/ixapi-client ` in the root of your project or add ` dant89/ix-api-client ` to your composer.json.
11+
12+ View the tagged versions to choose between ` v1 ` and ` v2 ` implementations of this client.
1113``` json
1214"require" : {
1315 "dant89/ix-api-client" : " ^LATEST_VERSION_TAG"
@@ -25,31 +27,43 @@ use Dant89\IXAPIClient\Client;
2527$client = new Client(IXAPI_URL);
2628
2729// Get a bearer token from key / secret
28- $response = $client->getHttpClient('auth' )
30+ $response = $client->getHttpClient(HttpClientType::AUTH )
2931 ->postAuthToken(IXAPI_KEY, IXAPI_SECRET);
3032
3133// Check for valid response status
3234if ($response->getStatus() === 200) {
33- $data = $response->getContent();
34- $client->setBearerToken($data['access_token']);
35+ $client->setBearerToken($response->getContent()['access_token']);
3536}
3637```
3738
38- With the bearer token set, you can return data from all endpoints that require authentication, such as the products endpoints:
39+ With the bearer token set, you can return data from all endpoints that require authentication.
40+
41+ ** Get Product Offerings:**
3942``` php
4043// Query for products
41- $response = $client->getHttpClient('products')
42- ->getProducts();
44+ $response = $client->getHttpClient(HttpClientType::PRODUCT_OFFERINGS)
45+ ->getProductOfferingss();
46+
47+ // Check for valid response and set the array of products
48+ if ($response->getStatus() === 200) {
49+ $productOfferings = $response->getContent();
50+ }
51+ ````
52+ **Get Connections Statistical Timeseries Data:**
53+ ```php
54+ // Query for connections timeseries data
55+ $response = $client->getHttpClient(HttpClientType::CONNECTIONS)
56+ ->getStatisticTimeseries('connection-123-uuid', '30d');
4357
4458// Check for valid response and set the array of products
4559if ($response->getStatus() === 200) {
46- $products = $response->getContent();
60+ $timeseries = $response->getContent();
4761}
4862````
4963
5064## Authentication
5165
52- You will need to speak directly to an exchange to be provided with an API key / secret combination and the URL of their IX-API implementation.
66+ You will need to contact an exchange to create an API key / secret combination and find out the URL of their IX-API implementation.
5367
5468## Questions
5569
0 commit comments