Skip to content

Commit 03faf1a

Browse files
authored
Merge pull request #3 from MarketDataApp/add-more-endpoints
Add more endpoints
2 parents 35a51d5 + 37479cb commit 03faf1a

24 files changed

Lines changed: 690 additions & 8 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## v0.3.0-alpha
4+
5+
- Completed Stocks endpoints: earnings, news.
6+
- Add stubs for the rest of the endpoints.
7+
38
## v0.2.0-alpha
49

510
- Completed Indices endpoints.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ composer require MarketDataApp/sdk-php
2020
## Usage
2121

2222
```php
23-
$client = new MarketDataApp\Client();
23+
$client = new MarketDataApp\Client('your_api_token');
2424

2525
// Indices
2626
$quote = $client->indices->quote('DJI');
@@ -32,9 +32,13 @@ $candles = $client->indices->candles(
3232
);
3333

3434
// Stocks
35+
$candles = $client->stocks->candles('AAPL');
36+
$bulk_candles = $client->stocks->bulkCandles(['AAPL, MSFT']);
3537
$quote = $client->stocks->quote('AAPL');
3638
$quotes = $client->stocks->quotes(['AAPL', 'NFLX']);
3739
$bulk_quotes = $client->stocks->bulk_quotes(['AAPL', 'NFLX']);
40+
$earnings = $client->stocks->earnings(symbol: 'AAPL', from: Carbon::parse('2023-01-01'));
41+
$news = $client->stocks->news(symbol: 'AAPL', from: Carbon::parse('2023-01-01'));
3842
```
3943

4044
## Testing

src/Client.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
namespace MarketDataApp;
44

55
use MarketDataApp\Endpoints\Indices;
6+
use MarketDataApp\Endpoints\Markets;
7+
use MarketDataApp\Endpoints\MutualFunds;
8+
use MarketDataApp\Endpoints\Options;
69
use MarketDataApp\Endpoints\Stocks;
10+
use MarketDataApp\Endpoints\Utilities;
711

812
class Client extends ClientBase
913
{
@@ -19,11 +23,39 @@ class Client extends ClientBase
1923
*/
2024
public Stocks $stocks;
2125

26+
/**
27+
* The Market Data API provides a comprehensive suite of options endpoints, designed to cater to various needs
28+
* around options data. These endpoints are designed to be flexible and robust, supporting both real-time
29+
* and historical data queries. They accommodate a wide range of optional parameters for detailed data
30+
* retrieval, making the Market Data API a versatile tool for options traders and financial analysts.
31+
*/
32+
public Options $options;
33+
34+
/**
35+
* The Markets endpoints provide reference and status data about the markets covered by Market Data.
36+
*/
37+
public Markets $markets;
38+
39+
/**
40+
* The mutual funds endpoints offer access to historical pricing data for mutual funds.
41+
*/
42+
public MutualFunds $mutual_funds;
43+
44+
/**
45+
* These endpoints are designed to assist with API-related service issues, including checking the online status and
46+
* uptime.
47+
*/
48+
public Utilities $utilities;
49+
2250
public function __construct($token)
2351
{
2452
parent::__construct($token);
2553

2654
$this->indices = new Indices($this);
2755
$this->stocks = new Stocks($this);
56+
$this->options = new Options($this);
57+
$this->markets = new Markets($this);
58+
$this->mutual_funds = new MutualFunds($this);
59+
$this->utilities = new Utilities($this);
2860
}
2961
}

src/Endpoints/Markets.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace MarketDataApp\Endpoints;
4+
5+
use MarketDataApp\Client;
6+
use MarketDataApp\Endpoints\Responses\Markets\Status;
7+
8+
class Markets
9+
{
10+
11+
private Client $client;
12+
public const BASE_URL = "v1/markets/";
13+
14+
public function __construct($client)
15+
{
16+
$this->client = $client;
17+
}
18+
19+
public function status(): Status
20+
{
21+
// Stub
22+
return new Status();
23+
}
24+
}

src/Endpoints/MutualFunds.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace MarketDataApp\Endpoints;
4+
5+
use MarketDataApp\Client;
6+
use MarketDataApp\Endpoints\Responses\MutualFunds\Candles;
7+
8+
class MutualFunds
9+
{
10+
11+
private Client $client;
12+
public const BASE_URL = "v1/funds/";
13+
14+
public function __construct($client)
15+
{
16+
$this->client = $client;
17+
}
18+
19+
public function candles(): Candles
20+
{
21+
// Stub
22+
return new Candles();
23+
}
24+
}

src/Endpoints/Options.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
3+
namespace MarketDataApp\Endpoints;
4+
5+
use MarketDataApp\Client;
6+
use MarketDataApp\Endpoints\Responses\Options\Expirations;
7+
use MarketDataApp\Endpoints\Responses\Options\Lookup;
8+
use MarketDataApp\Endpoints\Responses\Options\OptionChain;
9+
use MarketDataApp\Endpoints\Responses\Options\Quotes;
10+
use MarketDataApp\Endpoints\Responses\Options\Strikes;
11+
12+
class Options
13+
{
14+
15+
private Client $client;
16+
public const BASE_URL = "v1/options/";
17+
18+
public function __construct($client)
19+
{
20+
$this->client = $client;
21+
}
22+
23+
public function expirations(): Expirations
24+
{
25+
// Stub
26+
return new Expirations();
27+
}
28+
29+
public function lookup(): Lookup
30+
{
31+
// Stub
32+
return new Lookup();
33+
}
34+
35+
public function strikes(): Strikes
36+
{
37+
// Stub
38+
return new Strikes();
39+
}
40+
41+
public function option_chain(): OptionChain
42+
{
43+
// Stub
44+
return new OptionChain();
45+
}
46+
47+
public function quotes(): Quotes
48+
{
49+
// Stub
50+
return new Quotes();
51+
}
52+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace MarketDataApp\Endpoints\Responses\Markets;
4+
5+
class Status
6+
{
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace MarketDataApp\Endpoints\Responses\MutualFunds;
4+
5+
class Candles
6+
{
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace MarketDataApp\Endpoints\Responses\Options;
4+
5+
class Expirations
6+
{
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace MarketDataApp\Endpoints\Responses\Options;
4+
5+
class Lookup
6+
{
7+
}

0 commit comments

Comments
 (0)