Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .konfig/generate-id.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9be05c51-16c8-489a-aa9b-10ffc9752007
6d5dfc92-f988-4c4c-b849-3fd5e6ebadf4
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Connect brokerage accounts to your app for live positions and trading
* [`snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`](#snaptradeexperimentalendpointsgetuseraccountorderdetailv2)
* [`snaptrade.experimentalEndpoints.getUserAccountOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountordersv2)
* [`snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountrecentordersv2)
* [`snaptrade.options.getOptionQuote`](#snaptradeoptionsgetoptionquote)
* [`snaptrade.options.getUserAccountOptionQuotes`](#snaptradeoptionsgetuseraccountoptionquotes)
* [`snaptrade.options.listOptionHoldings`](#snaptradeoptionslistoptionholdings)
* [`snaptrade.referenceData.getCurrencyExchangeRatePair`](#snaptradereferencedatagetcurrencyexchangeratepair)
* [`snaptrade.referenceData.getPartnerInfo`](#snaptradereferencedatagetpartnerinfo)
Expand Down Expand Up @@ -1432,16 +1432,17 @@ Defaults to true. Indicates if request should fetch only executed orders. Set to
---


### `snaptrade.options.getOptionQuote`<a id="snaptradeoptionsgetoptionquote"></a>
### `snaptrade.options.getUserAccountOptionQuotes`<a id="snaptradeoptionsgetuseraccountoptionquotes"></a>

Returns a real-time quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example `AAPL 251114C00240000` represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example `AAPL 251114C00240000` represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
**Note:** These are derived values and are not suitable for trading purposes.



#### 🛠️ Usage<a id="🛠️-usage"></a>

```php
$result = $snaptrade->options->getOptionQuote(
$result = $snaptrade->options->getUserAccountOptionQuotes(
user_id: "snaptrade-user-123",
user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
Expand Down Expand Up @@ -2011,7 +2012,7 @@ $result = $snaptrade->trading->getCryptocurrencyPairQuote(
### `snaptrade.trading.getOptionImpact`<a id="snaptradetradinggetoptionimpact"></a>

Simulates an option order with up to 4 legs and returns the estimated cost and transaction fees without placing it.
Only supported for certain brokerages. Please refer to the [brokerage trading support page](https://snaptrade.notion.site/brokerages) for more information on which brokerages support this endpoint.
Only supported for certain brokerages. Please refer to the [brokerage trading support page](https://support.snaptrade.com/brokerages) for more information on which brokerages support this endpoint.



Expand Down
62 changes: 31 additions & 31 deletions lib/Api/OptionsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class OptionsApi extends \SnapTrade\CustomApi

/** @var string[] $contentTypes **/
public const contentTypes = [
'getOptionQuote' => [
'getUserAccountOptionQuotes' => [
'application/json',
],
'listOptionHoldings' => [
Expand Down Expand Up @@ -139,56 +139,56 @@ private function setRequestBodyProperty(&$body, $property, $value) {
}

/**
* Operation getOptionQuote
* Operation getUserAccountOptionQuotes
*
* Get option quote
*
* Returns a real-time quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example &#x60;AAPL 251114C00240000&#x60; represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
* Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example &#x60;AAPL 251114C00240000&#x60; represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format) **Note:** These are derived values and are not suitable for trading purposes.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $account_id account_id (required)
* @param string $symbol The OCC-formatted option symbol. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionQuote'] to see the possible values for this operation
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOptionQuotes'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \SnapTrade\Model\OptionQuote|\SnapTrade\Model\Model404FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
*/
public function getOptionQuote(
public function getUserAccountOptionQuotes(
$user_id,
$user_secret,
$account_id,
$symbol,

string $contentType = self::contentTypes['getOptionQuote'][0]
string $contentType = self::contentTypes['getUserAccountOptionQuotes'][0]
)
{

list($response) = $this->getOptionQuoteWithHttpInfo($user_id, $user_secret, $account_id, $symbol, $contentType);
list($response) = $this->getUserAccountOptionQuotesWithHttpInfo($user_id, $user_secret, $account_id, $symbol, $contentType);
return $response;
}

/**
* Operation getOptionQuoteWithHttpInfo
* Operation getUserAccountOptionQuotesWithHttpInfo
*
* Get option quote
*
* Returns a real-time quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example &#x60;AAPL 251114C00240000&#x60; represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
* Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example &#x60;AAPL 251114C00240000&#x60; represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format) **Note:** These are derived values and are not suitable for trading purposes.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
* @param string $symbol The OCC-formatted option symbol. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionQuote'] to see the possible values for this operation
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOptionQuotes'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \SnapTrade\Model\OptionQuote|\SnapTrade\Model\Model404FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getOptionQuoteWithHttpInfo($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionQuote'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
public function getUserAccountOptionQuotesWithHttpInfo($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getUserAccountOptionQuotes'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionQuoteRequest($user_id, $user_secret, $account_id, $symbol, $contentType);
["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOptionQuotesRequest($user_id, $user_secret, $account_id, $symbol, $contentType);

// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
Expand All @@ -203,7 +203,7 @@ public function getOptionQuoteWithHttpInfo($user_id, $user_secret, $account_id,
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
return $this->getOptionQuoteWithHttpInfo(
return $this->getUserAccountOptionQuotesWithHttpInfo(
$user_id,
$user_secret,
$account_id,
Expand Down Expand Up @@ -339,32 +339,32 @@ public function getOptionQuoteWithHttpInfo($user_id, $user_secret, $account_id,
}

/**
* Operation getOptionQuoteAsync
* Operation getUserAccountOptionQuotesAsync
*
* Get option quote
*
* Returns a real-time quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example &#x60;AAPL 251114C00240000&#x60; represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
* Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example &#x60;AAPL 251114C00240000&#x60; represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format) **Note:** These are derived values and are not suitable for trading purposes.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
* @param string $symbol The OCC-formatted option symbol. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionQuote'] to see the possible values for this operation
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOptionQuotes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOptionQuoteAsync(
public function getUserAccountOptionQuotesAsync(
$user_id,
$user_secret,
$account_id,
$symbol,

string $contentType = self::contentTypes['getOptionQuote'][0]
string $contentType = self::contentTypes['getUserAccountOptionQuotes'][0]
)
{

return $this->getOptionQuoteAsyncWithHttpInfo($user_id, $user_secret, $account_id, $symbol, $contentType)
return $this->getUserAccountOptionQuotesAsyncWithHttpInfo($user_id, $user_secret, $account_id, $symbol, $contentType)
->then(
function ($response) {
return $response[0];
Expand All @@ -373,25 +373,25 @@ function ($response) {
}

/**
* Operation getOptionQuoteAsyncWithHttpInfo
* Operation getUserAccountOptionQuotesAsyncWithHttpInfo
*
* Get option quote
*
* Returns a real-time quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example &#x60;AAPL 251114C00240000&#x60; represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format)
* Returns a quote for a single option contract. The option contract is specified using in the 21 character OCC format. For example &#x60;AAPL 251114C00240000&#x60; represents a call option on AAPL expiring on 2025-11-14 with a strike price of $240. For more information on the OCC format, see [here](https://en.wikipedia.org/wiki/Option_symbol#OCC_format) **Note:** These are derived values and are not suitable for trading purposes.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
* @param string $symbol The OCC-formatted option symbol. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionQuote'] to see the possible values for this operation
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOptionQuotes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
public function getOptionQuoteAsyncWithHttpInfo($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionQuote'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
public function getUserAccountOptionQuotesAsyncWithHttpInfo($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getUserAccountOptionQuotes'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
$returnType = '\SnapTrade\Model\OptionQuote';
["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionQuoteRequest($user_id, $user_secret, $account_id, $symbol, $contentType);
["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOptionQuotesRequest($user_id, $user_secret, $account_id, $symbol, $contentType);

// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
Expand Down Expand Up @@ -433,18 +433,18 @@ function ($exception) {
}

/**
* Create request for operation 'getOptionQuote'
* Create request for operation 'getUserAccountOptionQuotes'
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
* @param string $symbol The OCC-formatted option symbol. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionQuote'] to see the possible values for this operation
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOptionQuotes'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
public function getOptionQuoteRequest($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionQuote'][0])
public function getUserAccountOptionQuotesRequest($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getUserAccountOptionQuotes'][0])
{

// Check if $user_id is a string
Expand All @@ -454,7 +454,7 @@ public function getOptionQuoteRequest($user_id, $user_secret, $account_id, $symb
// verify the required parameter 'user_id' is set
if ($user_id === SENTINEL_VALUE || (is_array($user_id) && count($user_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter user_id when calling getOptionQuote'
'Missing the required parameter user_id when calling getUserAccountOptionQuotes'
);
}
// Check if $user_secret is a string
Expand All @@ -464,7 +464,7 @@ public function getOptionQuoteRequest($user_id, $user_secret, $account_id, $symb
// verify the required parameter 'user_secret' is set
if ($user_secret === SENTINEL_VALUE || (is_array($user_secret) && count($user_secret) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter user_secret when calling getOptionQuote'
'Missing the required parameter user_secret when calling getUserAccountOptionQuotes'
);
}
// Check if $account_id is a string
Expand All @@ -474,7 +474,7 @@ public function getOptionQuoteRequest($user_id, $user_secret, $account_id, $symb
// verify the required parameter 'account_id' is set
if ($account_id === SENTINEL_VALUE || (is_array($account_id) && count($account_id) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter account_id when calling getOptionQuote'
'Missing the required parameter account_id when calling getUserAccountOptionQuotes'
);
}
// Check if $symbol is a string
Expand All @@ -484,7 +484,7 @@ public function getOptionQuoteRequest($user_id, $user_secret, $account_id, $symb
// verify the required parameter 'symbol' is set
if ($symbol === SENTINEL_VALUE || (is_array($symbol) && count($symbol) === 0)) {
throw new \InvalidArgumentException(
'Missing the required parameter symbol when calling getOptionQuote'
'Missing the required parameter symbol when calling getUserAccountOptionQuotes'
);
}

Expand Down
Loading