Skip to content

Commit 2ef1a9d

Browse files
[WIP] Add v3 rest client (#23)
* Add v3 rest client * Fix missing name property * Add scripts property for tests * Disable a few tests for debugging * Add MIT License * Update author and tweak license date * Update readme * Clean up * Update README.md
1 parent fc7d323 commit 2ef1a9d

File tree

1,007 files changed

+226350
-7164
lines changed

Some content is hidden

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

1,007 files changed

+226350
-7164
lines changed

Diff for: .circleci/config.yml

-20
This file was deleted.

Diff for: .gitignore

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore
2+
3+
composer.phar
14
/vendor/
2-
build
3-
.idea
4-
.phpunit.result.cache
5+
6+
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
7+
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
8+
# composer.lock
9+
10+
# php-cs-fixer cache
11+
.php_cs.cache
12+
.php-cs-fixer.cache
13+
14+
# PHPUnit cache
15+
.phpunit.result.cache

Diff for: LICENSE

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019 polygon.io
3+
Copyright (c) 2023 polygon.io
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

Diff for: README.md

+175-47
Large diffs are not rendered by default.

Diff for: composer.json

+22-19
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
{
22
"name": "polygon-io/api",
3-
"description": "polygon.io php client",
3+
"description": "polygon.io php-client",
4+
"keywords": [
5+
"openapitools",
6+
"openapi-generator",
7+
"openapi",
8+
"php",
9+
"sdk",
10+
"rest",
11+
"api"
12+
],
13+
"homepage": "https://openapi-generator.tech",
414
"type": "library",
515
"license": "MIT",
616
"authors": [
717
{
8-
"name": "Julien Prugne",
9-
"email": "[email protected]"
10-
},
11-
{
12-
"name": "Ersin Demirtas",
13-
"email": "[email protected]"
18+
"name": "Polygon.io, Inc.",
19+
"homepage": "https://polygon.io/"
1420
}
1521
],
1622
"require": {
17-
"php":">=7.2.5",
23+
"php": "^7.4 || ^8.0",
24+
"ext-curl": "*",
1825
"ext-json": "*",
19-
"guzzlehttp/guzzle": "^7.2.0",
20-
"amphp/websocket-client": "^0.2.4",
21-
"psr/http-client": "^1.0"
26+
"ext-mbstring": "*",
27+
"guzzlehttp/guzzle": "^7.3",
28+
"guzzlehttp/psr7": "^1.7 || ^2.0"
2229
},
2330
"require-dev": {
24-
"phpunit/phpunit": "^8",
25-
"squizlabs/php_codesniffer": "^3.5"
31+
"phpunit/phpunit": "^8.0 || ^9.0",
32+
"friendsofphp/php-cs-fixer": "^3.5"
2633
},
2734
"autoload": {
28-
"psr-4": {
29-
"PolygonIO\\": "src/"
30-
}
35+
"psr-4": { "OpenAPI\\Client\\" : "lib/" }
3136
},
3237
"autoload-dev": {
33-
"psr-4": {
34-
"PolygonIO\\Tests\\": "tests/"
35-
}
38+
"psr-4": { "OpenAPI\\Client\\Test\\" : "test/" }
3639
},
3740
"scripts": {
3841
"test": "./vendor/bin/phpunit"

Diff for: docs/Api/CrpytoaggregatesApi.md

+262
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
# OpenAPI\Client\CrpytoaggregatesApi
2+
3+
All URIs are relative to https://api.polygon.io, except if the operation defines another base path.
4+
5+
| Method | HTTP request | Description |
6+
| ------------- | ------------- | ------------- |
7+
| [**cryptoEMA()**](CrpytoaggregatesApi.md#cryptoEMA) | **GET** /v1/indicators/ema/{cryptoTicker} | Exponential Moving Average (EMA) |
8+
| [**cryptoRSI()**](CrpytoaggregatesApi.md#cryptoRSI) | **GET** /v1/indicators/rsi/{cryptoTicker} | Relative Strength Index (RSI) |
9+
| [**cryptoSMA()**](CrpytoaggregatesApi.md#cryptoSMA) | **GET** /v1/indicators/sma/{cryptoTicker} | Simple Moving Average (SMA) |
10+
11+
12+
## `cryptoEMA()`
13+
14+
```php
15+
cryptoEMA($crypto_ticker, $timestamp, $timespan, $window, $series_type, $expand_underlying, $order, $limit, $timestamp_gte, $timestamp_gt, $timestamp_lte, $timestamp_lt): \OpenAPI\Client\Model\CryptoEMA200Response
16+
```
17+
18+
Exponential Moving Average (EMA)
19+
20+
Get the exponential moving average (EMA) for a ticker symbol over a given time range.
21+
22+
### Example
23+
24+
```php
25+
<?php
26+
require_once(__DIR__ . '/vendor/autoload.php');
27+
28+
29+
// Configure API key authorization: apiKey
30+
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('apiKey', 'YOUR_API_KEY');
31+
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
32+
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apiKey', 'Bearer');
33+
34+
35+
$apiInstance = new OpenAPI\Client\Api\CrpytoaggregatesApi(
36+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
37+
// This is optional, `GuzzleHttp\Client` will be used as default.
38+
new GuzzleHttp\Client(),
39+
$config
40+
);
41+
$crypto_ticker = X:BTCUSD; // string | The ticker symbol for which to get exponential moving average (EMA) data.
42+
$timestamp = 'timestamp_example'; // string | Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
43+
$timespan = day; // string | The size of the aggregate time window.
44+
$window = 50; // int | The window size used to calculate the exponential moving average (EMA). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average.
45+
$series_type = close; // string | The price in the aggregate which will be used to calculate the exponential moving average. i.e. 'close' will result in using close prices to calculate the exponential moving average (EMA).
46+
$expand_underlying = false; // bool | Whether or not to include the aggregates used to calculate this indicator in the response.
47+
$order = desc; // string | The order in which to return the results, ordered by timestamp.
48+
$limit = 10; // int | Limit the number of results returned, default is 10 and max is 5000
49+
$timestamp_gte = 'timestamp_gte_example'; // string | Range by timestamp.
50+
$timestamp_gt = 'timestamp_gt_example'; // string | Range by timestamp.
51+
$timestamp_lte = 'timestamp_lte_example'; // string | Range by timestamp.
52+
$timestamp_lt = 'timestamp_lt_example'; // string | Range by timestamp.
53+
54+
try {
55+
$result = $apiInstance->cryptoEMA($crypto_ticker, $timestamp, $timespan, $window, $series_type, $expand_underlying, $order, $limit, $timestamp_gte, $timestamp_gt, $timestamp_lte, $timestamp_lt);
56+
print_r($result);
57+
} catch (Exception $e) {
58+
echo 'Exception when calling CrpytoaggregatesApi->cryptoEMA: ', $e->getMessage(), PHP_EOL;
59+
}
60+
```
61+
62+
### Parameters
63+
64+
| Name | Type | Description | Notes |
65+
| ------------- | ------------- | ------------- | ------------- |
66+
| **crypto_ticker** | **string**| The ticker symbol for which to get exponential moving average (EMA) data. | |
67+
| **timestamp** | **string**| Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp. | [optional] |
68+
| **timespan** | **string**| The size of the aggregate time window. | [optional] [default to &#39;day&#39;] |
69+
| **window** | **int**| The window size used to calculate the exponential moving average (EMA). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average. | [optional] [default to 50] |
70+
| **series_type** | **string**| The price in the aggregate which will be used to calculate the exponential moving average. i.e. &#39;close&#39; will result in using close prices to calculate the exponential moving average (EMA). | [optional] [default to &#39;close&#39;] |
71+
| **expand_underlying** | **bool**| Whether or not to include the aggregates used to calculate this indicator in the response. | [optional] [default to false] |
72+
| **order** | **string**| The order in which to return the results, ordered by timestamp. | [optional] [default to &#39;desc&#39;] |
73+
| **limit** | **int**| Limit the number of results returned, default is 10 and max is 5000 | [optional] [default to 10] |
74+
| **timestamp_gte** | **string**| Range by timestamp. | [optional] |
75+
| **timestamp_gt** | **string**| Range by timestamp. | [optional] |
76+
| **timestamp_lte** | **string**| Range by timestamp. | [optional] |
77+
| **timestamp_lt** | **string**| Range by timestamp. | [optional] |
78+
79+
### Return type
80+
81+
[**\OpenAPI\Client\Model\CryptoEMA200Response**](../Model/CryptoEMA200Response.md)
82+
83+
### Authorization
84+
85+
[apiKey](../../README.md#apiKey)
86+
87+
### HTTP request headers
88+
89+
- **Content-Type**: Not defined
90+
- **Accept**: `application/json`, `text/csv`
91+
92+
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
93+
[[Back to Model list]](../../README.md#models)
94+
[[Back to README]](../../README.md)
95+
96+
## `cryptoRSI()`
97+
98+
```php
99+
cryptoRSI($crypto_ticker, $timestamp, $timespan, $window, $series_type, $expand_underlying, $order, $limit, $timestamp_gte, $timestamp_gt, $timestamp_lte, $timestamp_lt): \OpenAPI\Client\Model\CryptoRSI200Response
100+
```
101+
102+
Relative Strength Index (RSI)
103+
104+
Get the relative strength index (RSI) for a ticker symbol over a given time range.
105+
106+
### Example
107+
108+
```php
109+
<?php
110+
require_once(__DIR__ . '/vendor/autoload.php');
111+
112+
113+
// Configure API key authorization: apiKey
114+
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('apiKey', 'YOUR_API_KEY');
115+
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
116+
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apiKey', 'Bearer');
117+
118+
119+
$apiInstance = new OpenAPI\Client\Api\CrpytoaggregatesApi(
120+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
121+
// This is optional, `GuzzleHttp\Client` will be used as default.
122+
new GuzzleHttp\Client(),
123+
$config
124+
);
125+
$crypto_ticker = X:BTCUSD; // string | The ticker symbol for which to get relative strength index (RSI) data.
126+
$timestamp = 'timestamp_example'; // string | Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
127+
$timespan = day; // string | The size of the aggregate time window.
128+
$window = 14; // int | The window size used to calculate the relative strength index (RSI). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average.
129+
$series_type = close; // string | The price in the aggregate which will be used to calculate the relative strength index. i.e. 'close' will result in using close prices to calculate the relative strength index (RSI).
130+
$expand_underlying = false; // bool | Whether or not to include the aggregates used to calculate this indicator in the response.
131+
$order = desc; // string | The order in which to return the results, ordered by timestamp.
132+
$limit = 10; // int | Limit the number of results returned, default is 10 and max is 5000
133+
$timestamp_gte = 'timestamp_gte_example'; // string | Range by timestamp.
134+
$timestamp_gt = 'timestamp_gt_example'; // string | Range by timestamp.
135+
$timestamp_lte = 'timestamp_lte_example'; // string | Range by timestamp.
136+
$timestamp_lt = 'timestamp_lt_example'; // string | Range by timestamp.
137+
138+
try {
139+
$result = $apiInstance->cryptoRSI($crypto_ticker, $timestamp, $timespan, $window, $series_type, $expand_underlying, $order, $limit, $timestamp_gte, $timestamp_gt, $timestamp_lte, $timestamp_lt);
140+
print_r($result);
141+
} catch (Exception $e) {
142+
echo 'Exception when calling CrpytoaggregatesApi->cryptoRSI: ', $e->getMessage(), PHP_EOL;
143+
}
144+
```
145+
146+
### Parameters
147+
148+
| Name | Type | Description | Notes |
149+
| ------------- | ------------- | ------------- | ------------- |
150+
| **crypto_ticker** | **string**| The ticker symbol for which to get relative strength index (RSI) data. | |
151+
| **timestamp** | **string**| Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp. | [optional] |
152+
| **timespan** | **string**| The size of the aggregate time window. | [optional] [default to &#39;day&#39;] |
153+
| **window** | **int**| The window size used to calculate the relative strength index (RSI). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average. | [optional] [default to 14] |
154+
| **series_type** | **string**| The price in the aggregate which will be used to calculate the relative strength index. i.e. &#39;close&#39; will result in using close prices to calculate the relative strength index (RSI). | [optional] [default to &#39;close&#39;] |
155+
| **expand_underlying** | **bool**| Whether or not to include the aggregates used to calculate this indicator in the response. | [optional] [default to false] |
156+
| **order** | **string**| The order in which to return the results, ordered by timestamp. | [optional] [default to &#39;desc&#39;] |
157+
| **limit** | **int**| Limit the number of results returned, default is 10 and max is 5000 | [optional] [default to 10] |
158+
| **timestamp_gte** | **string**| Range by timestamp. | [optional] |
159+
| **timestamp_gt** | **string**| Range by timestamp. | [optional] |
160+
| **timestamp_lte** | **string**| Range by timestamp. | [optional] |
161+
| **timestamp_lt** | **string**| Range by timestamp. | [optional] |
162+
163+
### Return type
164+
165+
[**\OpenAPI\Client\Model\CryptoRSI200Response**](../Model/CryptoRSI200Response.md)
166+
167+
### Authorization
168+
169+
[apiKey](../../README.md#apiKey)
170+
171+
### HTTP request headers
172+
173+
- **Content-Type**: Not defined
174+
- **Accept**: `application/json`, `text/csv`
175+
176+
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
177+
[[Back to Model list]](../../README.md#models)
178+
[[Back to README]](../../README.md)
179+
180+
## `cryptoSMA()`
181+
182+
```php
183+
cryptoSMA($crypto_ticker, $timestamp, $timespan, $window, $series_type, $expand_underlying, $order, $limit, $timestamp_gte, $timestamp_gt, $timestamp_lte, $timestamp_lt): \OpenAPI\Client\Model\CryptoSMA200Response
184+
```
185+
186+
Simple Moving Average (SMA)
187+
188+
Get the simple moving average (SMA) for a ticker symbol over a given time range.
189+
190+
### Example
191+
192+
```php
193+
<?php
194+
require_once(__DIR__ . '/vendor/autoload.php');
195+
196+
197+
// Configure API key authorization: apiKey
198+
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('apiKey', 'YOUR_API_KEY');
199+
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
200+
// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apiKey', 'Bearer');
201+
202+
203+
$apiInstance = new OpenAPI\Client\Api\CrpytoaggregatesApi(
204+
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
205+
// This is optional, `GuzzleHttp\Client` will be used as default.
206+
new GuzzleHttp\Client(),
207+
$config
208+
);
209+
$crypto_ticker = X:BTCUSD; // string | The ticker symbol for which to get simple moving average (SMA) data.
210+
$timestamp = 'timestamp_example'; // string | Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp.
211+
$timespan = day; // string | The size of the aggregate time window.
212+
$window = 50; // int | The window size used to calculate the simple moving average (SMA). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average.
213+
$series_type = close; // string | The price in the aggregate which will be used to calculate the simple moving average. i.e. 'close' will result in using close prices to calculate the simple moving average (SMA).
214+
$expand_underlying = false; // bool | Whether or not to include the aggregates used to calculate this indicator in the response.
215+
$order = desc; // string | The order in which to return the results, ordered by timestamp.
216+
$limit = 10; // int | Limit the number of results returned, default is 10 and max is 5000
217+
$timestamp_gte = 'timestamp_gte_example'; // string | Range by timestamp.
218+
$timestamp_gt = 'timestamp_gt_example'; // string | Range by timestamp.
219+
$timestamp_lte = 'timestamp_lte_example'; // string | Range by timestamp.
220+
$timestamp_lt = 'timestamp_lt_example'; // string | Range by timestamp.
221+
222+
try {
223+
$result = $apiInstance->cryptoSMA($crypto_ticker, $timestamp, $timespan, $window, $series_type, $expand_underlying, $order, $limit, $timestamp_gte, $timestamp_gt, $timestamp_lte, $timestamp_lt);
224+
print_r($result);
225+
} catch (Exception $e) {
226+
echo 'Exception when calling CrpytoaggregatesApi->cryptoSMA: ', $e->getMessage(), PHP_EOL;
227+
}
228+
```
229+
230+
### Parameters
231+
232+
| Name | Type | Description | Notes |
233+
| ------------- | ------------- | ------------- | ------------- |
234+
| **crypto_ticker** | **string**| The ticker symbol for which to get simple moving average (SMA) data. | |
235+
| **timestamp** | **string**| Query by timestamp. Either a date with the format YYYY-MM-DD or a millisecond timestamp. | [optional] |
236+
| **timespan** | **string**| The size of the aggregate time window. | [optional] [default to &#39;day&#39;] |
237+
| **window** | **int**| The window size used to calculate the simple moving average (SMA). i.e. a window size of 10 with daily aggregates would result in a 10 day moving average. | [optional] [default to 50] |
238+
| **series_type** | **string**| The price in the aggregate which will be used to calculate the simple moving average. i.e. &#39;close&#39; will result in using close prices to calculate the simple moving average (SMA). | [optional] [default to &#39;close&#39;] |
239+
| **expand_underlying** | **bool**| Whether or not to include the aggregates used to calculate this indicator in the response. | [optional] [default to false] |
240+
| **order** | **string**| The order in which to return the results, ordered by timestamp. | [optional] [default to &#39;desc&#39;] |
241+
| **limit** | **int**| Limit the number of results returned, default is 10 and max is 5000 | [optional] [default to 10] |
242+
| **timestamp_gte** | **string**| Range by timestamp. | [optional] |
243+
| **timestamp_gt** | **string**| Range by timestamp. | [optional] |
244+
| **timestamp_lte** | **string**| Range by timestamp. | [optional] |
245+
| **timestamp_lt** | **string**| Range by timestamp. | [optional] |
246+
247+
### Return type
248+
249+
[**\OpenAPI\Client\Model\CryptoSMA200Response**](../Model/CryptoSMA200Response.md)
250+
251+
### Authorization
252+
253+
[apiKey](../../README.md#apiKey)
254+
255+
### HTTP request headers
256+
257+
- **Content-Type**: Not defined
258+
- **Accept**: `application/json`, `text/csv`
259+
260+
[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
261+
[[Back to Model list]](../../README.md#models)
262+
[[Back to README]](../../README.md)

0 commit comments

Comments
 (0)