diff --git a/.konfig/generate-id.txt b/.konfig/generate-id.txt
index 0dfe1f1..00ec457 100644
--- a/.konfig/generate-id.txt
+++ b/.konfig/generate-id.txt
@@ -1 +1 @@
-a0c1adb3-872f-4b04-9c66-72b150225d7f
\ No newline at end of file
+c543538a-5735-46ae-91fa-72ebb0c872ef
\ No newline at end of file
diff --git a/README.md b/README.md
index fb0a31d..3bd75db 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
Connect brokerage accounts to your app for live positions and trading
-[](https://packagist.org/packages/konfig/snaptrade-php-sdk)
+[](https://packagist.org/packages/konfig/snaptrade-php-sdk)
[](https://snaptrade.com/)
@@ -21,11 +21,15 @@ Connect brokerage accounts to your app for live positions and trading
* [Manual Installation](#manual-installation)
- [Getting Started](#getting-started)
- [Reference](#reference)
+ * [`snaptrade.accountInformation.getAccountActivities`](#snaptradeaccountinformationgetaccountactivities)
* [`snaptrade.accountInformation.getAllUserHoldings`](#snaptradeaccountinformationgetalluserholdings)
* [`snaptrade.accountInformation.getUserAccountBalance`](#snaptradeaccountinformationgetuseraccountbalance)
* [`snaptrade.accountInformation.getUserAccountDetails`](#snaptradeaccountinformationgetuseraccountdetails)
+ * [`snaptrade.accountInformation.getUserAccountOrderDetail`](#snaptradeaccountinformationgetuseraccountorderdetail)
* [`snaptrade.accountInformation.getUserAccountOrders`](#snaptradeaccountinformationgetuseraccountorders)
* [`snaptrade.accountInformation.getUserAccountPositions`](#snaptradeaccountinformationgetuseraccountpositions)
+ * [`snaptrade.accountInformation.getUserAccountRecentOrders`](#snaptradeaccountinformationgetuseraccountrecentorders)
+ * [`snaptrade.accountInformation.getUserAccountReturnRates`](#snaptradeaccountinformationgetuseraccountreturnrates)
* [`snaptrade.accountInformation.getUserHoldings`](#snaptradeaccountinformationgetuserholdings)
* [`snaptrade.accountInformation.listUserAccounts`](#snaptradeaccountinformationlistuseraccounts)
* [`snaptrade.accountInformation.updateUserAccount`](#snaptradeaccountinformationupdateuseraccount)
@@ -40,12 +44,13 @@ Connect brokerage accounts to your app for live positions and trading
* [`snaptrade.connections.listBrokerageAuthorizations`](#snaptradeconnectionslistbrokerageauthorizations)
* [`snaptrade.connections.refreshBrokerageAuthorization`](#snaptradeconnectionsrefreshbrokerageauthorization)
* [`snaptrade.connections.removeBrokerageAuthorization`](#snaptradeconnectionsremovebrokerageauthorization)
+ * [`snaptrade.connections.returnRates`](#snaptradeconnectionsreturnrates)
* [`snaptrade.connections.sessionEvents`](#snaptradeconnectionssessionevents)
- * [`snaptrade.options.getOptionStrategy`](#snaptradeoptionsgetoptionstrategy)
+ * [`snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`](#snaptradeexperimentalendpointsgetuseraccountorderdetailv2)
+ * [`snaptrade.experimentalEndpoints.getUserAccountOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountordersv2)
+ * [`snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`](#snaptradeexperimentalendpointsgetuseraccountrecentordersv2)
* [`snaptrade.options.getOptionsChain`](#snaptradeoptionsgetoptionschain)
- * [`snaptrade.options.getOptionsStrategyQuote`](#snaptradeoptionsgetoptionsstrategyquote)
* [`snaptrade.options.listOptionHoldings`](#snaptradeoptionslistoptionholdings)
- * [`snaptrade.options.placeOptionStrategy`](#snaptradeoptionsplaceoptionstrategy)
* [`snaptrade.referenceData.getCurrencyExchangeRatePair`](#snaptradereferencedatagetcurrencyexchangeratepair)
* [`snaptrade.referenceData.getPartnerInfo`](#snaptradereferencedatagetpartnerinfo)
* [`snaptrade.referenceData.getSecurityTypes`](#snaptradereferencedatagetsecuritytypes)
@@ -53,15 +58,24 @@ Connect brokerage accounts to your app for live positions and trading
* [`snaptrade.referenceData.getSymbols`](#snaptradereferencedatagetsymbols)
* [`snaptrade.referenceData.getSymbolsByTicker`](#snaptradereferencedatagetsymbolsbyticker)
* [`snaptrade.referenceData.listAllBrokerageAuthorizationType`](#snaptradereferencedatalistallbrokerageauthorizationtype)
+ * [`snaptrade.referenceData.listAllBrokerageInstruments`](#snaptradereferencedatalistallbrokerageinstruments)
* [`snaptrade.referenceData.listAllBrokerages`](#snaptradereferencedatalistallbrokerages)
* [`snaptrade.referenceData.listAllCurrencies`](#snaptradereferencedatalistallcurrencies)
* [`snaptrade.referenceData.listAllCurrenciesRates`](#snaptradereferencedatalistallcurrenciesrates)
* [`snaptrade.referenceData.symbolSearchUserAccount`](#snaptradereferencedatasymbolsearchuseraccount)
+ * [`snaptrade.trading.cancelOrder`](#snaptradetradingcancelorder)
* [`snaptrade.trading.cancelUserAccountOrder`](#snaptradetradingcanceluseraccountorder)
+ * [`snaptrade.trading.getCryptocurrencyPairQuote`](#snaptradetradinggetcryptocurrencypairquote)
* [`snaptrade.trading.getOrderImpact`](#snaptradetradinggetorderimpact)
* [`snaptrade.trading.getUserAccountQuotes`](#snaptradetradinggetuseraccountquotes)
+ * [`snaptrade.trading.placeBracketOrder`](#snaptradetradingplacebracketorder)
+ * [`snaptrade.trading.placeCryptoOrder`](#snaptradetradingplacecryptoorder)
* [`snaptrade.trading.placeForceOrder`](#snaptradetradingplaceforceorder)
+ * [`snaptrade.trading.placeMlegOrder`](#snaptradetradingplacemlegorder)
* [`snaptrade.trading.placeOrder`](#snaptradetradingplaceorder)
+ * [`snaptrade.trading.previewCryptoOrder`](#snaptradetradingpreviewcryptoorder)
+ * [`snaptrade.trading.replaceOrder`](#snaptradetradingreplaceorder)
+ * [`snaptrade.trading.searchCryptocurrencyPairInstruments`](#snaptradetradingsearchcryptocurrencypairinstruments)
* [`snaptrade.transactionsAndReporting.getActivities`](#snaptradetransactionsandreportinggetactivities)
* [`snaptrade.transactionsAndReporting.getReportingCustomRange`](#snaptradetransactionsandreportinggetreportingcustomrange)
@@ -86,7 +100,7 @@ To install the bindings via [Composer](https://getcomposer.org/), add the follow
}
],
"require": {
- "konfig/snaptrade-php-sdk": "2.0.32"
+ "konfig/snaptrade-php-sdk": "2.0.160"
}
}
```
@@ -115,15 +129,91 @@ $snaptrade = new \SnapTrade\Client(
consumerKey: getenv("SNAPTRADE_CONSUMER_KEY")
);
-$result = $snaptrade->accountInformation->getAllUserHoldings(
+$result = $snaptrade->accountInformation->getAccountActivities(
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ start_date: "2022-01-24",
+ end_date: "2022-01-24",
+ offset: 0,
+ limit: 1,
+ type: "BUY,SELL,DIVIDEND"
);
```
## Reference
+### `snaptrade.accountInformation.getAccountActivities`
+
+Returns all historical transactions for the specified account.
+
+This endpoint is paginated with a default page size of 1000. The endpoint will return a maximum of 1000 transactions per request. See the query parameters for pagination options.
+
+Transaction are returned in reverse chronological order, using the `trade_date` field.
+
+The data returned here is always cached and refreshed once a day.
+
+If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->accountInformation->getAccountActivities(
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ start_date: "2022-01-24",
+ end_date: "2022-01-24",
+ offset: 0,
+ limit: 1,
+ type: "BUY,SELL,DIVIDEND"
+);
+```
+
+#### βοΈ Parameters
+
+##### account_id: `string`
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### start_date: `\DateTime`
+
+The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`.
+
+##### end_date: `\DateTime`
+
+The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
+
+##### offset: `int`
+
+An integer that specifies the starting point of the paginated results. Default is 0.
+
+##### limit: `int`
+
+An integer that specifies the maximum number of transactions to return. Default of 1000.
+
+##### type: `string`
+
+Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split.
+
+
+#### π Return
+
+[**PaginatedUniversalActivity**](./lib/Model/PaginatedUniversalActivity.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/activities` `GET`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
### `snaptrade.accountInformation.getAllUserHoldings`

@@ -139,7 +229,7 @@ account.
```php
$result = $snaptrade->accountInformation->getAllUserHoldings(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
);
```
@@ -152,7 +242,7 @@ $result = $snaptrade->accountInformation->getAllUserHoldings(
##### brokerage_authorizations: `string`
-Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations).
+Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations).
#### π Return
@@ -172,7 +262,11 @@ Optional. Comma seperated list of authorization IDs (only use if filtering is ne
Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances).
-The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
+Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
+ - If you do, this endpoint returns real-time data.
+ - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+
+If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
@@ -181,7 +275,7 @@ The data returned here is cached. How long the data is cached for varies by brok
```php
$result = $snaptrade->accountInformation->getUserAccountBalance(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
);
```
@@ -212,7 +306,11 @@ $result = $snaptrade->accountInformation->getUserAccountBalance(
Returns account detail known to SnapTrade for the specified account.
-The data returned here is always cached and refreshed once a day. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
+Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
+ - If you do, this endpoint returns real-time data.
+ - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+
+If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
@@ -221,7 +319,7 @@ The data returned here is always cached and refreshed once a day. **If you need
```php
$result = $snaptrade->accountInformation->getUserAccountDetails(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
);
```
@@ -248,11 +346,64 @@ $result = $snaptrade->accountInformation->getUserAccountDetails(
---
+### `snaptrade.accountInformation.getUserAccountOrderDetail`
+
+Returns the detail of a single order using the external order ID provided in the request body.
+
+This endpoint only works for single-leg orders at this time. Support for multi-leg orders will be added in the future.
+
+This endpoint is always realtime and does not rely on cached data.
+
+This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->accountInformation->getUserAccountOrderDetail(
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
+);
+```
+
+#### βοΈ Parameters
+
+##### brokerage_order_id: `string`
+
+Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
+
+##### account_id: `string`
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+
+#### π Return
+
+[**AccountOrderRecord**](./lib/Model/AccountOrderRecord.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/orders/details` `POST`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
### `snaptrade.accountInformation.getUserAccountOrders`
Returns a list of recent orders in the specified account.
-The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
+Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
+ - If you do, this endpoint returns real-time data.
+ - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+
+If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
@@ -261,7 +412,7 @@ The data returned here is cached. How long the data is cached for varies by brok
```php
$result = $snaptrade->accountInformation->getUserAccountOrders(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
state: "all",
days: 30
@@ -302,7 +453,11 @@ Number of days in the past to fetch the most recent orders. Defaults to the last
Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings).
-The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
+Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
+ - If you do, this endpoint returns real-time data.
+ - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+
+If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
@@ -311,7 +466,7 @@ The data returned here is cached. How long the data is cached for varies by brok
```php
$result = $snaptrade->accountInformation->getUserAccountPositions(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
);
```
@@ -338,11 +493,99 @@ $result = $snaptrade->accountInformation->getUserAccountPositions(
---
+### `snaptrade.accountInformation.getUserAccountRecentOrders`
+
+A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders.
+This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders
+Differs from /orders in that it is always realtime, and only checks the last 24 hours
+By default only returns executed orders, but that can be changed by setting *only_executed* to false
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->accountInformation->getUserAccountRecentOrders(
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ only_executed: True
+);
+```
+
+#### βοΈ Parameters
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### account_id: `string`
+
+##### only_executed: `bool`
+
+Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
+
+
+#### π Return
+
+[**RecentOrdersResponse**](./lib/Model/RecentOrdersResponse.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/recentOrders` `GET`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
+### `snaptrade.accountInformation.getUserAccountReturnRates`
+
+Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example "ALL", "1Y", "6M", "3M", "1M"
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->accountInformation->getUserAccountReturnRates(
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
+);
+```
+
+#### βοΈ Parameters
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### account_id: `string`
+
+
+#### π Return
+
+[**RateOfReturnResponse**](./lib/Model/RateOfReturnResponse.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/returnRates` `GET`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
### `snaptrade.accountInformation.getUserHoldings`
Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__
-The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
+Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
+ - If you do, this endpoint returns real-time data.
+ - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+
+If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
@@ -352,7 +595,7 @@ The data returned here is cached. How long the data is cached for varies by brok
$result = $snaptrade->accountInformation->getUserHoldings(
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
@@ -380,9 +623,11 @@ $result = $snaptrade->accountInformation->getUserHoldings(
### `snaptrade.accountInformation.listUserAccounts`
-Returns all brokerage accounts known to SnapTrade for the authenticated user.
+Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user.
-The data returned here is always cached and refreshed once a day. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
+Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
+ - If you do, this endpoint returns real-time data.
+ - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
@@ -391,7 +636,7 @@ The data returned here is always cached and refreshed once a day. **If you need
```php
$result = $snaptrade->accountInformation->listUserAccounts(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
@@ -425,7 +670,7 @@ Updates various properties of a specified account.
```php
$result = $snaptrade->accountInformation->updateUserAccount(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
account_id: "accountId_example"
);
```
@@ -481,7 +726,7 @@ $result = $snaptrade->apiStatus->check();
### `snaptrade.authentication.deleteSnapTradeUser`
-Deletes a user you've registered over the SnapTrade API, and any data associated with them or their investment accounts.
+Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a `USER_DELETED` webhook will be sent.
#### π οΈ Usage
@@ -512,7 +757,7 @@ $result = $snaptrade->authentication->deleteSnapTradeUser(
### `snaptrade.authentication.listSnapTradeUsers`
-Returns a list of users you've registered over the SnapTrade API.
+Returns a list of all registered user IDs. Please note that the response is not currently paginated.
#### π οΈ Usage
@@ -537,7 +782,10 @@ $result = $snaptrade->authentication->listSnapTradeUsers();
### `snaptrade.authentication.loginSnapTradeUser`
-Logs in a SnapTrade user and returns an authenticated connection portal URL for them to use to connect a brokerage account.
+Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app.
+
+Please note that the returned URL expires in 5 minutes.
+
#### π οΈ Usage
@@ -545,13 +793,15 @@ Logs in a SnapTrade user and returns an authenticated connection portal URL for
```php
$result = $snaptrade->authentication->loginSnapTradeUser(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
broker: "ALPACA",
immediate_redirect: True,
custom_redirect: "https://snaptrade.com",
reconnect: "8b5f262d-4bb9-365d-888a-202bd3b15fa1",
connection_type: "read",
- connection_portal_version: "v2"
+ show_close_button: True,
+ dark_mode: True,
+ connection_portal_version: "v4"
);
```
@@ -563,27 +813,35 @@ $result = $snaptrade->authentication->loginSnapTradeUser(
##### broker: `string`
-Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs.
+Slug of the brokerage to connect the user to. See [the integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=3cfea70ef4254afc89704e47275a7a9a&pvs=4) for a list of supported brokerages and their slugs.
##### immediateRedirect: `bool`
-When set to True, user will be redirected back to the partner's site instead of the connection portal
+When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
##### customRedirect: `string`
-URL to redirect the user to after the user connects their brokerage account
+URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
##### reconnect: `string`
-The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See βReconnecting Accountsβ for more information.
+The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information.
##### connectionType: `string`
-Sets whether the connection should be read or trade
+Determines connection permissions (default: read) - `read`: Data access only. - `trade`: Data and trading access. - `trade-if-available`: Attempts to establish a trading connection if the brokerage supports it, otherwise falls back to read-only access automatically.
+
+##### showCloseButton: `bool`
+
+Controls whether the close (X) button is displayed in the connection portal. When false, you control closing behavior from your app. Defaults to true.
+
+##### darkMode: `bool`
+
+Enable dark mode for the connection portal. Defaults to false.
##### connectionPortalVersion: `string`
-Sets the version of the connection portal to render, with a default to 'v3'
+Sets the connection portal version to render. Currently only v4 is supported and is the default. All other versions are deprecated and will automatically be set to v4.
#### π Return
@@ -601,8 +859,8 @@ Sets the version of the connection portal to render, with a default to 'v3'
### `snaptrade.authentication.registerSnapTradeUser`
-Registers a new SnapTrade user under your ClientID. A user secret will be automatically generated for you and must be properly stored in your database.
-Most SnapTrade operations require a user ID and user secret to be passed as a parameter.
+Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system.
+Most SnapTrade operations require a user ID and user secret to be passed in as parameters.
@@ -636,8 +894,7 @@ SnapTrade User ID. This is chosen by the API partner and can be any string that
### `snaptrade.authentication.resetSnapTradeUserSecret`
-This API is used to rotate the secret for a SnapTrade user. You might use this if a userSecret
-is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
+Rotates the secret for a SnapTrade user. You might use this if `userSecret` is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
@@ -646,7 +903,7 @@ is compromised. Please note that if you call this endpoint and fail to save the
```php
$result = $snaptrade->authentication->resetSnapTradeUserSecret(
user_id: "snaptrade-user-123",
- user_secret: "h81@cx1lkalablakwjaltkejraj11="
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
@@ -658,7 +915,7 @@ SnapTrade User ID. This is chosen by the API partner and can be any string that
##### userSecret: `string`
-SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API.
+SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
#### π Return
@@ -676,16 +933,16 @@ SnapTrade User Secret randomly generated by SnapTrade. This is privileged inform
### `snaptrade.connections.detailBrokerageAuthorization`
-Returns a single brokerage authorization object for the specified ID.
+Returns a single connection for the specified ID.
#### π οΈ Usage
```php
$result = $snaptrade->connections->detailBrokerageAuthorization(
- authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
@@ -693,8 +950,6 @@ $result = $snaptrade->connections->detailBrokerageAuthorization(
##### authorization_id: `string`
-The ID of a brokerage authorization object.
-
##### user_id: `string`
##### user_secret: `string`
@@ -715,16 +970,20 @@ The ID of a brokerage authorization object.
### `snaptrade.connections.disableBrokerageAuthorization`
-Manually disable a connection. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a CONNECTION_BROKEN webhook for the connection. Please contact us in order to use this endpoint as it is disabled by default.
+Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections.
+Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection.
+
+This endpoint is available on test keys. If you would like it enabled on production keys as well, please contact support as it is disabled by default.
+
#### π οΈ Usage
```php
$result = $snaptrade->connections->disableBrokerageAuthorization(
- authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
@@ -732,8 +991,6 @@ $result = $snaptrade->connections->disableBrokerageAuthorization(
##### authorization_id: `string`
-The ID of a brokerage authorization object.
-
##### user_id: `string`
##### user_secret: `string`
@@ -754,7 +1011,12 @@ The ID of a brokerage authorization object.
### `snaptrade.connections.listBrokerageAuthorizations`
-Returns a list of Brokerage Authorization objects for the user
+Returns a list of all connections for the specified user. Note that `Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency.
+
+A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts.
+
+SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
+
#### π οΈ Usage
@@ -762,7 +1024,7 @@ Returns a list of Brokerage Authorization objects for the user
```php
$result = $snaptrade->connections->listBrokerageAuthorizations(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
@@ -788,16 +1050,20 @@ $result = $snaptrade->connections->listBrokerageAuthorizations(
### `snaptrade.connections.refreshBrokerageAuthorization`
-Trigger a holdings update for all accounts under this authorization. Updates will be queued asynchronously. ACCOUNT_HOLDINGS_UPDATED webhook will be sent once the sync completes. Please contact support for access as this endpoint is not enabled by default
+Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection.
+This endpoint will also trigger a transaction sync for the past day if one has not yet occurred.
+
+**Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+
#### π οΈ Usage
```php
$result = $snaptrade->connections->refreshBrokerageAuthorization(
- authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
@@ -805,8 +1071,6 @@ $result = $snaptrade->connections->refreshBrokerageAuthorization(
##### authorization_id: `string`
-The ID of a brokerage authorization object.
-
##### user_id: `string`
##### user_secret: `string`
@@ -827,16 +1091,16 @@ The ID of a brokerage authorization object.
### `snaptrade.connections.removeBrokerageAuthorization`
-Deletes a specified brokerage authorization given by the ID.
+Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the data has been successfully deleted.
#### π οΈ Usage
```php
$snaptrade->connections->removeBrokerageAuthorization(
- authorization_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
@@ -844,8 +1108,6 @@ $snaptrade->connections->removeBrokerageAuthorization(
##### authorization_id: `string`
-The ID of the Authorization to delete.
-
##### user_id: `string`
##### user_secret: `string`
@@ -864,6 +1126,44 @@ void (empty response body)
---
+### `snaptrade.connections.returnRates`
+
+Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example "ALL", "1Y", "6M", "3M", "1M"
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->connections->returnRates(
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ authorization_id: "87b24961-b51e-4db8-9226-f198f6518a89"
+);
+```
+
+#### βοΈ Parameters
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### authorization_id: `string`
+
+
+#### π Return
+
+[**RateOfReturnResponse**](./lib/Model/RateOfReturnResponse.php)
+
+#### π Endpoint
+
+`/authorizations/{authorizationId}/returnRates` `GET`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
### `snaptrade.connections.sessionEvents`
Returns a list of session events associated with a user.
@@ -885,11 +1185,11 @@ $result = $snaptrade->connections->sessionEvents(
##### user_id: `string`
-Optional comma seperated list of user IDs used to filter the request on specific users
+Optional comma separated list of user IDs used to filter the request on specific users
##### session_id: `string`
-Optional comma seperated list of session IDs used to filter the request on specific users
+Optional comma separated list of session IDs used to filter the request on specific users
#### π Return
@@ -905,74 +1205,73 @@ Optional comma seperated list of session IDs used to filter the request on speci
---
-### `snaptrade.options.getOptionStrategy`
+### `snaptrade.experimentalEndpoints.getUserAccountOrderDetailV2`
+
+Returns the detail of a single order using the brokerage order ID provided as a path parameter.
+
+The V2 order response format includes all legs of the order in the `legs` list field.
+If the order is single legged, `legs` will be a list of one leg.
-Creates an option strategy object that will be used to place an option strategy order.
+This endpoint is always realtime and does not rely on cached data.
+
+This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
#### π οΈ Usage
```php
-$result = $snaptrade->options->getOptionStrategy(
- underlying_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
- legs: [
- [
- "action" => "BUY_TO_OPEN",
- "option_symbol_id" => "SPY220819P00200000",
- "quantity" => 1,
- ]
- ],
- strategy_type: "CUSTOM",
+$result = $snaptrade->experimentalEndpoints->getUserAccountOrderDetailV2(
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- account_id: "accountId_example"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61"
);
```
#### βοΈ Parameters
-##### underlying_symbol_id: `string`
-
-##### legs: [`OptionLeg`](./lib/Model/OptionLeg.php)[]
+##### account_id: `string`
-##### strategy_type: `string`
+##### brokerage_order_id: `string`
##### user_id: `string`
##### user_secret: `string`
-##### account_id: `string`
-
-The ID of the account to create the option strategy object in.
-
#### π Return
-[**StrategyQuotes**](./lib/Model/StrategyQuotes.php)
+[**AccountOrderRecordV2**](./lib/Model/AccountOrderRecordV2.php)
#### π Endpoint
-`/accounts/{accountId}/optionStrategy` `POST`
+`/accounts/{accountId}/orders/details/v2/{brokerageOrderId}` `GET`
[π **Back to Table of Contents**](#table-of-contents)
---
-### `snaptrade.options.getOptionsChain`
+### `snaptrade.experimentalEndpoints.getUserAccountOrdersV2`
+
+Returns a list of recent orders in the specified account.
+
+The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg.
+
+If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
-Returns the option chain for the specified symbol in the specified account.
#### π οΈ Usage
```php
-$result = $snaptrade->options->getOptionsChain(
+$result = $snaptrade->experimentalEndpoints->getUserAccountOrdersV2(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- account_id: "accountId_example",
- symbol: "symbol_example"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ state: "all",
+ days: 30
);
```
@@ -984,40 +1283,46 @@ $result = $snaptrade->options->getOptionsChain(
##### account_id: `string`
-The ID of the account to get the options chain from.
+##### state: `string`
-##### symbol: `string`
+defaults value is set to \"all\"
-Universal symbol ID if symbol
+##### days: `int`
+
+Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in.
#### π Return
-[**OptionChainInner**](./lib/Model/OptionChainInner.php)
+[**AccountOrdersV2Response**](./lib/Model/AccountOrdersV2Response.php)
#### π Endpoint
-`/accounts/{accountId}/optionsChain` `GET`
+`/accounts/{accountId}/orders/v2` `GET`
[π **Back to Table of Contents**](#table-of-contents)
---
-### `snaptrade.options.getOptionsStrategyQuote`
+### `snaptrade.experimentalEndpoints.getUserAccountRecentOrdersV2`
-Returns a Strategy Quotes object which has latest market data of the specified option strategy.
+A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format.
+This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders.
+Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days.
+By default only returns executed orders, but that can be changed by setting *only_executed* to false.
+**Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
#### π οΈ Usage
```php
-$result = $snaptrade->options->getOptionsStrategyQuote(
+$result = $snaptrade->experimentalEndpoints->getUserAccountRecentOrdersV2(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- account_id: "accountId_example",
- option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ only_executed: True
);
```
@@ -1029,41 +1334,37 @@ $result = $snaptrade->options->getOptionsStrategyQuote(
##### account_id: `string`
-The ID of the account the strategy will be placed in.
+##### only_executed: `bool`
-##### option_strategy_id: `string`
-
-Option strategy id obtained from response when creating option strategy object
+Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well
#### π Return
-[**StrategyQuotes**](./lib/Model/StrategyQuotes.php)
+[**AccountOrdersV2Response**](./lib/Model/AccountOrdersV2Response.php)
#### π Endpoint
-`/accounts/{accountId}/optionStrategy/{optionStrategyId}` `GET`
+`/accounts/{accountId}/recentOrders/v2` `GET`
[π **Back to Table of Contents**](#table-of-contents)
---
-### `snaptrade.options.listOptionHoldings`
-
-Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
-
-The data returned here is cached. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. **If you need real-time data, please use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint**.
+### `snaptrade.options.getOptionsChain`
+Returns the option chain for the specified symbol in the specified account.
#### π οΈ Usage
```php
-$result = $snaptrade->options->listOptionHoldings(
+$result = $snaptrade->options->getOptionsChain(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "accountId_example",
+ symbol: "symbol_example"
);
```
@@ -1075,69 +1376,62 @@ $result = $snaptrade->options->listOptionHoldings(
##### account_id: `string`
+The ID of the account to get the options chain from.
+
+##### symbol: `string`
+
+Universal symbol ID if symbol
+
#### π Return
-[**OptionsPosition**](./lib/Model/OptionsPosition.php)
+[**OptionChainInner**](./lib/Model/OptionChainInner.php)
#### π Endpoint
-`/accounts/{accountId}/options` `GET`
+`/accounts/{accountId}/optionsChain` `GET`
[π **Back to Table of Contents**](#table-of-contents)
---
-### `snaptrade.options.placeOptionStrategy`
+### `snaptrade.options.listOptionHoldings`
+
+Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions).
+
+Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access:
+ - If you do, this endpoint returns real-time data.
+ - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for "Cache Expiry Time" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
-Places the option strategy order and returns the order record received from the brokerage.
#### π οΈ Usage
```php
-$result = $snaptrade->options->placeOptionStrategy(
- order_type: "Limit",
- time_in_force: "FOK",
+$result = $snaptrade->options->listOptionHoldings(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
- option_strategy_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
- price: 31.33
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
);
```
#### βοΈ Parameters
-##### order_type:
-
-##### time_in_force:
-
##### user_id: `string`
##### user_secret: `string`
##### account_id: `string`
-The ID of the account to execute the strategy in.
-
-##### option_strategy_id: `string`
-
-Option strategy id obtained from response when creating option strategy object
-
-##### price: `float`
-
-Trade Price if limit or stop limit order
-
#### π Return
-[**StrategyOrderRecord**](./lib/Model/StrategyOrderRecord.php)
+[**OptionsPosition**](./lib/Model/OptionsPosition.php)
#### π Endpoint
-`/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute` `POST`
+`/accounts/{accountId}/options` `GET`
[π **Back to Table of Contents**](#table-of-contents)
@@ -1179,7 +1473,7 @@ A currency pair based on currency code for example, {CAD-USD}
### `snaptrade.referenceData.getPartnerInfo`
-Returns useful data related to the specified ClientID, including allowed brokerages and data access.
+Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
#### π οΈ Usage
@@ -1204,7 +1498,7 @@ $result = $snaptrade->referenceData->getPartnerInfo();
### `snaptrade.referenceData.getSecurityTypes`
-List security types available on SnapTrade.
+Return all available security types supported by SnapTrade.
#### π οΈ Usage
@@ -1254,9 +1548,7 @@ $result = $snaptrade->referenceData->getStockExchanges();
### `snaptrade.referenceData.getSymbols`
-Returns a list of Universal Symbol objects that match a defined string.
-
-Matches on ticker or name.
+Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
@@ -1264,7 +1556,7 @@ Matches on ticker or name.
```php
$result = $snaptrade->referenceData->getSymbols(
- substring: "apple"
+ substring: "AAPL"
);
```
@@ -1272,6 +1564,8 @@ $result = $snaptrade->referenceData->getSymbols(
##### substring: `string`
+The search query for symbols.
+
#### π Return
@@ -1288,7 +1582,8 @@ $result = $snaptrade->referenceData->getSymbols(
### `snaptrade.referenceData.getSymbolsByTicker`
-Returns the Universal Symbol object specified by the ticker or the universal_symbol_id.
+Returns the Universal Symbol object specified by the ticker or the Universal Symbol ID. When a ticker is specified, the first matching result is returned. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on "Yahoo Finance Market Coverage and Data Delays"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix. Please use the ticker with the proper suffix for the best results.
+
#### π οΈ Usage
@@ -1303,7 +1598,7 @@ $result = $snaptrade->referenceData->getSymbolsByTicker(
##### query: `string`
-The ticker or universal_symbol_id of the UniversalSymbol to get.
+The ticker or Universal Symbol ID to look up the symbol with.
#### π Return
@@ -1352,6 +1647,39 @@ Comma separated value of brokerage slugs
---
+### `snaptrade.referenceData.listAllBrokerageInstruments`
+
+Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list.
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->referenceData->listAllBrokerageInstruments(
+ slug: "QUESTRADE"
+);
+```
+
+#### βοΈ Parameters
+
+##### slug: `string`
+
+A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change.
+
+
+#### π Return
+
+[**BrokerageInstrumentsResponse**](./lib/Model/BrokerageInstrumentsResponse.php)
+
+#### π Endpoint
+
+`/brokerages/{slug}/instruments` `GET`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
### `snaptrade.referenceData.listAllBrokerages`
Returns a list of all defined Brokerage objects.
@@ -1429,9 +1757,9 @@ $result = $snaptrade->referenceData->listAllCurrenciesRates();
### `snaptrade.referenceData.symbolSearchUserAccount`
-Returns a list of universal symbols that are supported by
-the specificied account. Returned symbols are based on the
-provided search string, matching on ticker and name.
+Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
+
+The search results are further limited to the symbols supported by the brokerage for which the account is under.
@@ -1440,9 +1768,9 @@ provided search string, matching on ticker and name.
```php
$result = $snaptrade->referenceData->symbolSearchUserAccount(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
- substring: "apple"
+ substring: "AAPL"
);
```
@@ -1454,10 +1782,10 @@ $result = $snaptrade->referenceData->symbolSearchUserAccount(
##### account_id: `string`
-The ID of the account to search for symbols within.
-
##### substring: `string`
+The search query for symbols.
+
#### π Return
@@ -1472,36 +1800,80 @@ The ID of the account to search for symbols within.
---
-### `snaptrade.trading.cancelUserAccountOrder`
+### `snaptrade.trading.cancelOrder`
-Sends a signal to the brokerage to cancel the specified order.
-This will only work if the order has not yet been executed.
+Cancels an order in the specified account. Accepts order IDs for all asset types.
#### π οΈ Usage
```php
-$result = $snaptrade->trading->cancelUserAccountOrder(
+$result = $snaptrade->trading->cancelOrder(
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
- brokerage_order_id: "2bcd7cc3-e922-4976-bce1-9858296801c3"
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
);
```
#### βοΈ Parameters
+##### brokerage_order_id: `string`
+
+Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
+
##### user_id: `string`
##### user_secret: `string`
##### account_id: `string`
-The ID of the account to cancel the order in.
+
+#### π Return
+
+[**CancelOrderResponse**](./lib/Model/CancelOrderResponse.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/trading/cancel` `POST`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
+### `snaptrade.trading.cancelUserAccountOrder`
+
+
+**This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) **
+Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->trading->cancelUserAccountOrder(
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631"
+);
+```
+
+#### βοΈ Parameters
##### brokerage_order_id: `string`
+Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### account_id: `string`
+
#### π Return
@@ -1516,55 +1888,100 @@ The ID of the account to cancel the order in.
---
+### `snaptrade.trading.getCryptocurrencyPairQuote`
+
+Gets a quote for the specified account.
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->trading->getCryptocurrencyPairQuote(
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ instrument_symbol: "BTC-USD"
+);
+```
+
+#### βοΈ Parameters
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### account_id: `string`
+
+##### instrument_symbol: `string`
+
+
+#### π Return
+
+[**CryptocurrencyPairQuote**](./lib/Model/CryptocurrencyPairQuote.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/trading/instruments/cryptocurrencyPairs/{instrumentSymbol}/quote` `GET`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
### `snaptrade.trading.getOrderImpact`
-Return the trade object and it's impact on the account for the specified order.
+Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
#### π οΈ Usage
```php
$result = $snaptrade->trading->getOrderImpact(
- user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
action: "BUY",
- order_type: "Limit",
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ order_type: "Market",
+ time_in_force: "Day",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
price: 31.33,
stop: 31.33,
- time_in_force: "FOK",
- units: 3.14,
- universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ units: 10.5,
notional_value: None
);
```
#### βοΈ Parameters
-##### user_id: `string`
-
-##### user_secret: `string`
-
##### account_id: `string`
+Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
+
##### action:
+##### universal_symbol_id: `string`
+
+Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
+
##### order_type:
+##### time_in_force:
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
##### price: `float`
-Trade Price if limit or stop limit order
+The limit price for `Limit` and `StopLimit` orders.
##### stop: `float`
-Stop Price. If stop loss or stop limit order, the price to trigger the stop
-
-##### time_in_force:
+The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
##### units: [`float`](./lib/Model/float.php)
-##### universal_symbol_id: `string`
-
##### notional_value: [`ManualTradeFormNotionalValue`](./lib/Model/ManualTradeFormNotionalValue.php)
@@ -1583,7 +2000,14 @@ Stop Price. If stop loss or stop limit order, the price to trigger the stop
### `snaptrade.trading.getUserAccountQuotes`
-Returns quote(s) from the brokerage for the specified symbol(s).
+Returns quotes from the brokerage for the specified symbols and account.
+
+The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint.
+
+This endpoint does not work for options quotes.
+
+This endpoint is disabled for free plans by default. Please contact support to enable this endpoint if needed.
+
#### π οΈ Usage
@@ -1591,7 +2015,7 @@ Returns quote(s) from the brokerage for the specified symbol(s).
```php
$result = $snaptrade->trading->getUserAccountQuotes(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
symbols: "symbols_example",
account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
use_ticker: True
@@ -1606,15 +2030,13 @@ $result = $snaptrade->trading->getUserAccountQuotes(
##### symbols: `string`
-List of universal_symbol_id or tickers to get quotes for.
+List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator
##### account_id: `string`
-The ID of the account to get quotes.
-
##### use_ticker: `bool`
-Should be set to True if providing tickers.
+Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided.
#### π Return
@@ -1630,54 +2052,238 @@ Should be set to True if providing tickers.
---
-### `snaptrade.trading.placeForceOrder`
+### `snaptrade.trading.placeBracketOrder`
+
+Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for
+use. Only supported on certain brokerages
-Places a specified trade in the specified account.
#### π οΈ Usage
```php
-$result = $snaptrade->trading->placeForceOrder(
- user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
- account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+$result = $snaptrade->trading->placeBracketOrder(
action: "BUY",
- order_type: "Limit",
+ instrument: [
+ "symbol" => "AAPL",
+ "type" => "EQUITY",
+ ],
+ order_type: "Market",
+ time_in_force: "Day",
+ stop_loss: [
+ "stop_price" => "48.55",
+ "limit_price" => "48.50",
+ ],
+ take_profit: [
+ "limit_price" => "49.95",
+ ],
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
price: 31.33,
stop: 31.33,
- time_in_force: "FOK",
- units: 3.14,
- universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
- notional_value: None
+ units: 10.5
+);
+```
+
+#### βοΈ Parameters
+
+##### action:
+
+##### instrument: [`TradingInstrument`](./lib/Model/TradingInstrument.php)
+
+##### order_type:
+
+##### time_in_force:
+
+##### stop_loss: [`StopLoss`](./lib/Model/StopLoss.php)
+
+##### take_profit: [`TakeProfit`](./lib/Model/TakeProfit.php)
+
+##### account_id: `string`
+
+The ID of the account to execute the trade on.
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### price: `float`
+
+The limit price for `Limit` and `StopLimit` orders.
+
+##### stop: `float`
+
+The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
+
+##### units: `float`
+
+Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
+
+
+#### π Return
+
+[**AccountOrderRecord**](./lib/Model/AccountOrderRecord.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/trading/bracket` `POST`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
+### `snaptrade.trading.placeCryptoOrder`
+
+Places an order in the specified account.
+This endpoint does not compute the impact to the account balance from the order before submitting the order.
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->trading->placeCryptoOrder(
+ instrument: [
+ "symbol" => "BTC",
+ "type" => "CRYPTOCURRENCY",
+ ],
+ side: "BUY",
+ type: "MARKET",
+ time_in_force: "GTC",
+ amount: "123.45",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ limit_price: "123.45",
+ stop_price: "123.45",
+ post_only: False,
+ expiration_date: "2024-01-01T00:00:00Z"
);
```
#### βοΈ Parameters
+##### instrument: [`CryptoTradingInstrument`](./lib/Model/CryptoTradingInstrument.php)
+
+##### side:
+
+##### type: `string`
+
+The type of order to place.
+
+##### time_in_force: `string`
+
+The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
+
+##### amount: `float`
+
+The amount of the base currency to buy or sell.
+
##### user_id: `string`
##### user_secret: `string`
##### account_id: `string`
+##### limit_price: `float`
+
+The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
+
+##### stop_price: `float`
+
+The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
+
+##### post_only: `bool`
+
+Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
+
+##### expiration_date: `\DateTime`
+
+The expiration date of the order. Required if the time_in_force is GTD.
+
+
+#### π Return
+
+[**OrderUpdatedResponse**](./lib/Model/OrderUpdatedResponse.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/trading/crypto` `POST`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
+### `snaptrade.trading.placeForceOrder`
+
+Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds.
+
+This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact).
+
+It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->trading->placeForceOrder(
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ action: "BUY",
+ order_type: "Market",
+ time_in_force: "Day",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ universal_symbol_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ symbol: "AAPL",
+ trading_session: "REGULAR",
+ price: 31.33,
+ stop: 31.33,
+ units: 10.5,
+ notional_value: None
+);
+```
+
+#### βοΈ Parameters
+
+##### account_id: `string`
+
+Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
+
##### action:
##### order_type:
+##### time_in_force:
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### universal_symbol_id: [`string`](./lib/Model/string.php)
+
+The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
+
+##### symbol: `string`
+
+The security's trading ticker symbol. If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
+
+##### trading_session:
+
##### price: `float`
-Trade Price if limit or stop limit order
+The limit price for `Limit` and `StopLimit` orders.
##### stop: `float`
-Stop Price. If stop loss or stop limit order, the price to trigger the stop
-
-##### time_in_force:
+The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
##### units: [`float`](./lib/Model/float.php)
-##### universal_symbol_id: `string`
+For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
##### notional_value: [`ManualTradeFormNotionalValue`](./lib/Model/ManualTradeFormNotionalValue.php)
@@ -1695,10 +2301,80 @@ Stop Price. If stop loss or stop limit order, the price to trigger the stop
---
+### `snaptrade.trading.placeMlegOrder`
+
+Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->trading->placeMlegOrder(
+ order_type: "MARKET",
+ time_in_force: "Day",
+ legs: [
+ [
+ "instrument" => [
+ "symbol" => "PBI 250718C00006000",
+ "instrument_type" => "OPTION",
+ ],
+ "action" => "BUY_TO_OPEN",
+ "units" => 1,
+ ]
+ ],
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ limit_price: "",
+ stop_price: "",
+ price_effect: "DEBIT"
+);
+```
+
+#### βοΈ Parameters
+
+##### order_type:
+
+##### time_in_force:
+
+##### legs: [`MlegLeg`](./lib/Model/MlegLeg.php)[]
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### account_id: `string`
+
+##### limit_price: `float`
+
+The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
+
+##### stop_price: `float`
+
+The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
+
+##### price_effect: [`MlegPriceEffectStrict`](./lib/Model/MlegPriceEffectStrict.php)
+
+
+#### π Return
+
+[**MlegOrderResponse**](./lib/Model/MlegOrderResponse.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/trading/options` `POST`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
### `snaptrade.trading.placeOrder`
-Places the specified trade object. This places the order in the account and
-returns the status of the order from the brokerage.
+Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder).
+
+It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
@@ -1706,9 +2382,9 @@ returns the status of the order from the brokerage.
```php
$result = $snaptrade->trading->placeOrder(
- trade_id: "tradeId_example",
+ trade_id: "139e307a-82f7-4402-b39e-4da7baa87758",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
wait_to_confirm: True
);
```
@@ -1717,7 +2393,7 @@ $result = $snaptrade->trading->placeOrder(
##### trade_id: `string`
-The ID of trade object obtained from trade/impact endpoint
+Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact)
##### user_id: `string`
@@ -1725,7 +2401,7 @@ The ID of trade object obtained from trade/impact endpoint
##### wait_to_confirm: `bool`
-Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request
+Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status `PENDING` as we will not wait to check on the status before responding to the request.
#### π Return
@@ -1741,9 +2417,217 @@ Optional, defaults to true. Determines if a wait is performed to check on order
---
+### `snaptrade.trading.previewCryptoOrder`
+
+Previews an order using the specified account.
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->trading->previewCryptoOrder(
+ instrument: [
+ "symbol" => "BTC",
+ "type" => "CRYPTOCURRENCY",
+ ],
+ side: "BUY",
+ type: "MARKET",
+ time_in_force: "GTC",
+ amount: "123.45",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ limit_price: "123.45",
+ stop_price: "123.45",
+ post_only: False,
+ expiration_date: "2024-01-01T00:00:00Z"
+);
+```
+
+#### βοΈ Parameters
+
+##### instrument: [`CryptoTradingInstrument`](./lib/Model/CryptoTradingInstrument.php)
+
+##### side:
+
+##### type: `string`
+
+The type of order to place.
+
+##### time_in_force: `string`
+
+The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
+
+##### amount: `float`
+
+The amount of the base currency to buy or sell.
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### account_id: `string`
+
+##### limit_price: `float`
+
+The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
+
+##### stop_price: `float`
+
+The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
+
+##### post_only: `bool`
+
+Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
+
+##### expiration_date: `\DateTime`
+
+The expiration date of the order. Required if the time_in_force is GTD.
+
+
+#### π Return
+
+[**CryptoOrderPreview**](./lib/Model/CryptoOrderPreview.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/trading/crypto/preview` `POST`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
+### `snaptrade.trading.replaceOrder`
+
+Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling
+the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one
+returned in the response going forward. Only supported on some brokerages
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->trading->replaceOrder(
+ brokerage_order_id: "66a033fa-da74-4fcf-b527-feefdec9257e",
+ action: "BUY",
+ order_type: "Market",
+ time_in_force: "Day",
+ account_id: "2bcd7cc3-e922-4976-bce1-9858296801c3",
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ price: 31.33,
+ symbol: "AAPL",
+ stop: 31.33,
+ units: 10.5
+);
+```
+
+#### βοΈ Parameters
+
+##### brokerage_order_id: `string`
+
+Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
+
+##### action:
+
+##### order_type:
+
+##### time_in_force:
+
+##### account_id: `string`
+
+The ID of the account to execute the trade on.
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### price: `float`
+
+The limit price for `Limit` and `StopLimit` orders.
+
+##### symbol: `string`
+
+The security's trading ticker symbol
+
+##### stop: `float`
+
+The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
+
+##### units: [`float`](./lib/Model/float.php)
+
+
+#### π Return
+
+[**AccountOrderRecord**](./lib/Model/AccountOrderRecord.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/trading/replace` `POST`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
+### `snaptrade.trading.searchCryptocurrencyPairInstruments`
+
+Searches cryptocurrency pairs instruments accessible to the specified account. Both `base` and `quote` are optional. Omit both for a full list of cryptocurrency pairs.
+
+
+
+#### π οΈ Usage
+
+```php
+$result = $snaptrade->trading->searchCryptocurrencyPairInstruments(
+ user_id: "snaptrade-user-123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
+ account_id: "917c8734-8470-4a3e-a18f-57c3f2ee6631",
+ base: "BTC",
+ quote: "USD"
+);
+```
+
+#### βοΈ Parameters
+
+##### user_id: `string`
+
+##### user_secret: `string`
+
+##### account_id: `string`
+
+##### base: `string`
+
+##### quote: `string`
+
+
+#### π Return
+
+[**TradingSearchCryptocurrencyPairInstruments200Response**](./lib/Model/TradingSearchCryptocurrencyPairInstruments200Response.php)
+
+#### π Endpoint
+
+`/accounts/{accountId}/trading/instruments/cryptocurrencyPairs` `GET`
+
+[π **Back to Table of Contents**](#table-of-contents)
+
+---
+
+
### `snaptrade.transactionsAndReporting.getActivities`
+
+
+This endpoint is being deprecated but will continue to be available for use via SDKs, please use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) if possible
+
+Returns all historical transactions for the specified user and filtering criteria. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request.
+
+There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order.
+
+The data returned here is always cached and refreshed once a day.
-Returns activities (transactions) for a user. Specifying start and end date is highly recommended for better performance
#### π οΈ Usage
@@ -1751,12 +2635,12 @@ Returns activities (transactions) for a user. Specifying start and end date is h
```php
$result = $snaptrade->transactionsAndReporting->getActivities(
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
start_date: "2022-01-24",
end_date: "2022-01-24",
accounts: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
brokerage_authorizations: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
- type: "DIVIDEND"
+ type: "BUY,SELL,DIVIDEND"
);
```
@@ -1768,19 +2652,23 @@ $result = $snaptrade->transactionsAndReporting->getActivities(
##### start_date: `\DateTime`
+The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`.
+
##### end_date: `\DateTime`
+The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`.
+
##### accounts: `string`
-Optional comma seperated list of account IDs used to filter the request on specific accounts
+Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter.
##### brokerage_authorizations: `string`
-Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations
+Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter.
##### type: `string`
-Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT
+Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another
#### π Return
@@ -1809,7 +2697,7 @@ $result = $snaptrade->transactionsAndReporting->getReportingCustomRange(
start_date: "2022-01-24",
end_date: "2022-01-24",
user_id: "snaptrade-user-123",
- user_secret: "USERSECRET123",
+ user_secret: "adf2aa34-8219-40f7-a6b3-60156985cc61",
accounts: "917c8734-8470-4a3e-a18f-57c3f2ee6631,65e839a3-9103-4cfb-9b72-2071ef80c5f2",
detailed: True,
frequency: "monthly"
@@ -1828,7 +2716,7 @@ $result = $snaptrade->transactionsAndReporting->getReportingCustomRange(
##### accounts: `string`
-Optional comma seperated list of account IDs used to filter the request on specific accounts
+Optional comma separated list of account IDs used to filter the request on specific accounts
##### detailed: `bool`
diff --git a/lib/Api/AccountInformationApi.php b/lib/Api/AccountInformationApi.php
index 38852f5..1c48660 100644
--- a/lib/Api/AccountInformationApi.php
+++ b/lib/Api/AccountInformationApi.php
@@ -62,6 +62,9 @@ class AccountInformationApi extends \SnapTrade\CustomApi
/** @var string[] $contentTypes **/
public const contentTypes = [
+ 'getAccountActivities' => [
+ 'application/json',
+ ],
'getAllUserHoldings' => [
'application/json',
],
@@ -71,12 +74,21 @@ class AccountInformationApi extends \SnapTrade\CustomApi
'getUserAccountDetails' => [
'application/json',
],
+ 'getUserAccountOrderDetail' => [
+ 'application/json',
+ ],
'getUserAccountOrders' => [
'application/json',
],
'getUserAccountPositions' => [
'application/json',
],
+ 'getUserAccountRecentOrders' => [
+ 'application/json',
+ ],
+ 'getUserAccountReturnRates' => [
+ 'application/json',
+ ],
'getUserHoldings' => [
'application/json',
],
@@ -157,51 +169,68 @@ private function setRequestBodyProperty(&$body, $property, $value) {
}
/**
- * Operation getAllUserHoldings
+ * Operation getAccountActivities
*
- * List all accounts for the user, plus balances, positions, and orders for each account.
+ * List account activities
*
+ * Returns all historical transactions for the specified account. This endpoint is paginated with a default page size of 1000. The endpoint will return a maximum of 1000 transactions per request. See the query parameters for pagination options. Transaction are returned in reverse chronological order, using the `trade_date` field. The data returned here is always cached and refreshed once a day. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $account_id account_id (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param string $brokerage_authorizations Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param int $offset An integer that specifies the starting point of the paginated results. Default is 0. (optional)
+ * @param int $limit An integer that specifies the maximum number of transactions to return. Default of 1000. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivities'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\AccountHoldings[]|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse
- * @deprecated
+ * @return \SnapTrade\Model\PaginatedUniversalActivity
*/
- public function getAllUserHoldings(
+ public function getAccountActivities(
+ $account_id,
$user_id,
$user_secret,
- $brokerage_authorizations = SENTINEL_VALUE,
+ $start_date = SENTINEL_VALUE,
+ $end_date = SENTINEL_VALUE,
+ $offset = SENTINEL_VALUE,
+ $limit = SENTINEL_VALUE,
+ $type = SENTINEL_VALUE,
- string $contentType = self::contentTypes['getAllUserHoldings'][0]
+ string $contentType = self::contentTypes['getAccountActivities'][0]
)
{
- list($response) = $this->getAllUserHoldingsWithHttpInfo($user_id, $user_secret, $brokerage_authorizations, $contentType);
+ list($response) = $this->getAccountActivitiesWithHttpInfo($account_id, $user_id, $user_secret, $start_date, $end_date, $offset, $limit, $type, $contentType);
return $response;
}
/**
- * Operation getAllUserHoldingsWithHttpInfo
+ * Operation getAccountActivitiesWithHttpInfo
*
- * List all accounts for the user, plus balances, positions, and orders for each account.
+ * List account activities
+ *
+ * Returns all historical transactions for the specified account. This endpoint is paginated with a default page size of 1000. The endpoint will return a maximum of 1000 transactions per request. See the query parameters for pagination options. Transaction are returned in reverse chronological order, using the `trade_date` field. The data returned here is always cached and refreshed once a day. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
+ * @param string $account_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $brokerage_authorizations Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param int $offset An integer that specifies the starting point of the paginated results. Default is 0. (optional)
+ * @param int $limit An integer that specifies the maximum number of transactions to return. Default of 1000. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivities'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\AccountHoldings[]|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
- * @deprecated
+ * @return array of \SnapTrade\Model\PaginatedUniversalActivity, HTTP status code, HTTP response headers (array of strings)
*/
- public function getAllUserHoldingsWithHttpInfo($user_id, $user_secret, $brokerage_authorizations = null, string $contentType = self::contentTypes['getAllUserHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getAccountActivitiesWithHttpInfo($account_id, $user_id, $user_secret, $start_date = null, $end_date = null, $offset = null, $limit = null, $type = null, string $contentType = self::contentTypes['getAccountActivities'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_authorizations, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getAccountActivitiesRequest($account_id, $user_id, $user_secret, $start_date, $end_date, $offset, $limit, $type, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -216,10 +245,15 @@ public function getAllUserHoldingsWithHttpInfo($user_id, $user_secret, $brokerag
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getAllUserHoldingsWithHttpInfo(
+ return $this->getAccountActivitiesWithHttpInfo(
+ $account_id,
$user_id,
$user_secret,
- $brokerage_authorizations,
+ $start_date,
+ $end_date,
+ $offset,
+ $limit,
+ $type,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -257,53 +291,23 @@ public function getAllUserHoldingsWithHttpInfo($user_id, $user_secret, $brokerag
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\AccountHoldings[]' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\AccountHoldings[]' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountHoldings[]', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- case 400:
- if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- case 403:
- if ('\SnapTrade\Model\Model403FailedRequestResponse' === '\SplFileObject') {
+ if ('\SnapTrade\Model\PaginatedUniversalActivity' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\Model403FailedRequestResponse' !== 'string') {
+ if ('\SnapTrade\Model\PaginatedUniversalActivity' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FailedRequestResponse', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\PaginatedUniversalActivity', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
- $returnType = '\SnapTrade\Model\AccountHoldings[]';
+ $returnType = '\SnapTrade\Model\PaginatedUniversalActivity';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -324,23 +328,1847 @@ public function getAllUserHoldingsWithHttpInfo($user_id, $user_secret, $brokerag
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\AccountHoldings[]',
+ '\SnapTrade\Model\PaginatedUniversalActivity',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getAccountActivitiesAsync
+ *
+ * List account activities
+ *
+ * Returns all historical transactions for the specified account. This endpoint is paginated with a default page size of 1000. The endpoint will return a maximum of 1000 transactions per request. See the query parameters for pagination options. Transaction are returned in reverse chronological order, using the `trade_date` field. The data returned here is always cached and refreshed once a day. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $account_id (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param int $offset An integer that specifies the starting point of the paginated results. Default is 0. (optional)
+ * @param int $limit An integer that specifies the maximum number of transactions to return. Default of 1000. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivities'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getAccountActivitiesAsync(
+ $account_id,
+ $user_id,
+ $user_secret,
+ $start_date = SENTINEL_VALUE,
+ $end_date = SENTINEL_VALUE,
+ $offset = SENTINEL_VALUE,
+ $limit = SENTINEL_VALUE,
+ $type = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['getAccountActivities'][0]
+ )
+ {
+
+ return $this->getAccountActivitiesAsyncWithHttpInfo($account_id, $user_id, $user_secret, $start_date, $end_date, $offset, $limit, $type, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getAccountActivitiesAsyncWithHttpInfo
+ *
+ * List account activities
+ *
+ * Returns all historical transactions for the specified account. This endpoint is paginated with a default page size of 1000. The endpoint will return a maximum of 1000 transactions per request. See the query parameters for pagination options. Transaction are returned in reverse chronological order, using the `trade_date` field. The data returned here is always cached and refreshed once a day. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $account_id (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param int $offset An integer that specifies the starting point of the paginated results. Default is 0. (optional)
+ * @param int $limit An integer that specifies the maximum number of transactions to return. Default of 1000. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivities'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getAccountActivitiesAsyncWithHttpInfo($account_id, $user_id, $user_secret, $start_date = null, $end_date = null, $offset = null, $limit = null, $type = null, string $contentType = self::contentTypes['getAccountActivities'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\PaginatedUniversalActivity';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getAccountActivitiesRequest($account_id, $user_id, $user_secret, $start_date, $end_date, $offset, $limit, $type, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getAccountActivities'
+ *
+ * @param string $account_id (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param int $offset An integer that specifies the starting point of the paginated results. Default is 0. (optional)
+ * @param int $limit An integer that specifies the maximum number of transactions to return. Default of 1000. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAccountActivities'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getAccountActivitiesRequest($account_id, $user_id, $user_secret, $start_date = SENTINEL_VALUE, $end_date = SENTINEL_VALUE, $offset = SENTINEL_VALUE, $limit = SENTINEL_VALUE, $type = SENTINEL_VALUE, string $contentType = self::contentTypes['getAccountActivities'][0])
+ {
+
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getAccountActivities'
+ );
+ }
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getAccountActivities'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getAccountActivities'
+ );
+ }
+ if ($offset !== SENTINEL_VALUE && $offset < 0) {
+ throw new \InvalidArgumentException('invalid value for "offset" when calling AccountInformationApi.getAccountActivities, must be bigger than or equal to 0.');
+ }
+ if ($limit !== SENTINEL_VALUE && $limit < 1) {
+ throw new \InvalidArgumentException('invalid value for "limit" when calling AccountInformationApi.getAccountActivities, must be bigger than or equal to 1.');
+ }
+ // Check if $type is a string
+ if ($type !== SENTINEL_VALUE && !is_string($type)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($type, true), gettype($type)));
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/activities';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($start_date !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $start_date,
+ 'startDate', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+ if ($end_date !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $end_date,
+ 'endDate', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+ if ($offset !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $offset,
+ 'offset', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+ if ($limit !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $limit,
+ 'limit', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+ if ($type !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $type,
+ 'type', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation getAllUserHoldings
+ *
+ * List all accounts for the user, plus balances, positions, and orders for each account.
+ *
+ * **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $brokerage_authorizations Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\AccountHoldings[]|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse|\SnapTrade\Model\Model425FailedRequestResponse
+ * @deprecated
+ */
+ public function getAllUserHoldings(
+ $user_id,
+ $user_secret,
+ $brokerage_authorizations = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['getAllUserHoldings'][0]
+ )
+ {
+
+ list($response) = $this->getAllUserHoldingsWithHttpInfo($user_id, $user_secret, $brokerage_authorizations, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getAllUserHoldingsWithHttpInfo
+ *
+ * List all accounts for the user, plus balances, positions, and orders for each account.
+ *
+ * **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $brokerage_authorizations Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\AccountHoldings[]|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse|\SnapTrade\Model\Model425FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ * @deprecated
+ */
+ public function getAllUserHoldingsWithHttpInfo($user_id, $user_secret, $brokerage_authorizations = null, string $contentType = self::contentTypes['getAllUserHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_authorizations, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getAllUserHoldingsWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $brokerage_authorizations,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\AccountHoldings[]' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\AccountHoldings[]' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountHoldings[]', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 403:
+ if ('\SnapTrade\Model\Model403FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model403FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 425:
+ if ('\SnapTrade\Model\Model425FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model425FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model425FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\AccountHoldings[]';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\AccountHoldings[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model403FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 425:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model425FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getAllUserHoldingsAsync
+ *
+ * List all accounts for the user, plus balances, positions, and orders for each account.
+ *
+ * **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $brokerage_authorizations Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ * @deprecated
+ */
+ public function getAllUserHoldingsAsync(
+ $user_id,
+ $user_secret,
+ $brokerage_authorizations = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['getAllUserHoldings'][0]
+ )
+ {
+
+ return $this->getAllUserHoldingsAsyncWithHttpInfo($user_id, $user_secret, $brokerage_authorizations, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getAllUserHoldingsAsyncWithHttpInfo
+ *
+ * List all accounts for the user, plus balances, positions, and orders for each account.
+ *
+ * **Deprecated, please use the account-specific holdings endpoint instead.** List all accounts for the user, plus balances, positions, and orders for each account.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $brokerage_authorizations Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ * @deprecated
+ */
+ public function getAllUserHoldingsAsyncWithHttpInfo($user_id, $user_secret, $brokerage_authorizations = null, string $contentType = self::contentTypes['getAllUserHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\AccountHoldings[]';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_authorizations, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getAllUserHoldings'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $brokerage_authorizations Optional. Comma separated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ * @deprecated
+ */
+ public function getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_authorizations = SENTINEL_VALUE, string $contentType = self::contentTypes['getAllUserHoldings'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getAllUserHoldings'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getAllUserHoldings'
+ );
+ }
+ // Check if $brokerage_authorizations is a string
+ if ($brokerage_authorizations !== SENTINEL_VALUE && !is_string($brokerage_authorizations)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($brokerage_authorizations, true), gettype($brokerage_authorizations)));
+ }
+
+
+ $resourcePath = '/holdings';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($brokerage_authorizations !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $brokerage_authorizations,
+ 'brokerage_authorizations', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation getUserAccountBalance
+ *
+ * List account balances
+ *
+ * Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $account_id account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\Balance[]
+ */
+ public function getUserAccountBalance(
+ $user_id,
+ $user_secret,
+ $account_id,
+
+ string $contentType = self::contentTypes['getUserAccountBalance'][0]
+ )
+ {
+
+ list($response) = $this->getUserAccountBalanceWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getUserAccountBalanceWithHttpInfo
+ *
+ * List account balances
+ *
+ * Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\Balance[], HTTP status code, HTTP response headers (array of strings)
+ */
+ public function getUserAccountBalanceWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountBalance'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountBalanceRequest($user_id, $user_secret, $account_id, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getUserAccountBalanceWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\Balance[]' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Balance[]' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Balance[]', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\Balance[]';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Balance[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getUserAccountBalanceAsync
+ *
+ * List account balances
+ *
+ * Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountBalanceAsync(
+ $user_id,
+ $user_secret,
+ $account_id,
+
+ string $contentType = self::contentTypes['getUserAccountBalance'][0]
+ )
+ {
+
+ return $this->getUserAccountBalanceAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getUserAccountBalanceAsyncWithHttpInfo
+ *
+ * List account balances
+ *
+ * Returns a list of balances for the account. Each element of the list has a distinct currency. Some brokerages like Questrade [allows holding multiple currencies in the same account](https://www.questrade.com/learning/questrade-basics/balances-and-reports/understanding-your-account-balances). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountBalanceAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountBalance'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\Balance[]';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountBalanceRequest($user_id, $user_secret, $account_id, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getUserAccountBalance'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getUserAccountBalanceRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountBalance'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getUserAccountBalance'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getUserAccountBalance'
+ );
+ }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getUserAccountBalance'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/balances';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation getUserAccountDetails
+ *
+ * Get account detail
+ *
+ * Returns account detail known to SnapTrade for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $account_id account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\Account
+ */
+ public function getUserAccountDetails(
+ $user_id,
+ $user_secret,
+ $account_id,
+
+ string $contentType = self::contentTypes['getUserAccountDetails'][0]
+ )
+ {
+
+ list($response) = $this->getUserAccountDetailsWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getUserAccountDetailsWithHttpInfo
+ *
+ * Get account detail
+ *
+ * Returns account detail known to SnapTrade for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\Account, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function getUserAccountDetailsWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountDetails'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountDetailsRequest($user_id, $user_secret, $account_id, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getUserAccountDetailsWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\Account' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Account' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Account', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\Account';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Account',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getUserAccountDetailsAsync
+ *
+ * Get account detail
+ *
+ * Returns account detail known to SnapTrade for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountDetailsAsync(
+ $user_id,
+ $user_secret,
+ $account_id,
+
+ string $contentType = self::contentTypes['getUserAccountDetails'][0]
+ )
+ {
+
+ return $this->getUserAccountDetailsAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getUserAccountDetailsAsyncWithHttpInfo
+ *
+ * Get account detail
+ *
+ * Returns account detail known to SnapTrade for the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountDetailsAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountDetails'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\Account';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountDetailsRequest($user_id, $user_secret, $account_id, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getUserAccountDetails'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getUserAccountDetailsRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountDetails'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getUserAccountDetails'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getUserAccountDetails'
+ );
+ }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getUserAccountDetails'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation getUserAccountOrderDetail
+ *
+ * Get account order detail
+ *
+ * Returns the detail of a single order using the external order ID provided in the request body. This endpoint only works for single-leg orders at this time. Support for multi-leg orders will be added in the future. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
+ *
+ * @param string $account_id account_id (required)
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetail'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model404FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ */
+ public function getUserAccountOrderDetail(
+
+ $brokerage_order_id,
+ $account_id,
+ $user_id,
+ $user_secret,
+ string $contentType = self::contentTypes['getUserAccountOrderDetail'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "brokerage_order_id", $brokerage_order_id);
+ $account_information_get_user_account_order_detail_request = $_body;
+
+ list($response) = $this->getUserAccountOrderDetailWithHttpInfo($account_id, $user_id, $user_secret, $account_information_get_user_account_order_detail_request, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getUserAccountOrderDetailWithHttpInfo
+ *
+ * Get account order detail
+ *
+ * Returns the detail of a single order using the external order ID provided in the request body. This endpoint only works for single-leg orders at this time. Support for multi-leg orders will be added in the future. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
+ *
+ * @param string $account_id (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetail'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model404FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function getUserAccountOrderDetailWithHttpInfo($account_id, $user_id, $user_secret, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['getUserAccountOrderDetail'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrderDetailRequest($account_id, $user_id, $user_secret, $account_information_get_user_account_order_detail_request, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getUserAccountOrderDetailWithHttpInfo(
+ $account_id,
+ $user_id,
+ $user_secret,
+ $account_information_get_user_account_order_detail_request,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\AccountOrderRecord' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\AccountOrderRecord' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 404:
+ if ('\SnapTrade\Model\Model404FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model404FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model404FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\AccountOrderRecord',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
- case 400:
+ case 404:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\Model400FailedRequestResponse',
+ '\SnapTrade\Model\Model404FailedRequestResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
- case 403:
+ case 500:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\Model403FailedRequestResponse',
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -351,29 +2179,35 @@ public function getAllUserHoldingsWithHttpInfo($user_id, $user_secret, $brokerag
}
/**
- * Operation getAllUserHoldingsAsync
+ * Operation getUserAccountOrderDetailAsync
*
- * List all accounts for the user, plus balances, positions, and orders for each account.
+ * Get account order detail
*
+ * Returns the detail of a single order using the external order ID provided in the request body. This endpoint only works for single-leg orders at this time. Support for multi-leg orders will be added in the future. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
+ *
+ * @param string $account_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $brokerage_authorizations Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
- * @deprecated
*/
- public function getAllUserHoldingsAsync(
+ public function getUserAccountOrderDetailAsync(
+
+ $brokerage_order_id,
+ $account_id,
$user_id,
$user_secret,
- $brokerage_authorizations = SENTINEL_VALUE,
-
- string $contentType = self::contentTypes['getAllUserHoldings'][0]
+ string $contentType = self::contentTypes['getUserAccountOrderDetail'][0]
)
{
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "brokerage_order_id", $brokerage_order_id);
+ $account_information_get_user_account_order_detail_request = $_body;
- return $this->getAllUserHoldingsAsyncWithHttpInfo($user_id, $user_secret, $brokerage_authorizations, $contentType)
+ return $this->getUserAccountOrderDetailAsyncWithHttpInfo($account_id, $user_id, $user_secret, $account_information_get_user_account_order_detail_request, $contentType)
->then(
function ($response) {
return $response[0];
@@ -382,26 +2216,28 @@ function ($response) {
}
/**
- * Operation getAllUserHoldingsAsyncWithHttpInfo
+ * Operation getUserAccountOrderDetailAsyncWithHttpInfo
*
- * List all accounts for the user, plus balances, positions, and orders for each account.
+ * Get account order detail
+ *
+ * Returns the detail of a single order using the external order ID provided in the request body. This endpoint only works for single-leg orders at this time. Support for multi-leg orders will be added in the future. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
*
+ * @param string $account_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $brokerage_authorizations Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
- * @deprecated
*/
- public function getAllUserHoldingsAsyncWithHttpInfo($user_id, $user_secret, $brokerage_authorizations = null, string $contentType = self::contentTypes['getAllUserHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountOrderDetailAsyncWithHttpInfo($account_id, $user_id, $user_secret, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['getUserAccountOrderDetail'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\AccountHoldings[]';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_authorizations, $contentType);
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrderDetailRequest($account_id, $user_id, $user_secret, $account_information_get_user_account_order_detail_request, $contentType);
// Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config);
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
@@ -440,20 +2276,30 @@ function ($exception) {
}
/**
- * Create request for operation 'getAllUserHoldings'
+ * Create request for operation 'getUserAccountOrderDetail'
*
+ * @param string $account_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $brokerage_authorizations Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getAllUserHoldings'] to see the possible values for this operation
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetail'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
- * @deprecated
*/
- public function getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_authorizations = SENTINEL_VALUE, string $contentType = self::contentTypes['getAllUserHoldings'][0])
+ public function getUserAccountOrderDetailRequest($account_id, $user_id, $user_secret, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['getUserAccountOrderDetail'][0])
{
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getUserAccountOrderDetail'
+ );
+ }
// Check if $user_id is a string
if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
@@ -461,7 +2307,7 @@ public function getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_aut
// 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 getAllUserHoldings'
+ 'Missing the required parameter user_id when calling getUserAccountOrderDetail'
);
}
// Check if $user_secret is a string
@@ -471,16 +2317,26 @@ public function getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_aut
// 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 getAllUserHoldings'
+ 'Missing the required parameter user_secret when calling getUserAccountOrderDetail'
);
}
- // Check if $brokerage_authorizations is a string
- if ($brokerage_authorizations !== SENTINEL_VALUE && !is_string($brokerage_authorizations)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($brokerage_authorizations, true), gettype($brokerage_authorizations)));
+ if ($account_information_get_user_account_order_detail_request !== SENTINEL_VALUE) {
+ if (!($account_information_get_user_account_order_detail_request instanceof \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest)) {
+ if (!is_array($account_information_get_user_account_order_detail_request))
+ throw new \InvalidArgumentException('"account_information_get_user_account_order_detail_request" must be associative array or an instance of \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest AccountInformationApi.getUserAccountOrderDetail.');
+ else
+ $account_information_get_user_account_order_detail_request = new \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest($account_information_get_user_account_order_detail_request);
+ }
+ }
+ // verify the required parameter 'account_information_get_user_account_order_detail_request' is set
+ if ($account_information_get_user_account_order_detail_request === SENTINEL_VALUE || (is_array($account_information_get_user_account_order_detail_request) && count($account_information_get_user_account_order_detail_request) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter account_information_get_user_account_order_detail_request when calling getUserAccountOrderDetail'
+ );
}
- $resourcePath = '/holdings';
+ $resourcePath = '/accounts/{accountId}/orders/details';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -509,19 +2365,16 @@ public function getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_aut
true // required
) ?? []);
}
- if ($brokerage_authorizations !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $brokerage_authorizations,
- 'brokerage_authorizations', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- false // required
- ) ?? []);
- }
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
$headers = $this->headerSelector->selectHeaders(
@@ -531,7 +2384,14 @@ public function getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_aut
);
// for model (json/xml)
- if (count($formParams) > 0) {
+ if (isset($account_information_get_user_account_order_detail_request)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($account_information_get_user_account_order_detail_request));
+ } else {
+ $httpBody = $account_information_get_user_account_order_detail_request;
+ }
+ } elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
@@ -582,7 +2442,7 @@ public function getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_aut
$headers
);
- $method = 'GET';
+ $method = 'POST';
$this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
$operationHost = $this->config->getHost();
@@ -599,49 +2459,59 @@ public function getAllUserHoldingsRequest($user_id, $user_secret, $brokerage_aut
}
/**
- * Operation getUserAccountBalance
+ * Operation getUserAccountOrders
*
- * List account balances
+ * List account orders
+ *
+ * Returns a list of recent orders in the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $account_id account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\Balance[]
+ * @return \SnapTrade\Model\AccountOrderRecord[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse
*/
- public function getUserAccountBalance(
+ public function getUserAccountOrders(
$user_id,
$user_secret,
$account_id,
+ $state = SENTINEL_VALUE,
+ $days = SENTINEL_VALUE,
- string $contentType = self::contentTypes['getUserAccountBalance'][0]
+ string $contentType = self::contentTypes['getUserAccountOrders'][0]
)
{
- list($response) = $this->getUserAccountBalanceWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
+ list($response) = $this->getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $account_id, $state, $days, $contentType);
return $response;
}
/**
- * Operation getUserAccountBalanceWithHttpInfo
+ * Operation getUserAccountOrdersWithHttpInfo
*
- * List account balances
+ * List account orders
+ *
+ * Returns a list of recent orders in the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\Balance[], HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\AccountOrderRecord[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function getUserAccountBalanceWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountBalance'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $account_id, $state = null, $days = null, string $contentType = self::contentTypes['getUserAccountOrders'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountBalanceRequest($user_id, $user_secret, $account_id, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrdersRequest($user_id, $user_secret, $account_id, $state, $days, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -656,10 +2526,12 @@ public function getUserAccountBalanceWithHttpInfo($user_id, $user_secret, $accou
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getUserAccountBalanceWithHttpInfo(
+ return $this->getUserAccountOrdersWithHttpInfo(
$user_id,
$user_secret,
$account_id,
+ $state,
+ $days,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -697,23 +2569,38 @@ public function getUserAccountBalanceWithHttpInfo($user_id, $user_secret, $accou
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\Balance[]' === '\SplFileObject') {
+ if ('\SnapTrade\Model\AccountOrderRecord[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\Balance[]' !== 'string') {
+ if ('\SnapTrade\Model\AccountOrderRecord[]' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Balance[]', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord[]', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
- $returnType = '\SnapTrade\Model\Balance[]';
+ $returnType = '\SnapTrade\Model\AccountOrderRecord[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -734,7 +2621,15 @@ public function getUserAccountBalanceWithHttpInfo($user_id, $user_secret, $accou
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\Balance[]',
+ '\SnapTrade\Model\AccountOrderRecord[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -745,28 +2640,34 @@ public function getUserAccountBalanceWithHttpInfo($user_id, $user_secret, $accou
}
/**
- * Operation getUserAccountBalanceAsync
+ * Operation getUserAccountOrdersAsync
*
- * List account balances
+ * List account orders
+ *
+ * Returns a list of recent orders in the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountBalanceAsync(
+ public function getUserAccountOrdersAsync(
$user_id,
$user_secret,
$account_id,
+ $state = SENTINEL_VALUE,
+ $days = SENTINEL_VALUE,
- string $contentType = self::contentTypes['getUserAccountBalance'][0]
+ string $contentType = self::contentTypes['getUserAccountOrders'][0]
)
{
- return $this->getUserAccountBalanceAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
+ return $this->getUserAccountOrdersAsyncWithHttpInfo($user_id, $user_secret, $account_id, $state, $days, $contentType)
->then(
function ($response) {
return $response[0];
@@ -775,22 +2676,26 @@ function ($response) {
}
/**
- * Operation getUserAccountBalanceAsyncWithHttpInfo
+ * Operation getUserAccountOrdersAsyncWithHttpInfo
*
- * List account balances
+ * List account orders
+ *
+ * Returns a list of recent orders in the specified account. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountBalanceAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountBalance'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountOrdersAsyncWithHttpInfo($user_id, $user_secret, $account_id, $state = null, $days = null, string $contentType = self::contentTypes['getUserAccountOrders'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\Balance[]';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountBalanceRequest($user_id, $user_secret, $account_id, $contentType);
+ $returnType = '\SnapTrade\Model\AccountOrderRecord[]';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrdersRequest($user_id, $user_secret, $account_id, $state, $days, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -832,17 +2737,19 @@ function ($exception) {
}
/**
- * Create request for operation 'getUserAccountBalance'
+ * Create request for operation 'getUserAccountOrders'
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountBalance'] to see the possible values for this operation
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function getUserAccountBalanceRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountBalance'][0])
+ public function getUserAccountOrdersRequest($user_id, $user_secret, $account_id, $state = SENTINEL_VALUE, $days = SENTINEL_VALUE, string $contentType = self::contentTypes['getUserAccountOrders'][0])
{
// Check if $user_id is a string
@@ -852,7 +2759,7 @@ public function getUserAccountBalanceRequest($user_id, $user_secret, $account_id
// 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 getUserAccountBalance'
+ 'Missing the required parameter user_id when calling getUserAccountOrders'
);
}
// Check if $user_secret is a string
@@ -862,7 +2769,7 @@ public function getUserAccountBalanceRequest($user_id, $user_secret, $account_id
// 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 getUserAccountBalance'
+ 'Missing the required parameter user_secret when calling getUserAccountOrders'
);
}
// Check if $account_id is a string
@@ -872,12 +2779,19 @@ public function getUserAccountBalanceRequest($user_id, $user_secret, $account_id
// 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 getUserAccountBalance'
+ 'Missing the required parameter account_id when calling getUserAccountOrders'
);
}
+ // Check if $state is a string
+ if ($state !== SENTINEL_VALUE && !is_string($state)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($state, true), gettype($state)));
+ }
+ if ($days !== SENTINEL_VALUE && $days < 1) {
+ throw new \InvalidArgumentException('invalid value for "days" when calling AccountInformationApi.getUserAccountOrders, must be bigger than or equal to 1.');
+ }
+
-
- $resourcePath = '/accounts/{accountId}/balances';
+ $resourcePath = '/accounts/{accountId}/orders';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -906,6 +2820,28 @@ public function getUserAccountBalanceRequest($user_id, $user_secret, $account_id
true // required
) ?? []);
}
+ if ($state !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $state,
+ 'state', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+ if ($days !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $days,
+ 'days', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
// path params
@@ -993,49 +2929,53 @@ public function getUserAccountBalanceRequest($user_id, $user_secret, $account_id
}
/**
- * Operation getUserAccountDetails
+ * Operation getUserAccountPositions
*
- * Get account detail
+ * List account positions
+ *
+ * Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $account_id account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\Account
+ * @return \SnapTrade\Model\Position[]
*/
- public function getUserAccountDetails(
+ public function getUserAccountPositions(
$user_id,
$user_secret,
$account_id,
- string $contentType = self::contentTypes['getUserAccountDetails'][0]
+ string $contentType = self::contentTypes['getUserAccountPositions'][0]
)
{
- list($response) = $this->getUserAccountDetailsWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
+ list($response) = $this->getUserAccountPositionsWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
return $response;
}
/**
- * Operation getUserAccountDetailsWithHttpInfo
+ * Operation getUserAccountPositionsWithHttpInfo
*
- * Get account detail
+ * List account positions
+ *
+ * Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\Account, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\Position[], HTTP status code, HTTP response headers (array of strings)
*/
- public function getUserAccountDetailsWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountDetails'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountPositionsWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountPositions'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountDetailsRequest($user_id, $user_secret, $account_id, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountPositionsRequest($user_id, $user_secret, $account_id, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -1050,7 +2990,7 @@ public function getUserAccountDetailsWithHttpInfo($user_id, $user_secret, $accou
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getUserAccountDetailsWithHttpInfo(
+ return $this->getUserAccountPositionsWithHttpInfo(
$user_id,
$user_secret,
$account_id,
@@ -1091,23 +3031,23 @@ public function getUserAccountDetailsWithHttpInfo($user_id, $user_secret, $accou
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\Account' === '\SplFileObject') {
+ if ('\SnapTrade\Model\Position[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\Account' !== 'string') {
+ if ('\SnapTrade\Model\Position[]' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Account', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Position[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
- $returnType = '\SnapTrade\Model\Account';
+ $returnType = '\SnapTrade\Model\Position[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -1128,7 +3068,7 @@ public function getUserAccountDetailsWithHttpInfo($user_id, $user_secret, $accou
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\Account',
+ '\SnapTrade\Model\Position[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -1139,28 +3079,30 @@ public function getUserAccountDetailsWithHttpInfo($user_id, $user_secret, $accou
}
/**
- * Operation getUserAccountDetailsAsync
+ * Operation getUserAccountPositionsAsync
*
- * Get account detail
+ * List account positions
+ *
+ * Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountDetailsAsync(
+ public function getUserAccountPositionsAsync(
$user_id,
$user_secret,
$account_id,
- string $contentType = self::contentTypes['getUserAccountDetails'][0]
+ string $contentType = self::contentTypes['getUserAccountPositions'][0]
)
{
- return $this->getUserAccountDetailsAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
+ return $this->getUserAccountPositionsAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
->then(
function ($response) {
return $response[0];
@@ -1169,22 +3111,24 @@ function ($response) {
}
/**
- * Operation getUserAccountDetailsAsyncWithHttpInfo
+ * Operation getUserAccountPositionsAsyncWithHttpInfo
*
- * Get account detail
+ * List account positions
+ *
+ * Returns a list of stock/ETF/crypto/mutual fund positions in the specified account. For option positions, please use the [options endpoint](/reference/Options/Options_listOptionHoldings). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountDetailsAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountDetails'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountPositionsAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountPositions'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\Account';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountDetailsRequest($user_id, $user_secret, $account_id, $contentType);
+ $returnType = '\SnapTrade\Model\Position[]';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountPositionsRequest($user_id, $user_secret, $account_id, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -1226,17 +3170,17 @@ function ($exception) {
}
/**
- * Create request for operation 'getUserAccountDetails'
+ * Create request for operation 'getUserAccountPositions'
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountDetails'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function getUserAccountDetailsRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountDetails'][0])
+ public function getUserAccountPositionsRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountPositions'][0])
{
// Check if $user_id is a string
@@ -1246,7 +3190,7 @@ public function getUserAccountDetailsRequest($user_id, $user_secret, $account_id
// 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 getUserAccountDetails'
+ 'Missing the required parameter user_id when calling getUserAccountPositions'
);
}
// Check if $user_secret is a string
@@ -1256,7 +3200,7 @@ public function getUserAccountDetailsRequest($user_id, $user_secret, $account_id
// 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 getUserAccountDetails'
+ 'Missing the required parameter user_secret when calling getUserAccountPositions'
);
}
// Check if $account_id is a string
@@ -1266,12 +3210,12 @@ public function getUserAccountDetailsRequest($user_id, $user_secret, $account_id
// 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 getUserAccountDetails'
+ 'Missing the required parameter account_id when calling getUserAccountPositions'
);
}
- $resourcePath = '/accounts/{accountId}';
+ $resourcePath = '/accounts/{accountId}/positions';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -1387,55 +3331,56 @@ public function getUserAccountDetailsRequest($user_id, $user_secret, $account_id
}
/**
- * Operation getUserAccountOrders
+ * Operation getUserAccountRecentOrders
+ *
+ * List account recent orders (last 24 hours only)
*
- * List account recent orders
+ * A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders Differs from /orders in that it is always realtime, and only checks the last 24 hours By default only returns executed orders, but that can be changed by setting *only_executed* to false
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $account_id account_id (required)
- * @param string $state defaults value is set to \"all\" (optional)
- * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrders'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\AccountOrderRecord[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ * @return \SnapTrade\Model\RecentOrdersResponse|\SnapTrade\Model\Model403FeatureNotEnabledResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
*/
- public function getUserAccountOrders(
+ public function getUserAccountRecentOrders(
$user_id,
$user_secret,
$account_id,
- $state = SENTINEL_VALUE,
- $days = SENTINEL_VALUE,
+ $only_executed = SENTINEL_VALUE,
- string $contentType = self::contentTypes['getUserAccountOrders'][0]
+ string $contentType = self::contentTypes['getUserAccountRecentOrders'][0]
)
{
- list($response) = $this->getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $account_id, $state, $days, $contentType);
+ list($response) = $this->getUserAccountRecentOrdersWithHttpInfo($user_id, $user_secret, $account_id, $only_executed, $contentType);
return $response;
}
/**
- * Operation getUserAccountOrdersWithHttpInfo
+ * Operation getUserAccountRecentOrdersWithHttpInfo
*
- * List account recent orders
+ * List account recent orders (last 24 hours only)
+ *
+ * A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders Differs from /orders in that it is always realtime, and only checks the last 24 hours By default only returns executed orders, but that can be changed by setting *only_executed* to false
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $state defaults value is set to \"all\" (optional)
- * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrders'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\AccountOrderRecord[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\RecentOrdersResponse|\SnapTrade\Model\Model403FeatureNotEnabledResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $account_id, $state = null, $days = null, string $contentType = self::contentTypes['getUserAccountOrders'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountRecentOrdersWithHttpInfo($user_id, $user_secret, $account_id, $only_executed = null, string $contentType = self::contentTypes['getUserAccountRecentOrders'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrdersRequest($user_id, $user_secret, $account_id, $state, $days, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountRecentOrdersRequest($user_id, $user_secret, $account_id, $only_executed, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -1450,12 +3395,11 @@ public function getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $accoun
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getUserAccountOrdersWithHttpInfo(
+ return $this->getUserAccountRecentOrdersWithHttpInfo(
$user_id,
$user_secret,
$account_id,
- $state,
- $days,
+ $only_executed,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -1493,17 +3437,32 @@ public function getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $accoun
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\AccountOrderRecord[]' === '\SplFileObject') {
+ if ('\SnapTrade\Model\RecentOrdersResponse' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\AccountOrderRecord[]' !== 'string') {
+ if ('\SnapTrade\Model\RecentOrdersResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord[]', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\RecentOrdersResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 403:
+ if ('\SnapTrade\Model\Model403FeatureNotEnabledResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model403FeatureNotEnabledResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FeatureNotEnabledResponse', []),
$response->getStatusCode(),
$response->getHeaders()
];
@@ -1524,7 +3483,7 @@ public function getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $accoun
];
}
- $returnType = '\SnapTrade\Model\AccountOrderRecord[]';
+ $returnType = '\SnapTrade\Model\RecentOrdersResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -1545,7 +3504,15 @@ public function getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $accoun
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\AccountOrderRecord[]',
+ '\SnapTrade\Model\RecentOrdersResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model403FeatureNotEnabledResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -1564,32 +3531,32 @@ public function getUserAccountOrdersWithHttpInfo($user_id, $user_secret, $accoun
}
/**
- * Operation getUserAccountOrdersAsync
+ * Operation getUserAccountRecentOrdersAsync
+ *
+ * List account recent orders (last 24 hours only)
*
- * List account recent orders
+ * A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders Differs from /orders in that it is always realtime, and only checks the last 24 hours By default only returns executed orders, but that can be changed by setting *only_executed* to false
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $state defaults value is set to \"all\" (optional)
- * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountOrdersAsync(
+ public function getUserAccountRecentOrdersAsync(
$user_id,
$user_secret,
$account_id,
- $state = SENTINEL_VALUE,
- $days = SENTINEL_VALUE,
+ $only_executed = SENTINEL_VALUE,
- string $contentType = self::contentTypes['getUserAccountOrders'][0]
+ string $contentType = self::contentTypes['getUserAccountRecentOrders'][0]
)
{
- return $this->getUserAccountOrdersAsyncWithHttpInfo($user_id, $user_secret, $account_id, $state, $days, $contentType)
+ return $this->getUserAccountRecentOrdersAsyncWithHttpInfo($user_id, $user_secret, $account_id, $only_executed, $contentType)
->then(
function ($response) {
return $response[0];
@@ -1598,24 +3565,25 @@ function ($response) {
}
/**
- * Operation getUserAccountOrdersAsyncWithHttpInfo
+ * Operation getUserAccountRecentOrdersAsyncWithHttpInfo
+ *
+ * List account recent orders (last 24 hours only)
*
- * List account recent orders
+ * A lightweight endpoint that returns the latest page of orders placed in the last 24 hours in the specified account. For most brokerages, the default page size is 100 meaning the endpoint will return a max of 100 orders. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders Differs from /orders in that it is always realtime, and only checks the last 24 hours By default only returns executed orders, but that can be changed by setting *only_executed* to false
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $state defaults value is set to \"all\" (optional)
- * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountOrdersAsyncWithHttpInfo($user_id, $user_secret, $account_id, $state = null, $days = null, string $contentType = self::contentTypes['getUserAccountOrders'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountRecentOrdersAsyncWithHttpInfo($user_id, $user_secret, $account_id, $only_executed = null, string $contentType = self::contentTypes['getUserAccountRecentOrders'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\AccountOrderRecord[]';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrdersRequest($user_id, $user_secret, $account_id, $state, $days, $contentType);
+ $returnType = '\SnapTrade\Model\RecentOrdersResponse';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountRecentOrdersRequest($user_id, $user_secret, $account_id, $only_executed, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -1657,19 +3625,18 @@ function ($exception) {
}
/**
- * Create request for operation 'getUserAccountOrders'
+ * Create request for operation 'getUserAccountRecentOrders'
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $state defaults value is set to \"all\" (optional)
- * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrders'] to see the possible values for this operation
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrders'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function getUserAccountOrdersRequest($user_id, $user_secret, $account_id, $state = SENTINEL_VALUE, $days = SENTINEL_VALUE, string $contentType = self::contentTypes['getUserAccountOrders'][0])
+ public function getUserAccountRecentOrdersRequest($user_id, $user_secret, $account_id, $only_executed = SENTINEL_VALUE, string $contentType = self::contentTypes['getUserAccountRecentOrders'][0])
{
// Check if $user_id is a string
@@ -1679,7 +3646,7 @@ public function getUserAccountOrdersRequest($user_id, $user_secret, $account_id,
// 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 getUserAccountOrders'
+ 'Missing the required parameter user_id when calling getUserAccountRecentOrders'
);
}
// Check if $user_secret is a string
@@ -1689,7 +3656,7 @@ public function getUserAccountOrdersRequest($user_id, $user_secret, $account_id,
// 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 getUserAccountOrders'
+ 'Missing the required parameter user_secret when calling getUserAccountRecentOrders'
);
}
// Check if $account_id is a string
@@ -1699,19 +3666,12 @@ public function getUserAccountOrdersRequest($user_id, $user_secret, $account_id,
// 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 getUserAccountOrders'
+ 'Missing the required parameter account_id when calling getUserAccountRecentOrders'
);
}
- // Check if $state is a string
- if ($state !== SENTINEL_VALUE && !is_string($state)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($state, true), gettype($state)));
- }
- if ($days !== SENTINEL_VALUE && $days < 1) {
- throw new \InvalidArgumentException('invalid value for "days" when calling AccountInformationApi.getUserAccountOrders, must be bigger than or equal to 1.');
- }
-
- $resourcePath = '/accounts/{accountId}/orders';
+
+ $resourcePath = '/accounts/{accountId}/recentOrders';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -1740,23 +3700,12 @@ public function getUserAccountOrdersRequest($user_id, $user_secret, $account_id,
true // required
) ?? []);
}
- if ($state !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $state,
- 'state', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- false // required
- ) ?? []);
- }
- if ($days !== SENTINEL_VALUE) {
+ if ($only_executed !== SENTINEL_VALUE) {
// query params
$queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $days,
- 'days', // param base name
- 'integer', // openApiType
+ $only_executed,
+ 'only_executed', // param base name
+ 'boolean', // openApiType
'form', // style
true, // explode
false // required
@@ -1849,49 +3798,53 @@ public function getUserAccountOrdersRequest($user_id, $user_secret, $account_id,
}
/**
- * Operation getUserAccountPositions
+ * Operation getUserAccountReturnRates
*
- * List account positions
+ * List account rate of returns
+ *
+ * Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $account_id account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountReturnRates'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\Position[]
+ * @return \SnapTrade\Model\RateOfReturnResponse|\SnapTrade\Model\Model403FeatureNotEnabledResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
*/
- public function getUserAccountPositions(
+ public function getUserAccountReturnRates(
$user_id,
$user_secret,
$account_id,
- string $contentType = self::contentTypes['getUserAccountPositions'][0]
+ string $contentType = self::contentTypes['getUserAccountReturnRates'][0]
)
{
- list($response) = $this->getUserAccountPositionsWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
+ list($response) = $this->getUserAccountReturnRatesWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
return $response;
}
/**
- * Operation getUserAccountPositionsWithHttpInfo
+ * Operation getUserAccountReturnRatesWithHttpInfo
*
- * List account positions
+ * List account rate of returns
+ *
+ * Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountReturnRates'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\Position[], HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\RateOfReturnResponse|\SnapTrade\Model\Model403FeatureNotEnabledResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function getUserAccountPositionsWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountPositions'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountReturnRatesWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountReturnRates'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountPositionsRequest($user_id, $user_secret, $account_id, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountReturnRatesRequest($user_id, $user_secret, $account_id, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -1906,7 +3859,7 @@ public function getUserAccountPositionsWithHttpInfo($user_id, $user_secret, $acc
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getUserAccountPositionsWithHttpInfo(
+ return $this->getUserAccountReturnRatesWithHttpInfo(
$user_id,
$user_secret,
$account_id,
@@ -1947,23 +3900,53 @@ public function getUserAccountPositionsWithHttpInfo($user_id, $user_secret, $acc
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\Position[]' === '\SplFileObject') {
+ if ('\SnapTrade\Model\RateOfReturnResponse' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\Position[]' !== 'string') {
+ if ('\SnapTrade\Model\RateOfReturnResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Position[]', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\RateOfReturnResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 403:
+ if ('\SnapTrade\Model\Model403FeatureNotEnabledResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model403FeatureNotEnabledResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FeatureNotEnabledResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
- $returnType = '\SnapTrade\Model\Position[]';
+ $returnType = '\SnapTrade\Model\RateOfReturnResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -1984,7 +3967,23 @@ public function getUserAccountPositionsWithHttpInfo($user_id, $user_secret, $acc
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\Position[]',
+ '\SnapTrade\Model\RateOfReturnResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model403FeatureNotEnabledResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -1995,28 +3994,30 @@ public function getUserAccountPositionsWithHttpInfo($user_id, $user_secret, $acc
}
/**
- * Operation getUserAccountPositionsAsync
+ * Operation getUserAccountReturnRatesAsync
*
- * List account positions
+ * List account rate of returns
+ *
+ * Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountReturnRates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountPositionsAsync(
+ public function getUserAccountReturnRatesAsync(
$user_id,
$user_secret,
$account_id,
- string $contentType = self::contentTypes['getUserAccountPositions'][0]
+ string $contentType = self::contentTypes['getUserAccountReturnRates'][0]
)
{
- return $this->getUserAccountPositionsAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
+ return $this->getUserAccountReturnRatesAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
->then(
function ($response) {
return $response[0];
@@ -2025,22 +4026,24 @@ function ($response) {
}
/**
- * Operation getUserAccountPositionsAsyncWithHttpInfo
+ * Operation getUserAccountReturnRatesAsyncWithHttpInfo
*
- * List account positions
+ * List account rate of returns
+ *
+ * Returns a list of rate of return percents for a given account. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountReturnRates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountPositionsAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountPositions'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getUserAccountReturnRatesAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountReturnRates'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\Position[]';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountPositionsRequest($user_id, $user_secret, $account_id, $contentType);
+ $returnType = '\SnapTrade\Model\RateOfReturnResponse';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountReturnRatesRequest($user_id, $user_secret, $account_id, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -2082,17 +4085,17 @@ function ($exception) {
}
/**
- * Create request for operation 'getUserAccountPositions'
+ * Create request for operation 'getUserAccountReturnRates'
*
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountPositions'] to see the possible values for this operation
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountReturnRates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function getUserAccountPositionsRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountPositions'][0])
+ public function getUserAccountReturnRatesRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['getUserAccountReturnRates'][0])
{
// Check if $user_id is a string
@@ -2102,7 +4105,7 @@ public function getUserAccountPositionsRequest($user_id, $user_secret, $account_
// 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 getUserAccountPositions'
+ 'Missing the required parameter user_id when calling getUserAccountReturnRates'
);
}
// Check if $user_secret is a string
@@ -2112,7 +4115,7 @@ public function getUserAccountPositionsRequest($user_id, $user_secret, $account_
// 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 getUserAccountPositions'
+ 'Missing the required parameter user_secret when calling getUserAccountReturnRates'
);
}
// Check if $account_id is a string
@@ -2122,12 +4125,12 @@ public function getUserAccountPositionsRequest($user_id, $user_secret, $account_
// 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 getUserAccountPositions'
+ 'Missing the required parameter account_id when calling getUserAccountReturnRates'
);
}
- $resourcePath = '/accounts/{accountId}/positions';
+ $resourcePath = '/accounts/{accountId}/returnRates';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -2247,6 +4250,8 @@ public function getUserAccountPositionsRequest($user_id, $user_secret, $account_
*
* List account holdings
*
+ * Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
* @param string $account_id account_id (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
@@ -2254,7 +4259,7 @@ public function getUserAccountPositionsRequest($user_id, $user_secret, $account_
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\AccountHoldingsAccount|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse
+ * @return \SnapTrade\Model\AccountHoldingsAccount|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse|\SnapTrade\Model\Model425FailedRequestResponse
*/
public function getUserHoldings(
$account_id,
@@ -2274,6 +4279,8 @@ public function getUserHoldings(
*
* List account holdings
*
+ * Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
* @param string $account_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -2281,7 +4288,7 @@ public function getUserHoldings(
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\AccountHoldingsAccount|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\AccountHoldingsAccount|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse|\SnapTrade\Model\Model425FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getUserHoldingsWithHttpInfo($account_id, $user_id, $user_secret, string $contentType = self::contentTypes['getUserHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
@@ -2385,6 +4392,21 @@ public function getUserHoldingsWithHttpInfo($account_id, $user_id, $user_secret,
$response->getStatusCode(),
$response->getHeaders()
];
+ case 425:
+ if ('\SnapTrade\Model\Model425FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model425FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model425FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
}
$returnType = '\SnapTrade\Model\AccountHoldingsAccount';
@@ -2429,6 +4451,14 @@ public function getUserHoldingsWithHttpInfo($account_id, $user_id, $user_secret,
);
$e->setResponseObject($data);
break;
+ case 425:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model425FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
}
throw $e;
}
@@ -2439,6 +4469,8 @@ public function getUserHoldingsWithHttpInfo($account_id, $user_id, $user_secret,
*
* List account holdings
*
+ * Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
* @param string $account_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -2469,6 +4501,8 @@ function ($response) {
*
* List account holdings
*
+ * Returns a list of balances, positions, and recent orders for the specified account. The data returned is similar to the data returned over the more fine-grained [balances](/reference/Account%20Information/AccountInformation_getUserAccountBalance), [positions](/reference/Account%20Information/AccountInformation_getUserAccountPositions) and [orders](/reference/Account%20Information/AccountInformation_getUserAccountOrders) endpoints. __The finer-grained APIs are preferred. They are easier to work with, faster, and have better error handling than this coarse-grained API.__ Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
* @param string $account_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -2687,6 +4721,8 @@ public function getUserHoldingsRequest($account_id, $user_id, $user_secret, stri
*
* List accounts
*
+ * Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+ *
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listUserAccounts'] to see the possible values for this operation
@@ -2712,6 +4748,8 @@ public function listUserAccounts(
*
* List accounts
*
+ * Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listUserAccounts'] to see the possible values for this operation
@@ -2829,6 +4867,8 @@ public function listUserAccountsWithHttpInfo($user_id, $user_secret, string $con
*
* List accounts
*
+ * Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listUserAccounts'] to see the possible values for this operation
@@ -2857,6 +4897,8 @@ function ($response) {
*
* List accounts
*
+ * Returns all brokerage accounts across all connections known to SnapTrade for the authenticated user. Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listUserAccounts'] to see the possible values for this operation
@@ -3055,6 +5097,8 @@ public function listUserAccountsRequest($user_id, $user_secret, string $contentT
*
* Update details of an investment account
*
+ * Updates various properties of a specified account.
+ *
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $account_id The ID of the account to update. (required)
@@ -3082,6 +5126,8 @@ public function updateUserAccount(
*
* Update details of an investment account
*
+ * Updates various properties of a specified account.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id The ID of the account to update. (required)
@@ -3201,6 +5247,8 @@ public function updateUserAccountWithHttpInfo($user_id, $user_secret, $account_i
*
* Update details of an investment account
*
+ * Updates various properties of a specified account.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id The ID of the account to update. (required)
@@ -3231,6 +5279,8 @@ function ($response) {
*
* Update details of an investment account
*
+ * Updates various properties of a specified account.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $account_id The ID of the account to update. (required)
diff --git a/lib/Api/ApiStatusApi.php b/lib/Api/ApiStatusApi.php
index f635aeb..85e85d3 100644
--- a/lib/Api/ApiStatusApi.php
+++ b/lib/Api/ApiStatusApi.php
@@ -140,6 +140,8 @@ private function setRequestBodyProperty(&$body, $property, $value) {
*
* Get API Status
*
+ * Check whether the API is operational and verify timestamps.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['check'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -162,6 +164,8 @@ public function check(
*
* Get API Status
*
+ * Check whether the API is operational and verify timestamps.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['check'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -275,6 +279,8 @@ public function checkWithHttpInfo(string $contentType = self::contentTypes['chec
*
* Get API Status
*
+ * Check whether the API is operational and verify timestamps.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['check'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -300,6 +306,8 @@ function ($response) {
*
* Get API Status
*
+ * Check whether the API is operational and verify timestamps.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['check'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
diff --git a/lib/Api/AuthenticationApi.php b/lib/Api/AuthenticationApi.php
index 176a1ad..7bd7dd4 100644
--- a/lib/Api/AuthenticationApi.php
+++ b/lib/Api/AuthenticationApi.php
@@ -150,7 +150,9 @@ private function setRequestBodyProperty(&$body, $property, $value) {
/**
* Operation deleteSnapTradeUser
*
- * Delete SnapTrade user
+ * Delete user
+ *
+ * Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a `USER_DELETED` webhook will be sent.
*
* @param string $user_id user_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSnapTradeUser'] to see the possible values for this operation
@@ -173,7 +175,9 @@ public function deleteSnapTradeUser(
/**
* Operation deleteSnapTradeUserWithHttpInfo
*
- * Delete SnapTrade user
+ * Delete user
+ *
+ * Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a `USER_DELETED` webhook will be sent.
*
* @param string $user_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSnapTradeUser'] to see the possible values for this operation
@@ -357,7 +361,9 @@ public function deleteSnapTradeUserWithHttpInfo($user_id, string $contentType =
/**
* Operation deleteSnapTradeUserAsync
*
- * Delete SnapTrade user
+ * Delete user
+ *
+ * Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a `USER_DELETED` webhook will be sent.
*
* @param string $user_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSnapTradeUser'] to see the possible values for this operation
@@ -383,7 +389,9 @@ function ($response) {
/**
* Operation deleteSnapTradeUserAsyncWithHttpInfo
*
- * Delete SnapTrade user
+ * Delete user
+ *
+ * Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a `USER_DELETED` webhook will be sent.
*
* @param string $user_id (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteSnapTradeUser'] to see the possible values for this operation
@@ -558,7 +566,9 @@ public function deleteSnapTradeUserRequest($user_id, string $contentType = self:
/**
* Operation listSnapTradeUsers
*
- * List SnapTrade users
+ * List all users
+ *
+ * Returns a list of all registered user IDs. Please note that the response is not currently paginated.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSnapTradeUsers'] to see the possible values for this operation
*
@@ -580,7 +590,9 @@ public function listSnapTradeUsers(
/**
* Operation listSnapTradeUsersWithHttpInfo
*
- * List SnapTrade users
+ * List all users
+ *
+ * Returns a list of all registered user IDs. Please note that the response is not currently paginated.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSnapTradeUsers'] to see the possible values for this operation
*
@@ -762,7 +774,9 @@ public function listSnapTradeUsersWithHttpInfo(string $contentType = self::conte
/**
* Operation listSnapTradeUsersAsync
*
- * List SnapTrade users
+ * List all users
+ *
+ * Returns a list of all registered user IDs. Please note that the response is not currently paginated.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSnapTradeUsers'] to see the possible values for this operation
*
@@ -787,7 +801,9 @@ function ($response) {
/**
* Operation listSnapTradeUsersAsyncWithHttpInfo
*
- * List SnapTrade users
+ * List all users
+ *
+ * Returns a list of all registered user IDs. Please note that the response is not currently paginated.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listSnapTradeUsers'] to see the possible values for this operation
*
@@ -939,7 +955,9 @@ public function listSnapTradeUsersRequest(string $contentType = self::contentTyp
/**
* Operation loginSnapTradeUser
*
- * Login user & generate connection link
+ * Generate Connection Portal URL
+ *
+ * Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app. Please note that the returned URL expires in 5 minutes.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
@@ -957,8 +975,10 @@ public function loginSnapTradeUser(
$immediate_redirect = SENTINEL_VALUE,
$custom_redirect = SENTINEL_VALUE,
$reconnect = SENTINEL_VALUE,
- $connection_type = SENTINEL_VALUE,
- $connection_portal_version = SENTINEL_VALUE,
+ $connection_type = 'read',
+ $show_close_button = SENTINEL_VALUE,
+ $dark_mode = SENTINEL_VALUE,
+ $connection_portal_version = 'v4',
string $contentType = self::contentTypes['loginSnapTradeUser'][0]
)
@@ -969,6 +989,8 @@ public function loginSnapTradeUser(
$this->setRequestBodyProperty($_body, "custom_redirect", $custom_redirect);
$this->setRequestBodyProperty($_body, "reconnect", $reconnect);
$this->setRequestBodyProperty($_body, "connection_type", $connection_type);
+ $this->setRequestBodyProperty($_body, "show_close_button", $show_close_button);
+ $this->setRequestBodyProperty($_body, "dark_mode", $dark_mode);
$this->setRequestBodyProperty($_body, "connection_portal_version", $connection_portal_version);
$snap_trade_login_user_request_body = $_body;
@@ -979,7 +1001,9 @@ public function loginSnapTradeUser(
/**
* Operation loginSnapTradeUserWithHttpInfo
*
- * Login user & generate connection link
+ * Generate Connection Portal URL
+ *
+ * Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app. Please note that the returned URL expires in 5 minutes.
*
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -1167,7 +1191,9 @@ public function loginSnapTradeUserWithHttpInfo($user_id, $user_secret, $snap_tra
/**
* Operation loginSnapTradeUserAsync
*
- * Login user & generate connection link
+ * Generate Connection Portal URL
+ *
+ * Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app. Please note that the returned URL expires in 5 minutes.
*
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -1184,8 +1210,10 @@ public function loginSnapTradeUserAsync(
$immediate_redirect = SENTINEL_VALUE,
$custom_redirect = SENTINEL_VALUE,
$reconnect = SENTINEL_VALUE,
- $connection_type = SENTINEL_VALUE,
- $connection_portal_version = SENTINEL_VALUE,
+ $connection_type = 'read',
+ $show_close_button = SENTINEL_VALUE,
+ $dark_mode = SENTINEL_VALUE,
+ $connection_portal_version = 'v4',
string $contentType = self::contentTypes['loginSnapTradeUser'][0]
)
@@ -1196,6 +1224,8 @@ public function loginSnapTradeUserAsync(
$this->setRequestBodyProperty($_body, "custom_redirect", $custom_redirect);
$this->setRequestBodyProperty($_body, "reconnect", $reconnect);
$this->setRequestBodyProperty($_body, "connection_type", $connection_type);
+ $this->setRequestBodyProperty($_body, "show_close_button", $show_close_button);
+ $this->setRequestBodyProperty($_body, "dark_mode", $dark_mode);
$this->setRequestBodyProperty($_body, "connection_portal_version", $connection_portal_version);
$snap_trade_login_user_request_body = $_body;
@@ -1210,7 +1240,9 @@ function ($response) {
/**
* Operation loginSnapTradeUserAsyncWithHttpInfo
*
- * Login user & generate connection link
+ * Generate Connection Portal URL
+ *
+ * Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app. Please note that the returned URL expires in 5 minutes.
*
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -1425,7 +1457,9 @@ public function loginSnapTradeUserRequest($user_id, $user_secret, $snap_trade_lo
/**
* Operation registerSnapTradeUser
*
- * Create SnapTrade user
+ * Register user
+ *
+ * Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters.
*
* @param \SnapTrade\Model\SnapTradeRegisterUserRequestBody $snap_trade_register_user_request_body snap_trade_register_user_request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerSnapTradeUser'] to see the possible values for this operation
@@ -1436,7 +1470,7 @@ public function loginSnapTradeUserRequest($user_id, $user_secret, $snap_trade_lo
*/
public function registerSnapTradeUser(
- $user_id = SENTINEL_VALUE,
+ $user_id,
string $contentType = self::contentTypes['registerSnapTradeUser'][0]
)
{
@@ -1451,7 +1485,9 @@ public function registerSnapTradeUser(
/**
* Operation registerSnapTradeUserWithHttpInfo
*
- * Create SnapTrade user
+ * Register user
+ *
+ * Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters.
*
* @param \SnapTrade\Model\SnapTradeRegisterUserRequestBody $snap_trade_register_user_request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerSnapTradeUser'] to see the possible values for this operation
@@ -1635,7 +1671,9 @@ public function registerSnapTradeUserWithHttpInfo($snap_trade_register_user_requ
/**
* Operation registerSnapTradeUserAsync
*
- * Create SnapTrade user
+ * Register user
+ *
+ * Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters.
*
* @param \SnapTrade\Model\SnapTradeRegisterUserRequestBody $snap_trade_register_user_request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerSnapTradeUser'] to see the possible values for this operation
@@ -1645,7 +1683,7 @@ public function registerSnapTradeUserWithHttpInfo($snap_trade_register_user_requ
*/
public function registerSnapTradeUserAsync(
- $user_id = SENTINEL_VALUE,
+ $user_id,
string $contentType = self::contentTypes['registerSnapTradeUser'][0]
)
{
@@ -1664,7 +1702,9 @@ function ($response) {
/**
* Operation registerSnapTradeUserAsyncWithHttpInfo
*
- * Create SnapTrade user
+ * Register user
+ *
+ * Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters.
*
* @param \SnapTrade\Model\SnapTradeRegisterUserRequestBody $snap_trade_register_user_request_body (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['registerSnapTradeUser'] to see the possible values for this operation
@@ -1839,7 +1879,9 @@ public function registerSnapTradeUserRequest($snap_trade_register_user_request_b
/**
* Operation resetSnapTradeUserSecret
*
- * Obtain a new user secret for a user
+ * Rotate user secret
+ *
+ * Rotates the secret for a SnapTrade user. You might use this if `userSecret` is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
*
* @param \SnapTrade\Model\UserIDandSecret $user_i_dand_secret user_i_dand_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetSnapTradeUserSecret'] to see the possible values for this operation
@@ -1867,7 +1909,9 @@ public function resetSnapTradeUserSecret(
/**
* Operation resetSnapTradeUserSecretWithHttpInfo
*
- * Obtain a new user secret for a user
+ * Rotate user secret
+ *
+ * Rotates the secret for a SnapTrade user. You might use this if `userSecret` is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
*
* @param \SnapTrade\Model\UserIDandSecret $user_i_dand_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetSnapTradeUserSecret'] to see the possible values for this operation
@@ -2051,7 +2095,9 @@ public function resetSnapTradeUserSecretWithHttpInfo($user_i_dand_secret, string
/**
* Operation resetSnapTradeUserSecretAsync
*
- * Obtain a new user secret for a user
+ * Rotate user secret
+ *
+ * Rotates the secret for a SnapTrade user. You might use this if `userSecret` is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
*
* @param \SnapTrade\Model\UserIDandSecret $user_i_dand_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetSnapTradeUserSecret'] to see the possible values for this operation
@@ -2082,7 +2128,9 @@ function ($response) {
/**
* Operation resetSnapTradeUserSecretAsyncWithHttpInfo
*
- * Obtain a new user secret for a user
+ * Rotate user secret
+ *
+ * Rotates the secret for a SnapTrade user. You might use this if `userSecret` is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect.
*
* @param \SnapTrade\Model\UserIDandSecret $user_i_dand_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['resetSnapTradeUserSecret'] to see the possible values for this operation
diff --git a/lib/Api/ConnectionsApi.php b/lib/Api/ConnectionsApi.php
index 43f4cb3..c6482bd 100644
--- a/lib/Api/ConnectionsApi.php
+++ b/lib/Api/ConnectionsApi.php
@@ -77,6 +77,9 @@ class ConnectionsApi extends \SnapTrade\CustomApi
'removeBrokerageAuthorization' => [
'application/json',
],
+ 'returnRates' => [
+ 'application/json',
+ ],
'sessionEvents' => [
'application/json',
],
@@ -153,9 +156,11 @@ private function setRequestBodyProperty(&$body, $property, $value) {
/**
* Operation detailBrokerageAuthorization
*
- * Get brokerage authorization details
+ * Get connection detail
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * Returns a single connection for the specified ID.
+ *
+ * @param string $authorization_id authorization_id (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['detailBrokerageAuthorization'] to see the possible values for this operation
@@ -180,9 +185,11 @@ public function detailBrokerageAuthorization(
/**
* Operation detailBrokerageAuthorizationWithHttpInfo
*
- * Get brokerage authorization details
+ * Get connection detail
+ *
+ * Returns a single connection for the specified ID.
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['detailBrokerageAuthorization'] to see the possible values for this operation
@@ -299,9 +306,11 @@ public function detailBrokerageAuthorizationWithHttpInfo($authorization_id, $use
/**
* Operation detailBrokerageAuthorizationAsync
*
- * Get brokerage authorization details
+ * Get connection detail
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * Returns a single connection for the specified ID.
+ *
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['detailBrokerageAuthorization'] to see the possible values for this operation
@@ -329,9 +338,11 @@ function ($response) {
/**
* Operation detailBrokerageAuthorizationAsyncWithHttpInfo
*
- * Get brokerage authorization details
+ * Get connection detail
+ *
+ * Returns a single connection for the specified ID.
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['detailBrokerageAuthorization'] to see the possible values for this operation
@@ -386,7 +397,7 @@ function ($exception) {
/**
* Create request for operation 'detailBrokerageAuthorization'
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['detailBrokerageAuthorization'] to see the possible values for this operation
@@ -547,9 +558,11 @@ public function detailBrokerageAuthorizationRequest($authorization_id, $user_id,
/**
* Operation disableBrokerageAuthorization
*
- * Manually disable a connection for testing
+ * Force disable connection
+ *
+ * Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection. This endpoint is available on test keys. If you would like it enabled on production keys as well, please contact support as it is disabled by default.
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * @param string $authorization_id authorization_id (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableBrokerageAuthorization'] to see the possible values for this operation
@@ -574,9 +587,11 @@ public function disableBrokerageAuthorization(
/**
* Operation disableBrokerageAuthorizationWithHttpInfo
*
- * Manually disable a connection for testing
+ * Force disable connection
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection. This endpoint is available on test keys. If you would like it enabled on production keys as well, please contact support as it is disabled by default.
+ *
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableBrokerageAuthorization'] to see the possible values for this operation
@@ -785,9 +800,11 @@ public function disableBrokerageAuthorizationWithHttpInfo($authorization_id, $us
/**
* Operation disableBrokerageAuthorizationAsync
*
- * Manually disable a connection for testing
+ * Force disable connection
+ *
+ * Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection. This endpoint is available on test keys. If you would like it enabled on production keys as well, please contact support as it is disabled by default.
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableBrokerageAuthorization'] to see the possible values for this operation
@@ -815,9 +832,11 @@ function ($response) {
/**
* Operation disableBrokerageAuthorizationAsyncWithHttpInfo
*
- * Manually disable a connection for testing
+ * Force disable connection
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * Manually force the specified connection to become disabled. This should only be used for testing a reconnect flow, and never used on production connections. Will trigger a disconnect as if it happened naturally, and send a [`CONNECTION_BROKEN` webhook](/docs/webhooks#webhooks-connection_broken) for the connection. This endpoint is available on test keys. If you would like it enabled on production keys as well, please contact support as it is disabled by default.
+ *
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableBrokerageAuthorization'] to see the possible values for this operation
@@ -872,7 +891,7 @@ function ($exception) {
/**
* Create request for operation 'disableBrokerageAuthorization'
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['disableBrokerageAuthorization'] to see the possible values for this operation
@@ -1033,7 +1052,9 @@ public function disableBrokerageAuthorizationRequest($authorization_id, $user_id
/**
* Operation listBrokerageAuthorizations
*
- * List all brokerage authorizations for the User
+ * List all connections
+ *
+ * Returns a list of all connections for the specified user. Note that `Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency. A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts. SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
@@ -1058,7 +1079,9 @@ public function listBrokerageAuthorizations(
/**
* Operation listBrokerageAuthorizationsWithHttpInfo
*
- * List all brokerage authorizations for the User
+ * List all connections
+ *
+ * Returns a list of all connections for the specified user. Note that `Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency. A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts. SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
*
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -1175,7 +1198,9 @@ public function listBrokerageAuthorizationsWithHttpInfo($user_id, $user_secret,
/**
* Operation listBrokerageAuthorizationsAsync
*
- * List all brokerage authorizations for the User
+ * List all connections
+ *
+ * Returns a list of all connections for the specified user. Note that `Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency. A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts. SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
*
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -1203,7 +1228,9 @@ function ($response) {
/**
* Operation listBrokerageAuthorizationsAsyncWithHttpInfo
*
- * List all brokerage authorizations for the User
+ * List all connections
+ *
+ * Returns a list of all connections for the specified user. Note that `Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency. A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts. SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
*
* @param string $user_id (required)
* @param string $user_secret (required)
@@ -1403,7 +1430,9 @@ public function listBrokerageAuthorizationsRequest($user_id, $user_secret, strin
*
* Refresh holdings for a connection
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+ *
+ * @param string $authorization_id authorization_id (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshBrokerageAuthorization'] to see the possible values for this operation
@@ -1430,7 +1459,9 @@ public function refreshBrokerageAuthorization(
*
* Refresh holdings for a connection
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+ *
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshBrokerageAuthorization'] to see the possible values for this operation
@@ -1641,7 +1672,9 @@ public function refreshBrokerageAuthorizationWithHttpInfo($authorization_id, $us
*
* Refresh holdings for a connection
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+ *
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshBrokerageAuthorization'] to see the possible values for this operation
@@ -1671,7 +1704,9 @@ function ($response) {
*
* Refresh holdings for a connection
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * Trigger a holdings update for all accounts under this connection. Updates will be queued asynchronously. [`ACCOUNT_HOLDINGS_UPDATED` webhook](/docs/webhooks#webhooks-account_holdings_updated) will be sent once the sync completes for each account under the connection. This endpoint will also trigger a transaction sync for the past day if one has not yet occurred. **Because of the cost of refreshing a connection, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+ *
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshBrokerageAuthorization'] to see the possible values for this operation
@@ -1726,7 +1761,7 @@ function ($exception) {
/**
* Create request for operation 'refreshBrokerageAuthorization'
*
- * @param string $authorization_id The ID of a brokerage authorization object. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['refreshBrokerageAuthorization'] to see the possible values for this operation
@@ -1887,9 +1922,11 @@ public function refreshBrokerageAuthorizationRequest($authorization_id, $user_id
/**
* Operation removeBrokerageAuthorization
*
- * Delete brokerage authorization
+ * Delete connection
*
- * @param string $authorization_id The ID of the Authorization to delete. (required)
+ * Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the data has been successfully deleted.
+ *
+ * @param string $authorization_id authorization_id (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeBrokerageAuthorization'] to see the possible values for this operation
@@ -1913,9 +1950,11 @@ public function removeBrokerageAuthorization(
/**
* Operation removeBrokerageAuthorizationWithHttpInfo
*
- * Delete brokerage authorization
+ * Delete connection
+ *
+ * Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the data has been successfully deleted.
*
- * @param string $authorization_id The ID of the Authorization to delete. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeBrokerageAuthorization'] to see the possible values for this operation
@@ -1992,9 +2031,11 @@ public function removeBrokerageAuthorizationWithHttpInfo($authorization_id, $use
/**
* Operation removeBrokerageAuthorizationAsync
*
- * Delete brokerage authorization
+ * Delete connection
+ *
+ * Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the data has been successfully deleted.
*
- * @param string $authorization_id The ID of the Authorization to delete. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeBrokerageAuthorization'] to see the possible values for this operation
@@ -2022,9 +2063,11 @@ function ($response) {
/**
* Operation removeBrokerageAuthorizationAsyncWithHttpInfo
*
- * Delete brokerage authorization
+ * Delete connection
*
- * @param string $authorization_id The ID of the Authorization to delete. (required)
+ * Deletes the SnapTrade connection specified by the ID. This will also remove the accounts and holdings data associated with the connection from SnapTrade. This action is irreversible. This endpoint is synchronous, a 204 response indicates that the data has been successfully deleted.
+ *
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeBrokerageAuthorization'] to see the possible values for this operation
@@ -2066,7 +2109,7 @@ function ($exception) {
/**
* Create request for operation 'removeBrokerageAuthorization'
*
- * @param string $authorization_id The ID of the Authorization to delete. (required)
+ * @param string $authorization_id (required)
* @param string $user_id (required)
* @param string $user_secret (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeBrokerageAuthorization'] to see the possible values for this operation
@@ -2224,14 +2267,464 @@ public function removeBrokerageAuthorizationRequest($authorization_id, $user_id,
];
}
+ /**
+ * Operation returnRates
+ *
+ * List connection rate of returns
+ *
+ * Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $authorization_id authorization_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['returnRates'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\RateOfReturnResponse|\SnapTrade\Model\Model403FeatureNotEnabledResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ */
+ public function returnRates(
+ $user_id,
+ $user_secret,
+ $authorization_id,
+
+ string $contentType = self::contentTypes['returnRates'][0]
+ )
+ {
+
+ list($response) = $this->returnRatesWithHttpInfo($user_id, $user_secret, $authorization_id, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation returnRatesWithHttpInfo
+ *
+ * List connection rate of returns
+ *
+ * Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $authorization_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['returnRates'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\RateOfReturnResponse|\SnapTrade\Model\Model403FeatureNotEnabledResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function returnRatesWithHttpInfo($user_id, $user_secret, $authorization_id, string $contentType = self::contentTypes['returnRates'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->returnRatesRequest($user_id, $user_secret, $authorization_id, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->returnRatesWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $authorization_id,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\RateOfReturnResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\RateOfReturnResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\RateOfReturnResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 403:
+ if ('\SnapTrade\Model\Model403FeatureNotEnabledResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model403FeatureNotEnabledResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FeatureNotEnabledResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\RateOfReturnResponse';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\RateOfReturnResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model403FeatureNotEnabledResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation returnRatesAsync
+ *
+ * List connection rate of returns
+ *
+ * Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $authorization_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['returnRates'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function returnRatesAsync(
+ $user_id,
+ $user_secret,
+ $authorization_id,
+
+ string $contentType = self::contentTypes['returnRates'][0]
+ )
+ {
+
+ return $this->returnRatesAsyncWithHttpInfo($user_id, $user_secret, $authorization_id, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation returnRatesAsyncWithHttpInfo
+ *
+ * List connection rate of returns
+ *
+ * Returns a list of rate of return percents for a given connection. Will include timeframes available from the brokerage, for example \"ALL\", \"1Y\", \"6M\", \"3M\", \"1M\"
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $authorization_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['returnRates'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function returnRatesAsyncWithHttpInfo($user_id, $user_secret, $authorization_id, string $contentType = self::contentTypes['returnRates'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\RateOfReturnResponse';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->returnRatesRequest($user_id, $user_secret, $authorization_id, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'returnRates'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $authorization_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['returnRates'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function returnRatesRequest($user_id, $user_secret, $authorization_id, string $contentType = self::contentTypes['returnRates'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 returnRates'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 returnRates'
+ );
+ }
+ // Check if $authorization_id is a string
+ if ($authorization_id !== SENTINEL_VALUE && !is_string($authorization_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($authorization_id, true), gettype($authorization_id)));
+ }
+ // verify the required parameter 'authorization_id' is set
+ if ($authorization_id === SENTINEL_VALUE || (is_array($authorization_id) && count($authorization_id) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter authorization_id when calling returnRates'
+ );
+ }
+
+
+ $resourcePath = '/authorizations/{authorizationId}/returnRates';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($authorization_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'authorizationId' . '}',
+ ObjectSerializer::toPathValue($authorization_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
/**
* Operation sessionEvents
*
* Get all session events for a user
*
+ * Returns a list of session events associated with a user.
+ *
* @param string $partner_client_id partner_client_id (required)
- * @param string $user_id Optional comma seperated list of user IDs used to filter the request on specific users (optional)
- * @param string $session_id Optional comma seperated list of session IDs used to filter the request on specific users (optional)
+ * @param string $user_id Optional comma separated list of user IDs used to filter the request on specific users (optional)
+ * @param string $session_id Optional comma separated list of session IDs used to filter the request on specific users (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionEvents'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -2256,9 +2749,11 @@ public function sessionEvents(
*
* Get all session events for a user
*
+ * Returns a list of session events associated with a user.
+ *
* @param string $partner_client_id (required)
- * @param string $user_id Optional comma seperated list of user IDs used to filter the request on specific users (optional)
- * @param string $session_id Optional comma seperated list of session IDs used to filter the request on specific users (optional)
+ * @param string $user_id Optional comma separated list of user IDs used to filter the request on specific users (optional)
+ * @param string $session_id Optional comma separated list of session IDs used to filter the request on specific users (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionEvents'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -2375,9 +2870,11 @@ public function sessionEventsWithHttpInfo($partner_client_id, $user_id = null, $
*
* Get all session events for a user
*
+ * Returns a list of session events associated with a user.
+ *
* @param string $partner_client_id (required)
- * @param string $user_id Optional comma seperated list of user IDs used to filter the request on specific users (optional)
- * @param string $session_id Optional comma seperated list of session IDs used to filter the request on specific users (optional)
+ * @param string $user_id Optional comma separated list of user IDs used to filter the request on specific users (optional)
+ * @param string $session_id Optional comma separated list of session IDs used to filter the request on specific users (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -2405,9 +2902,11 @@ function ($response) {
*
* Get all session events for a user
*
+ * Returns a list of session events associated with a user.
+ *
* @param string $partner_client_id (required)
- * @param string $user_id Optional comma seperated list of user IDs used to filter the request on specific users (optional)
- * @param string $session_id Optional comma seperated list of session IDs used to filter the request on specific users (optional)
+ * @param string $user_id Optional comma separated list of user IDs used to filter the request on specific users (optional)
+ * @param string $session_id Optional comma separated list of session IDs used to filter the request on specific users (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -2461,8 +2960,8 @@ function ($exception) {
* Create request for operation 'sessionEvents'
*
* @param string $partner_client_id (required)
- * @param string $user_id Optional comma seperated list of user IDs used to filter the request on specific users (optional)
- * @param string $session_id Optional comma seperated list of session IDs used to filter the request on specific users (optional)
+ * @param string $user_id Optional comma separated list of user IDs used to filter the request on specific users (optional)
+ * @param string $session_id Optional comma separated list of session IDs used to filter the request on specific users (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['sessionEvents'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
diff --git a/lib/Api/ExperimentalEndpointsApi.php b/lib/Api/ExperimentalEndpointsApi.php
new file mode 100644
index 0000000..07f70b8
--- /dev/null
+++ b/lib/Api/ExperimentalEndpointsApi.php
@@ -0,0 +1,1573 @@
+ [
+ 'application/json',
+ ],
+ 'getUserAccountOrdersV2' => [
+ 'application/json',
+ ],
+ 'getUserAccountRecentOrdersV2' => [
+ 'application/json',
+ ],
+ ];
+
+/**
+ * @param ClientInterface $client
+ * @param Configuration $config
+ * @param HeaderSelector $selector
+ * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec
+ */
+ public function __construct(
+ Configuration $config = null,
+ ClientInterface $client = null,
+ HeaderSelector $selector = null,
+ $hostIndex = 0
+ ) {
+ $clientOptions = [];
+ if (!$config->getVerifySsl()) $clientOptions["verify"] = false;
+
+ // Do not truncate error messages
+ // https://github.com/guzzle/guzzle/issues/2185#issuecomment-800293420
+ $stack = new HandlerStack(Utils::chooseHandler());
+ $stack->push(Middleware::httpErrors(new BodySummarizer(10000)), 'http_errors');
+ $stack->push(Middleware::redirect(), 'allow_redirects');
+ $stack->push(Middleware::cookies(), 'cookies');
+ $stack->push(Middleware::prepareBody(), 'prepare_body');
+ $clientOptions["handler"] = $stack;
+
+ $this->client = $client ?: new Client($clientOptions);
+ $this->config = $config ?: new Configuration();
+ $this->headerSelector = $selector ?: new HeaderSelector();
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Set the host index
+ *
+ * @param int $hostIndex Host index (required)
+ */
+ public function setHostIndex($hostIndex): void
+ {
+ $this->hostIndex = $hostIndex;
+ }
+
+ /**
+ * Get the host index
+ *
+ * @return int Host index
+ */
+ public function getHostIndex()
+ {
+ return $this->hostIndex;
+ }
+
+ /**
+ * @return Configuration
+ */
+ public function getConfig()
+ {
+ return $this->config;
+ }
+
+ /**
+ * For initializing request body parameter
+ */
+ private function setRequestBodyProperty(&$body, $property, $value) {
+ if ($body === null) $body = [];
+ // user did not pass in a value for this parameter
+ if ($value === SENTINEL_VALUE) return;
+ $body[$property] = $value;
+ }
+
+ /**
+ * Operation getUserAccountOrderDetailV2
+ *
+ * Get account order detail (V2)
+ *
+ * Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
+ *
+ * @param string $account_id account_id (required)
+ * @param string $brokerage_order_id brokerage_order_id (required)
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetailV2'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\AccountOrderRecordV2|\SnapTrade\Model\Model404FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ */
+ public function getUserAccountOrderDetailV2(
+ $account_id,
+ $brokerage_order_id,
+ $user_id,
+ $user_secret,
+
+ string $contentType = self::contentTypes['getUserAccountOrderDetailV2'][0]
+ )
+ {
+
+ list($response) = $this->getUserAccountOrderDetailV2WithHttpInfo($account_id, $brokerage_order_id, $user_id, $user_secret, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getUserAccountOrderDetailV2WithHttpInfo
+ *
+ * Get account order detail (V2)
+ *
+ * Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
+ *
+ * @param string $account_id (required)
+ * @param string $brokerage_order_id (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetailV2'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\AccountOrderRecordV2|\SnapTrade\Model\Model404FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function getUserAccountOrderDetailV2WithHttpInfo($account_id, $brokerage_order_id, $user_id, $user_secret, string $contentType = self::contentTypes['getUserAccountOrderDetailV2'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrderDetailV2Request($account_id, $brokerage_order_id, $user_id, $user_secret, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getUserAccountOrderDetailV2WithHttpInfo(
+ $account_id,
+ $brokerage_order_id,
+ $user_id,
+ $user_secret,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\AccountOrderRecordV2' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\AccountOrderRecordV2' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecordV2', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 404:
+ if ('\SnapTrade\Model\Model404FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model404FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model404FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\AccountOrderRecordV2';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\AccountOrderRecordV2',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model404FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getUserAccountOrderDetailV2Async
+ *
+ * Get account order detail (V2)
+ *
+ * Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
+ *
+ * @param string $account_id (required)
+ * @param string $brokerage_order_id (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetailV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountOrderDetailV2Async(
+ $account_id,
+ $brokerage_order_id,
+ $user_id,
+ $user_secret,
+
+ string $contentType = self::contentTypes['getUserAccountOrderDetailV2'][0]
+ )
+ {
+
+ return $this->getUserAccountOrderDetailV2AsyncWithHttpInfo($account_id, $brokerage_order_id, $user_id, $user_secret, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getUserAccountOrderDetailV2AsyncWithHttpInfo
+ *
+ * Get account order detail (V2)
+ *
+ * Returns the detail of a single order using the brokerage order ID provided as a path parameter. The V2 order response format includes all legs of the order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. This endpoint is always realtime and does not rely on cached data. This endpoint only returns orders placed through SnapTrade. In other words, orders placed outside of the SnapTrade network are not returned by this endpoint.
+ *
+ * @param string $account_id (required)
+ * @param string $brokerage_order_id (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetailV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountOrderDetailV2AsyncWithHttpInfo($account_id, $brokerage_order_id, $user_id, $user_secret, string $contentType = self::contentTypes['getUserAccountOrderDetailV2'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\AccountOrderRecordV2';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrderDetailV2Request($account_id, $brokerage_order_id, $user_id, $user_secret, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getUserAccountOrderDetailV2'
+ *
+ * @param string $account_id (required)
+ * @param string $brokerage_order_id (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrderDetailV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getUserAccountOrderDetailV2Request($account_id, $brokerage_order_id, $user_id, $user_secret, string $contentType = self::contentTypes['getUserAccountOrderDetailV2'][0])
+ {
+
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getUserAccountOrderDetailV2'
+ );
+ }
+ // Check if $brokerage_order_id is a string
+ if ($brokerage_order_id !== SENTINEL_VALUE && !is_string($brokerage_order_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($brokerage_order_id, true), gettype($brokerage_order_id)));
+ }
+ // verify the required parameter 'brokerage_order_id' is set
+ if ($brokerage_order_id === SENTINEL_VALUE || (is_array($brokerage_order_id) && count($brokerage_order_id) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter brokerage_order_id when calling getUserAccountOrderDetailV2'
+ );
+ }
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getUserAccountOrderDetailV2'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getUserAccountOrderDetailV2'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/orders/details/v2/{brokerageOrderId}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($brokerage_order_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'brokerageOrderId' . '}',
+ ObjectSerializer::toPathValue($brokerage_order_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation getUserAccountOrdersV2
+ *
+ * List account orders v2
+ *
+ * Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $account_id account_id (required)
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\AccountOrdersV2Response|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ */
+ public function getUserAccountOrdersV2(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $state = SENTINEL_VALUE,
+ $days = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['getUserAccountOrdersV2'][0]
+ )
+ {
+
+ list($response) = $this->getUserAccountOrdersV2WithHttpInfo($user_id, $user_secret, $account_id, $state, $days, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getUserAccountOrdersV2WithHttpInfo
+ *
+ * List account orders v2
+ *
+ * Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\AccountOrdersV2Response|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function getUserAccountOrdersV2WithHttpInfo($user_id, $user_secret, $account_id, $state = null, $days = null, string $contentType = self::contentTypes['getUserAccountOrdersV2'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrdersV2Request($user_id, $user_secret, $account_id, $state, $days, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getUserAccountOrdersV2WithHttpInfo(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $state,
+ $days,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\AccountOrdersV2Response' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\AccountOrdersV2Response' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrdersV2Response', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\AccountOrdersV2Response';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\AccountOrdersV2Response',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getUserAccountOrdersV2Async
+ *
+ * List account orders v2
+ *
+ * Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountOrdersV2Async(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $state = SENTINEL_VALUE,
+ $days = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['getUserAccountOrdersV2'][0]
+ )
+ {
+
+ return $this->getUserAccountOrdersV2AsyncWithHttpInfo($user_id, $user_secret, $account_id, $state, $days, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getUserAccountOrdersV2AsyncWithHttpInfo
+ *
+ * List account orders v2
+ *
+ * Returns a list of recent orders in the specified account. The V2 order response format will include all legs of each order in the `legs` list field. If the order is single legged, `legs` will be a list of one leg. If the connection has become disabled, it can no longer access the latest data from the brokerage, but will continue to return the last available cached state. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountOrdersV2AsyncWithHttpInfo($user_id, $user_secret, $account_id, $state = null, $days = null, string $contentType = self::contentTypes['getUserAccountOrdersV2'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\AccountOrdersV2Response';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountOrdersV2Request($user_id, $user_secret, $account_id, $state, $days, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getUserAccountOrdersV2'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $state defaults value is set to \"all\" (optional)
+ * @param int $days Number of days in the past to fetch the most recent orders. Defaults to the last 30 days if no value is passed in. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getUserAccountOrdersV2Request($user_id, $user_secret, $account_id, $state = SENTINEL_VALUE, $days = SENTINEL_VALUE, string $contentType = self::contentTypes['getUserAccountOrdersV2'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getUserAccountOrdersV2'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getUserAccountOrdersV2'
+ );
+ }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getUserAccountOrdersV2'
+ );
+ }
+ // Check if $state is a string
+ if ($state !== SENTINEL_VALUE && !is_string($state)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($state, true), gettype($state)));
+ }
+ if ($days !== SENTINEL_VALUE && $days < 1) {
+ throw new \InvalidArgumentException('invalid value for "days" when calling ExperimentalEndpointsApi.getUserAccountOrdersV2, must be bigger than or equal to 1.');
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/orders/v2';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($state !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $state,
+ 'state', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+ if ($days !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $days,
+ 'days', // param base name
+ 'integer', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation getUserAccountRecentOrdersV2
+ *
+ * List account recent orders (V2, last 24 hours only)
+ *
+ * A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $account_id account_id (required)
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\AccountOrdersV2Response|\SnapTrade\Model\Model403FeatureNotEnabledResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ */
+ public function getUserAccountRecentOrdersV2(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $only_executed = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['getUserAccountRecentOrdersV2'][0]
+ )
+ {
+
+ list($response) = $this->getUserAccountRecentOrdersV2WithHttpInfo($user_id, $user_secret, $account_id, $only_executed, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getUserAccountRecentOrdersV2WithHttpInfo
+ *
+ * List account recent orders (V2, last 24 hours only)
+ *
+ * A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\AccountOrdersV2Response|\SnapTrade\Model\Model403FeatureNotEnabledResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function getUserAccountRecentOrdersV2WithHttpInfo($user_id, $user_secret, $account_id, $only_executed = null, string $contentType = self::contentTypes['getUserAccountRecentOrdersV2'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountRecentOrdersV2Request($user_id, $user_secret, $account_id, $only_executed, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getUserAccountRecentOrdersV2WithHttpInfo(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $only_executed,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\AccountOrdersV2Response' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\AccountOrdersV2Response' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrdersV2Response', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 403:
+ if ('\SnapTrade\Model\Model403FeatureNotEnabledResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model403FeatureNotEnabledResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FeatureNotEnabledResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\AccountOrdersV2Response';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\AccountOrdersV2Response',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model403FeatureNotEnabledResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getUserAccountRecentOrdersV2Async
+ *
+ * List account recent orders (V2, last 24 hours only)
+ *
+ * A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountRecentOrdersV2Async(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $only_executed = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['getUserAccountRecentOrdersV2'][0]
+ )
+ {
+
+ return $this->getUserAccountRecentOrdersV2AsyncWithHttpInfo($user_id, $user_secret, $account_id, $only_executed, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getUserAccountRecentOrdersV2AsyncWithHttpInfo
+ *
+ * List account recent orders (V2, last 24 hours only)
+ *
+ * A lightweight endpoint that returns a list of orders executed in the last 24 hours in the specified account using the V2 order format. This endpoint is realtime and can be used to quickly check if account state has recently changed due to an execution, or check status of recently placed orders. Differs from /orders in that it is realtime, and only checks the last 24 hours as opposed to the last 30 days. By default only returns executed orders, but that can be changed by setting *only_executed* to false. **Because of the cost of realtime requests, each call to this endpoint incurs an additional charge. You can find the exact cost for your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing)**
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountRecentOrdersV2AsyncWithHttpInfo($user_id, $user_secret, $account_id, $only_executed = null, string $contentType = self::contentTypes['getUserAccountRecentOrdersV2'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\AccountOrdersV2Response';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountRecentOrdersV2Request($user_id, $user_secret, $account_id, $only_executed, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getUserAccountRecentOrdersV2'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param bool $only_executed Defaults to true. Indicates if request should fetch only executed orders. Set to false to retrieve non executed orders as well (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountRecentOrdersV2'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getUserAccountRecentOrdersV2Request($user_id, $user_secret, $account_id, $only_executed = SENTINEL_VALUE, string $contentType = self::contentTypes['getUserAccountRecentOrdersV2'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getUserAccountRecentOrdersV2'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getUserAccountRecentOrdersV2'
+ );
+ }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getUserAccountRecentOrdersV2'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/recentOrders/v2';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($only_executed !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $only_executed,
+ 'only_executed', // param base name
+ 'boolean', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Create http client option
+ *
+ * @throws \RuntimeException on file opening failure
+ * @return array of http client options
+ */
+ protected function createHttpClientOption()
+ {
+ $options = [];
+ if ($this->config->getDebug()) {
+ $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
+ if (!$options[RequestOptions::DEBUG]) {
+ throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
+ }
+ }
+
+ return $options;
+ }
+}
diff --git a/lib/Api/OptionsApi.php b/lib/Api/OptionsApi.php
index 4f2b154..dcf363d 100644
--- a/lib/Api/OptionsApi.php
+++ b/lib/Api/OptionsApi.php
@@ -62,21 +62,12 @@ class OptionsApi extends \SnapTrade\CustomApi
/** @var string[] $contentTypes **/
public const contentTypes = [
- 'getOptionStrategy' => [
- 'application/json',
- ],
'getOptionsChain' => [
'application/json',
],
- 'getOptionsStrategyQuote' => [
- 'application/json',
- ],
'listOptionHoldings' => [
'application/json',
],
- 'placeOptionStrategy' => [
- 'application/json',
- ],
];
/**
@@ -148,62 +139,59 @@ private function setRequestBodyProperty(&$body, $property, $value) {
}
/**
- * Operation getOptionStrategy
+ * Operation getOptionsChain
+ *
+ * Get the options chain for a symbol
*
- * Create options strategy
+ * Returns the option chain for the specified symbol in the specified account.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param string $account_id The ID of the account to create the option strategy object in. (required)
- * @param \SnapTrade\Model\OptionsGetOptionStrategyRequest $options_get_option_strategy_request options_get_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionStrategy'] to see the possible values for this operation
+ * @param string $account_id The ID of the account to get the options chain from. (required)
+ * @param string $symbol Universal symbol ID if symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\StrategyQuotes|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ * @return \SnapTrade\Model\OptionChainInner[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse
*/
- public function getOptionStrategy(
-
- $underlying_symbol_id,
- $legs,
- $strategy_type,
+ public function getOptionsChain(
$user_id,
$user_secret,
$account_id,
- string $contentType = self::contentTypes['getOptionStrategy'][0]
+ $symbol,
+
+ string $contentType = self::contentTypes['getOptionsChain'][0]
)
{
- $_body = [];
- $this->setRequestBodyProperty($_body, "underlying_symbol_id", $underlying_symbol_id);
- $this->setRequestBodyProperty($_body, "legs", $legs);
- $this->setRequestBodyProperty($_body, "strategy_type", $strategy_type);
- $options_get_option_strategy_request = $_body;
- list($response) = $this->getOptionStrategyWithHttpInfo($user_id, $user_secret, $account_id, $options_get_option_strategy_request, $contentType);
+ list($response) = $this->getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id, $symbol, $contentType);
return $response;
}
/**
- * Operation getOptionStrategyWithHttpInfo
+ * Operation getOptionsChainWithHttpInfo
*
- * Create options strategy
+ * Get the options chain for a symbol
+ *
+ * Returns the option chain for the specified symbol in the specified account.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to create the option strategy object in. (required)
- * @param \SnapTrade\Model\OptionsGetOptionStrategyRequest $options_get_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionStrategy'] to see the possible values for this operation
+ * @param string $account_id The ID of the account to get the options chain from. (required)
+ * @param string $symbol Universal symbol ID if symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\StrategyQuotes|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\OptionChainInner[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function getOptionStrategyWithHttpInfo($user_id, $user_secret, $account_id, $options_get_option_strategy_request, string $contentType = self::contentTypes['getOptionStrategy'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionsChain'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionStrategyRequest($user_id, $user_secret, $account_id, $options_get_option_strategy_request, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionsChainRequest($user_id, $user_secret, $account_id, $symbol, $contentType);
// Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+ $this->beforeSendHook($request, $requestOptions, $this->config);
try {
$options = $this->createHttpClientOption();
@@ -215,11 +203,11 @@ public function getOptionStrategyWithHttpInfo($user_id, $user_secret, $account_i
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getOptionStrategyWithHttpInfo(
+ return $this->getOptionsChainWithHttpInfo(
$user_id,
$user_secret,
$account_id,
- $options_get_option_strategy_request,
+ $symbol,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -257,17 +245,17 @@ public function getOptionStrategyWithHttpInfo($user_id, $user_secret, $account_i
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\StrategyQuotes' === '\SplFileObject') {
+ if ('\SnapTrade\Model\OptionChainInner[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\StrategyQuotes' !== 'string') {
+ if ('\SnapTrade\Model\OptionChainInner[]' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\StrategyQuotes', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\OptionChainInner[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
@@ -288,7 +276,7 @@ public function getOptionStrategyWithHttpInfo($user_id, $user_secret, $account_i
];
}
- $returnType = '\SnapTrade\Model\StrategyQuotes';
+ $returnType = '\SnapTrade\Model\OptionChainInner[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -309,7 +297,7 @@ public function getOptionStrategyWithHttpInfo($user_id, $user_secret, $account_i
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\StrategyQuotes',
+ '\SnapTrade\Model\OptionChainInner[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -328,37 +316,32 @@ public function getOptionStrategyWithHttpInfo($user_id, $user_secret, $account_i
}
/**
- * Operation getOptionStrategyAsync
+ * Operation getOptionsChainAsync
+ *
+ * Get the options chain for a symbol
*
- * Create options strategy
+ * Returns the option chain for the specified symbol in the specified account.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to create the option strategy object in. (required)
- * @param \SnapTrade\Model\OptionsGetOptionStrategyRequest $options_get_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionStrategy'] to see the possible values for this operation
+ * @param string $account_id The ID of the account to get the options chain from. (required)
+ * @param string $symbol Universal symbol ID if symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getOptionStrategyAsync(
-
- $underlying_symbol_id,
- $legs,
- $strategy_type,
+ public function getOptionsChainAsync(
$user_id,
$user_secret,
$account_id,
- string $contentType = self::contentTypes['getOptionStrategy'][0]
+ $symbol,
+
+ string $contentType = self::contentTypes['getOptionsChain'][0]
)
{
- $_body = [];
- $this->setRequestBodyProperty($_body, "underlying_symbol_id", $underlying_symbol_id);
- $this->setRequestBodyProperty($_body, "legs", $legs);
- $this->setRequestBodyProperty($_body, "strategy_type", $strategy_type);
- $options_get_option_strategy_request = $_body;
- return $this->getOptionStrategyAsyncWithHttpInfo($user_id, $user_secret, $account_id, $options_get_option_strategy_request, $contentType)
+ return $this->getOptionsChainAsyncWithHttpInfo($user_id, $user_secret, $account_id, $symbol, $contentType)
->then(
function ($response) {
return $response[0];
@@ -367,26 +350,28 @@ function ($response) {
}
/**
- * Operation getOptionStrategyAsyncWithHttpInfo
+ * Operation getOptionsChainAsyncWithHttpInfo
+ *
+ * Get the options chain for a symbol
*
- * Create options strategy
+ * Returns the option chain for the specified symbol in the specified account.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to create the option strategy object in. (required)
- * @param \SnapTrade\Model\OptionsGetOptionStrategyRequest $options_get_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionStrategy'] to see the possible values for this operation
+ * @param string $account_id The ID of the account to get the options chain from. (required)
+ * @param string $symbol Universal symbol ID if symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getOptionStrategyAsyncWithHttpInfo($user_id, $user_secret, $account_id, $options_get_option_strategy_request, string $contentType = self::contentTypes['getOptionStrategy'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getOptionsChainAsyncWithHttpInfo($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionsChain'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\StrategyQuotes';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionStrategyRequest($user_id, $user_secret, $account_id, $options_get_option_strategy_request, $contentType);
+ $returnType = '\SnapTrade\Model\OptionChainInner[]';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionsChainRequest($user_id, $user_secret, $account_id, $symbol, $contentType);
// Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+ $this->beforeSendHook($request, $requestOptions, $this->config);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
@@ -425,18 +410,18 @@ function ($exception) {
}
/**
- * Create request for operation 'getOptionStrategy'
+ * Create request for operation 'getOptionsChain'
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to create the option strategy object in. (required)
- * @param \SnapTrade\Model\OptionsGetOptionStrategyRequest $options_get_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionStrategy'] to see the possible values for this operation
+ * @param string $account_id The ID of the account to get the options chain from. (required)
+ * @param string $symbol Universal symbol ID if symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function getOptionStrategyRequest($user_id, $user_secret, $account_id, $options_get_option_strategy_request, string $contentType = self::contentTypes['getOptionStrategy'][0])
+ public function getOptionsChainRequest($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionsChain'][0])
{
// Check if $user_id is a string
@@ -446,7 +431,7 @@ public function getOptionStrategyRequest($user_id, $user_secret, $account_id, $o
// 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 getOptionStrategy'
+ 'Missing the required parameter user_id when calling getOptionsChain'
);
}
// Check if $user_secret is a string
@@ -456,7 +441,7 @@ public function getOptionStrategyRequest($user_id, $user_secret, $account_id, $o
// 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 getOptionStrategy'
+ 'Missing the required parameter user_secret when calling getOptionsChain'
);
}
// Check if $account_id is a string
@@ -466,26 +451,22 @@ public function getOptionStrategyRequest($user_id, $user_secret, $account_id, $o
// 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 getOptionStrategy'
+ 'Missing the required parameter account_id when calling getOptionsChain'
);
}
- if ($options_get_option_strategy_request !== SENTINEL_VALUE) {
- if (!($options_get_option_strategy_request instanceof \SnapTrade\Model\OptionsGetOptionStrategyRequest)) {
- if (!is_array($options_get_option_strategy_request))
- throw new \InvalidArgumentException('"options_get_option_strategy_request" must be associative array or an instance of \SnapTrade\Model\OptionsGetOptionStrategyRequest OptionsApi.getOptionStrategy.');
- else
- $options_get_option_strategy_request = new \SnapTrade\Model\OptionsGetOptionStrategyRequest($options_get_option_strategy_request);
- }
+ // Check if $symbol is a string
+ if ($symbol !== SENTINEL_VALUE && !is_string($symbol)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($symbol, true), gettype($symbol)));
}
- // verify the required parameter 'options_get_option_strategy_request' is set
- if ($options_get_option_strategy_request === SENTINEL_VALUE || (is_array($options_get_option_strategy_request) && count($options_get_option_strategy_request) === 0)) {
+ // verify the required parameter 'symbol' is set
+ if ($symbol === SENTINEL_VALUE || (is_array($symbol) && count($symbol) === 0)) {
throw new \InvalidArgumentException(
- 'Missing the required parameter options_get_option_strategy_request when calling getOptionStrategy'
+ 'Missing the required parameter symbol when calling getOptionsChain'
);
}
- $resourcePath = '/accounts/{accountId}/optionStrategy';
+ $resourcePath = '/accounts/{accountId}/optionsChain';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -514,6 +495,17 @@ public function getOptionStrategyRequest($user_id, $user_secret, $account_id, $o
true // required
) ?? []);
}
+ if ($symbol !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $symbol,
+ 'symbol', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
// path params
@@ -533,14 +525,7 @@ public function getOptionStrategyRequest($user_id, $user_secret, $account_id, $o
);
// for model (json/xml)
- if (isset($options_get_option_strategy_request)) {
- if (stripos($headers['Content-Type'], 'application/json') !== false) {
- # if Content-Type contains "application/json", json_encode the body
- $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($options_get_option_strategy_request));
- } else {
- $httpBody = $options_get_option_strategy_request;
- }
- } elseif (count($formParams) > 0) {
+ if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
@@ -591,7 +576,7 @@ public function getOptionStrategyRequest($user_id, $user_secret, $account_id, $o
$headers
);
- $method = 'POST';
+ $method = 'GET';
$this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
$operationHost = $this->config->getHost();
@@ -608,52 +593,53 @@ public function getOptionStrategyRequest($user_id, $user_secret, $account_id, $o
}
/**
- * Operation getOptionsChain
+ * Operation listOptionHoldings
*
- * Get the options chain for a symbol
+ * List account option positions
+ *
+ * Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param string $account_id The ID of the account to get the options chain from. (required)
- * @param string $symbol Universal symbol ID if symbol (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
+ * @param string $account_id account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\OptionChainInner[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ * @return \SnapTrade\Model\OptionsPosition[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse
*/
- public function getOptionsChain(
+ public function listOptionHoldings(
$user_id,
$user_secret,
$account_id,
- $symbol,
- string $contentType = self::contentTypes['getOptionsChain'][0]
+ string $contentType = self::contentTypes['listOptionHoldings'][0]
)
{
- list($response) = $this->getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id, $symbol, $contentType);
+ list($response) = $this->listOptionHoldingsWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
return $response;
}
/**
- * Operation getOptionsChainWithHttpInfo
+ * Operation listOptionHoldingsWithHttpInfo
*
- * Get the options chain for a symbol
+ * List account option positions
+ *
+ * Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to get the options chain from. (required)
- * @param string $symbol Universal symbol ID if symbol (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\OptionChainInner[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\OptionsPosition[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionsChain'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function listOptionHoldingsWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['listOptionHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionsChainRequest($user_id, $user_secret, $account_id, $symbol, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->listOptionHoldingsRequest($user_id, $user_secret, $account_id, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -668,11 +654,10 @@ public function getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id,
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getOptionsChainWithHttpInfo(
+ return $this->listOptionHoldingsWithHttpInfo(
$user_id,
$user_secret,
$account_id,
- $symbol,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -710,17 +695,17 @@ public function getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id,
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\OptionChainInner[]' === '\SplFileObject') {
+ if ('\SnapTrade\Model\OptionsPosition[]' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\OptionChainInner[]' !== 'string') {
+ if ('\SnapTrade\Model\OptionsPosition[]' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\OptionChainInner[]', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\OptionsPosition[]', []),
$response->getStatusCode(),
$response->getHeaders()
];
@@ -741,7 +726,7 @@ public function getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id,
];
}
- $returnType = '\SnapTrade\Model\OptionChainInner[]';
+ $returnType = '\SnapTrade\Model\OptionsPosition[]';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -762,7 +747,7 @@ public function getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id,
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\OptionChainInner[]',
+ '\SnapTrade\Model\OptionsPosition[]',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -781,30 +766,30 @@ public function getOptionsChainWithHttpInfo($user_id, $user_secret, $account_id,
}
/**
- * Operation getOptionsChainAsync
+ * Operation listOptionHoldingsAsync
*
- * Get the options chain for a symbol
+ * List account option positions
+ *
+ * Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to get the options chain from. (required)
- * @param string $symbol Universal symbol ID if symbol (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getOptionsChainAsync(
+ public function listOptionHoldingsAsync(
$user_id,
$user_secret,
$account_id,
- $symbol,
- string $contentType = self::contentTypes['getOptionsChain'][0]
+ string $contentType = self::contentTypes['listOptionHoldings'][0]
)
{
- return $this->getOptionsChainAsyncWithHttpInfo($user_id, $user_secret, $account_id, $symbol, $contentType)
+ return $this->listOptionHoldingsAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
->then(
function ($response) {
return $response[0];
@@ -813,23 +798,24 @@ function ($response) {
}
/**
- * Operation getOptionsChainAsyncWithHttpInfo
+ * Operation listOptionHoldingsAsyncWithHttpInfo
*
- * Get the options chain for a symbol
+ * List account option positions
+ *
+ * Returns a list of option positions in the specified account. For stock/ETF/crypto/mutual fund positions, please use the [positions endpoint](/reference/Account%20Information/AccountInformation_getUserAccountPositions). Check your API key on the [Customer Dashboard billing page](https://dashboard.snaptrade.com/settings/billing) to see if you have real-time data access: - If you do, this endpoint returns real-time data. - If you don't, the data is cached and refreshed once a day. How long the data is cached for varies by brokerage. Check the [brokerage integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=d16c4c97b8d5438bbb2d8581ac53b11e) and look for \"Cache Expiry Time\" to see the exact value for a specific brokerage. If you need real-time, use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to get the options chain from. (required)
- * @param string $symbol Universal symbol ID if symbol (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getOptionsChainAsyncWithHttpInfo($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionsChain'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function listOptionHoldingsAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['listOptionHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\OptionChainInner[]';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionsChainRequest($user_id, $user_secret, $account_id, $symbol, $contentType);
+ $returnType = '\SnapTrade\Model\OptionsPosition[]';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->listOptionHoldingsRequest($user_id, $user_secret, $account_id, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -871,18 +857,17 @@ function ($exception) {
}
/**
- * Create request for operation 'getOptionsChain'
+ * Create request for operation 'listOptionHoldings'
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to get the options chain from. (required)
- * @param string $symbol Universal symbol ID if symbol (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsChain'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function getOptionsChainRequest($user_id, $user_secret, $account_id, $symbol, string $contentType = self::contentTypes['getOptionsChain'][0])
+ public function listOptionHoldingsRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['listOptionHoldings'][0])
{
// Check if $user_id is a string
@@ -892,7 +877,7 @@ public function getOptionsChainRequest($user_id, $user_secret, $account_id, $sym
// 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 getOptionsChain'
+ 'Missing the required parameter user_id when calling listOptionHoldings'
);
}
// Check if $user_secret is a string
@@ -902,7 +887,7 @@ public function getOptionsChainRequest($user_id, $user_secret, $account_id, $sym
// 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 getOptionsChain'
+ 'Missing the required parameter user_secret when calling listOptionHoldings'
);
}
// Check if $account_id is a string
@@ -912,22 +897,12 @@ public function getOptionsChainRequest($user_id, $user_secret, $account_id, $sym
// 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 getOptionsChain'
- );
- }
- // Check if $symbol is a string
- if ($symbol !== SENTINEL_VALUE && !is_string($symbol)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($symbol, true), gettype($symbol)));
- }
- // 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 getOptionsChain'
+ 'Missing the required parameter account_id when calling listOptionHoldings'
);
}
- $resourcePath = '/accounts/{accountId}/optionsChain';
+ $resourcePath = '/accounts/{accountId}/options';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -956,17 +931,6 @@ public function getOptionsChainRequest($user_id, $user_secret, $account_id, $sym
true // required
) ?? []);
}
- if ($symbol !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $symbol,
- 'symbol', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- true // required
- ) ?? []);
- }
// path params
@@ -1053,1352 +1017,6 @@ public function getOptionsChainRequest($user_id, $user_secret, $account_id, $sym
];
}
- /**
- * Operation getOptionsStrategyQuote
- *
- * Get options strategy quotes
- *
- * @param string $user_id user_id (required)
- * @param string $user_secret user_secret (required)
- * @param string $account_id The ID of the account the strategy will be placed in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsStrategyQuote'] to see the possible values for this operation
- *
- * @throws \SnapTrade\ApiException on non-2xx response
- * @throws \InvalidArgumentException
- * @return \SnapTrade\Model\StrategyQuotes|\SnapTrade\Model\Model500UnexpectedExceptionResponse
- */
- public function getOptionsStrategyQuote(
- $user_id,
- $user_secret,
- $account_id,
- $option_strategy_id,
-
- string $contentType = self::contentTypes['getOptionsStrategyQuote'][0]
- )
- {
-
- list($response) = $this->getOptionsStrategyQuoteWithHttpInfo($user_id, $user_secret, $account_id, $option_strategy_id, $contentType);
- return $response;
- }
-
- /**
- * Operation getOptionsStrategyQuoteWithHttpInfo
- *
- * Get options strategy quotes
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id The ID of the account the strategy will be placed in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsStrategyQuote'] to see the possible values for this operation
- *
- * @throws \SnapTrade\ApiException on non-2xx response
- * @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\StrategyQuotes|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
- */
- public function getOptionsStrategyQuoteWithHttpInfo($user_id, $user_secret, $account_id, $option_strategy_id, string $contentType = self::contentTypes['getOptionsStrategyQuote'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
- {
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionsStrategyQuoteRequest($user_id, $user_secret, $account_id, $option_strategy_id, $contentType);
-
- // Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config);
-
- try {
- $options = $this->createHttpClientOption();
- try {
- $response = $this->client->send($request, $options);
- } catch (RequestException $e) {
- if (
- ($e->getCode() == 401 || $e->getCode() == 403) &&
- !empty($this->getConfig()->getAccessToken()) &&
- $requestOptions->shouldRetryOAuth()
- ) {
- return $this->getOptionsStrategyQuoteWithHttpInfo(
- $user_id,
- $user_secret,
- $account_id,
- $option_strategy_id,
- $contentType,
- $requestOptions->setRetryOAuth(false)
- );
- }
-
- throw new ApiException(
- "[{$e->getCode()}] {$e->getMessage()}",
- (int) $e->getCode(),
- $e->getResponse() ? $e->getResponse()->getHeaders() : null,
- $e->getResponse() ? (string) $e->getResponse()->getBody() : null
- );
- } catch (ConnectException $e) {
- throw new ApiException(
- "[{$e->getCode()}] {$e->getMessage()}",
- (int) $e->getCode(),
- null,
- null
- );
- }
-
- $statusCode = $response->getStatusCode();
-
- if ($statusCode < 200 || $statusCode > 299) {
- throw new ApiException(
- sprintf(
- '[%d] Error connecting to the API (%s)',
- $statusCode,
- (string) $request->getUri()
- ),
- $statusCode,
- $response->getHeaders(),
- (string) $response->getBody()
- );
- }
-
- switch($statusCode) {
- case 200:
- if ('\SnapTrade\Model\StrategyQuotes' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\StrategyQuotes' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\StrategyQuotes', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- case 500:
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- }
-
- $returnType = '\SnapTrade\Model\StrategyQuotes';
- if ($returnType === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ($returnType !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, $returnType, []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
-
- } catch (ApiException $e) {
- switch ($e->getCode()) {
- case 200:
- $data = ObjectSerializer::deserialize(
- $e->getResponseBody(),
- '\SnapTrade\Model\StrategyQuotes',
- $e->getResponseHeaders()
- );
- $e->setResponseObject($data);
- break;
- case 500:
- $data = ObjectSerializer::deserialize(
- $e->getResponseBody(),
- '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
- $e->getResponseHeaders()
- );
- $e->setResponseObject($data);
- break;
- }
- throw $e;
- }
- }
-
- /**
- * Operation getOptionsStrategyQuoteAsync
- *
- * Get options strategy quotes
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id The ID of the account the strategy will be placed in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsStrategyQuote'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Promise\PromiseInterface
- */
- public function getOptionsStrategyQuoteAsync(
- $user_id,
- $user_secret,
- $account_id,
- $option_strategy_id,
-
- string $contentType = self::contentTypes['getOptionsStrategyQuote'][0]
- )
- {
-
- return $this->getOptionsStrategyQuoteAsyncWithHttpInfo($user_id, $user_secret, $account_id, $option_strategy_id, $contentType)
- ->then(
- function ($response) {
- return $response[0];
- }
- );
- }
-
- /**
- * Operation getOptionsStrategyQuoteAsyncWithHttpInfo
- *
- * Get options strategy quotes
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id The ID of the account the strategy will be placed in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsStrategyQuote'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Promise\PromiseInterface
- */
- public function getOptionsStrategyQuoteAsyncWithHttpInfo($user_id, $user_secret, $account_id, $option_strategy_id, string $contentType = self::contentTypes['getOptionsStrategyQuote'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
- {
- $returnType = '\SnapTrade\Model\StrategyQuotes';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getOptionsStrategyQuoteRequest($user_id, $user_secret, $account_id, $option_strategy_id, $contentType);
-
- // Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config);
-
- return $this->client
- ->sendAsync($request, $this->createHttpClientOption())
- ->then(
- function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ($returnType !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, $returnType, []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- },
- function ($exception) {
- $response = $exception->getResponse();
- $statusCode = $response->getStatusCode();
- throw new ApiException(
- sprintf(
- '[%d] Error connecting to the API (%s)',
- $statusCode,
- $exception->getRequest()->getUri()
- ),
- $statusCode,
- $response->getHeaders(),
- (string) $response->getBody()
- );
- }
- );
- }
-
- /**
- * Create request for operation 'getOptionsStrategyQuote'
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id The ID of the account the strategy will be placed in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOptionsStrategyQuote'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Psr7\Request
- */
- public function getOptionsStrategyQuoteRequest($user_id, $user_secret, $account_id, $option_strategy_id, string $contentType = self::contentTypes['getOptionsStrategyQuote'][0])
- {
-
- // Check if $user_id is a string
- if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
- }
- // 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 getOptionsStrategyQuote'
- );
- }
- // Check if $user_secret is a string
- if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
- }
- // 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 getOptionsStrategyQuote'
- );
- }
- // Check if $account_id is a string
- if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
- }
- // 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 getOptionsStrategyQuote'
- );
- }
- // Check if $option_strategy_id is a string
- if ($option_strategy_id !== SENTINEL_VALUE && !is_string($option_strategy_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($option_strategy_id, true), gettype($option_strategy_id)));
- }
- // verify the required parameter 'option_strategy_id' is set
- if ($option_strategy_id === SENTINEL_VALUE || (is_array($option_strategy_id) && count($option_strategy_id) === 0)) {
- throw new \InvalidArgumentException(
- 'Missing the required parameter option_strategy_id when calling getOptionsStrategyQuote'
- );
- }
-
-
- $resourcePath = '/accounts/{accountId}/optionStrategy/{optionStrategyId}';
- $formParams = [];
- $queryParams = [];
- $headerParams = [];
- $httpBody = '';
- $multipart = false;
-
- if ($user_id !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $user_id,
- 'userId', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- true // required
- ) ?? []);
- }
- if ($user_secret !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $user_secret,
- 'userSecret', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- true // required
- ) ?? []);
- }
-
-
- // path params
- if ($account_id !== SENTINEL_VALUE) {
- $resourcePath = str_replace(
- '{' . 'accountId' . '}',
- ObjectSerializer::toPathValue($account_id),
- $resourcePath
- );
- }
- // path params
- if ($option_strategy_id !== SENTINEL_VALUE) {
- $resourcePath = str_replace(
- '{' . 'optionStrategyId' . '}',
- ObjectSerializer::toPathValue($option_strategy_id),
- $resourcePath
- );
- }
-
-
- $headers = $this->headerSelector->selectHeaders(
- ['application/json', ],
- $contentType,
- $multipart
- );
-
- // for model (json/xml)
- if (count($formParams) > 0) {
- if ($multipart) {
- $multipartContents = [];
- foreach ($formParams as $formParamName => $formParamValue) {
- $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
- foreach ($formParamValueItems as $formParamValueItem) {
- $multipartContents[] = [
- 'name' => $formParamName,
- 'contents' => $formParamValueItem
- ];
- }
- }
- // for HTTP post (form)
- $httpBody = new MultipartStream($multipartContents);
-
- } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
- # if Content-Type contains "application/json", json_encode the form parameters
- $httpBody = \GuzzleHttp\json_encode($formParams);
- } else {
- // for HTTP post (form)
- $httpBody = ObjectSerializer::buildQuery($formParams);
- }
- }
-
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('clientId');
- if ($apiKey !== null) {
- $queryParams['clientId'] = $apiKey;
- }
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('Signature');
- if ($apiKey !== null) {
- $headers['Signature'] = $apiKey;
- }
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
- if ($apiKey !== null) {
- $queryParams['timestamp'] = $apiKey;
- }
-
- $defaultHeaders = [];
- if ($this->config->getUserAgent()) {
- $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
- }
-
- $headers = array_merge(
- $defaultHeaders,
- $headerParams,
- $headers
- );
-
- $method = 'GET';
- $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
-
- $operationHost = $this->config->getHost();
- $query = ObjectSerializer::buildQuery($queryParams);
- return [
- "request" => new Request(
- $method,
- $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
- $headers,
- $httpBody
- ),
- "serializedBody" => $httpBody
- ];
- }
-
- /**
- * Operation listOptionHoldings
- *
- * List account option positions
- *
- * @param string $user_id user_id (required)
- * @param string $user_secret user_secret (required)
- * @param string $account_id account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
- *
- * @throws \SnapTrade\ApiException on non-2xx response
- * @throws \InvalidArgumentException
- * @return \SnapTrade\Model\OptionsPosition[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse
- */
- public function listOptionHoldings(
- $user_id,
- $user_secret,
- $account_id,
-
- string $contentType = self::contentTypes['listOptionHoldings'][0]
- )
- {
-
- list($response) = $this->listOptionHoldingsWithHttpInfo($user_id, $user_secret, $account_id, $contentType);
- return $response;
- }
-
- /**
- * Operation listOptionHoldingsWithHttpInfo
- *
- * List account option positions
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
- *
- * @throws \SnapTrade\ApiException on non-2xx response
- * @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\OptionsPosition[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
- */
- public function listOptionHoldingsWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['listOptionHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
- {
- ["request" => $request, "serializedBody" => $serializedBody] = $this->listOptionHoldingsRequest($user_id, $user_secret, $account_id, $contentType);
-
- // Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config);
-
- try {
- $options = $this->createHttpClientOption();
- try {
- $response = $this->client->send($request, $options);
- } catch (RequestException $e) {
- if (
- ($e->getCode() == 401 || $e->getCode() == 403) &&
- !empty($this->getConfig()->getAccessToken()) &&
- $requestOptions->shouldRetryOAuth()
- ) {
- return $this->listOptionHoldingsWithHttpInfo(
- $user_id,
- $user_secret,
- $account_id,
- $contentType,
- $requestOptions->setRetryOAuth(false)
- );
- }
-
- throw new ApiException(
- "[{$e->getCode()}] {$e->getMessage()}",
- (int) $e->getCode(),
- $e->getResponse() ? $e->getResponse()->getHeaders() : null,
- $e->getResponse() ? (string) $e->getResponse()->getBody() : null
- );
- } catch (ConnectException $e) {
- throw new ApiException(
- "[{$e->getCode()}] {$e->getMessage()}",
- (int) $e->getCode(),
- null,
- null
- );
- }
-
- $statusCode = $response->getStatusCode();
-
- if ($statusCode < 200 || $statusCode > 299) {
- throw new ApiException(
- sprintf(
- '[%d] Error connecting to the API (%s)',
- $statusCode,
- (string) $request->getUri()
- ),
- $statusCode,
- $response->getHeaders(),
- (string) $response->getBody()
- );
- }
-
- switch($statusCode) {
- case 200:
- if ('\SnapTrade\Model\OptionsPosition[]' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\OptionsPosition[]' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\OptionsPosition[]', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- case 500:
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- }
-
- $returnType = '\SnapTrade\Model\OptionsPosition[]';
- if ($returnType === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ($returnType !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, $returnType, []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
-
- } catch (ApiException $e) {
- switch ($e->getCode()) {
- case 200:
- $data = ObjectSerializer::deserialize(
- $e->getResponseBody(),
- '\SnapTrade\Model\OptionsPosition[]',
- $e->getResponseHeaders()
- );
- $e->setResponseObject($data);
- break;
- case 500:
- $data = ObjectSerializer::deserialize(
- $e->getResponseBody(),
- '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
- $e->getResponseHeaders()
- );
- $e->setResponseObject($data);
- break;
- }
- throw $e;
- }
- }
-
- /**
- * Operation listOptionHoldingsAsync
- *
- * List account option positions
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Promise\PromiseInterface
- */
- public function listOptionHoldingsAsync(
- $user_id,
- $user_secret,
- $account_id,
-
- string $contentType = self::contentTypes['listOptionHoldings'][0]
- )
- {
-
- return $this->listOptionHoldingsAsyncWithHttpInfo($user_id, $user_secret, $account_id, $contentType)
- ->then(
- function ($response) {
- return $response[0];
- }
- );
- }
-
- /**
- * Operation listOptionHoldingsAsyncWithHttpInfo
- *
- * List account option positions
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Promise\PromiseInterface
- */
- public function listOptionHoldingsAsyncWithHttpInfo($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['listOptionHoldings'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
- {
- $returnType = '\SnapTrade\Model\OptionsPosition[]';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->listOptionHoldingsRequest($user_id, $user_secret, $account_id, $contentType);
-
- // Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config);
-
- return $this->client
- ->sendAsync($request, $this->createHttpClientOption())
- ->then(
- function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ($returnType !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, $returnType, []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- },
- function ($exception) {
- $response = $exception->getResponse();
- $statusCode = $response->getStatusCode();
- throw new ApiException(
- sprintf(
- '[%d] Error connecting to the API (%s)',
- $statusCode,
- $exception->getRequest()->getUri()
- ),
- $statusCode,
- $response->getHeaders(),
- (string) $response->getBody()
- );
- }
- );
- }
-
- /**
- * Create request for operation 'listOptionHoldings'
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listOptionHoldings'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Psr7\Request
- */
- public function listOptionHoldingsRequest($user_id, $user_secret, $account_id, string $contentType = self::contentTypes['listOptionHoldings'][0])
- {
-
- // Check if $user_id is a string
- if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
- }
- // 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 listOptionHoldings'
- );
- }
- // Check if $user_secret is a string
- if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
- }
- // 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 listOptionHoldings'
- );
- }
- // Check if $account_id is a string
- if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
- }
- // 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 listOptionHoldings'
- );
- }
-
-
- $resourcePath = '/accounts/{accountId}/options';
- $formParams = [];
- $queryParams = [];
- $headerParams = [];
- $httpBody = '';
- $multipart = false;
-
- if ($user_id !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $user_id,
- 'userId', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- true // required
- ) ?? []);
- }
- if ($user_secret !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $user_secret,
- 'userSecret', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- true // required
- ) ?? []);
- }
-
-
- // path params
- if ($account_id !== SENTINEL_VALUE) {
- $resourcePath = str_replace(
- '{' . 'accountId' . '}',
- ObjectSerializer::toPathValue($account_id),
- $resourcePath
- );
- }
-
-
- $headers = $this->headerSelector->selectHeaders(
- ['application/json', ],
- $contentType,
- $multipart
- );
-
- // for model (json/xml)
- if (count($formParams) > 0) {
- if ($multipart) {
- $multipartContents = [];
- foreach ($formParams as $formParamName => $formParamValue) {
- $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
- foreach ($formParamValueItems as $formParamValueItem) {
- $multipartContents[] = [
- 'name' => $formParamName,
- 'contents' => $formParamValueItem
- ];
- }
- }
- // for HTTP post (form)
- $httpBody = new MultipartStream($multipartContents);
-
- } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
- # if Content-Type contains "application/json", json_encode the form parameters
- $httpBody = \GuzzleHttp\json_encode($formParams);
- } else {
- // for HTTP post (form)
- $httpBody = ObjectSerializer::buildQuery($formParams);
- }
- }
-
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('clientId');
- if ($apiKey !== null) {
- $queryParams['clientId'] = $apiKey;
- }
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('Signature');
- if ($apiKey !== null) {
- $headers['Signature'] = $apiKey;
- }
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
- if ($apiKey !== null) {
- $queryParams['timestamp'] = $apiKey;
- }
-
- $defaultHeaders = [];
- if ($this->config->getUserAgent()) {
- $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
- }
-
- $headers = array_merge(
- $defaultHeaders,
- $headerParams,
- $headers
- );
-
- $method = 'GET';
- $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
-
- $operationHost = $this->config->getHost();
- $query = ObjectSerializer::buildQuery($queryParams);
- return [
- "request" => new Request(
- $method,
- $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
- $headers,
- $httpBody
- ),
- "serializedBody" => $httpBody
- ];
- }
-
- /**
- * Operation placeOptionStrategy
- *
- * Place an option strategy order
- *
- * @param string $user_id user_id (required)
- * @param string $user_secret user_secret (required)
- * @param string $account_id The ID of the account to execute the strategy in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param \SnapTrade\Model\OptionsPlaceOptionStrategyRequest $options_place_option_strategy_request options_place_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOptionStrategy'] to see the possible values for this operation
- *
- * @throws \SnapTrade\ApiException on non-2xx response
- * @throws \InvalidArgumentException
- * @return \SnapTrade\Model\StrategyOrderRecord|\SnapTrade\Model\Model500UnexpectedExceptionResponse
- */
- public function placeOptionStrategy(
-
- $order_type,
- $time_in_force,
- $user_id,
- $user_secret,
- $account_id,
- $option_strategy_id,
- $price = SENTINEL_VALUE,
- string $contentType = self::contentTypes['placeOptionStrategy'][0]
- )
- {
- $_body = [];
- $this->setRequestBodyProperty($_body, "order_type", $order_type);
- $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
- $this->setRequestBodyProperty($_body, "price", $price);
- $options_place_option_strategy_request = $_body;
-
- list($response) = $this->placeOptionStrategyWithHttpInfo($user_id, $user_secret, $account_id, $option_strategy_id, $options_place_option_strategy_request, $contentType);
- return $response;
- }
-
- /**
- * Operation placeOptionStrategyWithHttpInfo
- *
- * Place an option strategy order
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id The ID of the account to execute the strategy in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param \SnapTrade\Model\OptionsPlaceOptionStrategyRequest $options_place_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOptionStrategy'] to see the possible values for this operation
- *
- * @throws \SnapTrade\ApiException on non-2xx response
- * @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\StrategyOrderRecord|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
- */
- public function placeOptionStrategyWithHttpInfo($user_id, $user_secret, $account_id, $option_strategy_id, $options_place_option_strategy_request, string $contentType = self::contentTypes['placeOptionStrategy'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
- {
- ["request" => $request, "serializedBody" => $serializedBody] = $this->placeOptionStrategyRequest($user_id, $user_secret, $account_id, $option_strategy_id, $options_place_option_strategy_request, $contentType);
-
- // Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
-
- try {
- $options = $this->createHttpClientOption();
- try {
- $response = $this->client->send($request, $options);
- } catch (RequestException $e) {
- if (
- ($e->getCode() == 401 || $e->getCode() == 403) &&
- !empty($this->getConfig()->getAccessToken()) &&
- $requestOptions->shouldRetryOAuth()
- ) {
- return $this->placeOptionStrategyWithHttpInfo(
- $user_id,
- $user_secret,
- $account_id,
- $option_strategy_id,
- $options_place_option_strategy_request,
- $contentType,
- $requestOptions->setRetryOAuth(false)
- );
- }
-
- throw new ApiException(
- "[{$e->getCode()}] {$e->getMessage()}",
- (int) $e->getCode(),
- $e->getResponse() ? $e->getResponse()->getHeaders() : null,
- $e->getResponse() ? (string) $e->getResponse()->getBody() : null
- );
- } catch (ConnectException $e) {
- throw new ApiException(
- "[{$e->getCode()}] {$e->getMessage()}",
- (int) $e->getCode(),
- null,
- null
- );
- }
-
- $statusCode = $response->getStatusCode();
-
- if ($statusCode < 200 || $statusCode > 299) {
- throw new ApiException(
- sprintf(
- '[%d] Error connecting to the API (%s)',
- $statusCode,
- (string) $request->getUri()
- ),
- $statusCode,
- $response->getHeaders(),
- (string) $response->getBody()
- );
- }
-
- switch($statusCode) {
- case 200:
- if ('\SnapTrade\Model\StrategyOrderRecord' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\StrategyOrderRecord' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\StrategyOrderRecord', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- case 500:
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- }
-
- $returnType = '\SnapTrade\Model\StrategyOrderRecord';
- if ($returnType === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ($returnType !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, $returnType, []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
-
- } catch (ApiException $e) {
- switch ($e->getCode()) {
- case 200:
- $data = ObjectSerializer::deserialize(
- $e->getResponseBody(),
- '\SnapTrade\Model\StrategyOrderRecord',
- $e->getResponseHeaders()
- );
- $e->setResponseObject($data);
- break;
- case 500:
- $data = ObjectSerializer::deserialize(
- $e->getResponseBody(),
- '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
- $e->getResponseHeaders()
- );
- $e->setResponseObject($data);
- break;
- }
- throw $e;
- }
- }
-
- /**
- * Operation placeOptionStrategyAsync
- *
- * Place an option strategy order
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id The ID of the account to execute the strategy in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param \SnapTrade\Model\OptionsPlaceOptionStrategyRequest $options_place_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOptionStrategy'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Promise\PromiseInterface
- */
- public function placeOptionStrategyAsync(
-
- $order_type,
- $time_in_force,
- $user_id,
- $user_secret,
- $account_id,
- $option_strategy_id,
- $price = SENTINEL_VALUE,
- string $contentType = self::contentTypes['placeOptionStrategy'][0]
- )
- {
- $_body = [];
- $this->setRequestBodyProperty($_body, "order_type", $order_type);
- $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
- $this->setRequestBodyProperty($_body, "price", $price);
- $options_place_option_strategy_request = $_body;
-
- return $this->placeOptionStrategyAsyncWithHttpInfo($user_id, $user_secret, $account_id, $option_strategy_id, $options_place_option_strategy_request, $contentType)
- ->then(
- function ($response) {
- return $response[0];
- }
- );
- }
-
- /**
- * Operation placeOptionStrategyAsyncWithHttpInfo
- *
- * Place an option strategy order
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id The ID of the account to execute the strategy in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param \SnapTrade\Model\OptionsPlaceOptionStrategyRequest $options_place_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOptionStrategy'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Promise\PromiseInterface
- */
- public function placeOptionStrategyAsyncWithHttpInfo($user_id, $user_secret, $account_id, $option_strategy_id, $options_place_option_strategy_request, string $contentType = self::contentTypes['placeOptionStrategy'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
- {
- $returnType = '\SnapTrade\Model\StrategyOrderRecord';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->placeOptionStrategyRequest($user_id, $user_secret, $account_id, $option_strategy_id, $options_place_option_strategy_request, $contentType);
-
- // Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
-
- return $this->client
- ->sendAsync($request, $this->createHttpClientOption())
- ->then(
- function ($response) use ($returnType) {
- if ($returnType === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ($returnType !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, $returnType, []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
- },
- function ($exception) {
- $response = $exception->getResponse();
- $statusCode = $response->getStatusCode();
- throw new ApiException(
- sprintf(
- '[%d] Error connecting to the API (%s)',
- $statusCode,
- $exception->getRequest()->getUri()
- ),
- $statusCode,
- $response->getHeaders(),
- (string) $response->getBody()
- );
- }
- );
- }
-
- /**
- * Create request for operation 'placeOptionStrategy'
- *
- * @param string $user_id (required)
- * @param string $user_secret (required)
- * @param string $account_id The ID of the account to execute the strategy in. (required)
- * @param string $option_strategy_id Option strategy id obtained from response when creating option strategy object (required)
- * @param \SnapTrade\Model\OptionsPlaceOptionStrategyRequest $options_place_option_strategy_request (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOptionStrategy'] to see the possible values for this operation
- *
- * @throws \InvalidArgumentException
- * @return \GuzzleHttp\Psr7\Request
- */
- public function placeOptionStrategyRequest($user_id, $user_secret, $account_id, $option_strategy_id, $options_place_option_strategy_request, string $contentType = self::contentTypes['placeOptionStrategy'][0])
- {
-
- // Check if $user_id is a string
- if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
- }
- // 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 placeOptionStrategy'
- );
- }
- // Check if $user_secret is a string
- if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
- }
- // 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 placeOptionStrategy'
- );
- }
- // Check if $account_id is a string
- if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
- }
- // 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 placeOptionStrategy'
- );
- }
- // Check if $option_strategy_id is a string
- if ($option_strategy_id !== SENTINEL_VALUE && !is_string($option_strategy_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($option_strategy_id, true), gettype($option_strategy_id)));
- }
- // verify the required parameter 'option_strategy_id' is set
- if ($option_strategy_id === SENTINEL_VALUE || (is_array($option_strategy_id) && count($option_strategy_id) === 0)) {
- throw new \InvalidArgumentException(
- 'Missing the required parameter option_strategy_id when calling placeOptionStrategy'
- );
- }
- if ($options_place_option_strategy_request !== SENTINEL_VALUE) {
- if (!($options_place_option_strategy_request instanceof \SnapTrade\Model\OptionsPlaceOptionStrategyRequest)) {
- if (!is_array($options_place_option_strategy_request))
- throw new \InvalidArgumentException('"options_place_option_strategy_request" must be associative array or an instance of \SnapTrade\Model\OptionsPlaceOptionStrategyRequest OptionsApi.placeOptionStrategy.');
- else
- $options_place_option_strategy_request = new \SnapTrade\Model\OptionsPlaceOptionStrategyRequest($options_place_option_strategy_request);
- }
- }
- // verify the required parameter 'options_place_option_strategy_request' is set
- if ($options_place_option_strategy_request === SENTINEL_VALUE || (is_array($options_place_option_strategy_request) && count($options_place_option_strategy_request) === 0)) {
- throw new \InvalidArgumentException(
- 'Missing the required parameter options_place_option_strategy_request when calling placeOptionStrategy'
- );
- }
-
-
- $resourcePath = '/accounts/{accountId}/optionStrategy/{optionStrategyId}/execute';
- $formParams = [];
- $queryParams = [];
- $headerParams = [];
- $httpBody = '';
- $multipart = false;
-
- if ($user_id !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $user_id,
- 'userId', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- true // required
- ) ?? []);
- }
- if ($user_secret !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $user_secret,
- 'userSecret', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- true // required
- ) ?? []);
- }
-
-
- // path params
- if ($account_id !== SENTINEL_VALUE) {
- $resourcePath = str_replace(
- '{' . 'accountId' . '}',
- ObjectSerializer::toPathValue($account_id),
- $resourcePath
- );
- }
- // path params
- if ($option_strategy_id !== SENTINEL_VALUE) {
- $resourcePath = str_replace(
- '{' . 'optionStrategyId' . '}',
- ObjectSerializer::toPathValue($option_strategy_id),
- $resourcePath
- );
- }
-
-
- $headers = $this->headerSelector->selectHeaders(
- ['application/json', ],
- $contentType,
- $multipart
- );
-
- // for model (json/xml)
- if (isset($options_place_option_strategy_request)) {
- if (stripos($headers['Content-Type'], 'application/json') !== false) {
- # if Content-Type contains "application/json", json_encode the body
- $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($options_place_option_strategy_request));
- } else {
- $httpBody = $options_place_option_strategy_request;
- }
- } elseif (count($formParams) > 0) {
- if ($multipart) {
- $multipartContents = [];
- foreach ($formParams as $formParamName => $formParamValue) {
- $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
- foreach ($formParamValueItems as $formParamValueItem) {
- $multipartContents[] = [
- 'name' => $formParamName,
- 'contents' => $formParamValueItem
- ];
- }
- }
- // for HTTP post (form)
- $httpBody = new MultipartStream($multipartContents);
-
- } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
- # if Content-Type contains "application/json", json_encode the form parameters
- $httpBody = \GuzzleHttp\json_encode($formParams);
- } else {
- // for HTTP post (form)
- $httpBody = ObjectSerializer::buildQuery($formParams);
- }
- }
-
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('clientId');
- if ($apiKey !== null) {
- $queryParams['clientId'] = $apiKey;
- }
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('Signature');
- if ($apiKey !== null) {
- $headers['Signature'] = $apiKey;
- }
- // this endpoint requires API key authentication
- $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
- if ($apiKey !== null) {
- $queryParams['timestamp'] = $apiKey;
- }
-
- $defaultHeaders = [];
- if ($this->config->getUserAgent()) {
- $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
- }
-
- $headers = array_merge(
- $defaultHeaders,
- $headerParams,
- $headers
- );
-
- $method = 'POST';
- $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
-
- $operationHost = $this->config->getHost();
- $query = ObjectSerializer::buildQuery($queryParams);
- return [
- "request" => new Request(
- $method,
- $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
- $headers,
- $httpBody
- ),
- "serializedBody" => $httpBody
- ];
- }
-
/**
* Create http client option
*
diff --git a/lib/Api/ReferenceDataApi.php b/lib/Api/ReferenceDataApi.php
index bbebb48..96e7233 100644
--- a/lib/Api/ReferenceDataApi.php
+++ b/lib/Api/ReferenceDataApi.php
@@ -83,6 +83,9 @@ class ReferenceDataApi extends \SnapTrade\CustomApi
'listAllBrokerageAuthorizationType' => [
'application/json',
],
+ 'listAllBrokerageInstruments' => [
+ 'application/json',
+ ],
'listAllBrokerages' => [
'application/json',
],
@@ -170,6 +173,8 @@ private function setRequestBodyProperty(&$body, $property, $value) {
*
* Get exchange rate of a currency pair
*
+ * Returns an Exchange Rate Pair object for the specified Currency Pair.
+ *
* @param string $currency_pair A currency pair based on currency code for example, {CAD-USD} (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCurrencyExchangeRatePair'] to see the possible values for this operation
*
@@ -193,6 +198,8 @@ public function getCurrencyExchangeRatePair(
*
* Get exchange rate of a currency pair
*
+ * Returns an Exchange Rate Pair object for the specified Currency Pair.
+ *
* @param string $currency_pair A currency pair based on currency code for example, {CAD-USD} (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCurrencyExchangeRatePair'] to see the possible values for this operation
*
@@ -308,6 +315,8 @@ public function getCurrencyExchangeRatePairWithHttpInfo($currency_pair, string $
*
* Get exchange rate of a currency pair
*
+ * Returns an Exchange Rate Pair object for the specified Currency Pair.
+ *
* @param string $currency_pair A currency pair based on currency code for example, {CAD-USD} (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCurrencyExchangeRatePair'] to see the possible values for this operation
*
@@ -334,6 +343,8 @@ function ($response) {
*
* Get exchange rate of a currency pair
*
+ * Returns an Exchange Rate Pair object for the specified Currency Pair.
+ *
* @param string $currency_pair A currency pair based on currency code for example, {CAD-USD} (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCurrencyExchangeRatePair'] to see the possible values for this operation
*
@@ -504,7 +515,9 @@ public function getCurrencyExchangeRatePairRequest($currency_pair, string $conte
/**
* Operation getPartnerInfo
*
- * Get metadata related to Snaptrade partner
+ * Get Client Info
+ *
+ * Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartnerInfo'] to see the possible values for this operation
*
@@ -526,7 +539,9 @@ public function getPartnerInfo(
/**
* Operation getPartnerInfoWithHttpInfo
*
- * Get metadata related to Snaptrade partner
+ * Get Client Info
+ *
+ * Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartnerInfo'] to see the possible values for this operation
*
@@ -708,7 +723,9 @@ public function getPartnerInfoWithHttpInfo(string $contentType = self::contentTy
/**
* Operation getPartnerInfoAsync
*
- * Get metadata related to Snaptrade partner
+ * Get Client Info
+ *
+ * Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartnerInfo'] to see the possible values for this operation
*
@@ -733,7 +750,9 @@ function ($response) {
/**
* Operation getPartnerInfoAsyncWithHttpInfo
*
- * Get metadata related to Snaptrade partner
+ * Get Client Info
+ *
+ * Returns configurations for your SnapTrade Client ID, including allowed brokerages and data access.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getPartnerInfo'] to see the possible values for this operation
*
@@ -885,7 +904,9 @@ public function getPartnerInfoRequest(string $contentType = self::contentTypes['
/**
* Operation getSecurityTypes
*
- * List of all security types
+ * List security types
+ *
+ * Return all available security types supported by SnapTrade.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecurityTypes'] to see the possible values for this operation
*
@@ -907,7 +928,9 @@ public function getSecurityTypes(
/**
* Operation getSecurityTypesWithHttpInfo
*
- * List of all security types
+ * List security types
+ *
+ * Return all available security types supported by SnapTrade.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecurityTypes'] to see the possible values for this operation
*
@@ -1020,7 +1043,9 @@ public function getSecurityTypesWithHttpInfo(string $contentType = self::content
/**
* Operation getSecurityTypesAsync
*
- * List of all security types
+ * List security types
+ *
+ * Return all available security types supported by SnapTrade.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecurityTypes'] to see the possible values for this operation
*
@@ -1045,7 +1070,9 @@ function ($response) {
/**
* Operation getSecurityTypesAsyncWithHttpInfo
*
- * List of all security types
+ * List security types
+ *
+ * Return all available security types supported by SnapTrade.
*
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSecurityTypes'] to see the possible values for this operation
*
@@ -1199,6 +1226,8 @@ public function getSecurityTypesRequest(string $contentType = self::contentTypes
*
* Get exchanges
*
+ * Returns a list of all supported Exchanges.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStockExchanges'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -1221,6 +1250,8 @@ public function getStockExchanges(
*
* Get exchanges
*
+ * Returns a list of all supported Exchanges.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStockExchanges'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -1334,6 +1365,8 @@ public function getStockExchangesWithHttpInfo(string $contentType = self::conten
*
* Get exchanges
*
+ * Returns a list of all supported Exchanges.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStockExchanges'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -1359,6 +1392,8 @@ function ($response) {
*
* Get exchanges
*
+ * Returns a list of all supported Exchanges.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getStockExchanges'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -1509,7 +1544,9 @@ public function getStockExchangesRequest(string $contentType = self::contentType
/**
* Operation getSymbols
*
- * Search for symbols
+ * Search symbols
+ *
+ * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
*
* @param \SnapTrade\Model\SymbolQuery $symbol_query symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbols'] to see the possible values for this operation
@@ -1535,7 +1572,9 @@ public function getSymbols(
/**
* Operation getSymbolsWithHttpInfo
*
- * Search for symbols
+ * Search symbols
+ *
+ * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
*
* @param \SnapTrade\Model\SymbolQuery $symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbols'] to see the possible values for this operation
@@ -1650,7 +1689,9 @@ public function getSymbolsWithHttpInfo($symbol_query = null, string $contentType
/**
* Operation getSymbolsAsync
*
- * Search for symbols
+ * Search symbols
+ *
+ * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
*
* @param \SnapTrade\Model\SymbolQuery $symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbols'] to see the possible values for this operation
@@ -1679,7 +1720,9 @@ function ($response) {
/**
* Operation getSymbolsAsyncWithHttpInfo
*
- * Search for symbols
+ * Search symbols
+ *
+ * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned.
*
* @param \SnapTrade\Model\SymbolQuery $symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbols'] to see the possible values for this operation
@@ -1848,14 +1891,16 @@ public function getSymbolsRequest($symbol_query = SENTINEL_VALUE, string $conten
/**
* Operation getSymbolsByTicker
*
- * Get details of a symbol
+ * Get symbol detail
+ *
+ * Returns the Universal Symbol object specified by the ticker or the Universal Symbol ID. When a ticker is specified, the first matching result is returned. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix. Please use the ticker with the proper suffix for the best results.
*
- * @param string $query The ticker or universal_symbol_id of the UniversalSymbol to get. (required)
+ * @param string $query The ticker or Universal Symbol ID to look up the symbol with. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbolsByTicker'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\UniversalSymbol
+ * @return \SnapTrade\Model\UniversalSymbol|\SnapTrade\Model\Model404FailedRequestResponse
*/
public function getSymbolsByTicker(
$query,
@@ -1871,14 +1916,16 @@ public function getSymbolsByTicker(
/**
* Operation getSymbolsByTickerWithHttpInfo
*
- * Get details of a symbol
+ * Get symbol detail
*
- * @param string $query The ticker or universal_symbol_id of the UniversalSymbol to get. (required)
+ * Returns the Universal Symbol object specified by the ticker or the Universal Symbol ID. When a ticker is specified, the first matching result is returned. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix. Please use the ticker with the proper suffix for the best results.
+ *
+ * @param string $query The ticker or Universal Symbol ID to look up the symbol with. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbolsByTicker'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\UniversalSymbol, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\UniversalSymbol|\SnapTrade\Model\Model404FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
*/
public function getSymbolsByTickerWithHttpInfo($query, string $contentType = self::contentTypes['getSymbolsByTicker'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
@@ -1950,6 +1997,21 @@ public function getSymbolsByTickerWithHttpInfo($query, string $contentType = sel
$response->getStatusCode(),
$response->getHeaders()
];
+ case 404:
+ if ('\SnapTrade\Model\Model404FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model404FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model404FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
}
$returnType = '\SnapTrade\Model\UniversalSymbol';
@@ -1978,6 +2040,14 @@ public function getSymbolsByTickerWithHttpInfo($query, string $contentType = sel
);
$e->setResponseObject($data);
break;
+ case 404:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model404FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
}
throw $e;
}
@@ -1986,9 +2056,11 @@ public function getSymbolsByTickerWithHttpInfo($query, string $contentType = sel
/**
* Operation getSymbolsByTickerAsync
*
- * Get details of a symbol
+ * Get symbol detail
+ *
+ * Returns the Universal Symbol object specified by the ticker or the Universal Symbol ID. When a ticker is specified, the first matching result is returned. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix. Please use the ticker with the proper suffix for the best results.
*
- * @param string $query The ticker or universal_symbol_id of the UniversalSymbol to get. (required)
+ * @param string $query The ticker or Universal Symbol ID to look up the symbol with. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbolsByTicker'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -2012,9 +2084,11 @@ function ($response) {
/**
* Operation getSymbolsByTickerAsyncWithHttpInfo
*
- * Get details of a symbol
+ * Get symbol detail
*
- * @param string $query The ticker or universal_symbol_id of the UniversalSymbol to get. (required)
+ * Returns the Universal Symbol object specified by the ticker or the Universal Symbol ID. When a ticker is specified, the first matching result is returned. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix. Please use the ticker with the proper suffix for the best results.
+ *
+ * @param string $query The ticker or Universal Symbol ID to look up the symbol with. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbolsByTicker'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -2067,7 +2141,7 @@ function ($exception) {
/**
* Create request for operation 'getSymbolsByTicker'
*
- * @param string $query The ticker or universal_symbol_id of the UniversalSymbol to get. (required)
+ * @param string $query The ticker or Universal Symbol ID to look up the symbol with. (required)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getSymbolsByTicker'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -2108,7 +2182,7 @@ public function getSymbolsByTickerRequest($query, string $contentType = self::co
$headers = $this->headerSelector->selectHeaders(
- ['*/*', ],
+ ['application/json', ],
$contentType,
$multipart
);
@@ -2186,6 +2260,8 @@ public function getSymbolsByTickerRequest($query, string $contentType = self::co
*
* Get all brokerage authorization types
*
+ * Returns a list of all defined Brokerage authorization Type objects.
+ *
* @param string $brokerage Comma separated value of brokerage slugs (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageAuthorizationType'] to see the possible values for this operation
*
@@ -2209,6 +2285,8 @@ public function listAllBrokerageAuthorizationType(
*
* Get all brokerage authorization types
*
+ * Returns a list of all defined Brokerage authorization Type objects.
+ *
* @param string $brokerage Comma separated value of brokerage slugs (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageAuthorizationType'] to see the possible values for this operation
*
@@ -2324,6 +2402,8 @@ public function listAllBrokerageAuthorizationTypeWithHttpInfo($brokerage = null,
*
* Get all brokerage authorization types
*
+ * Returns a list of all defined Brokerage authorization Type objects.
+ *
* @param string $brokerage Comma separated value of brokerage slugs (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageAuthorizationType'] to see the possible values for this operation
*
@@ -2350,6 +2430,8 @@ function ($response) {
*
* Get all brokerage authorization types
*
+ * Returns a list of all defined Brokerage authorization Type objects.
+ *
* @param string $brokerage Comma separated value of brokerage slugs (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageAuthorizationType'] to see the possible values for this operation
*
@@ -2440,6 +2522,350 @@ public function listAllBrokerageAuthorizationTypeRequest($brokerage = SENTINEL_V
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation listAllBrokerageInstruments
+ *
+ * Get brokerage instruments
+ *
+ * Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list.
+ *
+ * @param string $slug A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change. (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageInstruments'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\BrokerageInstrumentsResponse
+ */
+ public function listAllBrokerageInstruments(
+ $slug,
+
+ string $contentType = self::contentTypes['listAllBrokerageInstruments'][0]
+ )
+ {
+
+ list($response) = $this->listAllBrokerageInstrumentsWithHttpInfo($slug, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation listAllBrokerageInstrumentsWithHttpInfo
+ *
+ * Get brokerage instruments
+ *
+ * Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list.
+ *
+ * @param string $slug A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change. (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageInstruments'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\BrokerageInstrumentsResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function listAllBrokerageInstrumentsWithHttpInfo($slug, string $contentType = self::contentTypes['listAllBrokerageInstruments'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->listAllBrokerageInstrumentsRequest($slug, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->listAllBrokerageInstrumentsWithHttpInfo(
+ $slug,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\BrokerageInstrumentsResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\BrokerageInstrumentsResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\BrokerageInstrumentsResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\BrokerageInstrumentsResponse';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\BrokerageInstrumentsResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation listAllBrokerageInstrumentsAsync
+ *
+ * Get brokerage instruments
+ *
+ * Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list.
+ *
+ * @param string $slug A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change. (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageInstruments'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function listAllBrokerageInstrumentsAsync(
+ $slug,
+
+ string $contentType = self::contentTypes['listAllBrokerageInstruments'][0]
+ )
+ {
+
+ return $this->listAllBrokerageInstrumentsAsyncWithHttpInfo($slug, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation listAllBrokerageInstrumentsAsyncWithHttpInfo
+ *
+ * Get brokerage instruments
+ *
+ * Returns a list of all brokerage instruments available for a given brokerage. Not all brokerages support this. The ones that don't will return an empty list.
+ *
+ * @param string $slug A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change. (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageInstruments'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function listAllBrokerageInstrumentsAsyncWithHttpInfo($slug, string $contentType = self::contentTypes['listAllBrokerageInstruments'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\BrokerageInstrumentsResponse';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->listAllBrokerageInstrumentsRequest($slug, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'listAllBrokerageInstruments'
+ *
+ * @param string $slug A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change. (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerageInstruments'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function listAllBrokerageInstrumentsRequest($slug, string $contentType = self::contentTypes['listAllBrokerageInstruments'][0])
+ {
+
+ // Check if $slug is a string
+ if ($slug !== SENTINEL_VALUE && !is_string($slug)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($slug, true), gettype($slug)));
+ }
+ // verify the required parameter 'slug' is set
+ if ($slug === SENTINEL_VALUE || (is_array($slug) && count($slug) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter slug when calling listAllBrokerageInstruments'
+ );
+ }
+
+
+ $resourcePath = '/brokerages/{slug}/instruments';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+
+
+ // path params
+ if ($slug !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'slug' . '}',
+ ObjectSerializer::toPathValue($slug),
+ $resourcePath
+ );
+ }
+
+
$headers = $this->headerSelector->selectHeaders(
['application/json', ],
$contentType,
@@ -2519,6 +2945,8 @@ public function listAllBrokerageAuthorizationTypeRequest($brokerage = SENTINEL_V
*
* Get brokerages
*
+ * Returns a list of all defined Brokerage objects.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerages'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -2541,6 +2969,8 @@ public function listAllBrokerages(
*
* Get brokerages
*
+ * Returns a list of all defined Brokerage objects.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerages'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -2654,6 +3084,8 @@ public function listAllBrokeragesWithHttpInfo(string $contentType = self::conten
*
* Get brokerages
*
+ * Returns a list of all defined Brokerage objects.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerages'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -2679,6 +3111,8 @@ function ($response) {
*
* Get brokerages
*
+ * Returns a list of all defined Brokerage objects.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllBrokerages'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -2831,6 +3265,8 @@ public function listAllBrokeragesRequest(string $contentType = self::contentType
*
* Get currencies
*
+ * Returns a list of all defined Currency objects.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllCurrencies'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -2853,6 +3289,8 @@ public function listAllCurrencies(
*
* Get currencies
*
+ * Returns a list of all defined Currency objects.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllCurrencies'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -2966,6 +3404,8 @@ public function listAllCurrenciesWithHttpInfo(string $contentType = self::conten
*
* Get currencies
*
+ * Returns a list of all defined Currency objects.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllCurrencies'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -2991,6 +3431,8 @@ function ($response) {
*
* Get currencies
*
+ * Returns a list of all defined Currency objects.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllCurrencies'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -3143,6 +3585,8 @@ public function listAllCurrenciesRequest(string $contentType = self::contentType
*
* Get currency exchange rates
*
+ * Returns a list of all Exchange Rate Pairs for all supported Currencies.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllCurrenciesRates'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -3165,6 +3609,8 @@ public function listAllCurrenciesRates(
*
* Get currency exchange rates
*
+ * Returns a list of all Exchange Rate Pairs for all supported Currencies.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllCurrenciesRates'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
@@ -3278,6 +3724,8 @@ public function listAllCurrenciesRatesWithHttpInfo(string $contentType = self::c
*
* Get currency exchange rates
*
+ * Returns a list of all Exchange Rate Pairs for all supported Currencies.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllCurrenciesRates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -3303,6 +3751,8 @@ function ($response) {
*
* Get currency exchange rates
*
+ * Returns a list of all Exchange Rate Pairs for all supported Currencies.
+ *
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['listAllCurrenciesRates'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
@@ -3453,11 +3903,13 @@ public function listAllCurrenciesRatesRequest(string $contentType = self::conten
/**
* Operation symbolSearchUserAccount
*
- * Search for symbols available in an account
+ * Search account symbols
+ *
+ * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned. The search results are further limited to the symbols supported by the brokerage for which the account is under.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param string $account_id The ID of the account to search for symbols within. (required)
+ * @param string $account_id account_id (required)
* @param \SnapTrade\Model\SymbolQuery $symbol_query symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['symbolSearchUserAccount'] to see the possible values for this operation
*
@@ -3485,11 +3937,13 @@ public function symbolSearchUserAccount(
/**
* Operation symbolSearchUserAccountWithHttpInfo
*
- * Search for symbols available in an account
+ * Search account symbols
+ *
+ * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned. The search results are further limited to the symbols supported by the brokerage for which the account is under.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to search for symbols within. (required)
+ * @param string $account_id (required)
* @param \SnapTrade\Model\SymbolQuery $symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['symbolSearchUserAccount'] to see the possible values for this operation
*
@@ -3606,11 +4060,13 @@ public function symbolSearchUserAccountWithHttpInfo($user_id, $user_secret, $acc
/**
* Operation symbolSearchUserAccountAsync
*
- * Search for symbols available in an account
+ * Search account symbols
+ *
+ * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned. The search results are further limited to the symbols supported by the brokerage for which the account is under.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to search for symbols within. (required)
+ * @param string $account_id (required)
* @param \SnapTrade\Model\SymbolQuery $symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['symbolSearchUserAccount'] to see the possible values for this operation
*
@@ -3641,11 +4097,13 @@ function ($response) {
/**
* Operation symbolSearchUserAccountAsyncWithHttpInfo
*
- * Search for symbols available in an account
+ * Search account symbols
+ *
+ * Returns a list of Universal Symbol objects that match the given query. The matching takes into consideration both the ticker and the name of the symbol. Only the first 20 results are returned. The search results are further limited to the symbols supported by the brokerage for which the account is under.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to search for symbols within. (required)
+ * @param string $account_id (required)
* @param \SnapTrade\Model\SymbolQuery $symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['symbolSearchUserAccount'] to see the possible values for this operation
*
@@ -3701,7 +4159,7 @@ function ($exception) {
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to search for symbols within. (required)
+ * @param string $account_id (required)
* @param \SnapTrade\Model\SymbolQuery $symbol_query (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['symbolSearchUserAccount'] to see the possible values for this operation
*
@@ -3793,7 +4251,7 @@ public function symbolSearchUserAccountRequest($user_id, $user_secret, $account_
$headers = $this->headerSelector->selectHeaders(
- ['*/*', ],
+ ['application/json', ],
$contentType,
$multipart
);
diff --git a/lib/Api/TradingApi.php b/lib/Api/TradingApi.php
index 2e1a4ac..f795410 100644
--- a/lib/Api/TradingApi.php
+++ b/lib/Api/TradingApi.php
@@ -62,21 +62,45 @@ class TradingApi extends \SnapTrade\CustomApi
/** @var string[] $contentTypes **/
public const contentTypes = [
+ 'cancelOrder' => [
+ 'application/json',
+ ],
'cancelUserAccountOrder' => [
'application/json',
],
+ 'getCryptocurrencyPairQuote' => [
+ 'application/json',
+ ],
'getOrderImpact' => [
'application/json',
],
'getUserAccountQuotes' => [
'application/json',
],
+ 'placeBracketOrder' => [
+ 'application/json',
+ ],
+ 'placeCryptoOrder' => [
+ 'application/json',
+ ],
'placeForceOrder' => [
'application/json',
],
+ 'placeMlegOrder' => [
+ 'application/json',
+ ],
'placeOrder' => [
'application/json',
],
+ 'previewCryptoOrder' => [
+ 'application/json',
+ ],
+ 'replaceOrder' => [
+ 'application/json',
+ ],
+ 'searchCryptocurrencyPairInstruments' => [
+ 'application/json',
+ ],
];
/**
@@ -148,55 +172,59 @@ private function setRequestBodyProperty(&$body, $property, $value) {
}
/**
- * Operation cancelUserAccountOrder
+ * Operation cancelOrder
+ *
+ * Cancel order
*
- * Cancel open order in account
+ * Cancels an order in the specified account. Accepts order IDs for all asset types.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param string $account_id The ID of the account to cancel the order in. (required)
- * @param \SnapTrade\Model\TradingCancelUserAccountOrderRequest $trading_cancel_user_account_order_request The Order ID to be canceled (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
+ * @param string $account_id account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOrder'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ * @return \SnapTrade\Model\CancelOrderResponse|\SnapTrade\Model\Model400FailedRequestResponse
*/
- public function cancelUserAccountOrder(
+ public function cancelOrder(
+ $brokerage_order_id,
$user_id,
$user_secret,
$account_id,
- $brokerage_order_id = SENTINEL_VALUE,
- string $contentType = self::contentTypes['cancelUserAccountOrder'][0]
+ string $contentType = self::contentTypes['cancelOrder'][0]
)
{
$_body = [];
$this->setRequestBodyProperty($_body, "brokerage_order_id", $brokerage_order_id);
- $trading_cancel_user_account_order_request = $_body;
+ $account_information_get_user_account_order_detail_request = $_body;
- list($response) = $this->cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $account_id, $trading_cancel_user_account_order_request, $contentType);
+ list($response) = $this->cancelOrderWithHttpInfo($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, $contentType);
return $response;
}
/**
- * Operation cancelUserAccountOrderWithHttpInfo
+ * Operation cancelOrderWithHttpInfo
+ *
+ * Cancel order
*
- * Cancel open order in account
+ * Cancels an order in the specified account. Accepts order IDs for all asset types.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to cancel the order in. (required)
- * @param \SnapTrade\Model\TradingCancelUserAccountOrderRequest $trading_cancel_user_account_order_request The Order ID to be canceled (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOrder'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\CancelOrderResponse|\SnapTrade\Model\Model400FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $account_id, $trading_cancel_user_account_order_request, string $contentType = self::contentTypes['cancelUserAccountOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function cancelOrderWithHttpInfo($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['cancelOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->cancelUserAccountOrderRequest($user_id, $user_secret, $account_id, $trading_cancel_user_account_order_request, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->cancelOrderRequest($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
@@ -211,11 +239,11 @@ public function cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $acco
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->cancelUserAccountOrderWithHttpInfo(
+ return $this->cancelOrderWithHttpInfo(
$user_id,
$user_secret,
$account_id,
- $trading_cancel_user_account_order_request,
+ $account_information_get_user_account_order_detail_request,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -253,17 +281,17 @@ public function cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $acco
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\AccountOrderRecord' === '\SplFileObject') {
+ if ('\SnapTrade\Model\CancelOrderResponse' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\AccountOrderRecord' !== 'string') {
+ if ('\SnapTrade\Model\CancelOrderResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\CancelOrderResponse', []),
$response->getStatusCode(),
$response->getHeaders()
];
@@ -282,24 +310,9 @@ public function cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $acco
$response->getStatusCode(),
$response->getHeaders()
];
- case 500:
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
- $content = $response->getBody(); //stream goes to serializer
- } else {
- $content = (string) $response->getBody();
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
- $content = json_decode($content);
- }
- }
-
- return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
- $response->getStatusCode(),
- $response->getHeaders()
- ];
}
- $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ $returnType = '\SnapTrade\Model\CancelOrderResponse';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -320,7 +333,7 @@ public function cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $acco
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\AccountOrderRecord',
+ '\SnapTrade\Model\CancelOrderResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -333,47 +346,41 @@ public function cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $acco
);
$e->setResponseObject($data);
break;
- case 500:
- $data = ObjectSerializer::deserialize(
- $e->getResponseBody(),
- '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
- $e->getResponseHeaders()
- );
- $e->setResponseObject($data);
- break;
}
throw $e;
}
}
/**
- * Operation cancelUserAccountOrderAsync
+ * Operation cancelOrderAsync
*
- * Cancel open order in account
+ * Cancel order
+ *
+ * Cancels an order in the specified account. Accepts order IDs for all asset types.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to cancel the order in. (required)
- * @param \SnapTrade\Model\TradingCancelUserAccountOrderRequest $trading_cancel_user_account_order_request The Order ID to be canceled (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function cancelUserAccountOrderAsync(
+ public function cancelOrderAsync(
+ $brokerage_order_id,
$user_id,
$user_secret,
$account_id,
- $brokerage_order_id = SENTINEL_VALUE,
- string $contentType = self::contentTypes['cancelUserAccountOrder'][0]
+ string $contentType = self::contentTypes['cancelOrder'][0]
)
{
$_body = [];
$this->setRequestBodyProperty($_body, "brokerage_order_id", $brokerage_order_id);
- $trading_cancel_user_account_order_request = $_body;
+ $account_information_get_user_account_order_detail_request = $_body;
- return $this->cancelUserAccountOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $trading_cancel_user_account_order_request, $contentType)
+ return $this->cancelOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, $contentType)
->then(
function ($response) {
return $response[0];
@@ -382,23 +389,25 @@ function ($response) {
}
/**
- * Operation cancelUserAccountOrderAsyncWithHttpInfo
+ * Operation cancelOrderAsyncWithHttpInfo
+ *
+ * Cancel order
*
- * Cancel open order in account
+ * Cancels an order in the specified account. Accepts order IDs for all asset types.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to cancel the order in. (required)
- * @param \SnapTrade\Model\TradingCancelUserAccountOrderRequest $trading_cancel_user_account_order_request The Order ID to be canceled (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function cancelUserAccountOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $trading_cancel_user_account_order_request, string $contentType = self::contentTypes['cancelUserAccountOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function cancelOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['cancelOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\AccountOrderRecord';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->cancelUserAccountOrderRequest($user_id, $user_secret, $account_id, $trading_cancel_user_account_order_request, $contentType);
+ $returnType = '\SnapTrade\Model\CancelOrderResponse';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->cancelOrderRequest($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
@@ -440,18 +449,18 @@ function ($exception) {
}
/**
- * Create request for operation 'cancelUserAccountOrder'
+ * Create request for operation 'cancelOrder'
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $account_id The ID of the account to cancel the order in. (required)
- * @param \SnapTrade\Model\TradingCancelUserAccountOrderRequest $trading_cancel_user_account_order_request The Order ID to be canceled (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function cancelUserAccountOrderRequest($user_id, $user_secret, $account_id, $trading_cancel_user_account_order_request, string $contentType = self::contentTypes['cancelUserAccountOrder'][0])
+ public function cancelOrderRequest($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['cancelOrder'][0])
{
// Check if $user_id is a string
@@ -461,7 +470,7 @@ public function cancelUserAccountOrderRequest($user_id, $user_secret, $account_i
// 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 cancelUserAccountOrder'
+ 'Missing the required parameter user_id when calling cancelOrder'
);
}
// Check if $user_secret is a string
@@ -471,7 +480,7 @@ public function cancelUserAccountOrderRequest($user_id, $user_secret, $account_i
// 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 cancelUserAccountOrder'
+ 'Missing the required parameter user_secret when calling cancelOrder'
);
}
// Check if $account_id is a string
@@ -481,26 +490,26 @@ public function cancelUserAccountOrderRequest($user_id, $user_secret, $account_i
// 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 cancelUserAccountOrder'
+ 'Missing the required parameter account_id when calling cancelOrder'
);
}
- if ($trading_cancel_user_account_order_request !== SENTINEL_VALUE) {
- if (!($trading_cancel_user_account_order_request instanceof \SnapTrade\Model\TradingCancelUserAccountOrderRequest)) {
- if (!is_array($trading_cancel_user_account_order_request))
- throw new \InvalidArgumentException('"trading_cancel_user_account_order_request" must be associative array or an instance of \SnapTrade\Model\TradingCancelUserAccountOrderRequest TradingApi.cancelUserAccountOrder.');
+ if ($account_information_get_user_account_order_detail_request !== SENTINEL_VALUE) {
+ if (!($account_information_get_user_account_order_detail_request instanceof \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest)) {
+ if (!is_array($account_information_get_user_account_order_detail_request))
+ throw new \InvalidArgumentException('"account_information_get_user_account_order_detail_request" must be associative array or an instance of \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest TradingApi.cancelOrder.');
else
- $trading_cancel_user_account_order_request = new \SnapTrade\Model\TradingCancelUserAccountOrderRequest($trading_cancel_user_account_order_request);
+ $account_information_get_user_account_order_detail_request = new \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest($account_information_get_user_account_order_detail_request);
}
}
- // verify the required parameter 'trading_cancel_user_account_order_request' is set
- if ($trading_cancel_user_account_order_request === SENTINEL_VALUE || (is_array($trading_cancel_user_account_order_request) && count($trading_cancel_user_account_order_request) === 0)) {
+ // verify the required parameter 'account_information_get_user_account_order_detail_request' is set
+ if ($account_information_get_user_account_order_detail_request === SENTINEL_VALUE || (is_array($account_information_get_user_account_order_detail_request) && count($account_information_get_user_account_order_detail_request) === 0)) {
throw new \InvalidArgumentException(
- 'Missing the required parameter trading_cancel_user_account_order_request when calling cancelUserAccountOrder'
+ 'Missing the required parameter account_information_get_user_account_order_detail_request when calling cancelOrder'
);
}
- $resourcePath = '/accounts/{accountId}/orders/cancel';
+ $resourcePath = '/accounts/{accountId}/trading/cancel';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -548,12 +557,12 @@ public function cancelUserAccountOrderRequest($user_id, $user_secret, $account_i
);
// for model (json/xml)
- if (isset($trading_cancel_user_account_order_request)) {
+ if (isset($account_information_get_user_account_order_detail_request)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
- $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($trading_cancel_user_account_order_request));
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($account_information_get_user_account_order_detail_request));
} else {
- $httpBody = $trading_cancel_user_account_order_request;
+ $httpBody = $account_information_get_user_account_order_detail_request;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@@ -623,68 +632,61 @@ public function cancelUserAccountOrderRequest($user_id, $user_secret, $account_i
}
/**
- * Operation getOrderImpact
+ * Operation cancelUserAccountOrder
*
- * Check the impact of a trade on an account
+ * Cancel equity order
+ *
+ * **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) ** Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ * @param string $account_id account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\ManualTradeAndImpact|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse
+ * @return \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ * @deprecated
*/
- public function getOrderImpact(
+ public function cancelUserAccountOrder(
+ $brokerage_order_id,
$user_id,
$user_secret,
- $account_id = SENTINEL_VALUE,
- $action = SENTINEL_VALUE,
- $order_type = SENTINEL_VALUE,
- $price = SENTINEL_VALUE,
- $stop = SENTINEL_VALUE,
- $time_in_force = SENTINEL_VALUE,
- $units = SENTINEL_VALUE,
- $universal_symbol_id = SENTINEL_VALUE,
- $notional_value = SENTINEL_VALUE,
- string $contentType = self::contentTypes['getOrderImpact'][0]
+ $account_id,
+ string $contentType = self::contentTypes['cancelUserAccountOrder'][0]
)
{
$_body = [];
- $this->setRequestBodyProperty($_body, "account_id", $account_id);
- $this->setRequestBodyProperty($_body, "action", $action);
- $this->setRequestBodyProperty($_body, "order_type", $order_type);
- $this->setRequestBodyProperty($_body, "price", $price);
- $this->setRequestBodyProperty($_body, "stop", $stop);
- $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
- $this->setRequestBodyProperty($_body, "units", $units);
- $this->setRequestBodyProperty($_body, "universal_symbol_id", $universal_symbol_id);
- $this->setRequestBodyProperty($_body, "notional_value", $notional_value);
- $manual_trade_form = $_body;
+ $this->setRequestBodyProperty($_body, "brokerage_order_id", $brokerage_order_id);
+ $account_information_get_user_account_order_detail_request = $_body;
- list($response) = $this->getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade_form, $contentType);
+ list($response) = $this->cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, $contentType);
return $response;
}
/**
- * Operation getOrderImpactWithHttpInfo
+ * Operation cancelUserAccountOrderWithHttpInfo
*
- * Check the impact of a trade on an account
+ * Cancel equity order
+ *
+ * **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) ** Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\ManualTradeAndImpact|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ * @deprecated
*/
- public function getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['getOrderImpact'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function cancelUserAccountOrderWithHttpInfo($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['cancelUserAccountOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getOrderImpactRequest($user_id, $user_secret, $manual_trade_form, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->cancelUserAccountOrderRequest($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
@@ -699,10 +701,11 @@ public function getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getOrderImpactWithHttpInfo(
+ return $this->cancelUserAccountOrderWithHttpInfo(
$user_id,
$user_secret,
- $manual_trade_form,
+ $account_id,
+ $account_information_get_user_account_order_detail_request,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -740,17 +743,17 @@ public function getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\ManualTradeAndImpact' === '\SplFileObject') {
+ if ('\SnapTrade\Model\AccountOrderRecord' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\ManualTradeAndImpact' !== 'string') {
+ if ('\SnapTrade\Model\AccountOrderRecord' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\ManualTradeAndImpact', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord', []),
$response->getStatusCode(),
$response->getHeaders()
];
@@ -769,24 +772,24 @@ public function getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade
$response->getStatusCode(),
$response->getHeaders()
];
- case 403:
- if ('\SnapTrade\Model\Model403FailedRequestResponse' === '\SplFileObject') {
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\Model403FailedRequestResponse' !== 'string') {
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FailedRequestResponse', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
- $returnType = '\SnapTrade\Model\ManualTradeAndImpact';
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -807,7 +810,7 @@ public function getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\ManualTradeAndImpact',
+ '\SnapTrade\Model\AccountOrderRecord',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -820,10 +823,10 @@ public function getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade
);
$e->setResponseObject($data);
break;
- case 403:
+ case 500:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\Model403FailedRequestResponse',
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -834,47 +837,36 @@ public function getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade
}
/**
- * Operation getOrderImpactAsync
+ * Operation cancelUserAccountOrderAsync
*
- * Check the impact of a trade on an account
+ * Cancel equity order
+ *
+ * **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) ** Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
+ * @deprecated
*/
- public function getOrderImpactAsync(
+ public function cancelUserAccountOrderAsync(
+ $brokerage_order_id,
$user_id,
$user_secret,
- $account_id = SENTINEL_VALUE,
- $action = SENTINEL_VALUE,
- $order_type = SENTINEL_VALUE,
- $price = SENTINEL_VALUE,
- $stop = SENTINEL_VALUE,
- $time_in_force = SENTINEL_VALUE,
- $units = SENTINEL_VALUE,
- $universal_symbol_id = SENTINEL_VALUE,
- $notional_value = SENTINEL_VALUE,
- string $contentType = self::contentTypes['getOrderImpact'][0]
+ $account_id,
+ string $contentType = self::contentTypes['cancelUserAccountOrder'][0]
)
{
$_body = [];
- $this->setRequestBodyProperty($_body, "account_id", $account_id);
- $this->setRequestBodyProperty($_body, "action", $action);
- $this->setRequestBodyProperty($_body, "order_type", $order_type);
- $this->setRequestBodyProperty($_body, "price", $price);
- $this->setRequestBodyProperty($_body, "stop", $stop);
- $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
- $this->setRequestBodyProperty($_body, "units", $units);
- $this->setRequestBodyProperty($_body, "universal_symbol_id", $universal_symbol_id);
- $this->setRequestBodyProperty($_body, "notional_value", $notional_value);
- $manual_trade_form = $_body;
+ $this->setRequestBodyProperty($_body, "brokerage_order_id", $brokerage_order_id);
+ $account_information_get_user_account_order_detail_request = $_body;
- return $this->getOrderImpactAsyncWithHttpInfo($user_id, $user_secret, $manual_trade_form, $contentType)
+ return $this->cancelUserAccountOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, $contentType)
->then(
function ($response) {
return $response[0];
@@ -883,22 +875,26 @@ function ($response) {
}
/**
- * Operation getOrderImpactAsyncWithHttpInfo
+ * Operation cancelUserAccountOrderAsyncWithHttpInfo
*
- * Check the impact of a trade on an account
+ * Cancel equity order
+ *
+ * **This endpoint is deprecated. Please switch to [the new cancel order endpoint](/reference/Trading/Trading_cancelOrder) ** Attempts to cancel an open order with the brokerage. If the order is no longer cancellable, the request will be rejected.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
+ * @deprecated
*/
- public function getOrderImpactAsyncWithHttpInfo($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['getOrderImpact'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function cancelUserAccountOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['cancelUserAccountOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\ManualTradeAndImpact';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getOrderImpactRequest($user_id, $user_secret, $manual_trade_form, $contentType);
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->cancelUserAccountOrderRequest($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
@@ -940,17 +936,19 @@ function ($exception) {
}
/**
- * Create request for operation 'getOrderImpact'
+ * Create request for operation 'cancelUserAccountOrder'
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest $account_information_get_user_account_order_detail_request (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelUserAccountOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
+ * @deprecated
*/
- public function getOrderImpactRequest($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['getOrderImpact'][0])
+ public function cancelUserAccountOrderRequest($user_id, $user_secret, $account_id, $account_information_get_user_account_order_detail_request, string $contentType = self::contentTypes['cancelUserAccountOrder'][0])
{
// Check if $user_id is a string
@@ -960,7 +958,7 @@ public function getOrderImpactRequest($user_id, $user_secret, $manual_trade_form
// 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 getOrderImpact'
+ 'Missing the required parameter user_id when calling cancelUserAccountOrder'
);
}
// Check if $user_secret is a string
@@ -970,26 +968,36 @@ public function getOrderImpactRequest($user_id, $user_secret, $manual_trade_form
// 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 getOrderImpact'
+ 'Missing the required parameter user_secret when calling cancelUserAccountOrder'
);
}
- if ($manual_trade_form !== SENTINEL_VALUE) {
- if (!($manual_trade_form instanceof \SnapTrade\Model\ManualTradeForm)) {
- if (!is_array($manual_trade_form))
- throw new \InvalidArgumentException('"manual_trade_form" must be associative array or an instance of \SnapTrade\Model\ManualTradeForm TradingApi.getOrderImpact.');
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 cancelUserAccountOrder'
+ );
+ }
+ if ($account_information_get_user_account_order_detail_request !== SENTINEL_VALUE) {
+ if (!($account_information_get_user_account_order_detail_request instanceof \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest)) {
+ if (!is_array($account_information_get_user_account_order_detail_request))
+ throw new \InvalidArgumentException('"account_information_get_user_account_order_detail_request" must be associative array or an instance of \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest TradingApi.cancelUserAccountOrder.');
else
- $manual_trade_form = new \SnapTrade\Model\ManualTradeForm($manual_trade_form);
+ $account_information_get_user_account_order_detail_request = new \SnapTrade\Model\AccountInformationGetUserAccountOrderDetailRequest($account_information_get_user_account_order_detail_request);
}
}
- // verify the required parameter 'manual_trade_form' is set
- if ($manual_trade_form === SENTINEL_VALUE || (is_array($manual_trade_form) && count($manual_trade_form) === 0)) {
+ // verify the required parameter 'account_information_get_user_account_order_detail_request' is set
+ if ($account_information_get_user_account_order_detail_request === SENTINEL_VALUE || (is_array($account_information_get_user_account_order_detail_request) && count($account_information_get_user_account_order_detail_request) === 0)) {
throw new \InvalidArgumentException(
- 'Missing the required parameter manual_trade_form when calling getOrderImpact'
+ 'Missing the required parameter account_information_get_user_account_order_detail_request when calling cancelUserAccountOrder'
);
}
- $resourcePath = '/trade/impact';
+ $resourcePath = '/accounts/{accountId}/orders/cancel';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -1020,6 +1028,14 @@ public function getOrderImpactRequest($user_id, $user_secret, $manual_trade_form
}
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
$headers = $this->headerSelector->selectHeaders(
@@ -1029,12 +1045,12 @@ public function getOrderImpactRequest($user_id, $user_secret, $manual_trade_form
);
// for model (json/xml)
- if (isset($manual_trade_form)) {
+ if (isset($account_information_get_user_account_order_detail_request)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
- $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($manual_trade_form));
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($account_information_get_user_account_order_detail_request));
} else {
- $httpBody = $manual_trade_form;
+ $httpBody = $account_information_get_user_account_order_detail_request;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@@ -1104,55 +1120,56 @@ public function getOrderImpactRequest($user_id, $user_secret, $manual_trade_form
}
/**
- * Operation getUserAccountQuotes
+ * Operation getCryptocurrencyPairQuote
*
- * Get symbol quotes
+ * Get crypto pair quote
+ *
+ * Gets a quote for the specified account.
*
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param string $symbols List of universal_symbol_id or tickers to get quotes for. (required)
- * @param string $account_id The ID of the account to get quotes. (required)
- * @param bool $use_ticker Should be set to True if providing tickers. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ * @param string $account_id account_id (required)
+ * @param string $instrument_symbol instrument_symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCryptocurrencyPairQuote'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\SymbolsQuotesInner[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ * @return \SnapTrade\Model\CryptocurrencyPairQuote|\SnapTrade\Model\Model400FailedRequestResponse
*/
- public function getUserAccountQuotes(
+ public function getCryptocurrencyPairQuote(
$user_id,
$user_secret,
- $symbols,
$account_id,
- $use_ticker = SENTINEL_VALUE,
+ $instrument_symbol,
- string $contentType = self::contentTypes['getUserAccountQuotes'][0]
+ string $contentType = self::contentTypes['getCryptocurrencyPairQuote'][0]
)
{
- list($response) = $this->getUserAccountQuotesWithHttpInfo($user_id, $user_secret, $symbols, $account_id, $use_ticker, $contentType);
+ list($response) = $this->getCryptocurrencyPairQuoteWithHttpInfo($user_id, $user_secret, $account_id, $instrument_symbol, $contentType);
return $response;
}
/**
- * Operation getUserAccountQuotesWithHttpInfo
+ * Operation getCryptocurrencyPairQuoteWithHttpInfo
+ *
+ * Get crypto pair quote
*
- * Get symbol quotes
+ * Gets a quote for the specified account.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $symbols List of universal_symbol_id or tickers to get quotes for. (required)
- * @param string $account_id The ID of the account to get quotes. (required)
- * @param bool $use_ticker Should be set to True if providing tickers. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $instrument_symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCryptocurrencyPairQuote'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\SymbolsQuotesInner[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\CryptocurrencyPairQuote|\SnapTrade\Model\Model400FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function getUserAccountQuotesWithHttpInfo($user_id, $user_secret, $symbols, $account_id, $use_ticker = null, string $contentType = self::contentTypes['getUserAccountQuotes'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function getCryptocurrencyPairQuoteWithHttpInfo($user_id, $user_secret, $account_id, $instrument_symbol, string $contentType = self::contentTypes['getCryptocurrencyPairQuote'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $account_id, $use_ticker, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getCryptocurrencyPairQuoteRequest($user_id, $user_secret, $account_id, $instrument_symbol, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config);
@@ -1167,12 +1184,11 @@ public function getUserAccountQuotesWithHttpInfo($user_id, $user_secret, $symbol
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->getUserAccountQuotesWithHttpInfo(
+ return $this->getCryptocurrencyPairQuoteWithHttpInfo(
$user_id,
$user_secret,
- $symbols,
$account_id,
- $use_ticker,
+ $instrument_symbol,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -1210,38 +1226,38 @@ public function getUserAccountQuotesWithHttpInfo($user_id, $user_secret, $symbol
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\SymbolsQuotesInner[]' === '\SplFileObject') {
+ if ('\SnapTrade\Model\CryptocurrencyPairQuote' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\SymbolsQuotesInner[]' !== 'string') {
+ if ('\SnapTrade\Model\CryptocurrencyPairQuote' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\SymbolsQuotesInner[]', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\CryptocurrencyPairQuote', []),
$response->getStatusCode(),
$response->getHeaders()
];
- case 500:
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
$response->getStatusCode(),
$response->getHeaders()
];
}
- $returnType = '\SnapTrade\Model\SymbolsQuotesInner[]';
+ $returnType = '\SnapTrade\Model\CryptocurrencyPairQuote';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -1262,15 +1278,15 @@ public function getUserAccountQuotesWithHttpInfo($user_id, $user_secret, $symbol
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\SymbolsQuotesInner[]',
+ '\SnapTrade\Model\CryptocurrencyPairQuote',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
break;
- case 500:
+ case 400:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
+ '\SnapTrade\Model\Model400FailedRequestResponse',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -1281,32 +1297,3921 @@ public function getUserAccountQuotesWithHttpInfo($user_id, $user_secret, $symbol
}
/**
- * Operation getUserAccountQuotesAsync
+ * Operation getCryptocurrencyPairQuoteAsync
+ *
+ * Get crypto pair quote
*
- * Get symbol quotes
+ * Gets a quote for the specified account.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $symbols List of universal_symbol_id or tickers to get quotes for. (required)
- * @param string $account_id The ID of the account to get quotes. (required)
- * @param bool $use_ticker Should be set to True if providing tickers. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $instrument_symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCryptocurrencyPairQuote'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountQuotesAsync(
+ public function getCryptocurrencyPairQuoteAsync(
$user_id,
$user_secret,
- $symbols,
$account_id,
- $use_ticker = SENTINEL_VALUE,
+ $instrument_symbol,
+
+ string $contentType = self::contentTypes['getCryptocurrencyPairQuote'][0]
+ )
+ {
+
+ return $this->getCryptocurrencyPairQuoteAsyncWithHttpInfo($user_id, $user_secret, $account_id, $instrument_symbol, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getCryptocurrencyPairQuoteAsyncWithHttpInfo
+ *
+ * Get crypto pair quote
+ *
+ * Gets a quote for the specified account.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $instrument_symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCryptocurrencyPairQuote'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getCryptocurrencyPairQuoteAsyncWithHttpInfo($user_id, $user_secret, $account_id, $instrument_symbol, string $contentType = self::contentTypes['getCryptocurrencyPairQuote'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\CryptocurrencyPairQuote';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getCryptocurrencyPairQuoteRequest($user_id, $user_secret, $account_id, $instrument_symbol, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getCryptocurrencyPairQuote'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param string $instrument_symbol (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getCryptocurrencyPairQuote'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getCryptocurrencyPairQuoteRequest($user_id, $user_secret, $account_id, $instrument_symbol, string $contentType = self::contentTypes['getCryptocurrencyPairQuote'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getCryptocurrencyPairQuote'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getCryptocurrencyPairQuote'
+ );
+ }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getCryptocurrencyPairQuote'
+ );
+ }
+ // Check if $instrument_symbol is a string
+ if ($instrument_symbol !== SENTINEL_VALUE && !is_string($instrument_symbol)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($instrument_symbol, true), gettype($instrument_symbol)));
+ }
+ // verify the required parameter 'instrument_symbol' is set
+ if ($instrument_symbol === SENTINEL_VALUE || (is_array($instrument_symbol) && count($instrument_symbol) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter instrument_symbol when calling getCryptocurrencyPairQuote'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/trading/instruments/cryptocurrencyPairs/{instrumentSymbol}/quote';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+ // path params
+ if ($instrument_symbol !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'instrumentSymbol' . '}',
+ ObjectSerializer::toPathValue($instrument_symbol),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation getOrderImpact
+ *
+ * Check equity order impact
+ *
+ * Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form manual_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\ManualTradeAndImpact|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse
+ */
+ public function getOrderImpact(
+
+ $account_id,
+ $action,
+ $universal_symbol_id,
+ $order_type,
+ $time_in_force,
+ $user_id,
+ $user_secret,
+ $price = SENTINEL_VALUE,
+ $stop = SENTINEL_VALUE,
+ $units = SENTINEL_VALUE,
+ $notional_value = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['getOrderImpact'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "account_id", $account_id);
+ $this->setRequestBodyProperty($_body, "action", $action);
+ $this->setRequestBodyProperty($_body, "universal_symbol_id", $universal_symbol_id);
+ $this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "price", $price);
+ $this->setRequestBodyProperty($_body, "stop", $stop);
+ $this->setRequestBodyProperty($_body, "units", $units);
+ $this->setRequestBodyProperty($_body, "notional_value", $notional_value);
+ $manual_trade_form = $_body;
+
+ list($response) = $this->getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade_form, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getOrderImpactWithHttpInfo
+ *
+ * Check equity order impact
+ *
+ * Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\ManualTradeAndImpact|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function getOrderImpactWithHttpInfo($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['getOrderImpact'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getOrderImpactRequest($user_id, $user_secret, $manual_trade_form, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getOrderImpactWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $manual_trade_form,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\ManualTradeAndImpact' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\ManualTradeAndImpact' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\ManualTradeAndImpact', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 403:
+ if ('\SnapTrade\Model\Model403FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model403FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\ManualTradeAndImpact';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\ManualTradeAndImpact',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model403FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getOrderImpactAsync
+ *
+ * Check equity order impact
+ *
+ * Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getOrderImpactAsync(
+
+ $account_id,
+ $action,
+ $universal_symbol_id,
+ $order_type,
+ $time_in_force,
+ $user_id,
+ $user_secret,
+ $price = SENTINEL_VALUE,
+ $stop = SENTINEL_VALUE,
+ $units = SENTINEL_VALUE,
+ $notional_value = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['getOrderImpact'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "account_id", $account_id);
+ $this->setRequestBodyProperty($_body, "action", $action);
+ $this->setRequestBodyProperty($_body, "universal_symbol_id", $universal_symbol_id);
+ $this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "price", $price);
+ $this->setRequestBodyProperty($_body, "stop", $stop);
+ $this->setRequestBodyProperty($_body, "units", $units);
+ $this->setRequestBodyProperty($_body, "notional_value", $notional_value);
+ $manual_trade_form = $_body;
+
+ return $this->getOrderImpactAsyncWithHttpInfo($user_id, $user_secret, $manual_trade_form, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getOrderImpactAsyncWithHttpInfo
+ *
+ * Check equity order impact
+ *
+ * Simulates an order and its impact on the account. This endpoint does not place the order with the brokerage. If successful, it returns a `Trade` object and the ID of the object can be used to place the order with the brokerage using the [place checked order endpoint](/reference/Trading/Trading_placeOrder). Please note that the `Trade` object returned expires after 5 minutes. Any order placed using an expired `Trade` will be rejected.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getOrderImpactAsyncWithHttpInfo($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['getOrderImpact'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\ManualTradeAndImpact';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getOrderImpactRequest($user_id, $user_secret, $manual_trade_form, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getOrderImpact'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getOrderImpact'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getOrderImpactRequest($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['getOrderImpact'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getOrderImpact'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getOrderImpact'
+ );
+ }
+ if ($manual_trade_form !== SENTINEL_VALUE) {
+ if (!($manual_trade_form instanceof \SnapTrade\Model\ManualTradeForm)) {
+ if (!is_array($manual_trade_form))
+ throw new \InvalidArgumentException('"manual_trade_form" must be associative array or an instance of \SnapTrade\Model\ManualTradeForm TradingApi.getOrderImpact.');
+ else
+ $manual_trade_form = new \SnapTrade\Model\ManualTradeForm($manual_trade_form);
+ }
+ }
+ // verify the required parameter 'manual_trade_form' is set
+ if ($manual_trade_form === SENTINEL_VALUE || (is_array($manual_trade_form) && count($manual_trade_form) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter manual_trade_form when calling getOrderImpact'
+ );
+ }
+
+
+ $resourcePath = '/trade/impact';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($manual_trade_form)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($manual_trade_form));
+ } else {
+ $httpBody = $manual_trade_form;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'POST';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation getUserAccountQuotes
+ *
+ * Get equity symbol quotes
+ *
+ * Returns quotes from the brokerage for the specified symbols and account. The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint. This endpoint does not work for options quotes. This endpoint is disabled for free plans by default. Please contact support to enable this endpoint if needed.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $symbols List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator (required)
+ * @param string $account_id account_id (required)
+ * @param bool $use_ticker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\SymbolsQuotesInner[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse
+ */
+ public function getUserAccountQuotes(
+ $user_id,
+ $user_secret,
+ $symbols,
+ $account_id,
+ $use_ticker = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['getUserAccountQuotes'][0]
+ )
+ {
+
+ list($response) = $this->getUserAccountQuotesWithHttpInfo($user_id, $user_secret, $symbols, $account_id, $use_ticker, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation getUserAccountQuotesWithHttpInfo
+ *
+ * Get equity symbol quotes
+ *
+ * Returns quotes from the brokerage for the specified symbols and account. The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint. This endpoint does not work for options quotes. This endpoint is disabled for free plans by default. Please contact support to enable this endpoint if needed.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $symbols List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator (required)
+ * @param string $account_id (required)
+ * @param bool $use_ticker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\SymbolsQuotesInner[]|\SnapTrade\Model\Model500UnexpectedExceptionResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function getUserAccountQuotesWithHttpInfo($user_id, $user_secret, $symbols, $account_id, $use_ticker = null, string $contentType = self::contentTypes['getUserAccountQuotes'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $account_id, $use_ticker, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->getUserAccountQuotesWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $symbols,
+ $account_id,
+ $use_ticker,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\SymbolsQuotesInner[]' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\SymbolsQuotesInner[]' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\SymbolsQuotesInner[]', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 500:
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model500UnexpectedExceptionResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model500UnexpectedExceptionResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\SymbolsQuotesInner[]';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\SymbolsQuotesInner[]',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 500:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model500UnexpectedExceptionResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation getUserAccountQuotesAsync
+ *
+ * Get equity symbol quotes
+ *
+ * Returns quotes from the brokerage for the specified symbols and account. The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint. This endpoint does not work for options quotes. This endpoint is disabled for free plans by default. Please contact support to enable this endpoint if needed.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $symbols List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator (required)
+ * @param string $account_id (required)
+ * @param bool $use_ticker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountQuotesAsync(
+ $user_id,
+ $user_secret,
+ $symbols,
+ $account_id,
+ $use_ticker = SENTINEL_VALUE,
string $contentType = self::contentTypes['getUserAccountQuotes'][0]
)
{
- return $this->getUserAccountQuotesAsyncWithHttpInfo($user_id, $user_secret, $symbols, $account_id, $use_ticker, $contentType)
+ return $this->getUserAccountQuotesAsyncWithHttpInfo($user_id, $user_secret, $symbols, $account_id, $use_ticker, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation getUserAccountQuotesAsyncWithHttpInfo
+ *
+ * Get equity symbol quotes
+ *
+ * Returns quotes from the brokerage for the specified symbols and account. The quotes returned can be delayed depending on the brokerage the account belongs to. It is highly recommended that you use your own market data provider for real-time quotes instead of relying on this endpoint. This endpoint does not work for options quotes. This endpoint is disabled for free plans by default. Please contact support to enable this endpoint if needed.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $symbols List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator (required)
+ * @param string $account_id (required)
+ * @param bool $use_ticker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function getUserAccountQuotesAsyncWithHttpInfo($user_id, $user_secret, $symbols, $account_id, $use_ticker = null, string $contentType = self::contentTypes['getUserAccountQuotes'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\SymbolsQuotesInner[]';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $account_id, $use_ticker, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'getUserAccountQuotes'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $symbols List of Universal Symbol IDs or tickers to get quotes for. When providing multiple values, use a comma as separator (required)
+ * @param string $account_id (required)
+ * @param bool $use_ticker Should be set to `True` if `symbols` are comprised of tickers. Defaults to `False` if not provided. (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $account_id, $use_ticker = SENTINEL_VALUE, string $contentType = self::contentTypes['getUserAccountQuotes'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 getUserAccountQuotes'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 getUserAccountQuotes'
+ );
+ }
+ // Check if $symbols is a string
+ if ($symbols !== SENTINEL_VALUE && !is_string($symbols)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($symbols, true), gettype($symbols)));
+ }
+ // verify the required parameter 'symbols' is set
+ if ($symbols === SENTINEL_VALUE || (is_array($symbols) && count($symbols) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter symbols when calling getUserAccountQuotes'
+ );
+ }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 getUserAccountQuotes'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/quotes';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($symbols !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $symbols,
+ 'symbols', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($use_ticker !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $use_ticker,
+ 'use_ticker', // param base name
+ 'boolean', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'GET';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation placeBracketOrder
+ *
+ * Place bracket order
+ *
+ * Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
+ *
+ * @param string $account_id The ID of the account to execute the trade on. (required)
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormBracket $manual_trade_form_bracket manual_trade_form_bracket (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeBracketOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse
+ */
+ public function placeBracketOrder(
+
+ $action,
+ $instrument,
+ $order_type,
+ $time_in_force,
+ $stop_loss,
+ $take_profit,
+ $account_id,
+ $user_id,
+ $user_secret,
+ $price = SENTINEL_VALUE,
+ $stop = SENTINEL_VALUE,
+ $units = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['placeBracketOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "action", $action);
+ $this->setRequestBodyProperty($_body, "instrument", $instrument);
+ $this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "price", $price);
+ $this->setRequestBodyProperty($_body, "stop", $stop);
+ $this->setRequestBodyProperty($_body, "units", $units);
+ $this->setRequestBodyProperty($_body, "stop_loss", $stop_loss);
+ $this->setRequestBodyProperty($_body, "take_profit", $take_profit);
+ $manual_trade_form_bracket = $_body;
+
+ list($response) = $this->placeBracketOrderWithHttpInfo($account_id, $user_id, $user_secret, $manual_trade_form_bracket, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation placeBracketOrderWithHttpInfo
+ *
+ * Place bracket order
+ *
+ * Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
+ *
+ * @param string $account_id The ID of the account to execute the trade on. (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormBracket $manual_trade_form_bracket (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeBracketOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function placeBracketOrderWithHttpInfo($account_id, $user_id, $user_secret, $manual_trade_form_bracket, string $contentType = self::contentTypes['placeBracketOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeBracketOrderRequest($account_id, $user_id, $user_secret, $manual_trade_form_bracket, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->placeBracketOrderWithHttpInfo(
+ $account_id,
+ $user_id,
+ $user_secret,
+ $manual_trade_form_bracket,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\AccountOrderRecord' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\AccountOrderRecord' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 403:
+ if ('\SnapTrade\Model\Model403FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model403FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\AccountOrderRecord',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model403FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation placeBracketOrderAsync
+ *
+ * Place bracket order
+ *
+ * Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
+ *
+ * @param string $account_id The ID of the account to execute the trade on. (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormBracket $manual_trade_form_bracket (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeBracketOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeBracketOrderAsync(
+
+ $action,
+ $instrument,
+ $order_type,
+ $time_in_force,
+ $stop_loss,
+ $take_profit,
+ $account_id,
+ $user_id,
+ $user_secret,
+ $price = SENTINEL_VALUE,
+ $stop = SENTINEL_VALUE,
+ $units = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['placeBracketOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "action", $action);
+ $this->setRequestBodyProperty($_body, "instrument", $instrument);
+ $this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "price", $price);
+ $this->setRequestBodyProperty($_body, "stop", $stop);
+ $this->setRequestBodyProperty($_body, "units", $units);
+ $this->setRequestBodyProperty($_body, "stop_loss", $stop_loss);
+ $this->setRequestBodyProperty($_body, "take_profit", $take_profit);
+ $manual_trade_form_bracket = $_body;
+
+ return $this->placeBracketOrderAsyncWithHttpInfo($account_id, $user_id, $user_secret, $manual_trade_form_bracket, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation placeBracketOrderAsyncWithHttpInfo
+ *
+ * Place bracket order
+ *
+ * Places a bracket order (entry order + OCO of stop loss and take profit). Disabled by default please contact support for use. Only supported on certain brokerages
+ *
+ * @param string $account_id The ID of the account to execute the trade on. (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormBracket $manual_trade_form_bracket (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeBracketOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeBracketOrderAsyncWithHttpInfo($account_id, $user_id, $user_secret, $manual_trade_form_bracket, string $contentType = self::contentTypes['placeBracketOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeBracketOrderRequest($account_id, $user_id, $user_secret, $manual_trade_form_bracket, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'placeBracketOrder'
+ *
+ * @param string $account_id The ID of the account to execute the trade on. (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormBracket $manual_trade_form_bracket (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeBracketOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function placeBracketOrderRequest($account_id, $user_id, $user_secret, $manual_trade_form_bracket, string $contentType = self::contentTypes['placeBracketOrder'][0])
+ {
+
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 placeBracketOrder'
+ );
+ }
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 placeBracketOrder'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 placeBracketOrder'
+ );
+ }
+ if ($manual_trade_form_bracket !== SENTINEL_VALUE) {
+ if (!($manual_trade_form_bracket instanceof \SnapTrade\Model\ManualTradeFormBracket)) {
+ if (!is_array($manual_trade_form_bracket))
+ throw new \InvalidArgumentException('"manual_trade_form_bracket" must be associative array or an instance of \SnapTrade\Model\ManualTradeFormBracket TradingApi.placeBracketOrder.');
+ else
+ $manual_trade_form_bracket = new \SnapTrade\Model\ManualTradeFormBracket($manual_trade_form_bracket);
+ }
+ }
+ // verify the required parameter 'manual_trade_form_bracket' is set
+ if ($manual_trade_form_bracket === SENTINEL_VALUE || (is_array($manual_trade_form_bracket) && count($manual_trade_form_bracket) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter manual_trade_form_bracket when calling placeBracketOrder'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/trading/bracket';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($manual_trade_form_bracket)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($manual_trade_form_bracket));
+ } else {
+ $httpBody = $manual_trade_form_bracket;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'POST';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation placeCryptoOrder
+ *
+ * Place crypto order
+ *
+ * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $account_id account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeCryptoOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\OrderUpdatedResponse|\SnapTrade\Model\Model400FailedRequestResponse
+ */
+ public function placeCryptoOrder(
+
+ $instrument,
+ $side,
+ $type,
+ $time_in_force,
+ $amount,
+ $user_id,
+ $user_secret,
+ $account_id,
+ $limit_price = SENTINEL_VALUE,
+ $stop_price = SENTINEL_VALUE,
+ $post_only = SENTINEL_VALUE,
+ $expiration_date = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['placeCryptoOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "instrument", $instrument);
+ $this->setRequestBodyProperty($_body, "side", $side);
+ $this->setRequestBodyProperty($_body, "type", $type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "amount", $amount);
+ $this->setRequestBodyProperty($_body, "limit_price", $limit_price);
+ $this->setRequestBodyProperty($_body, "stop_price", $stop_price);
+ $this->setRequestBodyProperty($_body, "post_only", $post_only);
+ $this->setRequestBodyProperty($_body, "expiration_date", $expiration_date);
+ $crypto_order_form = $_body;
+
+ list($response) = $this->placeCryptoOrderWithHttpInfo($user_id, $user_secret, $account_id, $crypto_order_form, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation placeCryptoOrderWithHttpInfo
+ *
+ * Place crypto order
+ *
+ * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeCryptoOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\OrderUpdatedResponse|\SnapTrade\Model\Model400FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function placeCryptoOrderWithHttpInfo($user_id, $user_secret, $account_id, $crypto_order_form, string $contentType = self::contentTypes['placeCryptoOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeCryptoOrderRequest($user_id, $user_secret, $account_id, $crypto_order_form, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->placeCryptoOrderWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $crypto_order_form,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\OrderUpdatedResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\OrderUpdatedResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\OrderUpdatedResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\OrderUpdatedResponse';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\OrderUpdatedResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation placeCryptoOrderAsync
+ *
+ * Place crypto order
+ *
+ * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeCryptoOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeCryptoOrderAsync(
+
+ $instrument,
+ $side,
+ $type,
+ $time_in_force,
+ $amount,
+ $user_id,
+ $user_secret,
+ $account_id,
+ $limit_price = SENTINEL_VALUE,
+ $stop_price = SENTINEL_VALUE,
+ $post_only = SENTINEL_VALUE,
+ $expiration_date = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['placeCryptoOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "instrument", $instrument);
+ $this->setRequestBodyProperty($_body, "side", $side);
+ $this->setRequestBodyProperty($_body, "type", $type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "amount", $amount);
+ $this->setRequestBodyProperty($_body, "limit_price", $limit_price);
+ $this->setRequestBodyProperty($_body, "stop_price", $stop_price);
+ $this->setRequestBodyProperty($_body, "post_only", $post_only);
+ $this->setRequestBodyProperty($_body, "expiration_date", $expiration_date);
+ $crypto_order_form = $_body;
+
+ return $this->placeCryptoOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $crypto_order_form, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation placeCryptoOrderAsyncWithHttpInfo
+ *
+ * Place crypto order
+ *
+ * Places an order in the specified account. This endpoint does not compute the impact to the account balance from the order before submitting the order.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeCryptoOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeCryptoOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $crypto_order_form, string $contentType = self::contentTypes['placeCryptoOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\OrderUpdatedResponse';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeCryptoOrderRequest($user_id, $user_secret, $account_id, $crypto_order_form, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'placeCryptoOrder'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeCryptoOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function placeCryptoOrderRequest($user_id, $user_secret, $account_id, $crypto_order_form, string $contentType = self::contentTypes['placeCryptoOrder'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 placeCryptoOrder'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 placeCryptoOrder'
+ );
+ }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 placeCryptoOrder'
+ );
+ }
+ if ($crypto_order_form !== SENTINEL_VALUE) {
+ if (!($crypto_order_form instanceof \SnapTrade\Model\CryptoOrderForm)) {
+ if (!is_array($crypto_order_form))
+ throw new \InvalidArgumentException('"crypto_order_form" must be associative array or an instance of \SnapTrade\Model\CryptoOrderForm TradingApi.placeCryptoOrder.');
+ else
+ $crypto_order_form = new \SnapTrade\Model\CryptoOrderForm($crypto_order_form);
+ }
+ }
+ // verify the required parameter 'crypto_order_form' is set
+ if ($crypto_order_form === SENTINEL_VALUE || (is_array($crypto_order_form) && count($crypto_order_form) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter crypto_order_form when calling placeCryptoOrder'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/trading/crypto';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($crypto_order_form)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($crypto_order_form));
+ } else {
+ $httpBody = $crypto_order_form;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'POST';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation placeForceOrder
+ *
+ * Place equity order
+ *
+ * Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormWithOptions $manual_trade_form_with_options manual_trade_form_with_options (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse
+ */
+ public function placeForceOrder(
+
+ $account_id,
+ $action,
+ $order_type,
+ $time_in_force,
+ $user_id,
+ $user_secret,
+ $universal_symbol_id = SENTINEL_VALUE,
+ $symbol = SENTINEL_VALUE,
+ $trading_session = SENTINEL_VALUE,
+ $price = SENTINEL_VALUE,
+ $stop = SENTINEL_VALUE,
+ $units = SENTINEL_VALUE,
+ $notional_value = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['placeForceOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "account_id", $account_id);
+ $this->setRequestBodyProperty($_body, "action", $action);
+ $this->setRequestBodyProperty($_body, "universal_symbol_id", $universal_symbol_id);
+ $this->setRequestBodyProperty($_body, "symbol", $symbol);
+ $this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "trading_session", $trading_session);
+ $this->setRequestBodyProperty($_body, "price", $price);
+ $this->setRequestBodyProperty($_body, "stop", $stop);
+ $this->setRequestBodyProperty($_body, "units", $units);
+ $this->setRequestBodyProperty($_body, "notional_value", $notional_value);
+ $manual_trade_form_with_options = $_body;
+
+ list($response) = $this->placeForceOrderWithHttpInfo($user_id, $user_secret, $manual_trade_form_with_options, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation placeForceOrderWithHttpInfo
+ *
+ * Place equity order
+ *
+ * Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormWithOptions $manual_trade_form_with_options (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function placeForceOrderWithHttpInfo($user_id, $user_secret, $manual_trade_form_with_options, string $contentType = self::contentTypes['placeForceOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeForceOrderRequest($user_id, $user_secret, $manual_trade_form_with_options, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->placeForceOrderWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $manual_trade_form_with_options,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\AccountOrderRecord' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\AccountOrderRecord' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 403:
+ if ('\SnapTrade\Model\Model403FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model403FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model403FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\AccountOrderRecord',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 403:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model403FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation placeForceOrderAsync
+ *
+ * Place equity order
+ *
+ * Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormWithOptions $manual_trade_form_with_options (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeForceOrderAsync(
+
+ $account_id,
+ $action,
+ $order_type,
+ $time_in_force,
+ $user_id,
+ $user_secret,
+ $universal_symbol_id = SENTINEL_VALUE,
+ $symbol = SENTINEL_VALUE,
+ $trading_session = SENTINEL_VALUE,
+ $price = SENTINEL_VALUE,
+ $stop = SENTINEL_VALUE,
+ $units = SENTINEL_VALUE,
+ $notional_value = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['placeForceOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "account_id", $account_id);
+ $this->setRequestBodyProperty($_body, "action", $action);
+ $this->setRequestBodyProperty($_body, "universal_symbol_id", $universal_symbol_id);
+ $this->setRequestBodyProperty($_body, "symbol", $symbol);
+ $this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "trading_session", $trading_session);
+ $this->setRequestBodyProperty($_body, "price", $price);
+ $this->setRequestBodyProperty($_body, "stop", $stop);
+ $this->setRequestBodyProperty($_body, "units", $units);
+ $this->setRequestBodyProperty($_body, "notional_value", $notional_value);
+ $manual_trade_form_with_options = $_body;
+
+ return $this->placeForceOrderAsyncWithHttpInfo($user_id, $user_secret, $manual_trade_form_with_options, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation placeForceOrderAsyncWithHttpInfo
+ *
+ * Place equity order
+ *
+ * Places a brokerage order in the specified account. The order could be rejected by the brokerage if it is invalid or if the account does not have sufficient funds. This endpoint does not compute the impact to the account balance from the order and any potential commissions before submitting the order to the brokerage. If that is desired, you can use the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormWithOptions $manual_trade_form_with_options (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeForceOrderAsyncWithHttpInfo($user_id, $user_secret, $manual_trade_form_with_options, string $contentType = self::contentTypes['placeForceOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeForceOrderRequest($user_id, $user_secret, $manual_trade_form_with_options, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'placeForceOrder'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ManualTradeFormWithOptions $manual_trade_form_with_options (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function placeForceOrderRequest($user_id, $user_secret, $manual_trade_form_with_options, string $contentType = self::contentTypes['placeForceOrder'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 placeForceOrder'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 placeForceOrder'
+ );
+ }
+ if ($manual_trade_form_with_options !== SENTINEL_VALUE) {
+ if (!($manual_trade_form_with_options instanceof \SnapTrade\Model\ManualTradeFormWithOptions)) {
+ if (!is_array($manual_trade_form_with_options))
+ throw new \InvalidArgumentException('"manual_trade_form_with_options" must be associative array or an instance of \SnapTrade\Model\ManualTradeFormWithOptions TradingApi.placeForceOrder.');
+ else
+ $manual_trade_form_with_options = new \SnapTrade\Model\ManualTradeFormWithOptions($manual_trade_form_with_options);
+ }
+ }
+ // verify the required parameter 'manual_trade_form_with_options' is set
+ if ($manual_trade_form_with_options === SENTINEL_VALUE || (is_array($manual_trade_form_with_options) && count($manual_trade_form_with_options) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter manual_trade_form_with_options when calling placeForceOrder'
+ );
+ }
+
+
+ $resourcePath = '/trade/place';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($manual_trade_form_with_options)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($manual_trade_form_with_options));
+ } else {
+ $httpBody = $manual_trade_form_with_options;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'POST';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation placeMlegOrder
+ *
+ * Place option order
+ *
+ * Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $account_id account_id (required)
+ * @param \SnapTrade\Model\MlegTradeForm $mleg_trade_form mleg_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeMlegOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\MlegOrderResponse|\SnapTrade\Model\Model400FailedRequestResponse
+ */
+ public function placeMlegOrder(
+
+ $order_type,
+ $time_in_force,
+ $legs,
+ $user_id,
+ $user_secret,
+ $account_id,
+ $limit_price = SENTINEL_VALUE,
+ $stop_price = SENTINEL_VALUE,
+ $price_effect = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['placeMlegOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "limit_price", $limit_price);
+ $this->setRequestBodyProperty($_body, "stop_price", $stop_price);
+ $this->setRequestBodyProperty($_body, "price_effect", $price_effect);
+ $this->setRequestBodyProperty($_body, "legs", $legs);
+ $mleg_trade_form = $_body;
+
+ list($response) = $this->placeMlegOrderWithHttpInfo($user_id, $user_secret, $account_id, $mleg_trade_form, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation placeMlegOrderWithHttpInfo
+ *
+ * Place option order
+ *
+ * Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\MlegTradeForm $mleg_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeMlegOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\MlegOrderResponse|\SnapTrade\Model\Model400FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function placeMlegOrderWithHttpInfo($user_id, $user_secret, $account_id, $mleg_trade_form, string $contentType = self::contentTypes['placeMlegOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeMlegOrderRequest($user_id, $user_secret, $account_id, $mleg_trade_form, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->placeMlegOrderWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $mleg_trade_form,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\MlegOrderResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\MlegOrderResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\MlegOrderResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\MlegOrderResponse';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\MlegOrderResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation placeMlegOrderAsync
+ *
+ * Place option order
+ *
+ * Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\MlegTradeForm $mleg_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeMlegOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeMlegOrderAsync(
+
+ $order_type,
+ $time_in_force,
+ $legs,
+ $user_id,
+ $user_secret,
+ $account_id,
+ $limit_price = SENTINEL_VALUE,
+ $stop_price = SENTINEL_VALUE,
+ $price_effect = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['placeMlegOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "limit_price", $limit_price);
+ $this->setRequestBodyProperty($_body, "stop_price", $stop_price);
+ $this->setRequestBodyProperty($_body, "price_effect", $price_effect);
+ $this->setRequestBodyProperty($_body, "legs", $legs);
+ $mleg_trade_form = $_body;
+
+ return $this->placeMlegOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $mleg_trade_form, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation placeMlegOrderAsyncWithHttpInfo
+ *
+ * Place option order
+ *
+ * Places a multi-leg option order. Only supported on certain option trading brokerages. https://snaptrade.notion.site/brokerages has information on brokerage trading support
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\MlegTradeForm $mleg_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeMlegOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeMlegOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $mleg_trade_form, string $contentType = self::contentTypes['placeMlegOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\MlegOrderResponse';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeMlegOrderRequest($user_id, $user_secret, $account_id, $mleg_trade_form, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'placeMlegOrder'
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\MlegTradeForm $mleg_trade_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeMlegOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function placeMlegOrderRequest($user_id, $user_secret, $account_id, $mleg_trade_form, string $contentType = self::contentTypes['placeMlegOrder'][0])
+ {
+
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 placeMlegOrder'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 placeMlegOrder'
+ );
+ }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 placeMlegOrder'
+ );
+ }
+ if ($mleg_trade_form !== SENTINEL_VALUE) {
+ if (!($mleg_trade_form instanceof \SnapTrade\Model\MlegTradeForm)) {
+ if (!is_array($mleg_trade_form))
+ throw new \InvalidArgumentException('"mleg_trade_form" must be associative array or an instance of \SnapTrade\Model\MlegTradeForm TradingApi.placeMlegOrder.');
+ else
+ $mleg_trade_form = new \SnapTrade\Model\MlegTradeForm($mleg_trade_form);
+ }
+ }
+ // verify the required parameter 'mleg_trade_form' is set
+ if ($mleg_trade_form === SENTINEL_VALUE || (is_array($mleg_trade_form) && count($mleg_trade_form) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter mleg_trade_form when calling placeMlegOrder'
+ );
+ }
+
+
+ $resourcePath = '/accounts/{accountId}/trading/options';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($mleg_trade_form)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($mleg_trade_form));
+ } else {
+ $httpBody = $mleg_trade_form;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'POST';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation placeOrder
+ *
+ * Place checked equity order
+ *
+ * Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+ *
+ * @param string $trade_id Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact) (required)
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body validated_trade_body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse
+ */
+ public function placeOrder(
+ $trade_id,
+ $user_id,
+ $user_secret,
+ $wait_to_confirm = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['placeOrder'][0]
+ )
+ {
+ $_body = null;
+ $this->setRequestBodyProperty($_body, "wait_to_confirm", $wait_to_confirm);
+ $validated_trade_body = $_body;
+
+ list($response) = $this->placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $validated_trade_body, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation placeOrderWithHttpInfo
+ *
+ * Place checked equity order
+ *
+ * Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+ *
+ * @param string $trade_id Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact) (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $validated_trade_body = null, string $contentType = self::contentTypes['placeOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeOrderRequest($trade_id, $user_id, $user_secret, $validated_trade_body, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->placeOrderWithHttpInfo(
+ $trade_id,
+ $user_id,
+ $user_secret,
+ $validated_trade_body,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\AccountOrderRecord' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\AccountOrderRecord' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\AccountOrderRecord',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation placeOrderAsync
+ *
+ * Place checked equity order
+ *
+ * Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+ *
+ * @param string $trade_id Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact) (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeOrderAsync(
+ $trade_id,
+ $user_id,
+ $user_secret,
+ $wait_to_confirm = SENTINEL_VALUE,
+
+ string $contentType = self::contentTypes['placeOrder'][0]
+ )
+ {
+ $_body = null;
+ $this->setRequestBodyProperty($_body, "wait_to_confirm", $wait_to_confirm);
+ $validated_trade_body = $_body;
+
+ return $this->placeOrderAsyncWithHttpInfo($trade_id, $user_id, $user_secret, $validated_trade_body, $contentType)
+ ->then(
+ function ($response) {
+ return $response[0];
+ }
+ );
+ }
+
+ /**
+ * Operation placeOrderAsyncWithHttpInfo
+ *
+ * Place checked equity order
+ *
+ * Places the previously checked order with the brokerage. The `tradeId` is obtained from the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact). If you prefer to place the order without checking for impact first, you can use the [place order endpoint](/reference/Trading/Trading_placeForceOrder). It's recommended to trigger a manual refresh of the account after placing an order to ensure the account is up to date. You can use the [manual refresh](/reference/Connections/Connections_refreshBrokerageAuthorization) endpoint for this.
+ *
+ * @param string $trade_id Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact) (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function placeOrderAsyncWithHttpInfo($trade_id, $user_id, $user_secret, $validated_trade_body = null, string $contentType = self::contentTypes['placeOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->placeOrderRequest($trade_id, $user_id, $user_secret, $validated_trade_body, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ return $this->client
+ ->sendAsync($request, $this->createHttpClientOption())
+ ->then(
+ function ($response) use ($returnType) {
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ },
+ function ($exception) {
+ $response = $exception->getResponse();
+ $statusCode = $response->getStatusCode();
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ $exception->getRequest()->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+ );
+ }
+
+ /**
+ * Create request for operation 'placeOrder'
+ *
+ * @param string $trade_id Obtained from calling the [check order impact endpoint](/reference/Trading/Trading_getOrderImpact) (required)
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Psr7\Request
+ */
+ public function placeOrderRequest($trade_id, $user_id, $user_secret, $validated_trade_body = SENTINEL_VALUE, string $contentType = self::contentTypes['placeOrder'][0])
+ {
+
+ // Check if $trade_id is a string
+ if ($trade_id !== SENTINEL_VALUE && !is_string($trade_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($trade_id, true), gettype($trade_id)));
+ }
+ // verify the required parameter 'trade_id' is set
+ if ($trade_id === SENTINEL_VALUE || (is_array($trade_id) && count($trade_id) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter trade_id when calling placeOrder'
+ );
+ }
+ // Check if $user_id is a string
+ if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
+ }
+ // 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 placeOrder'
+ );
+ }
+ // Check if $user_secret is a string
+ if ($user_secret !== SENTINEL_VALUE && !is_string($user_secret)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_secret, true), gettype($user_secret)));
+ }
+ // 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 placeOrder'
+ );
+ }
+ if ($validated_trade_body !== SENTINEL_VALUE) {
+ if (!($validated_trade_body instanceof \SnapTrade\Model\ValidatedTradeBody)) {
+ if (!is_array($validated_trade_body))
+ throw new \InvalidArgumentException('"validated_trade_body" must be associative array or an instance of \SnapTrade\Model\ValidatedTradeBody TradingApi.placeOrder.');
+ else
+ $validated_trade_body = new \SnapTrade\Model\ValidatedTradeBody($validated_trade_body);
+ }
+ }
+
+
+ $resourcePath = '/trade/{tradeId}';
+ $formParams = [];
+ $queryParams = [];
+ $headerParams = [];
+ $httpBody = '';
+ $multipart = false;
+
+ if ($user_id !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_id,
+ 'userId', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+ if ($user_secret !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $user_secret,
+ 'userSecret', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ true // required
+ ) ?? []);
+ }
+
+
+ // path params
+ if ($trade_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'tradeId' . '}',
+ ObjectSerializer::toPathValue($trade_id),
+ $resourcePath
+ );
+ }
+
+
+ $headers = $this->headerSelector->selectHeaders(
+ ['application/json', ],
+ $contentType,
+ $multipart
+ );
+
+ // for model (json/xml)
+ if (isset($validated_trade_body)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($validated_trade_body));
+ } else {
+ $httpBody = $validated_trade_body;
+ }
+ } elseif (count($formParams) > 0) {
+ if ($multipart) {
+ $multipartContents = [];
+ foreach ($formParams as $formParamName => $formParamValue) {
+ $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue];
+ foreach ($formParamValueItems as $formParamValueItem) {
+ $multipartContents[] = [
+ 'name' => $formParamName,
+ 'contents' => $formParamValueItem
+ ];
+ }
+ }
+ // for HTTP post (form)
+ $httpBody = new MultipartStream($multipartContents);
+
+ } elseif (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the form parameters
+ $httpBody = \GuzzleHttp\json_encode($formParams);
+ } else {
+ // for HTTP post (form)
+ $httpBody = ObjectSerializer::buildQuery($formParams);
+ }
+ }
+
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('clientId');
+ if ($apiKey !== null) {
+ $queryParams['clientId'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('Signature');
+ if ($apiKey !== null) {
+ $headers['Signature'] = $apiKey;
+ }
+ // this endpoint requires API key authentication
+ $apiKey = $this->config->getApiKeyWithPrefix('timestamp');
+ if ($apiKey !== null) {
+ $queryParams['timestamp'] = $apiKey;
+ }
+
+ $defaultHeaders = [];
+ if ($this->config->getUserAgent()) {
+ $defaultHeaders['User-Agent'] = $this->config->getUserAgent();
+ }
+
+ $headers = array_merge(
+ $defaultHeaders,
+ $headerParams,
+ $headers
+ );
+
+ $method = 'POST';
+ $this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
+
+ $operationHost = $this->config->getHost();
+ $query = ObjectSerializer::buildQuery($queryParams);
+ return [
+ "request" => new Request(
+ $method,
+ $operationHost . $resourcePath . ($query ? "?{$query}" : ''),
+ $headers,
+ $httpBody
+ ),
+ "serializedBody" => $httpBody
+ ];
+ }
+
+ /**
+ * Operation previewCryptoOrder
+ *
+ * Preview crypto order
+ *
+ * Previews an order using the specified account.
+ *
+ * @param string $user_id user_id (required)
+ * @param string $user_secret user_secret (required)
+ * @param string $account_id account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['previewCryptoOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return \SnapTrade\Model\CryptoOrderPreview|\SnapTrade\Model\Model400FailedRequestResponse
+ */
+ public function previewCryptoOrder(
+
+ $instrument,
+ $side,
+ $type,
+ $time_in_force,
+ $amount,
+ $user_id,
+ $user_secret,
+ $account_id,
+ $limit_price = SENTINEL_VALUE,
+ $stop_price = SENTINEL_VALUE,
+ $post_only = SENTINEL_VALUE,
+ $expiration_date = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['previewCryptoOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "instrument", $instrument);
+ $this->setRequestBodyProperty($_body, "side", $side);
+ $this->setRequestBodyProperty($_body, "type", $type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "amount", $amount);
+ $this->setRequestBodyProperty($_body, "limit_price", $limit_price);
+ $this->setRequestBodyProperty($_body, "stop_price", $stop_price);
+ $this->setRequestBodyProperty($_body, "post_only", $post_only);
+ $this->setRequestBodyProperty($_body, "expiration_date", $expiration_date);
+ $crypto_order_form = $_body;
+
+ list($response) = $this->previewCryptoOrderWithHttpInfo($user_id, $user_secret, $account_id, $crypto_order_form, $contentType);
+ return $response;
+ }
+
+ /**
+ * Operation previewCryptoOrderWithHttpInfo
+ *
+ * Preview crypto order
+ *
+ * Previews an order using the specified account.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['previewCryptoOrder'] to see the possible values for this operation
+ *
+ * @throws \SnapTrade\ApiException on non-2xx response
+ * @throws \InvalidArgumentException
+ * @return array of \SnapTrade\Model\CryptoOrderPreview|\SnapTrade\Model\Model400FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ */
+ public function previewCryptoOrderWithHttpInfo($user_id, $user_secret, $account_id, $crypto_order_form, string $contentType = self::contentTypes['previewCryptoOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ {
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->previewCryptoOrderRequest($user_id, $user_secret, $account_id, $crypto_order_form, $contentType);
+
+ // Customization hook
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+
+ try {
+ $options = $this->createHttpClientOption();
+ try {
+ $response = $this->client->send($request, $options);
+ } catch (RequestException $e) {
+ if (
+ ($e->getCode() == 401 || $e->getCode() == 403) &&
+ !empty($this->getConfig()->getAccessToken()) &&
+ $requestOptions->shouldRetryOAuth()
+ ) {
+ return $this->previewCryptoOrderWithHttpInfo(
+ $user_id,
+ $user_secret,
+ $account_id,
+ $crypto_order_form,
+ $contentType,
+ $requestOptions->setRetryOAuth(false)
+ );
+ }
+
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ $e->getResponse() ? $e->getResponse()->getHeaders() : null,
+ $e->getResponse() ? (string) $e->getResponse()->getBody() : null
+ );
+ } catch (ConnectException $e) {
+ throw new ApiException(
+ "[{$e->getCode()}] {$e->getMessage()}",
+ (int) $e->getCode(),
+ null,
+ null
+ );
+ }
+
+ $statusCode = $response->getStatusCode();
+
+ if ($statusCode < 200 || $statusCode > 299) {
+ throw new ApiException(
+ sprintf(
+ '[%d] Error connecting to the API (%s)',
+ $statusCode,
+ (string) $request->getUri()
+ ),
+ $statusCode,
+ $response->getHeaders(),
+ (string) $response->getBody()
+ );
+ }
+
+ switch($statusCode) {
+ case 200:
+ if ('\SnapTrade\Model\CryptoOrderPreview' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\CryptoOrderPreview' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\CryptoOrderPreview', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ case 400:
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ('\SnapTrade\Model\Model400FailedRequestResponse' !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\Model400FailedRequestResponse', []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+ }
+
+ $returnType = '\SnapTrade\Model\CryptoOrderPreview';
+ if ($returnType === '\SplFileObject') {
+ $content = $response->getBody(); //stream goes to serializer
+ } else {
+ $content = (string) $response->getBody();
+ if ($returnType !== 'string') {
+ $content = json_decode($content);
+ }
+ }
+
+ return [
+ ObjectSerializer::deserialize($content, $returnType, []),
+ $response->getStatusCode(),
+ $response->getHeaders()
+ ];
+
+ } catch (ApiException $e) {
+ switch ($e->getCode()) {
+ case 200:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\CryptoOrderPreview',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ case 400:
+ $data = ObjectSerializer::deserialize(
+ $e->getResponseBody(),
+ '\SnapTrade\Model\Model400FailedRequestResponse',
+ $e->getResponseHeaders()
+ );
+ $e->setResponseObject($data);
+ break;
+ }
+ throw $e;
+ }
+ }
+
+ /**
+ * Operation previewCryptoOrderAsync
+ *
+ * Preview crypto order
+ *
+ * Previews an order using the specified account.
+ *
+ * @param string $user_id (required)
+ * @param string $user_secret (required)
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['previewCryptoOrder'] to see the possible values for this operation
+ *
+ * @throws \InvalidArgumentException
+ * @return \GuzzleHttp\Promise\PromiseInterface
+ */
+ public function previewCryptoOrderAsync(
+
+ $instrument,
+ $side,
+ $type,
+ $time_in_force,
+ $amount,
+ $user_id,
+ $user_secret,
+ $account_id,
+ $limit_price = SENTINEL_VALUE,
+ $stop_price = SENTINEL_VALUE,
+ $post_only = SENTINEL_VALUE,
+ $expiration_date = SENTINEL_VALUE,
+ string $contentType = self::contentTypes['previewCryptoOrder'][0]
+ )
+ {
+ $_body = [];
+ $this->setRequestBodyProperty($_body, "instrument", $instrument);
+ $this->setRequestBodyProperty($_body, "side", $side);
+ $this->setRequestBodyProperty($_body, "type", $type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
+ $this->setRequestBodyProperty($_body, "amount", $amount);
+ $this->setRequestBodyProperty($_body, "limit_price", $limit_price);
+ $this->setRequestBodyProperty($_body, "stop_price", $stop_price);
+ $this->setRequestBodyProperty($_body, "post_only", $post_only);
+ $this->setRequestBodyProperty($_body, "expiration_date", $expiration_date);
+ $crypto_order_form = $_body;
+
+ return $this->previewCryptoOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $crypto_order_form, $contentType)
->then(
function ($response) {
return $response[0];
@@ -1315,27 +5220,28 @@ function ($response) {
}
/**
- * Operation getUserAccountQuotesAsyncWithHttpInfo
+ * Operation previewCryptoOrderAsyncWithHttpInfo
*
- * Get symbol quotes
+ * Preview crypto order
+ *
+ * Previews an order using the specified account.
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $symbols List of universal_symbol_id or tickers to get quotes for. (required)
- * @param string $account_id The ID of the account to get quotes. (required)
- * @param bool $use_ticker Should be set to True if providing tickers. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['previewCryptoOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function getUserAccountQuotesAsyncWithHttpInfo($user_id, $user_secret, $symbols, $account_id, $use_ticker = null, string $contentType = self::contentTypes['getUserAccountQuotes'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function previewCryptoOrderAsyncWithHttpInfo($user_id, $user_secret, $account_id, $crypto_order_form, string $contentType = self::contentTypes['previewCryptoOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\SymbolsQuotesInner[]';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $account_id, $use_ticker, $contentType);
+ $returnType = '\SnapTrade\Model\CryptoOrderPreview';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->previewCryptoOrderRequest($user_id, $user_secret, $account_id, $crypto_order_form, $contentType);
// Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config);
+ $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
@@ -1374,19 +5280,18 @@ function ($exception) {
}
/**
- * Create request for operation 'getUserAccountQuotes'
+ * Create request for operation 'previewCryptoOrder'
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $symbols List of universal_symbol_id or tickers to get quotes for. (required)
- * @param string $account_id The ID of the account to get quotes. (required)
- * @param bool $use_ticker Should be set to True if providing tickers. (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['getUserAccountQuotes'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param \SnapTrade\Model\CryptoOrderForm $crypto_order_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['previewCryptoOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $account_id, $use_ticker = SENTINEL_VALUE, string $contentType = self::contentTypes['getUserAccountQuotes'][0])
+ public function previewCryptoOrderRequest($user_id, $user_secret, $account_id, $crypto_order_form, string $contentType = self::contentTypes['previewCryptoOrder'][0])
{
// Check if $user_id is a string
@@ -1396,7 +5301,7 @@ public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $a
// 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 getUserAccountQuotes'
+ 'Missing the required parameter user_id when calling previewCryptoOrder'
);
}
// Check if $user_secret is a string
@@ -1406,17 +5311,7 @@ public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $a
// 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 getUserAccountQuotes'
- );
- }
- // Check if $symbols is a string
- if ($symbols !== SENTINEL_VALUE && !is_string($symbols)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($symbols, true), gettype($symbols)));
- }
- // verify the required parameter 'symbols' is set
- if ($symbols === SENTINEL_VALUE || (is_array($symbols) && count($symbols) === 0)) {
- throw new \InvalidArgumentException(
- 'Missing the required parameter symbols when calling getUserAccountQuotes'
+ 'Missing the required parameter user_secret when calling previewCryptoOrder'
);
}
// Check if $account_id is a string
@@ -1426,12 +5321,26 @@ public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $a
// 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 getUserAccountQuotes'
+ 'Missing the required parameter account_id when calling previewCryptoOrder'
+ );
+ }
+ if ($crypto_order_form !== SENTINEL_VALUE) {
+ if (!($crypto_order_form instanceof \SnapTrade\Model\CryptoOrderForm)) {
+ if (!is_array($crypto_order_form))
+ throw new \InvalidArgumentException('"crypto_order_form" must be associative array or an instance of \SnapTrade\Model\CryptoOrderForm TradingApi.previewCryptoOrder.');
+ else
+ $crypto_order_form = new \SnapTrade\Model\CryptoOrderForm($crypto_order_form);
+ }
+ }
+ // verify the required parameter 'crypto_order_form' is set
+ if ($crypto_order_form === SENTINEL_VALUE || (is_array($crypto_order_form) && count($crypto_order_form) === 0)) {
+ throw new \InvalidArgumentException(
+ 'Missing the required parameter crypto_order_form when calling previewCryptoOrder'
);
}
- $resourcePath = '/accounts/{accountId}/quotes';
+ $resourcePath = '/accounts/{accountId}/trading/crypto/preview';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -1460,28 +5369,6 @@ public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $a
true // required
) ?? []);
}
- if ($symbols !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $symbols,
- 'symbols', // param base name
- 'string', // openApiType
- 'form', // style
- true, // explode
- true // required
- ) ?? []);
- }
- if ($use_ticker !== SENTINEL_VALUE) {
- // query params
- $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
- $use_ticker,
- 'use_ticker', // param base name
- 'boolean', // openApiType
- 'form', // style
- true, // explode
- false // required
- ) ?? []);
- }
// path params
@@ -1501,7 +5388,14 @@ public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $a
);
// for model (json/xml)
- if (count($formParams) > 0) {
+ if (isset($crypto_order_form)) {
+ if (stripos($headers['Content-Type'], 'application/json') !== false) {
+ # if Content-Type contains "application/json", json_encode the body
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($crypto_order_form));
+ } else {
+ $httpBody = $crypto_order_form;
+ }
+ } elseif (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
@@ -1552,7 +5446,7 @@ public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $a
$headers
);
- $method = 'GET';
+ $method = 'POST';
$this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
$operationHost = $this->config->getHost();
@@ -1569,68 +5463,73 @@ public function getUserAccountQuotesRequest($user_id, $user_secret, $symbols, $a
}
/**
- * Operation placeForceOrder
+ * Operation replaceOrder
+ *
+ * Replace order
*
- * Place a trade with NO validation.
+ * Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages
*
+ * @param string $account_id The ID of the account to execute the trade on. (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ * @param \SnapTrade\Model\ManualTradeReplaceForm $manual_trade_replace_form manual_trade_replace_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceOrder'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse
*/
- public function placeForceOrder(
+ public function replaceOrder(
+ $brokerage_order_id,
+ $action,
+ $order_type,
+ $time_in_force,
+ $account_id,
$user_id,
$user_secret,
- $account_id = SENTINEL_VALUE,
- $action = SENTINEL_VALUE,
- $order_type = SENTINEL_VALUE,
$price = SENTINEL_VALUE,
+ $symbol = SENTINEL_VALUE,
$stop = SENTINEL_VALUE,
- $time_in_force = SENTINEL_VALUE,
$units = SENTINEL_VALUE,
- $universal_symbol_id = SENTINEL_VALUE,
- $notional_value = SENTINEL_VALUE,
- string $contentType = self::contentTypes['placeForceOrder'][0]
+ string $contentType = self::contentTypes['replaceOrder'][0]
)
{
$_body = [];
- $this->setRequestBodyProperty($_body, "account_id", $account_id);
+ $this->setRequestBodyProperty($_body, "brokerage_order_id", $brokerage_order_id);
$this->setRequestBodyProperty($_body, "action", $action);
$this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
$this->setRequestBodyProperty($_body, "price", $price);
+ $this->setRequestBodyProperty($_body, "symbol", $symbol);
$this->setRequestBodyProperty($_body, "stop", $stop);
- $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
$this->setRequestBodyProperty($_body, "units", $units);
- $this->setRequestBodyProperty($_body, "universal_symbol_id", $universal_symbol_id);
- $this->setRequestBodyProperty($_body, "notional_value", $notional_value);
- $manual_trade_form = $_body;
+ $manual_trade_replace_form = $_body;
- list($response) = $this->placeForceOrderWithHttpInfo($user_id, $user_secret, $manual_trade_form, $contentType);
+ list($response) = $this->replaceOrderWithHttpInfo($account_id, $user_id, $user_secret, $manual_trade_replace_form, $contentType);
return $response;
}
/**
- * Operation placeForceOrderWithHttpInfo
+ * Operation replaceOrderWithHttpInfo
+ *
+ * Replace order
*
- * Place a trade with NO validation.
+ * Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages
*
+ * @param string $account_id The ID of the account to execute the trade on. (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ * @param \SnapTrade\Model\ManualTradeReplaceForm $manual_trade_replace_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceOrder'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse|\SnapTrade\Model\Model403FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function placeForceOrderWithHttpInfo($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['placeForceOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function replaceOrderWithHttpInfo($account_id, $user_id, $user_secret, $manual_trade_replace_form, string $contentType = self::contentTypes['replaceOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->placeForceOrderRequest($user_id, $user_secret, $manual_trade_form, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->replaceOrderRequest($account_id, $user_id, $user_secret, $manual_trade_replace_form, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
@@ -1645,10 +5544,11 @@ public function placeForceOrderWithHttpInfo($user_id, $user_secret, $manual_trad
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->placeForceOrderWithHttpInfo(
+ return $this->replaceOrderWithHttpInfo(
+ $account_id,
$user_id,
$user_secret,
- $manual_trade_form,
+ $manual_trade_replace_form,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -1780,47 +5680,49 @@ public function placeForceOrderWithHttpInfo($user_id, $user_secret, $manual_trad
}
/**
- * Operation placeForceOrderAsync
+ * Operation replaceOrderAsync
*
- * Place a trade with NO validation.
+ * Replace order
*
+ * Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages
+ *
+ * @param string $account_id The ID of the account to execute the trade on. (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ * @param \SnapTrade\Model\ManualTradeReplaceForm $manual_trade_replace_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function placeForceOrderAsync(
+ public function replaceOrderAsync(
+ $brokerage_order_id,
+ $action,
+ $order_type,
+ $time_in_force,
+ $account_id,
$user_id,
$user_secret,
- $account_id = SENTINEL_VALUE,
- $action = SENTINEL_VALUE,
- $order_type = SENTINEL_VALUE,
$price = SENTINEL_VALUE,
+ $symbol = SENTINEL_VALUE,
$stop = SENTINEL_VALUE,
- $time_in_force = SENTINEL_VALUE,
$units = SENTINEL_VALUE,
- $universal_symbol_id = SENTINEL_VALUE,
- $notional_value = SENTINEL_VALUE,
- string $contentType = self::contentTypes['placeForceOrder'][0]
+ string $contentType = self::contentTypes['replaceOrder'][0]
)
{
$_body = [];
- $this->setRequestBodyProperty($_body, "account_id", $account_id);
+ $this->setRequestBodyProperty($_body, "brokerage_order_id", $brokerage_order_id);
$this->setRequestBodyProperty($_body, "action", $action);
$this->setRequestBodyProperty($_body, "order_type", $order_type);
+ $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
$this->setRequestBodyProperty($_body, "price", $price);
+ $this->setRequestBodyProperty($_body, "symbol", $symbol);
$this->setRequestBodyProperty($_body, "stop", $stop);
- $this->setRequestBodyProperty($_body, "time_in_force", $time_in_force);
$this->setRequestBodyProperty($_body, "units", $units);
- $this->setRequestBodyProperty($_body, "universal_symbol_id", $universal_symbol_id);
- $this->setRequestBodyProperty($_body, "notional_value", $notional_value);
- $manual_trade_form = $_body;
+ $manual_trade_replace_form = $_body;
- return $this->placeForceOrderAsyncWithHttpInfo($user_id, $user_secret, $manual_trade_form, $contentType)
+ return $this->replaceOrderAsyncWithHttpInfo($account_id, $user_id, $user_secret, $manual_trade_replace_form, $contentType)
->then(
function ($response) {
return $response[0];
@@ -1829,22 +5731,25 @@ function ($response) {
}
/**
- * Operation placeForceOrderAsyncWithHttpInfo
+ * Operation replaceOrderAsyncWithHttpInfo
*
- * Place a trade with NO validation.
+ * Replace order
*
+ * Replaces an existing pending order with a new one. The way this works is brokerage dependent, but usually involves cancelling the existing order and placing a new one. The order's brokerage_order_id may or may not change, be sure to use the one returned in the response going forward. Only supported on some brokerages
+ *
+ * @param string $account_id The ID of the account to execute the trade on. (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ * @param \SnapTrade\Model\ManualTradeReplaceForm $manual_trade_replace_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function placeForceOrderAsyncWithHttpInfo($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['placeForceOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function replaceOrderAsyncWithHttpInfo($account_id, $user_id, $user_secret, $manual_trade_replace_form, string $contentType = self::contentTypes['replaceOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
$returnType = '\SnapTrade\Model\AccountOrderRecord';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->placeForceOrderRequest($user_id, $user_secret, $manual_trade_form, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->replaceOrderRequest($account_id, $user_id, $user_secret, $manual_trade_replace_form, $contentType);
// Customization hook
$this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
@@ -1886,19 +5791,30 @@ function ($exception) {
}
/**
- * Create request for operation 'placeForceOrder'
+ * Create request for operation 'replaceOrder'
*
+ * @param string $account_id The ID of the account to execute the trade on. (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ManualTradeForm $manual_trade_form (required)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeForceOrder'] to see the possible values for this operation
+ * @param \SnapTrade\Model\ManualTradeReplaceForm $manual_trade_replace_form (required)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['replaceOrder'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function placeForceOrderRequest($user_id, $user_secret, $manual_trade_form, string $contentType = self::contentTypes['placeForceOrder'][0])
+ public function replaceOrderRequest($account_id, $user_id, $user_secret, $manual_trade_replace_form, string $contentType = self::contentTypes['replaceOrder'][0])
{
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 replaceOrder'
+ );
+ }
// Check if $user_id is a string
if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
@@ -1906,7 +5822,7 @@ public function placeForceOrderRequest($user_id, $user_secret, $manual_trade_for
// 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 placeForceOrder'
+ 'Missing the required parameter user_id when calling replaceOrder'
);
}
// Check if $user_secret is a string
@@ -1916,26 +5832,26 @@ public function placeForceOrderRequest($user_id, $user_secret, $manual_trade_for
// 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 placeForceOrder'
+ 'Missing the required parameter user_secret when calling replaceOrder'
);
}
- if ($manual_trade_form !== SENTINEL_VALUE) {
- if (!($manual_trade_form instanceof \SnapTrade\Model\ManualTradeForm)) {
- if (!is_array($manual_trade_form))
- throw new \InvalidArgumentException('"manual_trade_form" must be associative array or an instance of \SnapTrade\Model\ManualTradeForm TradingApi.placeForceOrder.');
+ if ($manual_trade_replace_form !== SENTINEL_VALUE) {
+ if (!($manual_trade_replace_form instanceof \SnapTrade\Model\ManualTradeReplaceForm)) {
+ if (!is_array($manual_trade_replace_form))
+ throw new \InvalidArgumentException('"manual_trade_replace_form" must be associative array or an instance of \SnapTrade\Model\ManualTradeReplaceForm TradingApi.replaceOrder.');
else
- $manual_trade_form = new \SnapTrade\Model\ManualTradeForm($manual_trade_form);
+ $manual_trade_replace_form = new \SnapTrade\Model\ManualTradeReplaceForm($manual_trade_replace_form);
}
}
- // verify the required parameter 'manual_trade_form' is set
- if ($manual_trade_form === SENTINEL_VALUE || (is_array($manual_trade_form) && count($manual_trade_form) === 0)) {
+ // verify the required parameter 'manual_trade_replace_form' is set
+ if ($manual_trade_replace_form === SENTINEL_VALUE || (is_array($manual_trade_replace_form) && count($manual_trade_replace_form) === 0)) {
throw new \InvalidArgumentException(
- 'Missing the required parameter manual_trade_form when calling placeForceOrder'
+ 'Missing the required parameter manual_trade_replace_form when calling replaceOrder'
);
}
- $resourcePath = '/trade/place';
+ $resourcePath = '/accounts/{accountId}/trading/replace';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -1966,6 +5882,14 @@ public function placeForceOrderRequest($user_id, $user_secret, $manual_trade_for
}
+ // path params
+ if ($account_id !== SENTINEL_VALUE) {
+ $resourcePath = str_replace(
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
+ $resourcePath
+ );
+ }
$headers = $this->headerSelector->selectHeaders(
@@ -1975,12 +5899,12 @@ public function placeForceOrderRequest($user_id, $user_secret, $manual_trade_for
);
// for model (json/xml)
- if (isset($manual_trade_form)) {
+ if (isset($manual_trade_replace_form)) {
if (stripos($headers['Content-Type'], 'application/json') !== false) {
# if Content-Type contains "application/json", json_encode the body
- $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($manual_trade_form));
+ $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($manual_trade_replace_form));
} else {
- $httpBody = $manual_trade_form;
+ $httpBody = $manual_trade_replace_form;
}
} elseif (count($formParams) > 0) {
if ($multipart) {
@@ -2050,58 +5974,62 @@ public function placeForceOrderRequest($user_id, $user_secret, $manual_trade_for
}
/**
- * Operation placeOrder
+ * Operation searchCryptocurrencyPairInstruments
*
- * Place order
+ * Get crypto pairs
+ *
+ * Searches cryptocurrency pairs instruments accessible to the specified account. Both `base` and `quote` are optional. Omit both for a full list of cryptocurrency pairs.
*
- * @param string $trade_id The ID of trade object obtained from trade/impact endpoint (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body validated_trade_body (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ * @param string $account_id account_id (required)
+ * @param string $base base (optional)
+ * @param string $quote quote (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchCryptocurrencyPairInstruments'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse
+ * @return \SnapTrade\Model\TradingSearchCryptocurrencyPairInstruments200Response|\SnapTrade\Model\Model400FailedRequestResponse
*/
- public function placeOrder(
- $trade_id,
+ public function searchCryptocurrencyPairInstruments(
$user_id,
$user_secret,
- $wait_to_confirm = SENTINEL_VALUE,
+ $account_id,
+ $base = SENTINEL_VALUE,
+ $quote = SENTINEL_VALUE,
- string $contentType = self::contentTypes['placeOrder'][0]
+ string $contentType = self::contentTypes['searchCryptocurrencyPairInstruments'][0]
)
{
- $_body = null;
- $this->setRequestBodyProperty($_body, "wait_to_confirm", $wait_to_confirm);
- $validated_trade_body = $_body;
- list($response) = $this->placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $validated_trade_body, $contentType);
+ list($response) = $this->searchCryptocurrencyPairInstrumentsWithHttpInfo($user_id, $user_secret, $account_id, $base, $quote, $contentType);
return $response;
}
/**
- * Operation placeOrderWithHttpInfo
+ * Operation searchCryptocurrencyPairInstrumentsWithHttpInfo
*
- * Place order
+ * Get crypto pairs
+ *
+ * Searches cryptocurrency pairs instruments accessible to the specified account. Both `base` and `quote` are optional. Omit both for a full list of cryptocurrency pairs.
*
- * @param string $trade_id The ID of trade object obtained from trade/impact endpoint (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $base (optional)
+ * @param string $quote (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchCryptocurrencyPairInstruments'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
- * @return array of \SnapTrade\Model\AccountOrderRecord|\SnapTrade\Model\Model400FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
+ * @return array of \SnapTrade\Model\TradingSearchCryptocurrencyPairInstruments200Response|\SnapTrade\Model\Model400FailedRequestResponse, HTTP status code, HTTP response headers (array of strings)
*/
- public function placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $validated_trade_body = null, string $contentType = self::contentTypes['placeOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function searchCryptocurrencyPairInstrumentsWithHttpInfo($user_id, $user_secret, $account_id, $base = null, $quote = null, string $contentType = self::contentTypes['searchCryptocurrencyPairInstruments'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- ["request" => $request, "serializedBody" => $serializedBody] = $this->placeOrderRequest($trade_id, $user_id, $user_secret, $validated_trade_body, $contentType);
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->searchCryptocurrencyPairInstrumentsRequest($user_id, $user_secret, $account_id, $base, $quote, $contentType);
// Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+ $this->beforeSendHook($request, $requestOptions, $this->config);
try {
$options = $this->createHttpClientOption();
@@ -2113,11 +6041,12 @@ public function placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $valid
!empty($this->getConfig()->getAccessToken()) &&
$requestOptions->shouldRetryOAuth()
) {
- return $this->placeOrderWithHttpInfo(
- $trade_id,
+ return $this->searchCryptocurrencyPairInstrumentsWithHttpInfo(
$user_id,
$user_secret,
- $validated_trade_body,
+ $account_id,
+ $base,
+ $quote,
$contentType,
$requestOptions->setRetryOAuth(false)
);
@@ -2155,17 +6084,17 @@ public function placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $valid
switch($statusCode) {
case 200:
- if ('\SnapTrade\Model\AccountOrderRecord' === '\SplFileObject') {
+ if ('\SnapTrade\Model\TradingSearchCryptocurrencyPairInstruments200Response' === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
$content = (string) $response->getBody();
- if ('\SnapTrade\Model\AccountOrderRecord' !== 'string') {
+ if ('\SnapTrade\Model\TradingSearchCryptocurrencyPairInstruments200Response' !== 'string') {
$content = json_decode($content);
}
}
return [
- ObjectSerializer::deserialize($content, '\SnapTrade\Model\AccountOrderRecord', []),
+ ObjectSerializer::deserialize($content, '\SnapTrade\Model\TradingSearchCryptocurrencyPairInstruments200Response', []),
$response->getStatusCode(),
$response->getHeaders()
];
@@ -2186,7 +6115,7 @@ public function placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $valid
];
}
- $returnType = '\SnapTrade\Model\AccountOrderRecord';
+ $returnType = '\SnapTrade\Model\TradingSearchCryptocurrencyPairInstruments200Response';
if ($returnType === '\SplFileObject') {
$content = $response->getBody(); //stream goes to serializer
} else {
@@ -2207,7 +6136,7 @@ public function placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $valid
case 200:
$data = ObjectSerializer::deserialize(
$e->getResponseBody(),
- '\SnapTrade\Model\AccountOrderRecord',
+ '\SnapTrade\Model\TradingSearchCryptocurrencyPairInstruments200Response',
$e->getResponseHeaders()
);
$e->setResponseObject($data);
@@ -2226,33 +6155,34 @@ public function placeOrderWithHttpInfo($trade_id, $user_id, $user_secret, $valid
}
/**
- * Operation placeOrderAsync
+ * Operation searchCryptocurrencyPairInstrumentsAsync
*
- * Place order
+ * Get crypto pairs
+ *
+ * Searches cryptocurrency pairs instruments accessible to the specified account. Both `base` and `quote` are optional. Omit both for a full list of cryptocurrency pairs.
*
- * @param string $trade_id The ID of trade object obtained from trade/impact endpoint (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $base (optional)
+ * @param string $quote (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchCryptocurrencyPairInstruments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function placeOrderAsync(
- $trade_id,
+ public function searchCryptocurrencyPairInstrumentsAsync(
$user_id,
$user_secret,
- $wait_to_confirm = SENTINEL_VALUE,
+ $account_id,
+ $base = SENTINEL_VALUE,
+ $quote = SENTINEL_VALUE,
- string $contentType = self::contentTypes['placeOrder'][0]
+ string $contentType = self::contentTypes['searchCryptocurrencyPairInstruments'][0]
)
{
- $_body = null;
- $this->setRequestBodyProperty($_body, "wait_to_confirm", $wait_to_confirm);
- $validated_trade_body = $_body;
- return $this->placeOrderAsyncWithHttpInfo($trade_id, $user_id, $user_secret, $validated_trade_body, $contentType)
+ return $this->searchCryptocurrencyPairInstrumentsAsyncWithHttpInfo($user_id, $user_secret, $account_id, $base, $quote, $contentType)
->then(
function ($response) {
return $response[0];
@@ -2261,26 +6191,29 @@ function ($response) {
}
/**
- * Operation placeOrderAsyncWithHttpInfo
+ * Operation searchCryptocurrencyPairInstrumentsAsyncWithHttpInfo
+ *
+ * Get crypto pairs
*
- * Place order
+ * Searches cryptocurrency pairs instruments accessible to the specified account. Both `base` and `quote` are optional. Omit both for a full list of cryptocurrency pairs.
*
- * @param string $trade_id The ID of trade object obtained from trade/impact endpoint (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $base (optional)
+ * @param string $quote (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchCryptocurrencyPairInstruments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
*/
- public function placeOrderAsyncWithHttpInfo($trade_id, $user_id, $user_secret, $validated_trade_body = null, string $contentType = self::contentTypes['placeOrder'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
+ public function searchCryptocurrencyPairInstrumentsAsyncWithHttpInfo($user_id, $user_secret, $account_id, $base = null, $quote = null, string $contentType = self::contentTypes['searchCryptocurrencyPairInstruments'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
- $returnType = '\SnapTrade\Model\AccountOrderRecord';
- ["request" => $request, "serializedBody" => $serializedBody] = $this->placeOrderRequest($trade_id, $user_id, $user_secret, $validated_trade_body, $contentType);
+ $returnType = '\SnapTrade\Model\TradingSearchCryptocurrencyPairInstruments200Response';
+ ["request" => $request, "serializedBody" => $serializedBody] = $this->searchCryptocurrencyPairInstrumentsRequest($user_id, $user_secret, $account_id, $base, $quote, $contentType);
// Customization hook
- $this->beforeSendHook($request, $requestOptions, $this->config, $serializedBody);
+ $this->beforeSendHook($request, $requestOptions, $this->config);
return $this->client
->sendAsync($request, $this->createHttpClientOption())
@@ -2319,30 +6252,21 @@ function ($exception) {
}
/**
- * Create request for operation 'placeOrder'
+ * Create request for operation 'searchCryptocurrencyPairInstruments'
*
- * @param string $trade_id The ID of trade object obtained from trade/impact endpoint (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \SnapTrade\Model\ValidatedTradeBody $validated_trade_body (optional)
- * @param string $contentType The value for the Content-Type header. Check self::contentTypes['placeOrder'] to see the possible values for this operation
+ * @param string $account_id (required)
+ * @param string $base (optional)
+ * @param string $quote (optional)
+ * @param string $contentType The value for the Content-Type header. Check self::contentTypes['searchCryptocurrencyPairInstruments'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
*/
- public function placeOrderRequest($trade_id, $user_id, $user_secret, $validated_trade_body = SENTINEL_VALUE, string $contentType = self::contentTypes['placeOrder'][0])
+ public function searchCryptocurrencyPairInstrumentsRequest($user_id, $user_secret, $account_id, $base = SENTINEL_VALUE, $quote = SENTINEL_VALUE, string $contentType = self::contentTypes['searchCryptocurrencyPairInstruments'][0])
{
- // Check if $trade_id is a string
- if ($trade_id !== SENTINEL_VALUE && !is_string($trade_id)) {
- throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($trade_id, true), gettype($trade_id)));
- }
- // verify the required parameter 'trade_id' is set
- if ($trade_id === SENTINEL_VALUE || (is_array($trade_id) && count($trade_id) === 0)) {
- throw new \InvalidArgumentException(
- 'Missing the required parameter trade_id when calling placeOrder'
- );
- }
// Check if $user_id is a string
if ($user_id !== SENTINEL_VALUE && !is_string($user_id)) {
throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($user_id, true), gettype($user_id)));
@@ -2350,7 +6274,7 @@ public function placeOrderRequest($trade_id, $user_id, $user_secret, $validated_
// 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 placeOrder'
+ 'Missing the required parameter user_id when calling searchCryptocurrencyPairInstruments'
);
}
// Check if $user_secret is a string
@@ -2360,20 +6284,30 @@ public function placeOrderRequest($trade_id, $user_id, $user_secret, $validated_
// 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 placeOrder'
+ 'Missing the required parameter user_secret when calling searchCryptocurrencyPairInstruments'
);
}
- if ($validated_trade_body !== SENTINEL_VALUE) {
- if (!($validated_trade_body instanceof \SnapTrade\Model\ValidatedTradeBody)) {
- if (!is_array($validated_trade_body))
- throw new \InvalidArgumentException('"validated_trade_body" must be associative array or an instance of \SnapTrade\Model\ValidatedTradeBody TradingApi.placeOrder.');
- else
- $validated_trade_body = new \SnapTrade\Model\ValidatedTradeBody($validated_trade_body);
- }
+ // Check if $account_id is a string
+ if ($account_id !== SENTINEL_VALUE && !is_string($account_id)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($account_id, true), gettype($account_id)));
+ }
+ // 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 searchCryptocurrencyPairInstruments'
+ );
+ }
+ // Check if $base is a string
+ if ($base !== SENTINEL_VALUE && !is_string($base)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($base, true), gettype($base)));
+ }
+ // Check if $quote is a string
+ if ($quote !== SENTINEL_VALUE && !is_string($quote)) {
+ throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($quote, true), gettype($quote)));
}
- $resourcePath = '/trade/{tradeId}';
+ $resourcePath = '/accounts/{accountId}/trading/instruments/cryptocurrencyPairs';
$formParams = [];
$queryParams = [];
$headerParams = [];
@@ -2402,13 +6336,35 @@ public function placeOrderRequest($trade_id, $user_id, $user_secret, $validated_
true // required
) ?? []);
}
+ if ($base !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $base,
+ 'base', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
+ if ($quote !== SENTINEL_VALUE) {
+ // query params
+ $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue(
+ $quote,
+ 'quote', // param base name
+ 'string', // openApiType
+ 'form', // style
+ true, // explode
+ false // required
+ ) ?? []);
+ }
// path params
- if ($trade_id !== SENTINEL_VALUE) {
+ if ($account_id !== SENTINEL_VALUE) {
$resourcePath = str_replace(
- '{' . 'tradeId' . '}',
- ObjectSerializer::toPathValue($trade_id),
+ '{' . 'accountId' . '}',
+ ObjectSerializer::toPathValue($account_id),
$resourcePath
);
}
@@ -2421,14 +6377,7 @@ public function placeOrderRequest($trade_id, $user_id, $user_secret, $validated_
);
// for model (json/xml)
- if (isset($validated_trade_body)) {
- if (stripos($headers['Content-Type'], 'application/json') !== false) {
- # if Content-Type contains "application/json", json_encode the body
- $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($validated_trade_body));
- } else {
- $httpBody = $validated_trade_body;
- }
- } elseif (count($formParams) > 0) {
+ if (count($formParams) > 0) {
if ($multipart) {
$multipartContents = [];
foreach ($formParams as $formParamName => $formParamValue) {
@@ -2479,7 +6428,7 @@ public function placeOrderRequest($trade_id, $user_id, $user_secret, $validated_
$headers
);
- $method = 'POST';
+ $method = 'GET';
$this->beforeCreateRequestHook($method, $resourcePath, $queryParams, $headers, $httpBody);
$operationHost = $this->config->getHost();
diff --git a/lib/Api/TransactionsAndReportingApi.php b/lib/Api/TransactionsAndReportingApi.php
index d81c657..4f1d179 100644
--- a/lib/Api/TransactionsAndReportingApi.php
+++ b/lib/Api/TransactionsAndReportingApi.php
@@ -143,18 +143,21 @@ private function setRequestBodyProperty(&$body, $property, $value) {
*
* Get transaction history for a user
*
+ * This endpoint is being deprecated but will continue to be available for use via SDKs, please use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) if possible Returns all historical transactions for the specified user and filtering criteria. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request. There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order. The data returned here is always cached and refreshed once a day.
+ *
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param \DateTime $start_date start_date (optional)
- * @param \DateTime $end_date end_date (optional)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
- * @param string $brokerage_authorizations Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations (optional)
- * @param string $type Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT (optional)
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param string $accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter. (optional)
+ * @param string $brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getActivities'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return \SnapTrade\Model\UniversalActivity[]
+ * @deprecated
*/
public function getActivities(
$user_id,
@@ -178,18 +181,21 @@ public function getActivities(
*
* Get transaction history for a user
*
+ * This endpoint is being deprecated but will continue to be available for use via SDKs, please use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) if possible Returns all historical transactions for the specified user and filtering criteria. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request. There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order. The data returned here is always cached and refreshed once a day.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \DateTime $start_date (optional)
- * @param \DateTime $end_date (optional)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
- * @param string $brokerage_authorizations Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations (optional)
- * @param string $type Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT (optional)
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param string $accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter. (optional)
+ * @param string $brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getActivities'] to see the possible values for this operation
*
* @throws \SnapTrade\ApiException on non-2xx response
* @throws \InvalidArgumentException
* @return array of \SnapTrade\Model\UniversalActivity[], HTTP status code, HTTP response headers (array of strings)
+ * @deprecated
*/
public function getActivitiesWithHttpInfo($user_id, $user_secret, $start_date = null, $end_date = null, $accounts = null, $brokerage_authorizations = null, $type = null, string $contentType = self::contentTypes['getActivities'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
@@ -305,17 +311,20 @@ public function getActivitiesWithHttpInfo($user_id, $user_secret, $start_date =
*
* Get transaction history for a user
*
+ * This endpoint is being deprecated but will continue to be available for use via SDKs, please use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) if possible Returns all historical transactions for the specified user and filtering criteria. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request. There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order. The data returned here is always cached and refreshed once a day.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \DateTime $start_date (optional)
- * @param \DateTime $end_date (optional)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
- * @param string $brokerage_authorizations Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations (optional)
- * @param string $type Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT (optional)
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param string $accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter. (optional)
+ * @param string $brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getActivities'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
+ * @deprecated
*/
public function getActivitiesAsync(
$user_id,
@@ -343,17 +352,20 @@ function ($response) {
*
* Get transaction history for a user
*
+ * This endpoint is being deprecated but will continue to be available for use via SDKs, please use [the account level endpoint](/reference/Account%20Information/AccountInformation_getAccountActivities) if possible Returns all historical transactions for the specified user and filtering criteria. It's recommended to use `startDate` and `endDate` to paginate through the data, as the response may be very large for accounts with a long history and/or a lot of activity. There's a max number of 10000 transactions returned per request. There is no guarantee to the ordering of the transactions returned. Please sort the transactions based on the `trade_date` field if you need them in a specific order. The data returned here is always cached and refreshed once a day.
+ *
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \DateTime $start_date (optional)
- * @param \DateTime $end_date (optional)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
- * @param string $brokerage_authorizations Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations (optional)
- * @param string $type Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT (optional)
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param string $accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter. (optional)
+ * @param string $brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getActivities'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Promise\PromiseInterface
+ * @deprecated
*/
public function getActivitiesAsyncWithHttpInfo($user_id, $user_secret, $start_date = null, $end_date = null, $accounts = null, $brokerage_authorizations = null, $type = null, string $contentType = self::contentTypes['getActivities'][0], \SnapTrade\RequestOptions $requestOptions = new \SnapTrade\RequestOptions())
{
@@ -404,15 +416,16 @@ function ($exception) {
*
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param \DateTime $start_date (optional)
- * @param \DateTime $end_date (optional)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
- * @param string $brokerage_authorizations Optional comma seperated list of brokerage authorization IDs used to filter the request on only accounts that belong to those authorizations (optional)
- * @param string $type Optional comma seperated list of types to filter activities by. This is not an exhaustive list, if we fail to match to these types, we will return the raw description from the brokerage. Potential values include - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT (optional)
+ * @param \DateTime $start_date The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param \DateTime $end_date The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
+ * @param string $accounts Optional comma separated list of SnapTrade Account IDs used to filter the request to specific accounts. If not provided, the default is all known brokerage accounts for the user. The `brokerageAuthorizations` parameter takes precedence over this parameter. (optional)
+ * @param string $brokerage_authorizations Optional comma separated list of SnapTrade Connection (Brokerage Authorization) IDs used to filter the request to only accounts that belong to those connections. If not provided, the default is all connections for the user. This parameter takes precedence over the `accounts` parameter. (optional)
+ * @param string $type Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getActivities'] to see the possible values for this operation
*
* @throws \InvalidArgumentException
* @return \GuzzleHttp\Psr7\Request
+ * @deprecated
*/
public function getActivitiesRequest($user_id, $user_secret, $start_date = SENTINEL_VALUE, $end_date = SENTINEL_VALUE, $accounts = SENTINEL_VALUE, $brokerage_authorizations = SENTINEL_VALUE, $type = SENTINEL_VALUE, string $contentType = self::contentTypes['getActivities'][0])
{
@@ -618,11 +631,13 @@ public function getActivitiesRequest($user_id, $user_secret, $start_date = SENTI
*
* Get performance information for a specific timeframe
*
+ * Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.
+ *
* @param \DateTime $start_date start_date (required)
* @param \DateTime $end_date end_date (required)
* @param string $user_id user_id (required)
* @param string $user_secret user_secret (required)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
+ * @param string $accounts Optional comma separated list of account IDs used to filter the request on specific accounts (optional)
* @param bool $detailed Optional, increases frequency of data points for the total value and contribution charts if set to true (optional)
* @param string $frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReportingCustomRange'] to see the possible values for this operation
@@ -654,11 +669,13 @@ public function getReportingCustomRange(
*
* Get performance information for a specific timeframe
*
+ * Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.
+ *
* @param \DateTime $start_date (required)
* @param \DateTime $end_date (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
+ * @param string $accounts Optional comma separated list of account IDs used to filter the request on specific accounts (optional)
* @param bool $detailed Optional, increases frequency of data points for the total value and contribution charts if set to true (optional)
* @param string $frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReportingCustomRange'] to see the possible values for this operation
@@ -782,11 +799,13 @@ public function getReportingCustomRangeWithHttpInfo($start_date, $end_date, $use
*
* Get performance information for a specific timeframe
*
+ * Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.
+ *
* @param \DateTime $start_date (required)
* @param \DateTime $end_date (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
+ * @param string $accounts Optional comma separated list of account IDs used to filter the request on specific accounts (optional)
* @param bool $detailed Optional, increases frequency of data points for the total value and contribution charts if set to true (optional)
* @param string $frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReportingCustomRange'] to see the possible values for this operation
@@ -821,11 +840,13 @@ function ($response) {
*
* Get performance information for a specific timeframe
*
+ * Returns performance information (contributions, dividends, rate of return, etc) for a specific timeframe. Please note that Total Equity Timeframe and Rate of Returns are experimental features. Please contact support@snaptrade.com if you notice any inconsistencies.
+ *
* @param \DateTime $start_date (required)
* @param \DateTime $end_date (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
+ * @param string $accounts Optional comma separated list of account IDs used to filter the request on specific accounts (optional)
* @param bool $detailed Optional, increases frequency of data points for the total value and contribution charts if set to true (optional)
* @param string $frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReportingCustomRange'] to see the possible values for this operation
@@ -885,7 +906,7 @@ function ($exception) {
* @param \DateTime $end_date (required)
* @param string $user_id (required)
* @param string $user_secret (required)
- * @param string $accounts Optional comma seperated list of account IDs used to filter the request on specific accounts (optional)
+ * @param string $accounts Optional comma separated list of account IDs used to filter the request on specific accounts (optional)
* @param bool $detailed Optional, increases frequency of data points for the total value and contribution charts if set to true (optional)
* @param string $frequency Optional frequency for the rate of return chart (defaults to monthly). Possible values are daily, weekly, monthly, quarterly, yearly. (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['getReportingCustomRange'] to see the possible values for this operation
diff --git a/lib/Client.php b/lib/Client.php
index b8de060..dd3cd18 100644
--- a/lib/Client.php
+++ b/lib/Client.php
@@ -13,6 +13,8 @@ class Client
public readonly \SnapTrade\Api\ConnectionsApi $connections;
+ public readonly \SnapTrade\Api\ExperimentalEndpointsApi $experimentalEndpoints;
+
public readonly \SnapTrade\Api\OptionsApi $options;
public readonly \SnapTrade\Api\ReferenceDataApi $referenceData;
@@ -48,6 +50,7 @@ public function __construct(
$this->apiStatus = new \SnapTrade\Api\ApiStatusApi($config);
$this->authentication = new \SnapTrade\Api\AuthenticationApi($config);
$this->connections = new \SnapTrade\Api\ConnectionsApi($config);
+ $this->experimentalEndpoints = new \SnapTrade\Api\ExperimentalEndpointsApi($config);
$this->options = new \SnapTrade\Api\OptionsApi($config);
$this->referenceData = new \SnapTrade\Api\ReferenceDataApi($config);
$this->trading = new \SnapTrade\Api\TradingApi($config);
diff --git a/lib/Configuration.php b/lib/Configuration.php
index 3b0a423..a6934b4 100644
--- a/lib/Configuration.php
+++ b/lib/Configuration.php
@@ -97,7 +97,7 @@ class Configuration
*
* @var string
*/
- protected $userAgent = 'Konfig/2.0.32/PHP';
+ protected $userAgent = 'Konfig/2.0.160/PHP';
/**
* Debug switch (default set to false)
@@ -487,7 +487,7 @@ public static function toDebugReport()
$report .= ' OS: ' . php_uname() . PHP_EOL;
$report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL;
$report .= ' The version of the OpenAPI document: 1.0.0' . PHP_EOL;
- $report .= ' SDK Package Version: 2.0.32' . PHP_EOL;
+ $report .= ' SDK Package Version: 2.0.160' . PHP_EOL;
$report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL;
return $report;
diff --git a/lib/Model/Account.php b/lib/Model/Account.php
index 4676599..2196b23 100644
--- a/lib/Model/Account.php
+++ b/lib/Model/Account.php
@@ -30,7 +30,7 @@
* Account Class Doc Comment
*
* @category Class
- * @description A single brokerage account at a financial institution.
+ * @description A single account at a brokerage.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -53,15 +53,20 @@ class Account implements ModelInterface, ArrayAccess, \JsonSerializable
protected static $openAPITypes = [
'id' => 'string',
'brokerage_authorization' => 'string',
- 'portfolio_group' => 'string',
'name' => 'string',
'number' => 'string',
'institution_name' => 'string',
'created_date' => '\DateTime',
+ 'funding_date' => '\DateTime',
+ 'opening_date' => '\DateTime',
+ 'sync_status' => '\SnapTrade\Model\AccountSyncStatus',
+ 'balance' => '\SnapTrade\Model\AccountBalance',
+ 'status' => 'string',
+ 'raw_type' => 'string',
'meta' => 'array',
+ 'portfolio_group' => 'string',
'cash_restrictions' => 'string[]',
- 'sync_status' => '\SnapTrade\Model\AccountSyncStatus',
- 'balance' => '\SnapTrade\Model\AccountBalance'
+ 'is_paper' => 'bool'
];
/**
@@ -74,15 +79,20 @@ class Account implements ModelInterface, ArrayAccess, \JsonSerializable
protected static $openAPIFormats = [
'id' => null,
'brokerage_authorization' => 'uuid',
- 'portfolio_group' => 'uuid',
'name' => null,
'number' => null,
'institution_name' => null,
'created_date' => 'date-time',
+ 'funding_date' => 'date-time',
+ 'opening_date' => 'date-time',
+ 'sync_status' => null,
+ 'balance' => null,
+ 'status' => null,
+ 'raw_type' => null,
'meta' => null,
+ 'portfolio_group' => 'uuid',
'cash_restrictions' => null,
- 'sync_status' => null,
- 'balance' => null
+ 'is_paper' => null
];
/**
@@ -93,15 +103,20 @@ class Account implements ModelInterface, ArrayAccess, \JsonSerializable
protected static array $openAPINullables = [
'id' => false,
'brokerage_authorization' => false,
- 'portfolio_group' => false,
'name' => true,
'number' => false,
'institution_name' => false,
'created_date' => false,
+ 'funding_date' => true,
+ 'opening_date' => true,
+ 'sync_status' => false,
+ 'balance' => false,
+ 'status' => true,
+ 'raw_type' => true,
'meta' => false,
+ 'portfolio_group' => false,
'cash_restrictions' => false,
- 'sync_status' => false,
- 'balance' => false
+ 'is_paper' => false
];
/**
@@ -192,15 +207,20 @@ public function isNullableSetToNull(string $property): bool
protected static $attributeMap = [
'id' => 'id',
'brokerage_authorization' => 'brokerage_authorization',
- 'portfolio_group' => 'portfolio_group',
'name' => 'name',
'number' => 'number',
'institution_name' => 'institution_name',
'created_date' => 'created_date',
+ 'funding_date' => 'funding_date',
+ 'opening_date' => 'opening_date',
+ 'sync_status' => 'sync_status',
+ 'balance' => 'balance',
+ 'status' => 'status',
+ 'raw_type' => 'raw_type',
'meta' => 'meta',
+ 'portfolio_group' => 'portfolio_group',
'cash_restrictions' => 'cash_restrictions',
- 'sync_status' => 'sync_status',
- 'balance' => 'balance'
+ 'is_paper' => 'is_paper'
];
/**
@@ -211,15 +231,20 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'id' => 'setId',
'brokerage_authorization' => 'setBrokerageAuthorization',
- 'portfolio_group' => 'setPortfolioGroup',
'name' => 'setName',
'number' => 'setNumber',
'institution_name' => 'setInstitutionName',
'created_date' => 'setCreatedDate',
+ 'funding_date' => 'setFundingDate',
+ 'opening_date' => 'setOpeningDate',
+ 'sync_status' => 'setSyncStatus',
+ 'balance' => 'setBalance',
+ 'status' => 'setStatus',
+ 'raw_type' => 'setRawType',
'meta' => 'setMeta',
+ 'portfolio_group' => 'setPortfolioGroup',
'cash_restrictions' => 'setCashRestrictions',
- 'sync_status' => 'setSyncStatus',
- 'balance' => 'setBalance'
+ 'is_paper' => 'setIsPaper'
];
/**
@@ -230,15 +255,20 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'id' => 'getId',
'brokerage_authorization' => 'getBrokerageAuthorization',
- 'portfolio_group' => 'getPortfolioGroup',
'name' => 'getName',
'number' => 'getNumber',
'institution_name' => 'getInstitutionName',
'created_date' => 'getCreatedDate',
+ 'funding_date' => 'getFundingDate',
+ 'opening_date' => 'getOpeningDate',
+ 'sync_status' => 'getSyncStatus',
+ 'balance' => 'getBalance',
+ 'status' => 'getStatus',
+ 'raw_type' => 'getRawType',
'meta' => 'getMeta',
+ 'portfolio_group' => 'getPortfolioGroup',
'cash_restrictions' => 'getCashRestrictions',
- 'sync_status' => 'getSyncStatus',
- 'balance' => 'getBalance'
+ 'is_paper' => 'getIsPaper'
];
/**
@@ -282,6 +312,25 @@ public function getModelName()
return self::$openAPIModelName;
}
+ public const STATUS_OPEN = 'open';
+ public const STATUS_CLOSED = 'closed';
+ public const STATUS_ARCHIVED = 'archived';
+ public const STATUS_UNAVAILABLE = 'unavailable';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getStatusAllowableValues()
+ {
+ return [
+ self::STATUS_OPEN,
+ self::STATUS_CLOSED,
+ self::STATUS_ARCHIVED,
+ self::STATUS_UNAVAILABLE,
+ ];
+ }
/**
* Associative array for storing property values
@@ -300,15 +349,20 @@ public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('brokerage_authorization', $data ?? [], null);
- $this->setIfExists('portfolio_group', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('number', $data ?? [], null);
$this->setIfExists('institution_name', $data ?? [], null);
$this->setIfExists('created_date', $data ?? [], null);
- $this->setIfExists('meta', $data ?? [], null);
- $this->setIfExists('cash_restrictions', $data ?? [], null);
+ $this->setIfExists('funding_date', $data ?? [], null);
+ $this->setIfExists('opening_date', $data ?? [], null);
$this->setIfExists('sync_status', $data ?? [], null);
$this->setIfExists('balance', $data ?? [], null);
+ $this->setIfExists('status', $data ?? [], null);
+ $this->setIfExists('raw_type', $data ?? [], null);
+ $this->setIfExists('meta', $data ?? [], null);
+ $this->setIfExists('portfolio_group', $data ?? [], null);
+ $this->setIfExists('cash_restrictions', $data ?? [], null);
+ $this->setIfExists('is_paper', $data ?? [], null);
}
/**
@@ -338,6 +392,42 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if ($this->container['id'] === null) {
+ $invalidProperties[] = "'id' can't be null";
+ }
+ if ($this->container['brokerage_authorization'] === null) {
+ $invalidProperties[] = "'brokerage_authorization' can't be null";
+ }
+ if ($this->container['name'] === null) {
+ $invalidProperties[] = "'name' can't be null";
+ }
+ if ($this->container['number'] === null) {
+ $invalidProperties[] = "'number' can't be null";
+ }
+ if ($this->container['institution_name'] === null) {
+ $invalidProperties[] = "'institution_name' can't be null";
+ }
+ if ($this->container['created_date'] === null) {
+ $invalidProperties[] = "'created_date' can't be null";
+ }
+ if ($this->container['sync_status'] === null) {
+ $invalidProperties[] = "'sync_status' can't be null";
+ }
+ if ($this->container['balance'] === null) {
+ $invalidProperties[] = "'balance' can't be null";
+ }
+ $allowedValues = $this->getStatusAllowableValues();
+ if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'status', must be one of '%s'",
+ $this->container['status'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ if ($this->container['is_paper'] === null) {
+ $invalidProperties[] = "'is_paper' can't be null";
+ }
return $invalidProperties;
}
@@ -356,7 +446,7 @@ public function valid()
/**
* Gets id
*
- * @return string|null
+ * @return string
*/
public function getId()
{
@@ -366,7 +456,7 @@ public function getId()
/**
* Sets id
*
- * @param string|null $id Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade. This ID should not change for as long as the connection stays active. If the connection is deleted and re-added, a new account ID will be generated. If you want a stable identifier for the account, use the `number` field.
+ * @param string $id Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade. This ID should not change for as long as the connection stays active. If the connection is deleted and re-added, a new account ID will be generated.
*
* @return self
*/
@@ -385,7 +475,7 @@ public function setId($id)
/**
* Gets brokerage_authorization
*
- * @return string|null
+ * @return string
*/
public function getBrokerageAuthorization()
{
@@ -395,7 +485,7 @@ public function getBrokerageAuthorization()
/**
* Sets brokerage_authorization
*
- * @param string|null $brokerage_authorization Unique identifier for the connection (brokerage authorization). This is the UUID used to reference the connection in SnapTrade.
+ * @param string $brokerage_authorization Unique identifier for the connection. This is the UUID used to reference the connection in SnapTrade.
*
* @return self
*/
@@ -411,41 +501,10 @@ public function setBrokerageAuthorization($brokerage_authorization)
return $this;
}
- /**
- * Gets portfolio_group
- *
- * @return string|null
- * @deprecated
- */
- public function getPortfolioGroup()
- {
- return $this->container['portfolio_group'];
- }
-
- /**
- * Sets portfolio_group
- *
- * @param string|null $portfolio_group Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it.
- *
- * @return self
- * @deprecated
- */
- public function setPortfolioGroup($portfolio_group)
- {
-
- if (is_null($portfolio_group)) {
- throw new \InvalidArgumentException('non-nullable portfolio_group cannot be null');
- }
-
- $this->container['portfolio_group'] = $portfolio_group;
-
- return $this;
- }
-
/**
* Gets name
*
- * @return string|null
+ * @return string
*/
public function getName()
{
@@ -455,7 +514,7 @@ public function getName()
/**
* Sets name
*
- * @param string|null $name A display name for the account. Either assigned by the user or by the financial institution itself. For certain institutions, SnapTrade appends the institution name to the account name for clarity.
+ * @param string $name A display name for the account. Either assigned by the user or by the brokerage itself. For certain brokerages, SnapTrade appends the brokerage name to the account name for clarity.
*
* @return self
*/
@@ -481,7 +540,7 @@ public function setName($name)
/**
* Gets number
*
- * @return string|null
+ * @return string
*/
public function getNumber()
{
@@ -491,7 +550,7 @@ public function getNumber()
/**
* Sets number
*
- * @param string|null $number The account number assigned by the financial institution.
+ * @param string $number The account number assigned by the brokerage. For some brokerages, this field may be masked for security reasons.
*
* @return self
*/
@@ -510,7 +569,7 @@ public function setNumber($number)
/**
* Gets institution_name
*
- * @return string|null
+ * @return string
*/
public function getInstitutionName()
{
@@ -520,7 +579,7 @@ public function getInstitutionName()
/**
* Sets institution_name
*
- * @param string|null $institution_name The name of the financial institution that holds the account.
+ * @param string $institution_name The name of the brokerage that holds the account.
*
* @return self
*/
@@ -539,7 +598,7 @@ public function setInstitutionName($institution_name)
/**
* Gets created_date
*
- * @return \DateTime|null
+ * @return \DateTime
*/
public function getCreatedDate()
{
@@ -549,7 +608,7 @@ public function getCreatedDate()
/**
* Sets created_date
*
- * @param \DateTime|null $created_date Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the financial institution.
+ * @param \DateTime $created_date Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was created in SnapTrade. This is _not_ the account opening date at the brokerage.
*
* @return self
*/
@@ -566,63 +625,73 @@ public function setCreatedDate($created_date)
}
/**
- * Gets meta
+ * Gets funding_date
*
- * @return array|null
- * @deprecated
+ * @return \DateTime|null
*/
- public function getMeta()
+ public function getFundingDate()
{
- return $this->container['meta'];
+ return $this->container['funding_date'];
}
/**
- * Sets meta
+ * Sets funding_date
*
- * @param array|null $meta Additional information about the account, such as account type, status, etc. This information is specific to the financial institution and there's no standard format for this data. Please use at your own risk.
+ * @param \DateTime|null $funding_date Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was funded.
*
* @return self
- * @deprecated
*/
- public function setMeta($meta)
+ public function setFundingDate($funding_date)
{
- if (is_null($meta)) {
- throw new \InvalidArgumentException('non-nullable meta cannot be null');
+ if (is_null($funding_date)) {
+ array_push($this->openAPINullablesSetToNull, 'funding_date');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('funding_date', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
- $this->container['meta'] = $meta;
+ $this->container['funding_date'] = $funding_date;
return $this;
}
/**
- * Gets cash_restrictions
+ * Gets opening_date
*
- * @return string[]|null
- * @deprecated
+ * @return \DateTime|null
*/
- public function getCashRestrictions()
+ public function getOpeningDate()
{
- return $this->container['cash_restrictions'];
+ return $this->container['opening_date'];
}
/**
- * Sets cash_restrictions
+ * Sets opening_date
*
- * @param string[]|null $cash_restrictions This field is deprecated.
+ * @param \DateTime|null $opening_date Timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format indicating when the account was opened at the brokerage.
*
* @return self
- * @deprecated
*/
- public function setCashRestrictions($cash_restrictions)
+ public function setOpeningDate($opening_date)
{
- if (is_null($cash_restrictions)) {
- throw new \InvalidArgumentException('non-nullable cash_restrictions cannot be null');
+ if (is_null($opening_date)) {
+ array_push($this->openAPINullablesSetToNull, 'opening_date');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('opening_date', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
- $this->container['cash_restrictions'] = $cash_restrictions;
+ $this->container['opening_date'] = $opening_date;
return $this;
}
@@ -630,7 +699,7 @@ public function setCashRestrictions($cash_restrictions)
/**
* Gets sync_status
*
- * @return \SnapTrade\Model\AccountSyncStatus|null
+ * @return \SnapTrade\Model\AccountSyncStatus
*/
public function getSyncStatus()
{
@@ -640,7 +709,7 @@ public function getSyncStatus()
/**
* Sets sync_status
*
- * @param \SnapTrade\Model\AccountSyncStatus|null $sync_status sync_status
+ * @param \SnapTrade\Model\AccountSyncStatus $sync_status sync_status
*
* @return self
*/
@@ -659,7 +728,7 @@ public function setSyncStatus($sync_status)
/**
* Gets balance
*
- * @return \SnapTrade\Model\AccountBalance|null
+ * @return \SnapTrade\Model\AccountBalance
*/
public function getBalance()
{
@@ -669,7 +738,7 @@ public function getBalance()
/**
* Sets balance
*
- * @param \SnapTrade\Model\AccountBalance|null $balance balance
+ * @param \SnapTrade\Model\AccountBalance $balance balance
*
* @return self
*/
@@ -684,6 +753,210 @@ public function setBalance($balance)
return $this;
}
+
+ /**
+ * Gets status
+ *
+ * @return string|null
+ */
+ public function getStatus()
+ {
+ return $this->container['status'];
+ }
+
+ /**
+ * Sets status
+ *
+ * @param string|null $status The current status of the account. Can be either \"open\", \"closed\", \"archived\" or null if the status is unknown or not provided by the brokerage.
+ *
+ * @return self
+ */
+ public function setStatus($status)
+ {
+ $allowedValues = $this->getStatusAllowableValues();
+ if (!is_null($status) && !in_array($status, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'status', must be one of '%s'",
+ $status,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+
+ if (is_null($status)) {
+ array_push($this->openAPINullablesSetToNull, 'status');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('status', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['status'] = $status;
+
+ return $this;
+ }
+
+ /**
+ * Gets raw_type
+ *
+ * @return string|null
+ */
+ public function getRawType()
+ {
+ return $this->container['raw_type'];
+ }
+
+ /**
+ * Sets raw_type
+ *
+ * @param string|null $raw_type The account type as provided by the brokerage
+ *
+ * @return self
+ */
+ public function setRawType($raw_type)
+ {
+
+ if (is_null($raw_type)) {
+ array_push($this->openAPINullablesSetToNull, 'raw_type');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('raw_type', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['raw_type'] = $raw_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets meta
+ *
+ * @return array|null
+ * @deprecated
+ */
+ public function getMeta()
+ {
+ return $this->container['meta'];
+ }
+
+ /**
+ * Sets meta
+ *
+ * @param array|null $meta Additional information about the account, such as account type, status, etc. This information is specific to the brokerage and there's no standard format for this data. This field is deprecated and subject to removal in a future version.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setMeta($meta)
+ {
+
+ if (is_null($meta)) {
+ throw new \InvalidArgumentException('non-nullable meta cannot be null');
+ }
+
+ $this->container['meta'] = $meta;
+
+ return $this;
+ }
+
+ /**
+ * Gets portfolio_group
+ *
+ * @return string|null
+ * @deprecated
+ */
+ public function getPortfolioGroup()
+ {
+ return $this->container['portfolio_group'];
+ }
+
+ /**
+ * Sets portfolio_group
+ *
+ * @param string|null $portfolio_group Portfolio Group ID. Portfolio Groups have been deprecated. Please contact support if you have a usecase for it.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setPortfolioGroup($portfolio_group)
+ {
+
+ if (is_null($portfolio_group)) {
+ throw new \InvalidArgumentException('non-nullable portfolio_group cannot be null');
+ }
+
+ $this->container['portfolio_group'] = $portfolio_group;
+
+ return $this;
+ }
+
+ /**
+ * Gets cash_restrictions
+ *
+ * @return string[]|null
+ * @deprecated
+ */
+ public function getCashRestrictions()
+ {
+ return $this->container['cash_restrictions'];
+ }
+
+ /**
+ * Sets cash_restrictions
+ *
+ * @param string[]|null $cash_restrictions This field is deprecated.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setCashRestrictions($cash_restrictions)
+ {
+
+ if (is_null($cash_restrictions)) {
+ throw new \InvalidArgumentException('non-nullable cash_restrictions cannot be null');
+ }
+
+ $this->container['cash_restrictions'] = $cash_restrictions;
+
+ return $this;
+ }
+
+ /**
+ * Gets is_paper
+ *
+ * @return bool
+ */
+ public function getIsPaper()
+ {
+ return $this->container['is_paper'];
+ }
+
+ /**
+ * Sets is_paper
+ *
+ * @param bool $is_paper Indicates whether the account is a paper (simulated) trading account.
+ *
+ * @return self
+ */
+ public function setIsPaper($is_paper)
+ {
+
+ if (is_null($is_paper)) {
+ throw new \InvalidArgumentException('non-nullable is_paper cannot be null');
+ }
+
+ $this->container['is_paper'] = $is_paper;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/AccountHoldings.php b/lib/Model/AccountHoldings.php
index 151b99e..dbe4070 100644
--- a/lib/Model/AccountHoldings.php
+++ b/lib/Model/AccountHoldings.php
@@ -409,6 +409,7 @@ public function setPositions($positions)
* Gets total_value
*
* @return \SnapTrade\Model\SnapTradeHoldingsTotalValue|null
+ * @deprecated
*/
public function getTotalValue()
{
@@ -421,6 +422,7 @@ public function getTotalValue()
* @param \SnapTrade\Model\SnapTradeHoldingsTotalValue|null $total_value total_value
*
* @return self
+ * @deprecated
*/
public function setTotalValue($total_value)
{
diff --git a/lib/Model/AccountHoldingsAccount.php b/lib/Model/AccountHoldingsAccount.php
index 0779629..55969e0 100644
--- a/lib/Model/AccountHoldingsAccount.php
+++ b/lib/Model/AccountHoldingsAccount.php
@@ -495,6 +495,7 @@ public function setOrders($orders)
* Gets total_value
*
* @return \SnapTrade\Model\SnapTradeHoldingsTotalValue|null
+ * @deprecated
*/
public function getTotalValue()
{
@@ -507,6 +508,7 @@ public function getTotalValue()
* @param \SnapTrade\Model\SnapTradeHoldingsTotalValue|null $total_value total_value
*
* @return self
+ * @deprecated
*/
public function setTotalValue($total_value)
{
diff --git a/lib/Model/TradingCancelUserAccountOrderRequest.php b/lib/Model/AccountInformationGetUserAccountOrderDetailRequest.php
similarity index 92%
rename from lib/Model/TradingCancelUserAccountOrderRequest.php
rename to lib/Model/AccountInformationGetUserAccountOrderDetailRequest.php
index 70f4351..5fe4e12 100644
--- a/lib/Model/TradingCancelUserAccountOrderRequest.php
+++ b/lib/Model/AccountInformationGetUserAccountOrderDetailRequest.php
@@ -1,6 +1,6 @@
*/
-class TradingCancelUserAccountOrderRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+class AccountInformationGetUserAccountOrderDetailRequest implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
@@ -42,7 +42,7 @@ class TradingCancelUserAccountOrderRequest implements ModelInterface, ArrayAcces
*
* @var string
*/
- protected static $openAPIModelName = 'Trading_cancelUserAccountOrder_request';
+ protected static $openAPIModelName = 'AccountInformation_getUserAccountOrderDetail_request';
/**
* Array of property to type mappings. Used for (de)serialization
@@ -61,7 +61,7 @@ class TradingCancelUserAccountOrderRequest implements ModelInterface, ArrayAcces
* @psalm-var array
*/
protected static $openAPIFormats = [
- 'brokerage_order_id' => 'uuid'
+ 'brokerage_order_id' => null
];
/**
@@ -267,6 +267,9 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if ($this->container['brokerage_order_id'] === null) {
+ $invalidProperties[] = "'brokerage_order_id' can't be null";
+ }
return $invalidProperties;
}
@@ -285,7 +288,7 @@ public function valid()
/**
* Gets brokerage_order_id
*
- * @return string|null
+ * @return string
*/
public function getBrokerageOrderId()
{
@@ -295,7 +298,7 @@ public function getBrokerageOrderId()
/**
* Sets brokerage_order_id
*
- * @param string|null $brokerage_order_id brokerage_order_id
+ * @param string $brokerage_order_id Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
*
* @return self
*/
diff --git a/lib/Model/AccountOrderRecord.php b/lib/Model/AccountOrderRecord.php
index 00d6445..af5a04b 100644
--- a/lib/Model/AccountOrderRecord.php
+++ b/lib/Model/AccountOrderRecord.php
@@ -53,14 +53,15 @@ class AccountOrderRecord implements ModelInterface, ArrayAccess, \JsonSerializab
protected static $openAPITypes = [
'brokerage_order_id' => 'string',
'status' => '\SnapTrade\Model\AccountOrderRecordStatus',
- 'symbol' => 'string',
'universal_symbol' => '\SnapTrade\Model\AccountOrderRecordUniversalSymbol',
'option_symbol' => '\SnapTrade\Model\AccountOrderRecordOptionSymbol',
+ 'quote_universal_symbol' => '\SnapTrade\Model\AccountOrderRecordQuoteUniversalSymbol',
+ 'quote_currency' => '\SnapTrade\Model\AccountOrderRecordQuoteCurrency',
'action' => 'string',
- 'total_quantity' => 'float',
- 'open_quantity' => 'float',
- 'canceled_quantity' => 'float',
- 'filled_quantity' => 'float',
+ 'total_quantity' => 'string',
+ 'open_quantity' => 'string',
+ 'canceled_quantity' => 'string',
+ 'filled_quantity' => 'string',
'execution_price' => 'float',
'limit_price' => 'float',
'stop_price' => 'float',
@@ -69,7 +70,9 @@ class AccountOrderRecord implements ModelInterface, ArrayAccess, \JsonSerializab
'time_placed' => '\DateTime',
'time_updated' => '\DateTime',
'time_executed' => '\DateTime',
- 'expiry_date' => '\DateTime'
+ 'expiry_date' => '\DateTime',
+ 'symbol' => 'string',
+ 'child_brokerage_order_ids' => '\SnapTrade\Model\AccountOrderRecordChildBrokerageOrderIds'
];
/**
@@ -82,9 +85,10 @@ class AccountOrderRecord implements ModelInterface, ArrayAccess, \JsonSerializab
protected static $openAPIFormats = [
'brokerage_order_id' => null,
'status' => null,
- 'symbol' => 'uuid',
'universal_symbol' => null,
'option_symbol' => null,
+ 'quote_universal_symbol' => null,
+ 'quote_currency' => null,
'action' => null,
'total_quantity' => null,
'open_quantity' => null,
@@ -98,7 +102,9 @@ class AccountOrderRecord implements ModelInterface, ArrayAccess, \JsonSerializab
'time_placed' => 'date-time',
'time_updated' => 'date-time',
'time_executed' => 'date-time',
- 'expiry_date' => 'date-time'
+ 'expiry_date' => 'date-time',
+ 'symbol' => 'uuid',
+ 'child_brokerage_order_ids' => null
];
/**
@@ -109,9 +115,10 @@ class AccountOrderRecord implements ModelInterface, ArrayAccess, \JsonSerializab
protected static array $openAPINullables = [
'brokerage_order_id' => false,
'status' => false,
- 'symbol' => false,
'universal_symbol' => false,
'option_symbol' => false,
+ 'quote_universal_symbol' => false,
+ 'quote_currency' => false,
'action' => false,
'total_quantity' => true,
'open_quantity' => true,
@@ -125,7 +132,9 @@ class AccountOrderRecord implements ModelInterface, ArrayAccess, \JsonSerializab
'time_placed' => false,
'time_updated' => true,
'time_executed' => true,
- 'expiry_date' => true
+ 'expiry_date' => true,
+ 'symbol' => false,
+ 'child_brokerage_order_ids' => true
];
/**
@@ -216,9 +225,10 @@ public function isNullableSetToNull(string $property): bool
protected static $attributeMap = [
'brokerage_order_id' => 'brokerage_order_id',
'status' => 'status',
- 'symbol' => 'symbol',
'universal_symbol' => 'universal_symbol',
'option_symbol' => 'option_symbol',
+ 'quote_universal_symbol' => 'quote_universal_symbol',
+ 'quote_currency' => 'quote_currency',
'action' => 'action',
'total_quantity' => 'total_quantity',
'open_quantity' => 'open_quantity',
@@ -232,7 +242,9 @@ public function isNullableSetToNull(string $property): bool
'time_placed' => 'time_placed',
'time_updated' => 'time_updated',
'time_executed' => 'time_executed',
- 'expiry_date' => 'expiry_date'
+ 'expiry_date' => 'expiry_date',
+ 'symbol' => 'symbol',
+ 'child_brokerage_order_ids' => 'child_brokerage_order_ids'
];
/**
@@ -243,9 +255,10 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'brokerage_order_id' => 'setBrokerageOrderId',
'status' => 'setStatus',
- 'symbol' => 'setSymbol',
'universal_symbol' => 'setUniversalSymbol',
'option_symbol' => 'setOptionSymbol',
+ 'quote_universal_symbol' => 'setQuoteUniversalSymbol',
+ 'quote_currency' => 'setQuoteCurrency',
'action' => 'setAction',
'total_quantity' => 'setTotalQuantity',
'open_quantity' => 'setOpenQuantity',
@@ -259,7 +272,9 @@ public function isNullableSetToNull(string $property): bool
'time_placed' => 'setTimePlaced',
'time_updated' => 'setTimeUpdated',
'time_executed' => 'setTimeExecuted',
- 'expiry_date' => 'setExpiryDate'
+ 'expiry_date' => 'setExpiryDate',
+ 'symbol' => 'setSymbol',
+ 'child_brokerage_order_ids' => 'setChildBrokerageOrderIds'
];
/**
@@ -270,9 +285,10 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'brokerage_order_id' => 'getBrokerageOrderId',
'status' => 'getStatus',
- 'symbol' => 'getSymbol',
'universal_symbol' => 'getUniversalSymbol',
'option_symbol' => 'getOptionSymbol',
+ 'quote_universal_symbol' => 'getQuoteUniversalSymbol',
+ 'quote_currency' => 'getQuoteCurrency',
'action' => 'getAction',
'total_quantity' => 'getTotalQuantity',
'open_quantity' => 'getOpenQuantity',
@@ -286,7 +302,9 @@ public function isNullableSetToNull(string $property): bool
'time_placed' => 'getTimePlaced',
'time_updated' => 'getTimeUpdated',
'time_executed' => 'getTimeExecuted',
- 'expiry_date' => 'getExpiryDate'
+ 'expiry_date' => 'getExpiryDate',
+ 'symbol' => 'getSymbol',
+ 'child_brokerage_order_ids' => 'getChildBrokerageOrderIds'
];
/**
@@ -348,9 +366,10 @@ public function __construct(array $data = null)
{
$this->setIfExists('brokerage_order_id', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
- $this->setIfExists('symbol', $data ?? [], null);
$this->setIfExists('universal_symbol', $data ?? [], null);
$this->setIfExists('option_symbol', $data ?? [], null);
+ $this->setIfExists('quote_universal_symbol', $data ?? [], null);
+ $this->setIfExists('quote_currency', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
$this->setIfExists('total_quantity', $data ?? [], null);
$this->setIfExists('open_quantity', $data ?? [], null);
@@ -365,6 +384,8 @@ public function __construct(array $data = null)
$this->setIfExists('time_updated', $data ?? [], null);
$this->setIfExists('time_executed', $data ?? [], null);
$this->setIfExists('expiry_date', $data ?? [], null);
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('child_brokerage_order_ids', $data ?? [], null);
}
/**
@@ -467,37 +488,6 @@ public function setStatus($status)
return $this;
}
- /**
- * Gets symbol
- *
- * @return string|null
- * @deprecated
- */
- public function getSymbol()
- {
- return $this->container['symbol'];
- }
-
- /**
- * Sets symbol
- *
- * @param string|null $symbol A unique ID for the security within SnapTrade, scoped to the brokerage account that the security belongs to. This is a legacy field and should not be used. Do not rely on this being a stable ID as it can change.
- *
- * @return self
- * @deprecated
- */
- public function setSymbol($symbol)
- {
-
- if (is_null($symbol)) {
- throw new \InvalidArgumentException('non-nullable symbol cannot be null');
- }
-
- $this->container['symbol'] = $symbol;
-
- return $this;
- }
-
/**
* Gets universal_symbol
*
@@ -556,6 +546,64 @@ public function setOptionSymbol($option_symbol)
return $this;
}
+ /**
+ * Gets quote_universal_symbol
+ *
+ * @return \SnapTrade\Model\AccountOrderRecordQuoteUniversalSymbol|null
+ */
+ public function getQuoteUniversalSymbol()
+ {
+ return $this->container['quote_universal_symbol'];
+ }
+
+ /**
+ * Sets quote_universal_symbol
+ *
+ * @param \SnapTrade\Model\AccountOrderRecordQuoteUniversalSymbol|null $quote_universal_symbol quote_universal_symbol
+ *
+ * @return self
+ */
+ public function setQuoteUniversalSymbol($quote_universal_symbol)
+ {
+
+ if (is_null($quote_universal_symbol)) {
+ throw new \InvalidArgumentException('non-nullable quote_universal_symbol cannot be null');
+ }
+
+ $this->container['quote_universal_symbol'] = $quote_universal_symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets quote_currency
+ *
+ * @return \SnapTrade\Model\AccountOrderRecordQuoteCurrency|null
+ */
+ public function getQuoteCurrency()
+ {
+ return $this->container['quote_currency'];
+ }
+
+ /**
+ * Sets quote_currency
+ *
+ * @param \SnapTrade\Model\AccountOrderRecordQuoteCurrency|null $quote_currency quote_currency
+ *
+ * @return self
+ */
+ public function setQuoteCurrency($quote_currency)
+ {
+
+ if (is_null($quote_currency)) {
+ throw new \InvalidArgumentException('non-nullable quote_currency cannot be null');
+ }
+
+ $this->container['quote_currency'] = $quote_currency;
+
+ return $this;
+ }
+
/**
* Gets action
*
@@ -588,7 +636,7 @@ public function setAction($action)
/**
* Gets total_quantity
*
- * @return float|null
+ * @return string|null
*/
public function getTotalQuantity()
{
@@ -598,7 +646,7 @@ public function getTotalQuantity()
/**
* Sets total_quantity
*
- * @param float|null $total_quantity The total number of shares or contracts of the order. This should be the sum of the filled, canceled, and open quantities. Can be a decimal number for fractional shares.
+ * @param string|null $total_quantity The total number of shares or contracts of the order. This should be the sum of the filled, canceled, and open quantities. Can be a decimal number for fractional shares.
*
* @return self
*/
@@ -624,7 +672,7 @@ public function setTotalQuantity($total_quantity)
/**
* Gets open_quantity
*
- * @return float|null
+ * @return string|null
*/
public function getOpenQuantity()
{
@@ -634,7 +682,7 @@ public function getOpenQuantity()
/**
* Sets open_quantity
*
- * @param float|null $open_quantity The number of shares or contracts that are still open (waiting for execution). Can be a decimal number for fractional shares.
+ * @param string|null $open_quantity The number of shares or contracts that are still open (waiting for execution). Can be a decimal number for fractional shares.
*
* @return self
*/
@@ -660,7 +708,7 @@ public function setOpenQuantity($open_quantity)
/**
* Gets canceled_quantity
*
- * @return float|null
+ * @return string|null
*/
public function getCanceledQuantity()
{
@@ -670,7 +718,7 @@ public function getCanceledQuantity()
/**
* Sets canceled_quantity
*
- * @param float|null $canceled_quantity The number of shares or contracts that have been canceled. Can be a decimal number for fractional shares.
+ * @param string|null $canceled_quantity The number of shares or contracts that have been canceled. Can be a decimal number for fractional shares.
*
* @return self
*/
@@ -696,7 +744,7 @@ public function setCanceledQuantity($canceled_quantity)
/**
* Gets filled_quantity
*
- * @return float|null
+ * @return string|null
*/
public function getFilledQuantity()
{
@@ -706,7 +754,7 @@ public function getFilledQuantity()
/**
* Sets filled_quantity
*
- * @param float|null $filled_quantity The number of shares or contracts that have been filled. Can be a decimal number for fractional shares.
+ * @param string|null $filled_quantity The number of shares or contracts that have been filled. Can be a decimal number for fractional shares.
*
* @return self
*/
@@ -886,7 +934,7 @@ public function getTimeInForce()
/**
* Sets time_in_force
*
- * @param string|null $time_in_force The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. We try our best to map brokerage time in force values to the following. When mapping fails, we will return the brokerage's time in force value. - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
+ * @param string|null $time_in_force The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. We try our best to map brokerage time in force values to the following. When mapping fails, we will return the brokerage's time in force value. - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date. - `MOO` - Market On Open. The order is to be executed at the day's opening price. - `EHP` - Extended Hours P.M. The order is to be placed during extended hour trading, after markets close.
*
* @return self
*/
@@ -1038,6 +1086,73 @@ public function setExpiryDate($expiry_date)
return $this;
}
+
+ /**
+ * Gets symbol
+ *
+ * @return string|null
+ * @deprecated
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string|null $symbol A unique ID for the security within SnapTrade, scoped to the brokerage account that the security belongs to. This is a legacy field and should not be used. Do not rely on this being a stable ID as it can change.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets child_brokerage_order_ids
+ *
+ * @return \SnapTrade\Model\AccountOrderRecordChildBrokerageOrderIds|null
+ */
+ public function getChildBrokerageOrderIds()
+ {
+ return $this->container['child_brokerage_order_ids'];
+ }
+
+ /**
+ * Sets child_brokerage_order_ids
+ *
+ * @param \SnapTrade\Model\AccountOrderRecordChildBrokerageOrderIds|null $child_brokerage_order_ids child_brokerage_order_ids
+ *
+ * @return self
+ */
+ public function setChildBrokerageOrderIds($child_brokerage_order_ids)
+ {
+
+ if (is_null($child_brokerage_order_ids)) {
+ array_push($this->openAPINullablesSetToNull, 'child_brokerage_order_ids');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('child_brokerage_order_ids', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['child_brokerage_order_ids'] = $child_brokerage_order_ids;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/AccountOrderRecordChildBrokerageOrderIds.php b/lib/Model/AccountOrderRecordChildBrokerageOrderIds.php
new file mode 100644
index 0000000..49ea682
--- /dev/null
+++ b/lib/Model/AccountOrderRecordChildBrokerageOrderIds.php
@@ -0,0 +1,440 @@
+
+ */
+class AccountOrderRecordChildBrokerageOrderIds implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountOrderRecord_child_brokerage_order_ids';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'take_profit_order_id' => 'string',
+ 'stop_loss_order_id' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'take_profit_order_id' => null,
+ 'stop_loss_order_id' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'take_profit_order_id' => false,
+ 'stop_loss_order_id' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'take_profit_order_id' => 'take_profit_order_id',
+ 'stop_loss_order_id' => 'stop_loss_order_id'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'take_profit_order_id' => 'setTakeProfitOrderId',
+ 'stop_loss_order_id' => 'setStopLossOrderId'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'take_profit_order_id' => 'getTakeProfitOrderId',
+ 'stop_loss_order_id' => 'getStopLossOrderId'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('take_profit_order_id', $data ?? [], null);
+ $this->setIfExists('stop_loss_order_id', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets take_profit_order_id
+ *
+ * @return string|null
+ */
+ public function getTakeProfitOrderId()
+ {
+ return $this->container['take_profit_order_id'];
+ }
+
+ /**
+ * Sets take_profit_order_id
+ *
+ * @param string|null $take_profit_order_id The brokerage order ID for the take profit leg of the bracket order
+ *
+ * @return self
+ */
+ public function setTakeProfitOrderId($take_profit_order_id)
+ {
+
+ if (is_null($take_profit_order_id)) {
+ throw new \InvalidArgumentException('non-nullable take_profit_order_id cannot be null');
+ }
+
+ $this->container['take_profit_order_id'] = $take_profit_order_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop_loss_order_id
+ *
+ * @return string|null
+ */
+ public function getStopLossOrderId()
+ {
+ return $this->container['stop_loss_order_id'];
+ }
+
+ /**
+ * Sets stop_loss_order_id
+ *
+ * @param string|null $stop_loss_order_id The brokerage order ID for the stop loss leg of the bracket order
+ *
+ * @return self
+ */
+ public function setStopLossOrderId($stop_loss_order_id)
+ {
+
+ if (is_null($stop_loss_order_id)) {
+ throw new \InvalidArgumentException('non-nullable stop_loss_order_id cannot be null');
+ }
+
+ $this->container['stop_loss_order_id'] = $stop_loss_order_id;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountOrderRecordLeg.php b/lib/Model/AccountOrderRecordLeg.php
new file mode 100644
index 0000000..c27f223
--- /dev/null
+++ b/lib/Model/AccountOrderRecordLeg.php
@@ -0,0 +1,699 @@
+
+ */
+class AccountOrderRecordLeg implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountOrderRecordLeg';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'leg_id' => 'string',
+ 'instrument' => '\SnapTrade\Model\AccountOrderRecordLegInstrument',
+ 'action' => 'string',
+ 'execution_price' => 'float',
+ 'total_quantity' => 'string',
+ 'canceled_quantity' => 'string',
+ 'filled_quantity' => 'string',
+ 'status' => 'AccountOrderRecordStatusV2'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'leg_id' => null,
+ 'instrument' => null,
+ 'action' => null,
+ 'execution_price' => null,
+ 'total_quantity' => null,
+ 'canceled_quantity' => null,
+ 'filled_quantity' => null,
+ 'status' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'leg_id' => true,
+ 'instrument' => false,
+ 'action' => false,
+ 'execution_price' => true,
+ 'total_quantity' => true,
+ 'canceled_quantity' => true,
+ 'filled_quantity' => true,
+ 'status' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'leg_id' => 'leg_id',
+ 'instrument' => 'instrument',
+ 'action' => 'action',
+ 'execution_price' => 'execution_price',
+ 'total_quantity' => 'total_quantity',
+ 'canceled_quantity' => 'canceled_quantity',
+ 'filled_quantity' => 'filled_quantity',
+ 'status' => 'status'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'leg_id' => 'setLegId',
+ 'instrument' => 'setInstrument',
+ 'action' => 'setAction',
+ 'execution_price' => 'setExecutionPrice',
+ 'total_quantity' => 'setTotalQuantity',
+ 'canceled_quantity' => 'setCanceledQuantity',
+ 'filled_quantity' => 'setFilledQuantity',
+ 'status' => 'setStatus'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'leg_id' => 'getLegId',
+ 'instrument' => 'getInstrument',
+ 'action' => 'getAction',
+ 'execution_price' => 'getExecutionPrice',
+ 'total_quantity' => 'getTotalQuantity',
+ 'canceled_quantity' => 'getCanceledQuantity',
+ 'filled_quantity' => 'getFilledQuantity',
+ 'status' => 'getStatus'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('leg_id', $data ?? [], null);
+ $this->setIfExists('instrument', $data ?? [], null);
+ $this->setIfExists('action', $data ?? [], null);
+ $this->setIfExists('execution_price', $data ?? [], null);
+ $this->setIfExists('total_quantity', $data ?? [], null);
+ $this->setIfExists('canceled_quantity', $data ?? [], null);
+ $this->setIfExists('filled_quantity', $data ?? [], null);
+ $this->setIfExists('status', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets leg_id
+ *
+ * @return string|null
+ */
+ public function getLegId()
+ {
+ return $this->container['leg_id'];
+ }
+
+ /**
+ * Sets leg_id
+ *
+ * @param string|null $leg_id Brokerage order identifier for this leg, if available.
+ *
+ * @return self
+ */
+ public function setLegId($leg_id)
+ {
+
+ if (is_null($leg_id)) {
+ array_push($this->openAPINullablesSetToNull, 'leg_id');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('leg_id', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['leg_id'] = $leg_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets instrument
+ *
+ * @return \SnapTrade\Model\AccountOrderRecordLegInstrument|null
+ */
+ public function getInstrument()
+ {
+ return $this->container['instrument'];
+ }
+
+ /**
+ * Sets instrument
+ *
+ * @param \SnapTrade\Model\AccountOrderRecordLegInstrument|null $instrument instrument
+ *
+ * @return self
+ */
+ public function setInstrument($instrument)
+ {
+
+ if (is_null($instrument)) {
+ throw new \InvalidArgumentException('non-nullable instrument cannot be null');
+ }
+
+ $this->container['instrument'] = $instrument;
+
+ return $this;
+ }
+
+ /**
+ * Gets action
+ *
+ * @return string|null
+ */
+ public function getAction()
+ {
+ return $this->container['action'];
+ }
+
+ /**
+ * Sets action
+ *
+ * @param string|null $action The action describes the intent or side of a trade. - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_TO_OPEN - BUY_TO_CLOSE - SELL_TO_OPEN - SELL_TO_CLOSE
+ *
+ * @return self
+ */
+ public function setAction($action)
+ {
+
+ if (is_null($action)) {
+ throw new \InvalidArgumentException('non-nullable action cannot be null');
+ }
+
+ $this->container['action'] = $action;
+
+ return $this;
+ }
+
+ /**
+ * Gets execution_price
+ *
+ * @return float|null
+ */
+ public function getExecutionPrice()
+ {
+ return $this->container['execution_price'];
+ }
+
+ /**
+ * Sets execution_price
+ *
+ * @param float|null $execution_price Execution price for this leg, if available.
+ *
+ * @return self
+ */
+ public function setExecutionPrice($execution_price)
+ {
+
+ if (is_null($execution_price)) {
+ array_push($this->openAPINullablesSetToNull, 'execution_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('execution_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['execution_price'] = $execution_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets total_quantity
+ *
+ * @return string|null
+ */
+ public function getTotalQuantity()
+ {
+ return $this->container['total_quantity'];
+ }
+
+ /**
+ * Sets total_quantity
+ *
+ * @param string|null $total_quantity The total number of shares or contracts associated with this leg. Can be a decimal number for fractional shares.
+ *
+ * @return self
+ */
+ public function setTotalQuantity($total_quantity)
+ {
+
+ if (is_null($total_quantity)) {
+ array_push($this->openAPINullablesSetToNull, 'total_quantity');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('total_quantity', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['total_quantity'] = $total_quantity;
+
+ return $this;
+ }
+
+ /**
+ * Gets canceled_quantity
+ *
+ * @return string|null
+ */
+ public function getCanceledQuantity()
+ {
+ return $this->container['canceled_quantity'];
+ }
+
+ /**
+ * Sets canceled_quantity
+ *
+ * @param string|null $canceled_quantity The number of shares or contracts that have been canceled for this leg.
+ *
+ * @return self
+ */
+ public function setCanceledQuantity($canceled_quantity)
+ {
+
+ if (is_null($canceled_quantity)) {
+ array_push($this->openAPINullablesSetToNull, 'canceled_quantity');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('canceled_quantity', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['canceled_quantity'] = $canceled_quantity;
+
+ return $this;
+ }
+
+ /**
+ * Gets filled_quantity
+ *
+ * @return string|null
+ */
+ public function getFilledQuantity()
+ {
+ return $this->container['filled_quantity'];
+ }
+
+ /**
+ * Sets filled_quantity
+ *
+ * @param string|null $filled_quantity The number of shares or contracts that have been filled for this leg.
+ *
+ * @return self
+ */
+ public function setFilledQuantity($filled_quantity)
+ {
+
+ if (is_null($filled_quantity)) {
+ array_push($this->openAPINullablesSetToNull, 'filled_quantity');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('filled_quantity', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['filled_quantity'] = $filled_quantity;
+
+ return $this;
+ }
+
+ /**
+ * Gets status
+ *
+ * @return AccountOrderRecordStatusV2|null
+ */
+ public function getStatus()
+ {
+ return $this->container['status'];
+ }
+
+ /**
+ * Sets status
+ *
+ * @param AccountOrderRecordStatusV2|null $status status
+ *
+ * @return self
+ */
+ public function setStatus($status)
+ {
+
+ if (is_null($status)) {
+ array_push($this->openAPINullablesSetToNull, 'status');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('status', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['status'] = $status;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountOrderRecordLegInstrument.php b/lib/Model/AccountOrderRecordLegInstrument.php
new file mode 100644
index 0000000..24025a5
--- /dev/null
+++ b/lib/Model/AccountOrderRecordLegInstrument.php
@@ -0,0 +1,556 @@
+
+ */
+class AccountOrderRecordLegInstrument implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountOrderRecordLegInstrument';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'symbol' => 'string',
+ 'description' => 'string',
+ 'asset_type' => 'string',
+ 'exchange_mic_code' => 'string',
+ 'figi_code' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'symbol' => null,
+ 'description' => null,
+ 'asset_type' => null,
+ 'exchange_mic_code' => null,
+ 'figi_code' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'symbol' => false,
+ 'description' => false,
+ 'asset_type' => false,
+ 'exchange_mic_code' => false,
+ 'figi_code' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'symbol' => 'symbol',
+ 'description' => 'description',
+ 'asset_type' => 'asset_type',
+ 'exchange_mic_code' => 'exchange_mic_code',
+ 'figi_code' => 'figi_code'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'symbol' => 'setSymbol',
+ 'description' => 'setDescription',
+ 'asset_type' => 'setAssetType',
+ 'exchange_mic_code' => 'setExchangeMicCode',
+ 'figi_code' => 'setFigiCode'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'symbol' => 'getSymbol',
+ 'description' => 'getDescription',
+ 'asset_type' => 'getAssetType',
+ 'exchange_mic_code' => 'getExchangeMicCode',
+ 'figi_code' => 'getFigiCode'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('description', $data ?? [], null);
+ $this->setIfExists('asset_type', $data ?? [], null);
+ $this->setIfExists('exchange_mic_code', $data ?? [], null);
+ $this->setIfExists('figi_code', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets symbol
+ *
+ * @return string|null
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string|null $symbol The symbol or ticker for the security.
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets description
+ *
+ * @return string|null
+ */
+ public function getDescription()
+ {
+ return $this->container['description'];
+ }
+
+ /**
+ * Sets description
+ *
+ * @param string|null $description Human-readable description of the security.
+ *
+ * @return self
+ */
+ public function setDescription($description)
+ {
+
+ if (is_null($description)) {
+ throw new \InvalidArgumentException('non-nullable description cannot be null');
+ }
+
+ $this->container['description'] = $description;
+
+ return $this;
+ }
+
+ /**
+ * Gets asset_type
+ *
+ * @return string|null
+ */
+ public function getAssetType()
+ {
+ return $this->container['asset_type'];
+ }
+
+ /**
+ * Sets asset_type
+ *
+ * @param string|null $asset_type Type of instrument for the leg. - EQUITY - OPTION - CRYPTO
+ *
+ * @return self
+ */
+ public function setAssetType($asset_type)
+ {
+
+ if (is_null($asset_type)) {
+ throw new \InvalidArgumentException('non-nullable asset_type cannot be null');
+ }
+
+ $this->container['asset_type'] = $asset_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets exchange_mic_code
+ *
+ * @return string|null
+ */
+ public function getExchangeMicCode()
+ {
+ return $this->container['exchange_mic_code'];
+ }
+
+ /**
+ * Sets exchange_mic_code
+ *
+ * @param string|null $exchange_mic_code Market Identifier Code (MIC) for the exchange on which the instrument trades.
+ *
+ * @return self
+ */
+ public function setExchangeMicCode($exchange_mic_code)
+ {
+
+ if (is_null($exchange_mic_code)) {
+ throw new \InvalidArgumentException('non-nullable exchange_mic_code cannot be null');
+ }
+
+ $this->container['exchange_mic_code'] = $exchange_mic_code;
+
+ return $this;
+ }
+
+ /**
+ * Gets figi_code
+ *
+ * @return string|null
+ */
+ public function getFigiCode()
+ {
+ return $this->container['figi_code'];
+ }
+
+ /**
+ * Sets figi_code
+ *
+ * @param string|null $figi_code Financial Instrument Global Identifier (FIGI) if available.
+ *
+ * @return self
+ */
+ public function setFigiCode($figi_code)
+ {
+
+ if (is_null($figi_code)) {
+ array_push($this->openAPINullablesSetToNull, 'figi_code');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('figi_code', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['figi_code'] = $figi_code;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountOrderRecordQuoteCurrency.php b/lib/Model/AccountOrderRecordQuoteCurrency.php
new file mode 100644
index 0000000..58fe427
--- /dev/null
+++ b/lib/Model/AccountOrderRecordQuoteCurrency.php
@@ -0,0 +1,477 @@
+
+ */
+class AccountOrderRecordQuoteCurrency implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountOrderRecord_quote_currency';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'string',
+ 'code' => 'string',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'uuid',
+ 'code' => null,
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'code' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'code' => 'code',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'code' => 'setCode',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'code' => 'getCode',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('code', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param string|null $id Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets code
+ *
+ * @return string|null
+ */
+ public function getCode()
+ {
+ return $this->container['code'];
+ }
+
+ /**
+ * Sets code
+ *
+ * @param string|null $code The ISO-4217 currency code for the currency.
+ *
+ * @return self
+ */
+ public function setCode($code)
+ {
+
+ if (is_null($code)) {
+ throw new \InvalidArgumentException('non-nullable code cannot be null');
+ }
+
+ $this->container['code'] = $code;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name A human-friendly name of the currency.
+ *
+ * @return self
+ */
+ public function setName($name)
+ {
+
+ if (is_null($name)) {
+ throw new \InvalidArgumentException('non-nullable name cannot be null');
+ }
+
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountOrderRecordQuoteUniversalSymbol.php b/lib/Model/AccountOrderRecordQuoteUniversalSymbol.php
new file mode 100644
index 0000000..0f23d4b
--- /dev/null
+++ b/lib/Model/AccountOrderRecordQuoteUniversalSymbol.php
@@ -0,0 +1,770 @@
+
+ */
+class AccountOrderRecordQuoteUniversalSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountOrderRecord_quote_universal_symbol';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'string',
+ 'symbol' => 'string',
+ 'raw_symbol' => 'string',
+ 'description' => 'string',
+ 'currency' => '\SnapTrade\Model\SymbolCurrency',
+ 'exchange' => '\SnapTrade\Model\SymbolExchange',
+ 'type' => '\SnapTrade\Model\SecurityType',
+ 'figi_code' => 'string',
+ 'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument',
+ 'currencies' => '\SnapTrade\Model\Currency[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'uuid',
+ 'symbol' => null,
+ 'raw_symbol' => null,
+ 'description' => null,
+ 'currency' => null,
+ 'exchange' => null,
+ 'type' => null,
+ 'figi_code' => null,
+ 'figi_instrument' => null,
+ 'currencies' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'symbol' => false,
+ 'raw_symbol' => false,
+ 'description' => true,
+ 'currency' => false,
+ 'exchange' => false,
+ 'type' => false,
+ 'figi_code' => true,
+ 'figi_instrument' => true,
+ 'currencies' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'symbol' => 'symbol',
+ 'raw_symbol' => 'raw_symbol',
+ 'description' => 'description',
+ 'currency' => 'currency',
+ 'exchange' => 'exchange',
+ 'type' => 'type',
+ 'figi_code' => 'figi_code',
+ 'figi_instrument' => 'figi_instrument',
+ 'currencies' => 'currencies'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'symbol' => 'setSymbol',
+ 'raw_symbol' => 'setRawSymbol',
+ 'description' => 'setDescription',
+ 'currency' => 'setCurrency',
+ 'exchange' => 'setExchange',
+ 'type' => 'setType',
+ 'figi_code' => 'setFigiCode',
+ 'figi_instrument' => 'setFigiInstrument',
+ 'currencies' => 'setCurrencies'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'symbol' => 'getSymbol',
+ 'raw_symbol' => 'getRawSymbol',
+ 'description' => 'getDescription',
+ 'currency' => 'getCurrency',
+ 'exchange' => 'getExchange',
+ 'type' => 'getType',
+ 'figi_code' => 'getFigiCode',
+ 'figi_instrument' => 'getFigiInstrument',
+ 'currencies' => 'getCurrencies'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('raw_symbol', $data ?? [], null);
+ $this->setIfExists('description', $data ?? [], null);
+ $this->setIfExists('currency', $data ?? [], null);
+ $this->setIfExists('exchange', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ $this->setIfExists('figi_code', $data ?? [], null);
+ $this->setIfExists('figi_instrument', $data ?? [], null);
+ $this->setIfExists('currencies', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['id'] === null) {
+ $invalidProperties[] = "'id' can't be null";
+ }
+ if ($this->container['symbol'] === null) {
+ $invalidProperties[] = "'symbol' can't be null";
+ }
+ if ($this->container['raw_symbol'] === null) {
+ $invalidProperties[] = "'raw_symbol' can't be null";
+ }
+ if ($this->container['currency'] === null) {
+ $invalidProperties[] = "'currency' can't be null";
+ }
+ if ($this->container['type'] === null) {
+ $invalidProperties[] = "'type' can't be null";
+ }
+ if ($this->container['currencies'] === null) {
+ $invalidProperties[] = "'currencies' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return string
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param string $id Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets symbol
+ *
+ * @return string
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string $symbol The security's trading ticker symbol. For example \"AAPL\" for Apple Inc. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix.
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets raw_symbol
+ *
+ * @return string
+ */
+ public function getRawSymbol()
+ {
+ return $this->container['raw_symbol'];
+ }
+
+ /**
+ * Sets raw_symbol
+ *
+ * @param string $raw_symbol The raw symbol is `symbol` with the exchange suffix removed. For example, if `symbol` is \"VAB.TO\", then `raw_symbol` is \"VAB\".
+ *
+ * @return self
+ */
+ public function setRawSymbol($raw_symbol)
+ {
+
+ if (is_null($raw_symbol)) {
+ throw new \InvalidArgumentException('non-nullable raw_symbol cannot be null');
+ }
+
+ $this->container['raw_symbol'] = $raw_symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets description
+ *
+ * @return string|null
+ */
+ public function getDescription()
+ {
+ return $this->container['description'];
+ }
+
+ /**
+ * Sets description
+ *
+ * @param string|null $description A human-readable description of the security. This is usually the company name or ETF name.
+ *
+ * @return self
+ */
+ public function setDescription($description)
+ {
+
+ if (is_null($description)) {
+ array_push($this->openAPINullablesSetToNull, 'description');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('description', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['description'] = $description;
+
+ return $this;
+ }
+
+ /**
+ * Gets currency
+ *
+ * @return \SnapTrade\Model\SymbolCurrency
+ */
+ public function getCurrency()
+ {
+ return $this->container['currency'];
+ }
+
+ /**
+ * Sets currency
+ *
+ * @param \SnapTrade\Model\SymbolCurrency $currency currency
+ *
+ * @return self
+ */
+ public function setCurrency($currency)
+ {
+
+ if (is_null($currency)) {
+ throw new \InvalidArgumentException('non-nullable currency cannot be null');
+ }
+
+ $this->container['currency'] = $currency;
+
+ return $this;
+ }
+
+ /**
+ * Gets exchange
+ *
+ * @return \SnapTrade\Model\SymbolExchange|null
+ */
+ public function getExchange()
+ {
+ return $this->container['exchange'];
+ }
+
+ /**
+ * Sets exchange
+ *
+ * @param \SnapTrade\Model\SymbolExchange|null $exchange exchange
+ *
+ * @return self
+ */
+ public function setExchange($exchange)
+ {
+
+ if (is_null($exchange)) {
+ throw new \InvalidArgumentException('non-nullable exchange cannot be null');
+ }
+
+ $this->container['exchange'] = $exchange;
+
+ return $this;
+ }
+
+ /**
+ * Gets type
+ *
+ * @return \SnapTrade\Model\SecurityType
+ */
+ public function getType()
+ {
+ return $this->container['type'];
+ }
+
+ /**
+ * Sets type
+ *
+ * @param \SnapTrade\Model\SecurityType $type type
+ *
+ * @return self
+ */
+ public function setType($type)
+ {
+
+ if (is_null($type)) {
+ throw new \InvalidArgumentException('non-nullable type cannot be null');
+ }
+
+ $this->container['type'] = $type;
+
+ return $this;
+ }
+
+ /**
+ * Gets figi_code
+ *
+ * @return string|null
+ */
+ public function getFigiCode()
+ {
+ return $this->container['figi_code'];
+ }
+
+ /**
+ * Sets figi_code
+ *
+ * @param string|null $figi_code This identifier is unique per security per trading venue. See section 1.4.1 of the [FIGI Standard](https://www.openfigi.com/assets/local/figi-allocation-rules.pdf) for more information. This value should be the same as the `figi_code` in the `figi_instrument` child property.
+ *
+ * @return self
+ */
+ public function setFigiCode($figi_code)
+ {
+
+ if (is_null($figi_code)) {
+ array_push($this->openAPINullablesSetToNull, 'figi_code');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('figi_code', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['figi_code'] = $figi_code;
+
+ return $this;
+ }
+
+ /**
+ * Gets figi_instrument
+ *
+ * @return \SnapTrade\Model\SymbolFigiInstrument|null
+ */
+ public function getFigiInstrument()
+ {
+ return $this->container['figi_instrument'];
+ }
+
+ /**
+ * Sets figi_instrument
+ *
+ * @param \SnapTrade\Model\SymbolFigiInstrument|null $figi_instrument figi_instrument
+ *
+ * @return self
+ */
+ public function setFigiInstrument($figi_instrument)
+ {
+
+ if (is_null($figi_instrument)) {
+ array_push($this->openAPINullablesSetToNull, 'figi_instrument');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('figi_instrument', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['figi_instrument'] = $figi_instrument;
+
+ return $this;
+ }
+
+ /**
+ * Gets currencies
+ *
+ * @return \SnapTrade\Model\Currency[]
+ * @deprecated
+ */
+ public function getCurrencies()
+ {
+ return $this->container['currencies'];
+ }
+
+ /**
+ * Sets currencies
+ *
+ * @param \SnapTrade\Model\Currency[] $currencies This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setCurrencies($currencies)
+ {
+
+ if (is_null($currencies)) {
+ throw new \InvalidArgumentException('non-nullable currencies cannot be null');
+ }
+
+ $this->container['currencies'] = $currencies;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountOrderRecordStatus.php b/lib/Model/AccountOrderRecordStatus.php
index d54bc28..37917f4 100644
--- a/lib/Model/AccountOrderRecordStatus.php
+++ b/lib/Model/AccountOrderRecordStatus.php
@@ -28,7 +28,7 @@
* AccountOrderRecordStatus Class Doc Comment
*
* @category Class
- * @description Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum.
+ * @description Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum. Possible values include: - NONE - PENDING - ACCEPTED - FAILED - REJECTED - CANCELED - PARTIAL_CANCELED - CANCEL_PENDING - EXECUTED - PARTIAL - REPLACE_PENDING - REPLACED - EXPIRED - QUEUED - TRIGGERED - ACTIVATED
* @package SnapTrade
*/
class AccountOrderRecordStatus
diff --git a/lib/Model/AccountOrderRecordStatusV2.php b/lib/Model/AccountOrderRecordStatusV2.php
new file mode 100644
index 0000000..0d33d07
--- /dev/null
+++ b/lib/Model/AccountOrderRecordStatusV2.php
@@ -0,0 +1,80 @@
+ 'string',
'raw_symbol' => 'string',
'description' => 'string',
- 'currency' => '\SnapTrade\Model\UniversalSymbolCurrency',
- 'exchange' => '\SnapTrade\Model\UniversalSymbolExchange',
+ 'currency' => '\SnapTrade\Model\SymbolCurrency',
+ 'exchange' => '\SnapTrade\Model\SymbolExchange',
'type' => '\SnapTrade\Model\SecurityType',
- 'currencies' => '\SnapTrade\Model\Currency[]',
'figi_code' => 'string',
- 'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument'
+ 'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument',
+ 'currencies' => '\SnapTrade\Model\Currency[]'
];
/**
@@ -78,9 +78,9 @@ class AccountOrderRecordUniversalSymbol implements ModelInterface, ArrayAccess,
'currency' => null,
'exchange' => null,
'type' => null,
- 'currencies' => null,
'figi_code' => null,
- 'figi_instrument' => null
+ 'figi_instrument' => null,
+ 'currencies' => null
];
/**
@@ -96,9 +96,9 @@ class AccountOrderRecordUniversalSymbol implements ModelInterface, ArrayAccess,
'currency' => false,
'exchange' => false,
'type' => false,
- 'currencies' => false,
'figi_code' => true,
- 'figi_instrument' => true
+ 'figi_instrument' => true,
+ 'currencies' => false
];
/**
@@ -194,9 +194,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'currency',
'exchange' => 'exchange',
'type' => 'type',
- 'currencies' => 'currencies',
'figi_code' => 'figi_code',
- 'figi_instrument' => 'figi_instrument'
+ 'figi_instrument' => 'figi_instrument',
+ 'currencies' => 'currencies'
];
/**
@@ -212,9 +212,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'setCurrency',
'exchange' => 'setExchange',
'type' => 'setType',
- 'currencies' => 'setCurrencies',
'figi_code' => 'setFigiCode',
- 'figi_instrument' => 'setFigiInstrument'
+ 'figi_instrument' => 'setFigiInstrument',
+ 'currencies' => 'setCurrencies'
];
/**
@@ -230,9 +230,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'getCurrency',
'exchange' => 'getExchange',
'type' => 'getType',
- 'currencies' => 'getCurrencies',
'figi_code' => 'getFigiCode',
- 'figi_instrument' => 'getFigiInstrument'
+ 'figi_instrument' => 'getFigiInstrument',
+ 'currencies' => 'getCurrencies'
];
/**
@@ -299,9 +299,9 @@ public function __construct(array $data = null)
$this->setIfExists('currency', $data ?? [], null);
$this->setIfExists('exchange', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
- $this->setIfExists('currencies', $data ?? [], null);
$this->setIfExists('figi_code', $data ?? [], null);
$this->setIfExists('figi_instrument', $data ?? [], null);
+ $this->setIfExists('currencies', $data ?? [], null);
}
/**
@@ -490,7 +490,7 @@ public function setDescription($description)
/**
* Gets currency
*
- * @return \SnapTrade\Model\UniversalSymbolCurrency
+ * @return \SnapTrade\Model\SymbolCurrency
*/
public function getCurrency()
{
@@ -500,7 +500,7 @@ public function getCurrency()
/**
* Sets currency
*
- * @param \SnapTrade\Model\UniversalSymbolCurrency $currency currency
+ * @param \SnapTrade\Model\SymbolCurrency $currency currency
*
* @return self
*/
@@ -519,7 +519,7 @@ public function setCurrency($currency)
/**
* Gets exchange
*
- * @return \SnapTrade\Model\UniversalSymbolExchange|null
+ * @return \SnapTrade\Model\SymbolExchange|null
*/
public function getExchange()
{
@@ -529,7 +529,7 @@ public function getExchange()
/**
* Sets exchange
*
- * @param \SnapTrade\Model\UniversalSymbolExchange|null $exchange exchange
+ * @param \SnapTrade\Model\SymbolExchange|null $exchange exchange
*
* @return self
*/
@@ -574,37 +574,6 @@ public function setType($type)
return $this;
}
- /**
- * Gets currencies
- *
- * @return \SnapTrade\Model\Currency[]
- * @deprecated
- */
- public function getCurrencies()
- {
- return $this->container['currencies'];
- }
-
- /**
- * Sets currencies
- *
- * @param \SnapTrade\Model\Currency[] $currencies This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
- *
- * @return self
- * @deprecated
- */
- public function setCurrencies($currencies)
- {
-
- if (is_null($currencies)) {
- throw new \InvalidArgumentException('non-nullable currencies cannot be null');
- }
-
- $this->container['currencies'] = $currencies;
-
- return $this;
- }
-
/**
* Gets figi_code
*
@@ -676,6 +645,37 @@ public function setFigiInstrument($figi_instrument)
return $this;
}
+
+ /**
+ * Gets currencies
+ *
+ * @return \SnapTrade\Model\Currency[]
+ * @deprecated
+ */
+ public function getCurrencies()
+ {
+ return $this->container['currencies'];
+ }
+
+ /**
+ * Sets currencies
+ *
+ * @param \SnapTrade\Model\Currency[] $currencies This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setCurrencies($currencies)
+ {
+
+ if (is_null($currencies)) {
+ throw new \InvalidArgumentException('non-nullable currencies cannot be null');
+ }
+
+ $this->container['currencies'] = $currencies;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/AccountOrderRecordV2.php b/lib/Model/AccountOrderRecordV2.php
new file mode 100644
index 0000000..6b8e5ef
--- /dev/null
+++ b/lib/Model/AccountOrderRecordV2.php
@@ -0,0 +1,800 @@
+
+ */
+class AccountOrderRecordV2 implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountOrderRecordV2';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'brokerage_order_id' => 'string',
+ 'status' => '\SnapTrade\Model\AccountOrderRecordStatus',
+ 'order_type' => 'string',
+ 'time_in_force' => 'string',
+ 'time_placed' => '\DateTime',
+ 'time_executed' => '\DateTime',
+ 'quote_currency' => 'string',
+ 'execution_price' => 'float',
+ 'limit_price' => 'float',
+ 'stop_price' => 'float',
+ 'legs' => '\SnapTrade\Model\AccountOrderRecordLeg[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'brokerage_order_id' => null,
+ 'status' => null,
+ 'order_type' => null,
+ 'time_in_force' => null,
+ 'time_placed' => 'date-time',
+ 'time_executed' => 'date-time',
+ 'quote_currency' => null,
+ 'execution_price' => null,
+ 'limit_price' => null,
+ 'stop_price' => null,
+ 'legs' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'brokerage_order_id' => false,
+ 'status' => false,
+ 'order_type' => true,
+ 'time_in_force' => false,
+ 'time_placed' => false,
+ 'time_executed' => true,
+ 'quote_currency' => false,
+ 'execution_price' => true,
+ 'limit_price' => true,
+ 'stop_price' => true,
+ 'legs' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'brokerage_order_id' => 'brokerage_order_id',
+ 'status' => 'status',
+ 'order_type' => 'order_type',
+ 'time_in_force' => 'time_in_force',
+ 'time_placed' => 'time_placed',
+ 'time_executed' => 'time_executed',
+ 'quote_currency' => 'quote_currency',
+ 'execution_price' => 'execution_price',
+ 'limit_price' => 'limit_price',
+ 'stop_price' => 'stop_price',
+ 'legs' => 'legs'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'brokerage_order_id' => 'setBrokerageOrderId',
+ 'status' => 'setStatus',
+ 'order_type' => 'setOrderType',
+ 'time_in_force' => 'setTimeInForce',
+ 'time_placed' => 'setTimePlaced',
+ 'time_executed' => 'setTimeExecuted',
+ 'quote_currency' => 'setQuoteCurrency',
+ 'execution_price' => 'setExecutionPrice',
+ 'limit_price' => 'setLimitPrice',
+ 'stop_price' => 'setStopPrice',
+ 'legs' => 'setLegs'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'brokerage_order_id' => 'getBrokerageOrderId',
+ 'status' => 'getStatus',
+ 'order_type' => 'getOrderType',
+ 'time_in_force' => 'getTimeInForce',
+ 'time_placed' => 'getTimePlaced',
+ 'time_executed' => 'getTimeExecuted',
+ 'quote_currency' => 'getQuoteCurrency',
+ 'execution_price' => 'getExecutionPrice',
+ 'limit_price' => 'getLimitPrice',
+ 'stop_price' => 'getStopPrice',
+ 'legs' => 'getLegs'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('brokerage_order_id', $data ?? [], null);
+ $this->setIfExists('status', $data ?? [], null);
+ $this->setIfExists('order_type', $data ?? [], null);
+ $this->setIfExists('time_in_force', $data ?? [], null);
+ $this->setIfExists('time_placed', $data ?? [], null);
+ $this->setIfExists('time_executed', $data ?? [], null);
+ $this->setIfExists('quote_currency', $data ?? [], null);
+ $this->setIfExists('execution_price', $data ?? [], null);
+ $this->setIfExists('limit_price', $data ?? [], null);
+ $this->setIfExists('stop_price', $data ?? [], null);
+ $this->setIfExists('legs', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets brokerage_order_id
+ *
+ * @return string|null
+ */
+ public function getBrokerageOrderId()
+ {
+ return $this->container['brokerage_order_id'];
+ }
+
+ /**
+ * Sets brokerage_order_id
+ *
+ * @param string|null $brokerage_order_id Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
+ *
+ * @return self
+ */
+ public function setBrokerageOrderId($brokerage_order_id)
+ {
+
+ if (is_null($brokerage_order_id)) {
+ throw new \InvalidArgumentException('non-nullable brokerage_order_id cannot be null');
+ }
+
+ $this->container['brokerage_order_id'] = $brokerage_order_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets status
+ *
+ * @return \SnapTrade\Model\AccountOrderRecordStatus|null
+ */
+ public function getStatus()
+ {
+ return $this->container['status'];
+ }
+
+ /**
+ * Sets status
+ *
+ * @param \SnapTrade\Model\AccountOrderRecordStatus|null $status status
+ *
+ * @return self
+ */
+ public function setStatus($status)
+ {
+
+ if (is_null($status)) {
+ throw new \InvalidArgumentException('non-nullable status cannot be null');
+ }
+
+ $this->container['status'] = $status;
+
+ return $this;
+ }
+
+ /**
+ * Gets order_type
+ *
+ * @return string|null
+ */
+ public function getOrderType()
+ {
+ return $this->container['order_type'];
+ }
+
+ /**
+ * Sets order_type
+ *
+ * @param string|null $order_type The type of order placed. - `MARKET` - `LIMIT` - `STOP` - `STOP_LIMIT`
+ *
+ * @return self
+ */
+ public function setOrderType($order_type)
+ {
+
+ if (is_null($order_type)) {
+ array_push($this->openAPINullablesSetToNull, 'order_type');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('order_type', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['order_type'] = $order_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_in_force
+ *
+ * @return string|null
+ */
+ public function getTimeInForce()
+ {
+ return $this->container['time_in_force'];
+ }
+
+ /**
+ * Sets time_in_force
+ *
+ * @param string|null $time_in_force The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. We try our best to map brokerage time in force values to the following. When mapping fails, we will return the brokerage's time in force value. - `DAY` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date. - `MOO` - Market On Open. The order is to be executed at the day's opening price. - `EHP` - Extended Hours P.M. The order is to be placed during extended hour trading, after markets close.
+ *
+ * @return self
+ */
+ public function setTimeInForce($time_in_force)
+ {
+
+ if (is_null($time_in_force)) {
+ throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ }
+
+ $this->container['time_in_force'] = $time_in_force;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_placed
+ *
+ * @return \DateTime|null
+ */
+ public function getTimePlaced()
+ {
+ return $this->container['time_placed'];
+ }
+
+ /**
+ * Sets time_placed
+ *
+ * @param \DateTime|null $time_placed The time the order was placed. This is the time the order was submitted to the brokerage.
+ *
+ * @return self
+ */
+ public function setTimePlaced($time_placed)
+ {
+
+ if (is_null($time_placed)) {
+ throw new \InvalidArgumentException('non-nullable time_placed cannot be null');
+ }
+
+ $this->container['time_placed'] = $time_placed;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_executed
+ *
+ * @return \DateTime|null
+ */
+ public function getTimeExecuted()
+ {
+ return $this->container['time_executed'];
+ }
+
+ /**
+ * Sets time_executed
+ *
+ * @param \DateTime|null $time_executed The time the order was executed in the brokerage system. This value is not always available from the brokerage.
+ *
+ * @return self
+ */
+ public function setTimeExecuted($time_executed)
+ {
+
+ if (is_null($time_executed)) {
+ array_push($this->openAPINullablesSetToNull, 'time_executed');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('time_executed', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['time_executed'] = $time_executed;
+
+ return $this;
+ }
+
+ /**
+ * Gets quote_currency
+ *
+ * @return string|null
+ */
+ public function getQuoteCurrency()
+ {
+ return $this->container['quote_currency'];
+ }
+
+ /**
+ * Sets quote_currency
+ *
+ * @param string|null $quote_currency Quote currency code for the order.
+ *
+ * @return self
+ */
+ public function setQuoteCurrency($quote_currency)
+ {
+
+ if (is_null($quote_currency)) {
+ throw new \InvalidArgumentException('non-nullable quote_currency cannot be null');
+ }
+
+ $this->container['quote_currency'] = $quote_currency;
+
+ return $this;
+ }
+
+ /**
+ * Gets execution_price
+ *
+ * @return float|null
+ */
+ public function getExecutionPrice()
+ {
+ return $this->container['execution_price'];
+ }
+
+ /**
+ * Sets execution_price
+ *
+ * @param float|null $execution_price The price at which the order was executed.
+ *
+ * @return self
+ */
+ public function setExecutionPrice($execution_price)
+ {
+
+ if (is_null($execution_price)) {
+ array_push($this->openAPINullablesSetToNull, 'execution_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('execution_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['execution_price'] = $execution_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets limit_price
+ *
+ * @return float|null
+ */
+ public function getLimitPrice()
+ {
+ return $this->container['limit_price'];
+ }
+
+ /**
+ * Sets limit_price
+ *
+ * @param float|null $limit_price The limit price is maximum price one is willing to pay for a buy order or the minimum price one is willing to accept for a sell order. Should only apply to `Limit` and `StopLimit` orders.
+ *
+ * @return self
+ */
+ public function setLimitPrice($limit_price)
+ {
+
+ if (is_null($limit_price)) {
+ array_push($this->openAPINullablesSetToNull, 'limit_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('limit_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['limit_price'] = $limit_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop_price
+ *
+ * @return float|null
+ */
+ public function getStopPrice()
+ {
+ return $this->container['stop_price'];
+ }
+
+ /**
+ * Sets stop_price
+ *
+ * @param float|null $stop_price The stop price is the price at which a stop order is triggered. Should only apply to `Stop` and `StopLimit` orders.
+ *
+ * @return self
+ */
+ public function setStopPrice($stop_price)
+ {
+
+ if (is_null($stop_price)) {
+ array_push($this->openAPINullablesSetToNull, 'stop_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('stop_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['stop_price'] = $stop_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets legs
+ *
+ * @return \SnapTrade\Model\AccountOrderRecordLeg[]|null
+ */
+ public function getLegs()
+ {
+ return $this->container['legs'];
+ }
+
+ /**
+ * Sets legs
+ *
+ * @param \SnapTrade\Model\AccountOrderRecordLeg[]|null $legs List of legs that make up the order.
+ *
+ * @return self
+ */
+ public function setLegs($legs)
+ {
+
+ if (is_null($legs)) {
+ throw new \InvalidArgumentException('non-nullable legs cannot be null');
+ }
+
+ $this->container['legs'] = $legs;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountOrdersV2Response.php b/lib/Model/AccountOrdersV2Response.php
new file mode 100644
index 0000000..4f2737d
--- /dev/null
+++ b/lib/Model/AccountOrdersV2Response.php
@@ -0,0 +1,408 @@
+
+ */
+class AccountOrdersV2Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountOrdersV2Response';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'orders' => '\SnapTrade\Model\AccountOrderRecordV2[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'orders' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'orders' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'orders' => 'orders'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'orders' => 'setOrders'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'orders' => 'getOrders'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('orders', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['orders'] === null) {
+ $invalidProperties[] = "'orders' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets orders
+ *
+ * @return \SnapTrade\Model\AccountOrderRecordV2[]
+ */
+ public function getOrders()
+ {
+ return $this->container['orders'];
+ }
+
+ /**
+ * Sets orders
+ *
+ * @param \SnapTrade\Model\AccountOrderRecordV2[] $orders List of orders returned by the endpoint.
+ *
+ * @return self
+ */
+ public function setOrders($orders)
+ {
+
+ if (is_null($orders)) {
+ throw new \InvalidArgumentException('non-nullable orders cannot be null');
+ }
+
+ $this->container['orders'] = $orders;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountSimple.php b/lib/Model/AccountSimple.php
index b6d9a39..d3140ac 100644
--- a/lib/Model/AccountSimple.php
+++ b/lib/Model/AccountSimple.php
@@ -30,7 +30,7 @@
* AccountSimple Class Doc Comment
*
* @category Class
- * @description SnapTradeUser Investment Account
+ * @description A single account at a brokerage.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -317,7 +317,7 @@ public function getId()
/**
* Sets id
*
- * @param string|null $id id
+ * @param string|null $id Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
*
* @return self
*/
@@ -346,7 +346,7 @@ public function getName()
/**
* Sets name
*
- * @param string|null $name name
+ * @param string|null $name A display name for the account. Either assigned by the user or by the brokerage itself. For certain brokerages, SnapTrade appends the brokerage name to the account name for clarity.
*
* @return self
*/
@@ -375,7 +375,7 @@ public function getNumber()
/**
* Sets number
*
- * @param string|null $number number
+ * @param string|null $number The account number assigned by the brokerage. For some brokerages, this field may be masked for security reasons.
*
* @return self
*/
diff --git a/lib/Model/AccountUniversalActivity.php b/lib/Model/AccountUniversalActivity.php
new file mode 100644
index 0000000..98d04d1
--- /dev/null
+++ b/lib/Model/AccountUniversalActivity.php
@@ -0,0 +1,987 @@
+
+ */
+class AccountUniversalActivity implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountUniversalActivity';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'string',
+ 'symbol' => '\SnapTrade\Model\AccountUniversalActivitySymbol',
+ 'option_symbol' => '\SnapTrade\Model\AccountUniversalActivityOptionSymbol',
+ 'price' => 'float',
+ 'units' => 'float',
+ 'amount' => 'float',
+ 'currency' => '\SnapTrade\Model\AccountUniversalActivityCurrency',
+ 'type' => 'string',
+ 'option_type' => 'string',
+ 'description' => 'string',
+ 'trade_date' => '\DateTime',
+ 'settlement_date' => '\DateTime',
+ 'fee' => 'float',
+ 'fx_rate' => 'float',
+ 'institution' => 'string',
+ 'external_reference_id' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => null,
+ 'symbol' => null,
+ 'option_symbol' => null,
+ 'price' => null,
+ 'units' => null,
+ 'amount' => null,
+ 'currency' => null,
+ 'type' => null,
+ 'option_type' => null,
+ 'description' => null,
+ 'trade_date' => 'date-time',
+ 'settlement_date' => 'date-time',
+ 'fee' => null,
+ 'fx_rate' => null,
+ 'institution' => null,
+ 'external_reference_id' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'symbol' => true,
+ 'option_symbol' => true,
+ 'price' => false,
+ 'units' => false,
+ 'amount' => true,
+ 'currency' => false,
+ 'type' => false,
+ 'option_type' => false,
+ 'description' => false,
+ 'trade_date' => true,
+ 'settlement_date' => false,
+ 'fee' => false,
+ 'fx_rate' => true,
+ 'institution' => false,
+ 'external_reference_id' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'symbol' => 'symbol',
+ 'option_symbol' => 'option_symbol',
+ 'price' => 'price',
+ 'units' => 'units',
+ 'amount' => 'amount',
+ 'currency' => 'currency',
+ 'type' => 'type',
+ 'option_type' => 'option_type',
+ 'description' => 'description',
+ 'trade_date' => 'trade_date',
+ 'settlement_date' => 'settlement_date',
+ 'fee' => 'fee',
+ 'fx_rate' => 'fx_rate',
+ 'institution' => 'institution',
+ 'external_reference_id' => 'external_reference_id'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'symbol' => 'setSymbol',
+ 'option_symbol' => 'setOptionSymbol',
+ 'price' => 'setPrice',
+ 'units' => 'setUnits',
+ 'amount' => 'setAmount',
+ 'currency' => 'setCurrency',
+ 'type' => 'setType',
+ 'option_type' => 'setOptionType',
+ 'description' => 'setDescription',
+ 'trade_date' => 'setTradeDate',
+ 'settlement_date' => 'setSettlementDate',
+ 'fee' => 'setFee',
+ 'fx_rate' => 'setFxRate',
+ 'institution' => 'setInstitution',
+ 'external_reference_id' => 'setExternalReferenceId'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'symbol' => 'getSymbol',
+ 'option_symbol' => 'getOptionSymbol',
+ 'price' => 'getPrice',
+ 'units' => 'getUnits',
+ 'amount' => 'getAmount',
+ 'currency' => 'getCurrency',
+ 'type' => 'getType',
+ 'option_type' => 'getOptionType',
+ 'description' => 'getDescription',
+ 'trade_date' => 'getTradeDate',
+ 'settlement_date' => 'getSettlementDate',
+ 'fee' => 'getFee',
+ 'fx_rate' => 'getFxRate',
+ 'institution' => 'getInstitution',
+ 'external_reference_id' => 'getExternalReferenceId'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('option_symbol', $data ?? [], null);
+ $this->setIfExists('price', $data ?? [], null);
+ $this->setIfExists('units', $data ?? [], null);
+ $this->setIfExists('amount', $data ?? [], null);
+ $this->setIfExists('currency', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ $this->setIfExists('option_type', $data ?? [], null);
+ $this->setIfExists('description', $data ?? [], null);
+ $this->setIfExists('trade_date', $data ?? [], null);
+ $this->setIfExists('settlement_date', $data ?? [], null);
+ $this->setIfExists('fee', $data ?? [], null);
+ $this->setIfExists('fx_rate', $data ?? [], null);
+ $this->setIfExists('institution', $data ?? [], null);
+ $this->setIfExists('external_reference_id', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param string|null $id Unique identifier for the transaction. This is the ID used to reference the transaction in SnapTrade. Please note that this ID _can_ change if the transaction is deleted and re-added. Under normal circumstances, SnapTrade does not delete transactions. The only time this would happen is if SnapTrade re-fetches and reprocesses the data from the brokerage, which is rare. If you require a stable ID, please let us know and we can work with you to provide one.
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets symbol
+ *
+ * @return \SnapTrade\Model\AccountUniversalActivitySymbol|null
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param \SnapTrade\Model\AccountUniversalActivitySymbol|null $symbol symbol
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ array_push($this->openAPINullablesSetToNull, 'symbol');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('symbol', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets option_symbol
+ *
+ * @return \SnapTrade\Model\AccountUniversalActivityOptionSymbol|null
+ */
+ public function getOptionSymbol()
+ {
+ return $this->container['option_symbol'];
+ }
+
+ /**
+ * Sets option_symbol
+ *
+ * @param \SnapTrade\Model\AccountUniversalActivityOptionSymbol|null $option_symbol option_symbol
+ *
+ * @return self
+ */
+ public function setOptionSymbol($option_symbol)
+ {
+
+ if (is_null($option_symbol)) {
+ array_push($this->openAPINullablesSetToNull, 'option_symbol');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('option_symbol', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['option_symbol'] = $option_symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets price
+ *
+ * @return float|null
+ */
+ public function getPrice()
+ {
+ return $this->container['price'];
+ }
+
+ /**
+ * Sets price
+ *
+ * @param float|null $price The price of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
+ *
+ * @return self
+ */
+ public function setPrice($price)
+ {
+
+ if (is_null($price)) {
+ throw new \InvalidArgumentException('non-nullable price cannot be null');
+ }
+
+ $this->container['price'] = $price;
+
+ return $this;
+ }
+
+ /**
+ * Gets units
+ *
+ * @return float|null
+ */
+ public function getUnits()
+ {
+ return $this->container['units'];
+ }
+
+ /**
+ * Sets units
+ *
+ * @param float|null $units The number of units of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
+ *
+ * @return self
+ */
+ public function setUnits($units)
+ {
+
+ if (is_null($units)) {
+ throw new \InvalidArgumentException('non-nullable units cannot be null');
+ }
+
+ $this->container['units'] = $units;
+
+ return $this;
+ }
+
+ /**
+ * Gets amount
+ *
+ * @return float|null
+ */
+ public function getAmount()
+ {
+ return $this->container['amount'];
+ }
+
+ /**
+ * Sets amount
+ *
+ * @param float|null $amount The amount of the transaction denominated in `currency`. This can be positive or negative. In general, transactions that positively affect the account balance (like sell, deposits, dividends, etc) will have a positive amount, while transactions that negatively affect the account balance (like buy, withdrawals, fees, etc) will have a negative amount.
+ *
+ * @return self
+ */
+ public function setAmount($amount)
+ {
+
+ if (is_null($amount)) {
+ array_push($this->openAPINullablesSetToNull, 'amount');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('amount', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['amount'] = $amount;
+
+ return $this;
+ }
+
+ /**
+ * Gets currency
+ *
+ * @return \SnapTrade\Model\AccountUniversalActivityCurrency|null
+ */
+ public function getCurrency()
+ {
+ return $this->container['currency'];
+ }
+
+ /**
+ * Sets currency
+ *
+ * @param \SnapTrade\Model\AccountUniversalActivityCurrency|null $currency currency
+ *
+ * @return self
+ */
+ public function setCurrency($currency)
+ {
+
+ if (is_null($currency)) {
+ throw new \InvalidArgumentException('non-nullable currency cannot be null');
+ }
+
+ $this->container['currency'] = $currency;
+
+ return $this;
+ }
+
+ /**
+ * Gets type
+ *
+ * @return string|null
+ */
+ public function getType()
+ {
+ return $this->container['type'];
+ }
+
+ /**
+ * Sets type
+ *
+ * @param string|null $type A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of asset(s) from one account to another. - `EXTERNAL_ASSET_TRANSFER_IN` - Incoming transfer of an asset from an external account to this account. - `EXTERNAL_ASSET_TRANSFER_OUT` - Outgoing transfer of an asset from this account to an external account. - `SPLIT` - A stock share split. - `ADJUSTMENT` - A one time adjustment of the account's cash balance or shares of an asset
+ *
+ * @return self
+ */
+ public function setType($type)
+ {
+
+ if (is_null($type)) {
+ throw new \InvalidArgumentException('non-nullable type cannot be null');
+ }
+
+ $this->container['type'] = $type;
+
+ return $this;
+ }
+
+ /**
+ * Gets option_type
+ *
+ * @return string|null
+ */
+ public function getOptionType()
+ {
+ return $this->container['option_type'];
+ }
+
+ /**
+ * Sets option_type
+ *
+ * @param string|null $option_type If an option `BUY` or `SELL` transaction, this further specifies the type of action. The possible values are: - BUY_TO_OPEN - BUY_TO_CLOSE - SELL_TO_OPEN - SELL_TO_CLOSE
+ *
+ * @return self
+ */
+ public function setOptionType($option_type)
+ {
+
+ if (is_null($option_type)) {
+ throw new \InvalidArgumentException('non-nullable option_type cannot be null');
+ }
+
+ $this->container['option_type'] = $option_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets description
+ *
+ * @return string|null
+ */
+ public function getDescription()
+ {
+ return $this->container['description'];
+ }
+
+ /**
+ * Sets description
+ *
+ * @param string|null $description A human-readable description of the transaction. This is usually the brokerage's description of the transaction.
+ *
+ * @return self
+ */
+ public function setDescription($description)
+ {
+
+ if (is_null($description)) {
+ throw new \InvalidArgumentException('non-nullable description cannot be null');
+ }
+
+ $this->container['description'] = $description;
+
+ return $this;
+ }
+
+ /**
+ * Gets trade_date
+ *
+ * @return \DateTime|null
+ */
+ public function getTradeDate()
+ {
+ return $this->container['trade_date'];
+ }
+
+ /**
+ * Sets trade_date
+ *
+ * @param \DateTime|null $trade_date The recorded time for the transaction. The granularity of this timestamp depends on the brokerage. Some brokerages provide the exact time of the transaction, while others provide only the date. Please check the [integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=6fab8012ade6441fa0c6d9af9c55ce3a) for the specific brokerage to see the granularity of the timestamps. Note that even though the field is named `trade_date`, it can represent any type of transaction, not just trades.
+ *
+ * @return self
+ */
+ public function setTradeDate($trade_date)
+ {
+
+ if (is_null($trade_date)) {
+ array_push($this->openAPINullablesSetToNull, 'trade_date');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('trade_date', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['trade_date'] = $trade_date;
+
+ return $this;
+ }
+
+ /**
+ * Gets settlement_date
+ *
+ * @return \DateTime|null
+ */
+ public function getSettlementDate()
+ {
+ return $this->container['settlement_date'];
+ }
+
+ /**
+ * Sets settlement_date
+ *
+ * @param \DateTime|null $settlement_date The date on which the transaction is settled.
+ *
+ * @return self
+ */
+ public function setSettlementDate($settlement_date)
+ {
+
+ if (is_null($settlement_date)) {
+ throw new \InvalidArgumentException('non-nullable settlement_date cannot be null');
+ }
+
+ $this->container['settlement_date'] = $settlement_date;
+
+ return $this;
+ }
+
+ /**
+ * Gets fee
+ *
+ * @return float|null
+ */
+ public function getFee()
+ {
+ return $this->container['fee'];
+ }
+
+ /**
+ * Sets fee
+ *
+ * @param float|null $fee Any fee associated with the transaction if provided by the brokerage.
+ *
+ * @return self
+ */
+ public function setFee($fee)
+ {
+
+ if (is_null($fee)) {
+ throw new \InvalidArgumentException('non-nullable fee cannot be null');
+ }
+
+ $this->container['fee'] = $fee;
+
+ return $this;
+ }
+
+ /**
+ * Gets fx_rate
+ *
+ * @return float|null
+ */
+ public function getFxRate()
+ {
+ return $this->container['fx_rate'];
+ }
+
+ /**
+ * Sets fx_rate
+ *
+ * @param float|null $fx_rate The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency)
+ *
+ * @return self
+ */
+ public function setFxRate($fx_rate)
+ {
+
+ if (is_null($fx_rate)) {
+ array_push($this->openAPINullablesSetToNull, 'fx_rate');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('fx_rate', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['fx_rate'] = $fx_rate;
+
+ return $this;
+ }
+
+ /**
+ * Gets institution
+ *
+ * @return string|null
+ */
+ public function getInstitution()
+ {
+ return $this->container['institution'];
+ }
+
+ /**
+ * Sets institution
+ *
+ * @param string|null $institution The institution that the transaction is associated with. This is usually the brokerage name.
+ *
+ * @return self
+ */
+ public function setInstitution($institution)
+ {
+
+ if (is_null($institution)) {
+ throw new \InvalidArgumentException('non-nullable institution cannot be null');
+ }
+
+ $this->container['institution'] = $institution;
+
+ return $this;
+ }
+
+ /**
+ * Gets external_reference_id
+ *
+ * @return string|null
+ */
+ public function getExternalReferenceId()
+ {
+ return $this->container['external_reference_id'];
+ }
+
+ /**
+ * Sets external_reference_id
+ *
+ * @param string|null $external_reference_id Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same `external_reference_id`
+ *
+ * @return self
+ */
+ public function setExternalReferenceId($external_reference_id)
+ {
+
+ if (is_null($external_reference_id)) {
+ array_push($this->openAPINullablesSetToNull, 'external_reference_id');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('external_reference_id', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['external_reference_id'] = $external_reference_id;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountUniversalActivityCurrency.php b/lib/Model/AccountUniversalActivityCurrency.php
new file mode 100644
index 0000000..87d9ebc
--- /dev/null
+++ b/lib/Model/AccountUniversalActivityCurrency.php
@@ -0,0 +1,477 @@
+
+ */
+class AccountUniversalActivityCurrency implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountUniversalActivity_currency';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'string',
+ 'code' => 'string',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'uuid',
+ 'code' => null,
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'code' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'code' => 'code',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'code' => 'setCode',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'code' => 'getCode',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('code', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param string|null $id Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets code
+ *
+ * @return string|null
+ */
+ public function getCode()
+ {
+ return $this->container['code'];
+ }
+
+ /**
+ * Sets code
+ *
+ * @param string|null $code The ISO-4217 currency code for the currency.
+ *
+ * @return self
+ */
+ public function setCode($code)
+ {
+
+ if (is_null($code)) {
+ throw new \InvalidArgumentException('non-nullable code cannot be null');
+ }
+
+ $this->container['code'] = $code;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name A human-friendly name of the currency.
+ *
+ * @return self
+ */
+ public function setName($name)
+ {
+
+ if (is_null($name)) {
+ throw new \InvalidArgumentException('non-nullable name cannot be null');
+ }
+
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountUniversalActivityOptionSymbol.php b/lib/Model/AccountUniversalActivityOptionSymbol.php
new file mode 100644
index 0000000..acd5871
--- /dev/null
+++ b/lib/Model/AccountUniversalActivityOptionSymbol.php
@@ -0,0 +1,673 @@
+
+ */
+class AccountUniversalActivityOptionSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountUniversalActivity_option_symbol';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'string',
+ 'ticker' => 'string',
+ 'option_type' => 'string',
+ 'strike_price' => 'float',
+ 'expiration_date' => '\DateTime',
+ 'is_mini_option' => 'bool',
+ 'underlying_symbol' => '\SnapTrade\Model\UnderlyingSymbol'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'uuid',
+ 'ticker' => null,
+ 'option_type' => null,
+ 'strike_price' => null,
+ 'expiration_date' => 'date',
+ 'is_mini_option' => null,
+ 'underlying_symbol' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'ticker' => false,
+ 'option_type' => false,
+ 'strike_price' => false,
+ 'expiration_date' => false,
+ 'is_mini_option' => false,
+ 'underlying_symbol' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'ticker' => 'ticker',
+ 'option_type' => 'option_type',
+ 'strike_price' => 'strike_price',
+ 'expiration_date' => 'expiration_date',
+ 'is_mini_option' => 'is_mini_option',
+ 'underlying_symbol' => 'underlying_symbol'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'ticker' => 'setTicker',
+ 'option_type' => 'setOptionType',
+ 'strike_price' => 'setStrikePrice',
+ 'expiration_date' => 'setExpirationDate',
+ 'is_mini_option' => 'setIsMiniOption',
+ 'underlying_symbol' => 'setUnderlyingSymbol'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'ticker' => 'getTicker',
+ 'option_type' => 'getOptionType',
+ 'strike_price' => 'getStrikePrice',
+ 'expiration_date' => 'getExpirationDate',
+ 'is_mini_option' => 'getIsMiniOption',
+ 'underlying_symbol' => 'getUnderlyingSymbol'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const OPTION_TYPE_CALL = 'CALL';
+ public const OPTION_TYPE_PUT = 'PUT';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getOptionTypeAllowableValues()
+ {
+ return [
+ self::OPTION_TYPE_CALL,
+ self::OPTION_TYPE_PUT,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('ticker', $data ?? [], null);
+ $this->setIfExists('option_type', $data ?? [], null);
+ $this->setIfExists('strike_price', $data ?? [], null);
+ $this->setIfExists('expiration_date', $data ?? [], null);
+ $this->setIfExists('is_mini_option', $data ?? [], null);
+ $this->setIfExists('underlying_symbol', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['id'] === null) {
+ $invalidProperties[] = "'id' can't be null";
+ }
+ if ($this->container['ticker'] === null) {
+ $invalidProperties[] = "'ticker' can't be null";
+ }
+ if ($this->container['option_type'] === null) {
+ $invalidProperties[] = "'option_type' can't be null";
+ }
+ $allowedValues = $this->getOptionTypeAllowableValues();
+ if (!is_null($this->container['option_type']) && !in_array($this->container['option_type'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'option_type', must be one of '%s'",
+ $this->container['option_type'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ if ($this->container['strike_price'] === null) {
+ $invalidProperties[] = "'strike_price' can't be null";
+ }
+ if ($this->container['expiration_date'] === null) {
+ $invalidProperties[] = "'expiration_date' can't be null";
+ }
+ if ($this->container['underlying_symbol'] === null) {
+ $invalidProperties[] = "'underlying_symbol' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return string
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param string $id Unique identifier for the option symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets ticker
+ *
+ * @return string
+ */
+ public function getTicker()
+ {
+ return $this->container['ticker'];
+ }
+
+ /**
+ * Sets ticker
+ *
+ * @param string $ticker The [OCC symbol](https://en.wikipedia.org/wiki/Option_symbol) for the option.
+ *
+ * @return self
+ */
+ public function setTicker($ticker)
+ {
+
+ if (is_null($ticker)) {
+ throw new \InvalidArgumentException('non-nullable ticker cannot be null');
+ }
+
+ $this->container['ticker'] = $ticker;
+
+ return $this;
+ }
+
+ /**
+ * Gets option_type
+ *
+ * @return string
+ */
+ public function getOptionType()
+ {
+ return $this->container['option_type'];
+ }
+
+ /**
+ * Sets option_type
+ *
+ * @param string $option_type The type of option. Either \"CALL\" or \"PUT\".
+ *
+ * @return self
+ */
+ public function setOptionType($option_type)
+ {
+ $allowedValues = $this->getOptionTypeAllowableValues();
+ if (!in_array($option_type, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'option_type', must be one of '%s'",
+ $option_type,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+
+ if (is_null($option_type)) {
+ throw new \InvalidArgumentException('non-nullable option_type cannot be null');
+ }
+
+ $this->container['option_type'] = $option_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets strike_price
+ *
+ * @return float
+ */
+ public function getStrikePrice()
+ {
+ return $this->container['strike_price'];
+ }
+
+ /**
+ * Sets strike_price
+ *
+ * @param float $strike_price The option strike price.
+ *
+ * @return self
+ */
+ public function setStrikePrice($strike_price)
+ {
+
+ if (is_null($strike_price)) {
+ throw new \InvalidArgumentException('non-nullable strike_price cannot be null');
+ }
+
+ $this->container['strike_price'] = $strike_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets expiration_date
+ *
+ * @return \DateTime
+ */
+ public function getExpirationDate()
+ {
+ return $this->container['expiration_date'];
+ }
+
+ /**
+ * Sets expiration_date
+ *
+ * @param \DateTime $expiration_date The option expiration date.
+ *
+ * @return self
+ */
+ public function setExpirationDate($expiration_date)
+ {
+
+ if (is_null($expiration_date)) {
+ throw new \InvalidArgumentException('non-nullable expiration_date cannot be null');
+ }
+
+ $this->container['expiration_date'] = $expiration_date;
+
+ return $this;
+ }
+
+ /**
+ * Gets is_mini_option
+ *
+ * @return bool|null
+ */
+ public function getIsMiniOption()
+ {
+ return $this->container['is_mini_option'];
+ }
+
+ /**
+ * Sets is_mini_option
+ *
+ * @param bool|null $is_mini_option Whether the option is a mini option. Mini options have 10 underlying shares per contract instead of the standard 100.
+ *
+ * @return self
+ */
+ public function setIsMiniOption($is_mini_option)
+ {
+
+ if (is_null($is_mini_option)) {
+ throw new \InvalidArgumentException('non-nullable is_mini_option cannot be null');
+ }
+
+ $this->container['is_mini_option'] = $is_mini_option;
+
+ return $this;
+ }
+
+ /**
+ * Gets underlying_symbol
+ *
+ * @return \SnapTrade\Model\UnderlyingSymbol
+ */
+ public function getUnderlyingSymbol()
+ {
+ return $this->container['underlying_symbol'];
+ }
+
+ /**
+ * Sets underlying_symbol
+ *
+ * @param \SnapTrade\Model\UnderlyingSymbol $underlying_symbol underlying_symbol
+ *
+ * @return self
+ */
+ public function setUnderlyingSymbol($underlying_symbol)
+ {
+
+ if (is_null($underlying_symbol)) {
+ throw new \InvalidArgumentException('non-nullable underlying_symbol cannot be null');
+ }
+
+ $this->container['underlying_symbol'] = $underlying_symbol;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/AccountUniversalActivitySymbol.php b/lib/Model/AccountUniversalActivitySymbol.php
new file mode 100644
index 0000000..e1d539b
--- /dev/null
+++ b/lib/Model/AccountUniversalActivitySymbol.php
@@ -0,0 +1,714 @@
+
+ */
+class AccountUniversalActivitySymbol implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'AccountUniversalActivity_symbol';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'string',
+ 'symbol' => 'string',
+ 'raw_symbol' => 'string',
+ 'description' => 'string',
+ 'currency' => '\SnapTrade\Model\SymbolCurrency',
+ 'exchange' => '\SnapTrade\Model\SymbolExchange',
+ 'type' => '\SnapTrade\Model\SecurityType',
+ 'figi_code' => 'string',
+ 'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'uuid',
+ 'symbol' => null,
+ 'raw_symbol' => null,
+ 'description' => null,
+ 'currency' => null,
+ 'exchange' => null,
+ 'type' => null,
+ 'figi_code' => null,
+ 'figi_instrument' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'symbol' => false,
+ 'raw_symbol' => false,
+ 'description' => true,
+ 'currency' => false,
+ 'exchange' => false,
+ 'type' => false,
+ 'figi_code' => true,
+ 'figi_instrument' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'symbol' => 'symbol',
+ 'raw_symbol' => 'raw_symbol',
+ 'description' => 'description',
+ 'currency' => 'currency',
+ 'exchange' => 'exchange',
+ 'type' => 'type',
+ 'figi_code' => 'figi_code',
+ 'figi_instrument' => 'figi_instrument'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'symbol' => 'setSymbol',
+ 'raw_symbol' => 'setRawSymbol',
+ 'description' => 'setDescription',
+ 'currency' => 'setCurrency',
+ 'exchange' => 'setExchange',
+ 'type' => 'setType',
+ 'figi_code' => 'setFigiCode',
+ 'figi_instrument' => 'setFigiInstrument'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'symbol' => 'getSymbol',
+ 'raw_symbol' => 'getRawSymbol',
+ 'description' => 'getDescription',
+ 'currency' => 'getCurrency',
+ 'exchange' => 'getExchange',
+ 'type' => 'getType',
+ 'figi_code' => 'getFigiCode',
+ 'figi_instrument' => 'getFigiInstrument'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('raw_symbol', $data ?? [], null);
+ $this->setIfExists('description', $data ?? [], null);
+ $this->setIfExists('currency', $data ?? [], null);
+ $this->setIfExists('exchange', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ $this->setIfExists('figi_code', $data ?? [], null);
+ $this->setIfExists('figi_instrument', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param string|null $id Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets symbol
+ *
+ * @return string|null
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string|null $symbol The security's trading ticker symbol. For example \"AAPL\" for Apple Inc. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix.
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets raw_symbol
+ *
+ * @return string|null
+ */
+ public function getRawSymbol()
+ {
+ return $this->container['raw_symbol'];
+ }
+
+ /**
+ * Sets raw_symbol
+ *
+ * @param string|null $raw_symbol The raw symbol is `symbol` with the exchange suffix removed. For example, if `symbol` is \"VAB.TO\", then `raw_symbol` is \"VAB\".
+ *
+ * @return self
+ */
+ public function setRawSymbol($raw_symbol)
+ {
+
+ if (is_null($raw_symbol)) {
+ throw new \InvalidArgumentException('non-nullable raw_symbol cannot be null');
+ }
+
+ $this->container['raw_symbol'] = $raw_symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets description
+ *
+ * @return string|null
+ */
+ public function getDescription()
+ {
+ return $this->container['description'];
+ }
+
+ /**
+ * Sets description
+ *
+ * @param string|null $description A human-readable description of the security. This is usually the company name or ETF name.
+ *
+ * @return self
+ */
+ public function setDescription($description)
+ {
+
+ if (is_null($description)) {
+ array_push($this->openAPINullablesSetToNull, 'description');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('description', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['description'] = $description;
+
+ return $this;
+ }
+
+ /**
+ * Gets currency
+ *
+ * @return \SnapTrade\Model\SymbolCurrency|null
+ */
+ public function getCurrency()
+ {
+ return $this->container['currency'];
+ }
+
+ /**
+ * Sets currency
+ *
+ * @param \SnapTrade\Model\SymbolCurrency|null $currency currency
+ *
+ * @return self
+ */
+ public function setCurrency($currency)
+ {
+
+ if (is_null($currency)) {
+ throw new \InvalidArgumentException('non-nullable currency cannot be null');
+ }
+
+ $this->container['currency'] = $currency;
+
+ return $this;
+ }
+
+ /**
+ * Gets exchange
+ *
+ * @return \SnapTrade\Model\SymbolExchange|null
+ */
+ public function getExchange()
+ {
+ return $this->container['exchange'];
+ }
+
+ /**
+ * Sets exchange
+ *
+ * @param \SnapTrade\Model\SymbolExchange|null $exchange exchange
+ *
+ * @return self
+ */
+ public function setExchange($exchange)
+ {
+
+ if (is_null($exchange)) {
+ throw new \InvalidArgumentException('non-nullable exchange cannot be null');
+ }
+
+ $this->container['exchange'] = $exchange;
+
+ return $this;
+ }
+
+ /**
+ * Gets type
+ *
+ * @return \SnapTrade\Model\SecurityType|null
+ */
+ public function getType()
+ {
+ return $this->container['type'];
+ }
+
+ /**
+ * Sets type
+ *
+ * @param \SnapTrade\Model\SecurityType|null $type type
+ *
+ * @return self
+ */
+ public function setType($type)
+ {
+
+ if (is_null($type)) {
+ throw new \InvalidArgumentException('non-nullable type cannot be null');
+ }
+
+ $this->container['type'] = $type;
+
+ return $this;
+ }
+
+ /**
+ * Gets figi_code
+ *
+ * @return string|null
+ */
+ public function getFigiCode()
+ {
+ return $this->container['figi_code'];
+ }
+
+ /**
+ * Sets figi_code
+ *
+ * @param string|null $figi_code This identifier is unique per security per trading venue. See section 1.4.1 of the [FIGI Standard](https://www.openfigi.com/assets/local/figi-allocation-rules.pdf) for more information. This value should be the same as the `figi_code` in the `figi_instrument` child property.
+ *
+ * @return self
+ */
+ public function setFigiCode($figi_code)
+ {
+
+ if (is_null($figi_code)) {
+ array_push($this->openAPINullablesSetToNull, 'figi_code');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('figi_code', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['figi_code'] = $figi_code;
+
+ return $this;
+ }
+
+ /**
+ * Gets figi_instrument
+ *
+ * @return \SnapTrade\Model\SymbolFigiInstrument|null
+ */
+ public function getFigiInstrument()
+ {
+ return $this->container['figi_instrument'];
+ }
+
+ /**
+ * Sets figi_instrument
+ *
+ * @param \SnapTrade\Model\SymbolFigiInstrument|null $figi_instrument figi_instrument
+ *
+ * @return self
+ */
+ public function setFigiInstrument($figi_instrument)
+ {
+
+ if (is_null($figi_instrument)) {
+ array_push($this->openAPINullablesSetToNull, 'figi_instrument');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('figi_instrument', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['figi_instrument'] = $figi_instrument;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/ActionStrict.php b/lib/Model/ActionStrict.php
index 36c3ddc..3e5447b 100644
--- a/lib/Model/ActionStrict.php
+++ b/lib/Model/ActionStrict.php
@@ -28,7 +28,7 @@
* ActionStrict Class Doc Comment
*
* @category Class
- * @description Trade Action
+ * @description The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
* @package SnapTrade
*/
class ActionStrict
diff --git a/lib/Model/ActionStrictWithOptions.php b/lib/Model/ActionStrictWithOptions.php
new file mode 100644
index 0000000..2bf0a45
--- /dev/null
+++ b/lib/Model/ActionStrictWithOptions.php
@@ -0,0 +1,68 @@
+ 'mixed',
+ 'redirect_uri' => 'string',
'session_id' => 'string',
'encrypted_shared_key' => 'string',
'encrypted_message_data' => '\SnapTrade\Model\EncryptedResponseEncryptedMessageData'
@@ -76,7 +76,7 @@ class AuthenticationLoginSnapTradeUser200Response implements ModelInterface, Arr
* @var boolean[]
*/
protected static array $openAPINullables = [
- 'redirect_uri' => true,
+ 'redirect_uri' => false,
'session_id' => false,
'encrypted_shared_key' => false,
'encrypted_message_data' => false
@@ -306,7 +306,7 @@ public function valid()
/**
* Gets redirect_uri
*
- * @return mixed|null
+ * @return string|null
*/
public function getRedirectUri()
{
@@ -316,7 +316,7 @@ public function getRedirectUri()
/**
* Sets redirect_uri
*
- * @param mixed|null $redirect_uri redirect_uri
+ * @param string|null $redirect_uri Connection Portal link to redirect user to connect a brokerage account.
*
* @return self
*/
@@ -324,14 +324,7 @@ public function setRedirectUri($redirect_uri)
{
if (is_null($redirect_uri)) {
- array_push($this->openAPINullablesSetToNull, 'redirect_uri');
- } else {
- $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('redirect_uri', $nullablesSetToNull);
- if ($index !== FALSE) {
- unset($nullablesSetToNull[$index]);
- $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
- }
+ throw new \InvalidArgumentException('non-nullable redirect_uri cannot be null');
}
$this->container['redirect_uri'] = $redirect_uri;
@@ -352,7 +345,7 @@ public function getSessionId()
/**
* Sets session_id
*
- * @param string|null $session_id session_id
+ * @param string|null $session_id ID to identify the connection portal session.
*
* @return self
*/
diff --git a/lib/Model/Brokerage.php b/lib/Model/Brokerage.php
index c015202..903c882 100644
--- a/lib/Model/Brokerage.php
+++ b/lib/Model/Brokerage.php
@@ -30,6 +30,7 @@
* Brokerage Class Doc Comment
*
* @category Class
+ * @description Describes a brokerage that SnapTrade supports.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -51,25 +52,22 @@ class Brokerage implements ModelInterface, ArrayAccess, \JsonSerializable
*/
protected static $openAPITypes = [
'id' => 'string',
+ 'slug' => 'string',
'name' => 'string',
'display_name' => 'string',
'description' => 'string',
'aws_s3_logo_url' => 'string',
'aws_s3_square_logo_url' => 'string',
- 'open_url' => 'string',
- 'slug' => 'string',
'url' => 'string',
'enabled' => 'bool',
'maintenance_mode' => 'bool',
- 'allows_fractional_units' => 'bool',
'allows_trading' => 'bool',
+ 'allows_fractional_units' => 'bool',
'has_reporting' => 'bool',
'is_real_time_connection' => 'bool',
- 'allows_trading_through_snaptrade_api' => 'bool',
- 'is_scraping_integration' => 'bool',
- 'default_currency' => 'string',
'brokerage_type' => '\SnapTrade\Model\BrokerageType',
- 'exchanges' => 'mixed[]'
+ 'exchanges' => 'mixed[]',
+ 'open_url' => 'string'
];
/**
@@ -81,25 +79,22 @@ class Brokerage implements ModelInterface, ArrayAccess, \JsonSerializable
*/
protected static $openAPIFormats = [
'id' => 'uuid',
+ 'slug' => null,
'name' => null,
'display_name' => null,
'description' => null,
'aws_s3_logo_url' => 'url',
'aws_s3_square_logo_url' => 'url',
- 'open_url' => 'url',
- 'slug' => null,
'url' => 'url',
'enabled' => null,
'maintenance_mode' => null,
- 'allows_fractional_units' => null,
'allows_trading' => null,
+ 'allows_fractional_units' => null,
'has_reporting' => null,
'is_real_time_connection' => null,
- 'allows_trading_through_snaptrade_api' => null,
- 'is_scraping_integration' => null,
- 'default_currency' => 'uuid',
'brokerage_type' => null,
- 'exchanges' => null
+ 'exchanges' => null,
+ 'open_url' => 'url'
];
/**
@@ -109,25 +104,22 @@ class Brokerage implements ModelInterface, ArrayAccess, \JsonSerializable
*/
protected static array $openAPINullables = [
'id' => false,
+ 'slug' => false,
'name' => false,
'display_name' => false,
'description' => false,
'aws_s3_logo_url' => false,
'aws_s3_square_logo_url' => true,
- 'open_url' => true,
- 'slug' => false,
'url' => false,
'enabled' => false,
'maintenance_mode' => false,
- 'allows_fractional_units' => true,
'allows_trading' => true,
+ 'allows_fractional_units' => true,
'has_reporting' => true,
'is_real_time_connection' => false,
- 'allows_trading_through_snaptrade_api' => true,
- 'is_scraping_integration' => false,
- 'default_currency' => false,
'brokerage_type' => false,
- 'exchanges' => false
+ 'exchanges' => false,
+ 'open_url' => true
];
/**
@@ -217,25 +209,22 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $attributeMap = [
'id' => 'id',
+ 'slug' => 'slug',
'name' => 'name',
'display_name' => 'display_name',
'description' => 'description',
'aws_s3_logo_url' => 'aws_s3_logo_url',
'aws_s3_square_logo_url' => 'aws_s3_square_logo_url',
- 'open_url' => 'open_url',
- 'slug' => 'slug',
'url' => 'url',
'enabled' => 'enabled',
'maintenance_mode' => 'maintenance_mode',
- 'allows_fractional_units' => 'allows_fractional_units',
'allows_trading' => 'allows_trading',
+ 'allows_fractional_units' => 'allows_fractional_units',
'has_reporting' => 'has_reporting',
'is_real_time_connection' => 'is_real_time_connection',
- 'allows_trading_through_snaptrade_api' => 'allows_trading_through_snaptrade_api',
- 'is_scraping_integration' => 'is_scraping_integration',
- 'default_currency' => 'default_currency',
'brokerage_type' => 'brokerage_type',
- 'exchanges' => 'exchanges'
+ 'exchanges' => 'exchanges',
+ 'open_url' => 'open_url'
];
/**
@@ -245,25 +234,22 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $setters = [
'id' => 'setId',
+ 'slug' => 'setSlug',
'name' => 'setName',
'display_name' => 'setDisplayName',
'description' => 'setDescription',
'aws_s3_logo_url' => 'setAwsS3LogoUrl',
'aws_s3_square_logo_url' => 'setAwsS3SquareLogoUrl',
- 'open_url' => 'setOpenUrl',
- 'slug' => 'setSlug',
'url' => 'setUrl',
'enabled' => 'setEnabled',
'maintenance_mode' => 'setMaintenanceMode',
- 'allows_fractional_units' => 'setAllowsFractionalUnits',
'allows_trading' => 'setAllowsTrading',
+ 'allows_fractional_units' => 'setAllowsFractionalUnits',
'has_reporting' => 'setHasReporting',
'is_real_time_connection' => 'setIsRealTimeConnection',
- 'allows_trading_through_snaptrade_api' => 'setAllowsTradingThroughSnaptradeApi',
- 'is_scraping_integration' => 'setIsScrapingIntegration',
- 'default_currency' => 'setDefaultCurrency',
'brokerage_type' => 'setBrokerageType',
- 'exchanges' => 'setExchanges'
+ 'exchanges' => 'setExchanges',
+ 'open_url' => 'setOpenUrl'
];
/**
@@ -273,25 +259,22 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $getters = [
'id' => 'getId',
+ 'slug' => 'getSlug',
'name' => 'getName',
'display_name' => 'getDisplayName',
'description' => 'getDescription',
'aws_s3_logo_url' => 'getAwsS3LogoUrl',
'aws_s3_square_logo_url' => 'getAwsS3SquareLogoUrl',
- 'open_url' => 'getOpenUrl',
- 'slug' => 'getSlug',
'url' => 'getUrl',
'enabled' => 'getEnabled',
'maintenance_mode' => 'getMaintenanceMode',
- 'allows_fractional_units' => 'getAllowsFractionalUnits',
'allows_trading' => 'getAllowsTrading',
+ 'allows_fractional_units' => 'getAllowsFractionalUnits',
'has_reporting' => 'getHasReporting',
'is_real_time_connection' => 'getIsRealTimeConnection',
- 'allows_trading_through_snaptrade_api' => 'getAllowsTradingThroughSnaptradeApi',
- 'is_scraping_integration' => 'getIsScrapingIntegration',
- 'default_currency' => 'getDefaultCurrency',
'brokerage_type' => 'getBrokerageType',
- 'exchanges' => 'getExchanges'
+ 'exchanges' => 'getExchanges',
+ 'open_url' => 'getOpenUrl'
];
/**
@@ -352,25 +335,22 @@ public function getModelName()
public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('slug', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('display_name', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('aws_s3_logo_url', $data ?? [], null);
$this->setIfExists('aws_s3_square_logo_url', $data ?? [], null);
- $this->setIfExists('open_url', $data ?? [], null);
- $this->setIfExists('slug', $data ?? [], null);
$this->setIfExists('url', $data ?? [], null);
$this->setIfExists('enabled', $data ?? [], null);
$this->setIfExists('maintenance_mode', $data ?? [], null);
- $this->setIfExists('allows_fractional_units', $data ?? [], null);
$this->setIfExists('allows_trading', $data ?? [], null);
+ $this->setIfExists('allows_fractional_units', $data ?? [], null);
$this->setIfExists('has_reporting', $data ?? [], null);
$this->setIfExists('is_real_time_connection', $data ?? [], null);
- $this->setIfExists('allows_trading_through_snaptrade_api', $data ?? [], null);
- $this->setIfExists('is_scraping_integration', $data ?? [], null);
- $this->setIfExists('default_currency', $data ?? [], null);
$this->setIfExists('brokerage_type', $data ?? [], null);
$this->setIfExists('exchanges', $data ?? [], null);
+ $this->setIfExists('open_url', $data ?? [], null);
}
/**
@@ -428,7 +408,7 @@ public function getId()
/**
* Sets id
*
- * @param string|null $id id
+ * @param string|null $id Unique identifier for the brokerage firm. This is the UUID used to reference the brokerage in SnapTrade.
*
* @return self
*/
@@ -444,6 +424,35 @@ public function setId($id)
return $this;
}
+ /**
+ * Gets slug
+ *
+ * @return string|null
+ */
+ public function getSlug()
+ {
+ return $this->container['slug'];
+ }
+
+ /**
+ * Sets slug
+ *
+ * @param string|null $slug A short, unique identifier for the brokerage. It is usually the name of the brokerage in capital letters and will never change.
+ *
+ * @return self
+ */
+ public function setSlug($slug)
+ {
+
+ if (is_null($slug)) {
+ throw new \InvalidArgumentException('non-nullable slug cannot be null');
+ }
+
+ $this->container['slug'] = $slug;
+
+ return $this;
+ }
+
/**
* Gets name
*
@@ -515,7 +524,7 @@ public function getDescription()
/**
* Sets description
*
- * @param string|null $description description
+ * @param string|null $description A brief description of the brokerage.
*
* @return self
*/
@@ -544,7 +553,7 @@ public function getAwsS3LogoUrl()
/**
* Sets aws_s3_logo_url
*
- * @param string|null $aws_s3_logo_url aws_s3_logo_url
+ * @param string|null $aws_s3_logo_url URL to the brokerage's logo.
*
* @return self
*/
@@ -573,7 +582,7 @@ public function getAwsS3SquareLogoUrl()
/**
* Sets aws_s3_square_logo_url
*
- * @param string|null $aws_s3_square_logo_url aws_s3_square_logo_url
+ * @param string|null $aws_s3_square_logo_url URL to the brokerage's logo in square format.
*
* @return self
*/
@@ -596,71 +605,6 @@ public function setAwsS3SquareLogoUrl($aws_s3_square_logo_url)
return $this;
}
- /**
- * Gets open_url
- *
- * @return string|null
- */
- public function getOpenUrl()
- {
- return $this->container['open_url'];
- }
-
- /**
- * Sets open_url
- *
- * @param string|null $open_url open_url
- *
- * @return self
- */
- public function setOpenUrl($open_url)
- {
-
- if (is_null($open_url)) {
- array_push($this->openAPINullablesSetToNull, 'open_url');
- } else {
- $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('open_url', $nullablesSetToNull);
- if ($index !== FALSE) {
- unset($nullablesSetToNull[$index]);
- $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
- }
- }
-
- $this->container['open_url'] = $open_url;
-
- return $this;
- }
-
- /**
- * Gets slug
- *
- * @return string|null
- */
- public function getSlug()
- {
- return $this->container['slug'];
- }
-
- /**
- * Sets slug
- *
- * @param string|null $slug A unique identifier for that brokerage. It is usually the name of the brokerage in capital letters and will never change.
- *
- * @return self
- */
- public function setSlug($slug)
- {
-
- if (is_null($slug)) {
- throw new \InvalidArgumentException('non-nullable slug cannot be null');
- }
-
- $this->container['slug'] = $slug;
-
- return $this;
- }
-
/**
* Gets url
*
@@ -674,7 +618,7 @@ public function getUrl()
/**
* Sets url
*
- * @param string|null $url url
+ * @param string|null $url URL to the brokerage's website.
*
* @return self
*/
@@ -703,7 +647,7 @@ public function getEnabled()
/**
* Sets enabled
*
- * @param bool|null $enabled enabled
+ * @param bool|null $enabled Whether the brokerage is enabled in SnapTrade. A disabled brokerage will not be available for new connections.
*
* @return self
*/
@@ -732,7 +676,7 @@ public function getMaintenanceMode()
/**
* Sets maintenance_mode
*
- * @param bool|null $maintenance_mode maintenance_mode
+ * @param bool|null $maintenance_mode Whether the brokerage is currently in maintenance mode. A brokerage in maintenance mode will not be available for new connections.
*
* @return self
*/
@@ -749,73 +693,75 @@ public function setMaintenanceMode($maintenance_mode)
}
/**
- * Gets allows_fractional_units
+ * Gets allows_trading
*
* @return bool|null
*/
- public function getAllowsFractionalUnits()
+ public function getAllowsTrading()
{
- return $this->container['allows_fractional_units'];
+ return $this->container['allows_trading'];
}
/**
- * Sets allows_fractional_units
+ * Sets allows_trading
*
- * @param bool|null $allows_fractional_units allows_fractional_units
+ * @param bool|null $allows_trading Whether the brokerage allows trading through SnapTrade.
*
* @return self
*/
- public function setAllowsFractionalUnits($allows_fractional_units)
+ public function setAllowsTrading($allows_trading)
{
- if (is_null($allows_fractional_units)) {
- array_push($this->openAPINullablesSetToNull, 'allows_fractional_units');
+ if (is_null($allows_trading)) {
+ array_push($this->openAPINullablesSetToNull, 'allows_trading');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('allows_fractional_units', $nullablesSetToNull);
+ $index = array_search('allows_trading', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['allows_fractional_units'] = $allows_fractional_units;
+ $this->container['allows_trading'] = $allows_trading;
return $this;
}
/**
- * Gets allows_trading
+ * Gets allows_fractional_units
*
* @return bool|null
+ * @deprecated
*/
- public function getAllowsTrading()
+ public function getAllowsFractionalUnits()
{
- return $this->container['allows_trading'];
+ return $this->container['allows_fractional_units'];
}
/**
- * Sets allows_trading
+ * Sets allows_fractional_units
*
- * @param bool|null $allows_trading allows_trading
+ * @param bool|null $allows_fractional_units This field is deprecated. Please contact us if you have a valid use case for it.
*
* @return self
+ * @deprecated
*/
- public function setAllowsTrading($allows_trading)
+ public function setAllowsFractionalUnits($allows_fractional_units)
{
- if (is_null($allows_trading)) {
- array_push($this->openAPINullablesSetToNull, 'allows_trading');
+ if (is_null($allows_fractional_units)) {
+ array_push($this->openAPINullablesSetToNull, 'allows_fractional_units');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('allows_trading', $nullablesSetToNull);
+ $index = array_search('allows_fractional_units', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['allows_trading'] = $allows_trading;
+ $this->container['allows_fractional_units'] = $allows_fractional_units;
return $this;
}
@@ -824,6 +770,7 @@ public function setAllowsTrading($allows_trading)
* Gets has_reporting
*
* @return bool|null
+ * @deprecated
*/
public function getHasReporting()
{
@@ -833,9 +780,10 @@ public function getHasReporting()
/**
* Sets has_reporting
*
- * @param bool|null $has_reporting has_reporting
+ * @param bool|null $has_reporting This field is deprecated. Please contact us if you have a valid use case for it.
*
* @return self
+ * @deprecated
*/
public function setHasReporting($has_reporting)
{
@@ -860,6 +808,7 @@ public function setHasReporting($has_reporting)
* Gets is_real_time_connection
*
* @return bool|null
+ * @deprecated
*/
public function getIsRealTimeConnection()
{
@@ -869,9 +818,10 @@ public function getIsRealTimeConnection()
/**
* Sets is_real_time_connection
*
- * @param bool|null $is_real_time_connection is_real_time_connection
+ * @param bool|null $is_real_time_connection This field is deprecated. Please contact us if you have a valid use case for it.
*
* @return self
+ * @deprecated
*/
public function setIsRealTimeConnection($is_real_time_connection)
{
@@ -886,153 +836,99 @@ public function setIsRealTimeConnection($is_real_time_connection)
}
/**
- * Gets allows_trading_through_snaptrade_api
+ * Gets brokerage_type
*
- * @return bool|null
+ * @return \SnapTrade\Model\BrokerageType|null
*/
- public function getAllowsTradingThroughSnaptradeApi()
+ public function getBrokerageType()
{
- return $this->container['allows_trading_through_snaptrade_api'];
+ return $this->container['brokerage_type'];
}
/**
- * Sets allows_trading_through_snaptrade_api
+ * Sets brokerage_type
*
- * @param bool|null $allows_trading_through_snaptrade_api allows_trading_through_snaptrade_api
+ * @param \SnapTrade\Model\BrokerageType|null $brokerage_type brokerage_type
*
* @return self
*/
- public function setAllowsTradingThroughSnaptradeApi($allows_trading_through_snaptrade_api)
+ public function setBrokerageType($brokerage_type)
{
- if (is_null($allows_trading_through_snaptrade_api)) {
- array_push($this->openAPINullablesSetToNull, 'allows_trading_through_snaptrade_api');
- } else {
- $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('allows_trading_through_snaptrade_api', $nullablesSetToNull);
- if ($index !== FALSE) {
- unset($nullablesSetToNull[$index]);
- $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
- }
+ if (is_null($brokerage_type)) {
+ throw new \InvalidArgumentException('non-nullable brokerage_type cannot be null');
}
- $this->container['allows_trading_through_snaptrade_api'] = $allows_trading_through_snaptrade_api;
+ $this->container['brokerage_type'] = $brokerage_type;
return $this;
}
/**
- * Gets is_scraping_integration
+ * Gets exchanges
*
- * @return bool|null
+ * @return mixed[]|null
+ * @deprecated
*/
- public function getIsScrapingIntegration()
+ public function getExchanges()
{
- return $this->container['is_scraping_integration'];
+ return $this->container['exchanges'];
}
/**
- * Sets is_scraping_integration
+ * Sets exchanges
*
- * @param bool|null $is_scraping_integration is_scraping_integration
+ * @param mixed[]|null $exchanges This field is deprecated. Please contact us if you have a valid use case for it.
*
* @return self
+ * @deprecated
*/
- public function setIsScrapingIntegration($is_scraping_integration)
+ public function setExchanges($exchanges)
{
- if (is_null($is_scraping_integration)) {
- throw new \InvalidArgumentException('non-nullable is_scraping_integration cannot be null');
+ if (is_null($exchanges)) {
+ throw new \InvalidArgumentException('non-nullable exchanges cannot be null');
}
- $this->container['is_scraping_integration'] = $is_scraping_integration;
+ $this->container['exchanges'] = $exchanges;
return $this;
}
/**
- * Gets default_currency
+ * Gets open_url
*
* @return string|null
+ * @deprecated
*/
- public function getDefaultCurrency()
- {
- return $this->container['default_currency'];
- }
-
- /**
- * Sets default_currency
- *
- * @param string|null $default_currency default_currency
- *
- * @return self
- */
- public function setDefaultCurrency($default_currency)
- {
-
- if (is_null($default_currency)) {
- throw new \InvalidArgumentException('non-nullable default_currency cannot be null');
- }
-
- $this->container['default_currency'] = $default_currency;
-
- return $this;
- }
-
- /**
- * Gets brokerage_type
- *
- * @return \SnapTrade\Model\BrokerageType|null
- */
- public function getBrokerageType()
- {
- return $this->container['brokerage_type'];
- }
-
- /**
- * Sets brokerage_type
- *
- * @param \SnapTrade\Model\BrokerageType|null $brokerage_type brokerage_type
- *
- * @return self
- */
- public function setBrokerageType($brokerage_type)
- {
-
- if (is_null($brokerage_type)) {
- throw new \InvalidArgumentException('non-nullable brokerage_type cannot be null');
- }
-
- $this->container['brokerage_type'] = $brokerage_type;
-
- return $this;
- }
-
- /**
- * Gets exchanges
- *
- * @return mixed[]|null
- */
- public function getExchanges()
+ public function getOpenUrl()
{
- return $this->container['exchanges'];
+ return $this->container['open_url'];
}
/**
- * Sets exchanges
+ * Sets open_url
*
- * @param mixed[]|null $exchanges List of exchange ID supported by brokerage
+ * @param string|null $open_url This field is deprecated.
*
* @return self
+ * @deprecated
*/
- public function setExchanges($exchanges)
+ public function setOpenUrl($open_url)
{
- if (is_null($exchanges)) {
- throw new \InvalidArgumentException('non-nullable exchanges cannot be null');
+ if (is_null($open_url)) {
+ array_push($this->openAPINullablesSetToNull, 'open_url');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('open_url', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
- $this->container['exchanges'] = $exchanges;
+ $this->container['open_url'] = $open_url;
return $this;
}
diff --git a/lib/Model/BrokerageAuthorization.php b/lib/Model/BrokerageAuthorization.php
index 90f74bd..3a015c2 100644
--- a/lib/Model/BrokerageAuthorization.php
+++ b/lib/Model/BrokerageAuthorization.php
@@ -30,6 +30,7 @@
* BrokerageAuthorization Class Doc Comment
*
* @category Class
+ * @description A single connection with a brokerage. Note that `Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency. A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts. SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -51,14 +52,15 @@ class BrokerageAuthorization implements ModelInterface, ArrayAccess, \JsonSerial
*/
protected static $openAPITypes = [
'id' => 'string',
- 'created_date' => 'string',
- 'updated_date' => 'string',
+ 'created_date' => '\DateTime',
'brokerage' => '\SnapTrade\Model\Brokerage',
'name' => 'string',
'type' => 'string',
'disabled' => 'bool',
- 'disabled_date' => 'string',
- 'meta' => 'array'
+ 'disabled_date' => '\DateTime',
+ 'meta' => 'array',
+ 'updated_date' => '\DateTime',
+ 'is_eligible_for_payout' => 'bool'
];
/**
@@ -70,14 +72,15 @@ class BrokerageAuthorization implements ModelInterface, ArrayAccess, \JsonSerial
*/
protected static $openAPIFormats = [
'id' => 'uuid',
- 'created_date' => null,
- 'updated_date' => null,
+ 'created_date' => 'date-time',
'brokerage' => null,
'name' => null,
'type' => null,
'disabled' => null,
- 'disabled_date' => null,
- 'meta' => null
+ 'disabled_date' => 'date-time',
+ 'meta' => null,
+ 'updated_date' => 'date-time',
+ 'is_eligible_for_payout' => null
];
/**
@@ -88,13 +91,14 @@ class BrokerageAuthorization implements ModelInterface, ArrayAccess, \JsonSerial
protected static array $openAPINullables = [
'id' => false,
'created_date' => false,
- 'updated_date' => false,
'brokerage' => false,
'name' => false,
'type' => false,
'disabled' => false,
'disabled_date' => true,
- 'meta' => false
+ 'meta' => false,
+ 'updated_date' => false,
+ 'is_eligible_for_payout' => false
];
/**
@@ -185,13 +189,14 @@ public function isNullableSetToNull(string $property): bool
protected static $attributeMap = [
'id' => 'id',
'created_date' => 'created_date',
- 'updated_date' => 'updated_date',
'brokerage' => 'brokerage',
'name' => 'name',
'type' => 'type',
'disabled' => 'disabled',
'disabled_date' => 'disabled_date',
- 'meta' => 'meta'
+ 'meta' => 'meta',
+ 'updated_date' => 'updated_date',
+ 'is_eligible_for_payout' => 'is_eligible_for_payout'
];
/**
@@ -202,13 +207,14 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'id' => 'setId',
'created_date' => 'setCreatedDate',
- 'updated_date' => 'setUpdatedDate',
'brokerage' => 'setBrokerage',
'name' => 'setName',
'type' => 'setType',
'disabled' => 'setDisabled',
'disabled_date' => 'setDisabledDate',
- 'meta' => 'setMeta'
+ 'meta' => 'setMeta',
+ 'updated_date' => 'setUpdatedDate',
+ 'is_eligible_for_payout' => 'setIsEligibleForPayout'
];
/**
@@ -219,13 +225,14 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'id' => 'getId',
'created_date' => 'getCreatedDate',
- 'updated_date' => 'getUpdatedDate',
'brokerage' => 'getBrokerage',
'name' => 'getName',
'type' => 'getType',
'disabled' => 'getDisabled',
'disabled_date' => 'getDisabledDate',
- 'meta' => 'getMeta'
+ 'meta' => 'getMeta',
+ 'updated_date' => 'getUpdatedDate',
+ 'is_eligible_for_payout' => 'getIsEligibleForPayout'
];
/**
@@ -287,13 +294,14 @@ public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('created_date', $data ?? [], null);
- $this->setIfExists('updated_date', $data ?? [], null);
$this->setIfExists('brokerage', $data ?? [], null);
$this->setIfExists('name', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
$this->setIfExists('disabled', $data ?? [], null);
$this->setIfExists('disabled_date', $data ?? [], null);
$this->setIfExists('meta', $data ?? [], null);
+ $this->setIfExists('updated_date', $data ?? [], null);
+ $this->setIfExists('is_eligible_for_payout', $data ?? [], null);
}
/**
@@ -351,7 +359,7 @@ public function getId()
/**
* Sets id
*
- * @param string|null $id id
+ * @param string|null $id Unique identifier for the connection. This is the UUID used to reference the connection in SnapTrade.
*
* @return self
*/
@@ -370,7 +378,7 @@ public function setId($id)
/**
* Gets created_date
*
- * @return string|null
+ * @return \DateTime|null
*/
public function getCreatedDate()
{
@@ -380,7 +388,7 @@ public function getCreatedDate()
/**
* Sets created_date
*
- * @param string|null $created_date Time
+ * @param \DateTime|null $created_date Timestamp of when the connection was established in SnapTrade.
*
* @return self
*/
@@ -396,35 +404,6 @@ public function setCreatedDate($created_date)
return $this;
}
- /**
- * Gets updated_date
- *
- * @return string|null
- */
- public function getUpdatedDate()
- {
- return $this->container['updated_date'];
- }
-
- /**
- * Sets updated_date
- *
- * @param string|null $updated_date Time
- *
- * @return self
- */
- public function setUpdatedDate($updated_date)
- {
-
- if (is_null($updated_date)) {
- throw new \InvalidArgumentException('non-nullable updated_date cannot be null');
- }
-
- $this->container['updated_date'] = $updated_date;
-
- return $this;
- }
-
/**
* Gets brokerage
*
@@ -467,7 +446,7 @@ public function getName()
/**
* Sets name
*
- * @param string|null $name Connection Name
+ * @param string|null $name A short, human-readable name for the connection.
*
* @return self
*/
@@ -496,7 +475,7 @@ public function getType()
/**
* Sets type
*
- * @param string|null $type type
+ * @param string|null $type Whether the connection is read-only or trade-enabled. A read-only connection can only be used to fetch data, while a trade-enabled connection can be used to place trades. Valid values are `read` and `trade`.
*
* @return self
*/
@@ -525,7 +504,7 @@ public function getDisabled()
/**
* Sets disabled
*
- * @param bool|null $disabled disabled
+ * @param bool|null $disabled Whether the connection is disabled. A disabled connection can no longer access the latest data from the brokerage, but will continue to return the last cached state. A connection can become disabled for many reasons and differs by brokerage. Here are some common scenarios: - The user has changed their username or password at the brokerage. - The user has explicitly removed the access grant at the brokerage. - The session has expired at the brokerage and now requires explicit user re-authentication. Please see [this guide](/docs/fix-broken-connections) on how to fix a disabled connection.
*
* @return self
*/
@@ -544,7 +523,7 @@ public function setDisabled($disabled)
/**
* Gets disabled_date
*
- * @return string|null
+ * @return \DateTime|null
*/
public function getDisabledDate()
{
@@ -554,7 +533,7 @@ public function getDisabledDate()
/**
* Sets disabled_date
*
- * @param string|null $disabled_date Disabled date
+ * @param \DateTime|null $disabled_date Timestamp of when the connection was disabled in SnapTrade.
*
* @return self
*/
@@ -581,6 +560,7 @@ public function setDisabledDate($disabled_date)
* Gets meta
*
* @return array|null
+ * @deprecated
*/
public function getMeta()
{
@@ -590,9 +570,10 @@ public function getMeta()
/**
* Sets meta
*
- * @param array|null $meta Additional data about brokerage authorization
+ * @param array|null $meta Additional data about the connection. This information is specific to the brokerage and there's no standard format for this data. This field is deprecated and subject to removal in a future version.
*
* @return self
+ * @deprecated
*/
public function setMeta($meta)
{
@@ -605,6 +586,66 @@ public function setMeta($meta)
return $this;
}
+
+ /**
+ * Gets updated_date
+ *
+ * @return \DateTime|null
+ * @deprecated
+ */
+ public function getUpdatedDate()
+ {
+ return $this->container['updated_date'];
+ }
+
+ /**
+ * Sets updated_date
+ *
+ * @param \DateTime|null $updated_date Timestamp of when the connection was last updated in SnapTrade. This field is deprecated. Please let us know if you have a valid use case for this field.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setUpdatedDate($updated_date)
+ {
+
+ if (is_null($updated_date)) {
+ throw new \InvalidArgumentException('non-nullable updated_date cannot be null');
+ }
+
+ $this->container['updated_date'] = $updated_date;
+
+ return $this;
+ }
+
+ /**
+ * Gets is_eligible_for_payout
+ *
+ * @return bool|null
+ */
+ public function getIsEligibleForPayout()
+ {
+ return $this->container['is_eligible_for_payout'];
+ }
+
+ /**
+ * Sets is_eligible_for_payout
+ *
+ * @param bool|null $is_eligible_for_payout Whether the connection is eligible for a payout. This is an experimental field that is NOT generally available for all partners. Do not use in production without speaking to the SnapTrade team.
+ *
+ * @return self
+ */
+ public function setIsEligibleForPayout($is_eligible_for_payout)
+ {
+
+ if (is_null($is_eligible_for_payout)) {
+ throw new \InvalidArgumentException('non-nullable is_eligible_for_payout cannot be null');
+ }
+
+ $this->container['is_eligible_for_payout'] = $is_eligible_for_payout;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/BrokerageAuthorizationDisabledConfirmation.php b/lib/Model/BrokerageAuthorizationDisabledConfirmation.php
index ad43858..90b9171 100644
--- a/lib/Model/BrokerageAuthorizationDisabledConfirmation.php
+++ b/lib/Model/BrokerageAuthorizationDisabledConfirmation.php
@@ -30,6 +30,7 @@
* BrokerageAuthorizationDisabledConfirmation Class Doc Comment
*
* @category Class
+ * @description Confirmation that the connection has been disabled.
* @package SnapTrade
* @implements \ArrayAccess
*/
diff --git a/lib/Model/BrokerageAuthorizationRefreshConfirmation.php b/lib/Model/BrokerageAuthorizationRefreshConfirmation.php
index 0b053bd..662cc5e 100644
--- a/lib/Model/BrokerageAuthorizationRefreshConfirmation.php
+++ b/lib/Model/BrokerageAuthorizationRefreshConfirmation.php
@@ -30,6 +30,7 @@
* BrokerageAuthorizationRefreshConfirmation Class Doc Comment
*
* @category Class
+ * @description Confirmation that the syncs have been scheduled.
* @package SnapTrade
* @implements \ArrayAccess
*/
diff --git a/lib/Model/BrokerageInstrument.php b/lib/Model/BrokerageInstrument.php
new file mode 100644
index 0000000..7b6fdd3
--- /dev/null
+++ b/lib/Model/BrokerageInstrument.php
@@ -0,0 +1,579 @@
+
+ */
+class BrokerageInstrument implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'BrokerageInstrument';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'symbol' => 'string',
+ 'exchange_mic' => 'string',
+ 'tradeable' => 'bool',
+ 'fractionable' => 'bool',
+ 'universal_symbol_id' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'symbol' => null,
+ 'exchange_mic' => null,
+ 'tradeable' => null,
+ 'fractionable' => null,
+ 'universal_symbol_id' => 'uuid'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'symbol' => false,
+ 'exchange_mic' => true,
+ 'tradeable' => true,
+ 'fractionable' => true,
+ 'universal_symbol_id' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'symbol' => 'symbol',
+ 'exchange_mic' => 'exchange_mic',
+ 'tradeable' => 'tradeable',
+ 'fractionable' => 'fractionable',
+ 'universal_symbol_id' => 'universal_symbol_id'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'symbol' => 'setSymbol',
+ 'exchange_mic' => 'setExchangeMic',
+ 'tradeable' => 'setTradeable',
+ 'fractionable' => 'setFractionable',
+ 'universal_symbol_id' => 'setUniversalSymbolId'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'symbol' => 'getSymbol',
+ 'exchange_mic' => 'getExchangeMic',
+ 'tradeable' => 'getTradeable',
+ 'fractionable' => 'getFractionable',
+ 'universal_symbol_id' => 'getUniversalSymbolId'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('exchange_mic', $data ?? [], null);
+ $this->setIfExists('tradeable', $data ?? [], null);
+ $this->setIfExists('fractionable', $data ?? [], null);
+ $this->setIfExists('universal_symbol_id', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['symbol'] === null) {
+ $invalidProperties[] = "'symbol' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets symbol
+ *
+ * @return string
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string $symbol The instrument's trading symbol / ticker.
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets exchange_mic
+ *
+ * @return string|null
+ */
+ public function getExchangeMic()
+ {
+ return $this->container['exchange_mic'];
+ }
+
+ /**
+ * Sets exchange_mic
+ *
+ * @param string|null $exchange_mic The MIC code of the exchange where the instrument is traded.
+ *
+ * @return self
+ */
+ public function setExchangeMic($exchange_mic)
+ {
+
+ if (is_null($exchange_mic)) {
+ array_push($this->openAPINullablesSetToNull, 'exchange_mic');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('exchange_mic', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['exchange_mic'] = $exchange_mic;
+
+ return $this;
+ }
+
+ /**
+ * Gets tradeable
+ *
+ * @return bool|null
+ */
+ public function getTradeable()
+ {
+ return $this->container['tradeable'];
+ }
+
+ /**
+ * Sets tradeable
+ *
+ * @param bool|null $tradeable Whether the instrument is tradeable through the brokerage. `null` if the tradeability is unknown.
+ *
+ * @return self
+ */
+ public function setTradeable($tradeable)
+ {
+
+ if (is_null($tradeable)) {
+ array_push($this->openAPINullablesSetToNull, 'tradeable');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('tradeable', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['tradeable'] = $tradeable;
+
+ return $this;
+ }
+
+ /**
+ * Gets fractionable
+ *
+ * @return bool|null
+ */
+ public function getFractionable()
+ {
+ return $this->container['fractionable'];
+ }
+
+ /**
+ * Sets fractionable
+ *
+ * @param bool|null $fractionable Whether the instrument allows fractional units. `null` if the fractionability is unknown.
+ *
+ * @return self
+ */
+ public function setFractionable($fractionable)
+ {
+
+ if (is_null($fractionable)) {
+ array_push($this->openAPINullablesSetToNull, 'fractionable');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('fractionable', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['fractionable'] = $fractionable;
+
+ return $this;
+ }
+
+ /**
+ * Gets universal_symbol_id
+ *
+ * @return string|null
+ */
+ public function getUniversalSymbolId()
+ {
+ return $this->container['universal_symbol_id'];
+ }
+
+ /**
+ * Sets universal_symbol_id
+ *
+ * @param string|null $universal_symbol_id The universal symbol ID of the instrument. This is the ID used to reference the instrument in SnapTrade API calls.
+ *
+ * @return self
+ */
+ public function setUniversalSymbolId($universal_symbol_id)
+ {
+
+ if (is_null($universal_symbol_id)) {
+ array_push($this->openAPINullablesSetToNull, 'universal_symbol_id');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('universal_symbol_id', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['universal_symbol_id'] = $universal_symbol_id;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/BrokerageInstrumentsResponse.php b/lib/Model/BrokerageInstrumentsResponse.php
new file mode 100644
index 0000000..9a5405d
--- /dev/null
+++ b/lib/Model/BrokerageInstrumentsResponse.php
@@ -0,0 +1,404 @@
+
+ */
+class BrokerageInstrumentsResponse implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'BrokerageInstrumentsResponse';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'instruments' => '\SnapTrade\Model\BrokerageInstrument[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'instruments' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'instruments' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'instruments' => 'instruments'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'instruments' => 'setInstruments'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'instruments' => 'getInstruments'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('instruments', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets instruments
+ *
+ * @return \SnapTrade\Model\BrokerageInstrument[]|null
+ */
+ public function getInstruments()
+ {
+ return $this->container['instruments'];
+ }
+
+ /**
+ * Sets instruments
+ *
+ * @param \SnapTrade\Model\BrokerageInstrument[]|null $instruments instruments
+ *
+ * @return self
+ */
+ public function setInstruments($instruments)
+ {
+
+ if (is_null($instruments)) {
+ throw new \InvalidArgumentException('non-nullable instruments cannot be null');
+ }
+
+ $this->container['instruments'] = $instruments;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/BrokerageType.php b/lib/Model/BrokerageType.php
index 9bbd4b8..1162a75 100644
--- a/lib/Model/BrokerageType.php
+++ b/lib/Model/BrokerageType.php
@@ -30,7 +30,7 @@
* BrokerageType Class Doc Comment
*
* @category Class
- * @description Type of brokerage
+ * @description Type of brokerage. Currently supports traditional brokerages and crypto exchanges.
* @package SnapTrade
* @implements \ArrayAccess
*/
diff --git a/lib/Model/OptionsPlaceOptionStrategyRequest.php b/lib/Model/CancelOrderResponse.php
similarity index 74%
rename from lib/Model/OptionsPlaceOptionStrategyRequest.php
rename to lib/Model/CancelOrderResponse.php
index 4c18820..37a0d06 100644
--- a/lib/Model/OptionsPlaceOptionStrategyRequest.php
+++ b/lib/Model/CancelOrderResponse.php
@@ -1,6 +1,6 @@
*/
-class OptionsPlaceOptionStrategyRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+class CancelOrderResponse implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
@@ -42,7 +42,7 @@ class OptionsPlaceOptionStrategyRequest implements ModelInterface, ArrayAccess,
*
* @var string
*/
- protected static $openAPIModelName = 'Options_placeOptionStrategy_request';
+ protected static $openAPIModelName = 'CancelOrderResponse';
/**
* Array of property to type mappings. Used for (de)serialization
@@ -50,9 +50,8 @@ class OptionsPlaceOptionStrategyRequest implements ModelInterface, ArrayAccess,
* @var string[]
*/
protected static $openAPITypes = [
- 'order_type' => '\SnapTrade\Model\OrderTypeStrict',
- 'time_in_force' => '\SnapTrade\Model\TimeInForceStrict',
- 'price' => 'float'
+ 'brokerage_order_id' => 'string',
+ 'raw_response' => 'array'
];
/**
@@ -63,9 +62,8 @@ class OptionsPlaceOptionStrategyRequest implements ModelInterface, ArrayAccess,
* @psalm-var array
*/
protected static $openAPIFormats = [
- 'order_type' => null,
- 'time_in_force' => null,
- 'price' => null
+ 'brokerage_order_id' => null,
+ 'raw_response' => null
];
/**
@@ -74,9 +72,8 @@ class OptionsPlaceOptionStrategyRequest implements ModelInterface, ArrayAccess,
* @var boolean[]
*/
protected static array $openAPINullables = [
- 'order_type' => false,
- 'time_in_force' => false,
- 'price' => true
+ 'brokerage_order_id' => false,
+ 'raw_response' => true
];
/**
@@ -165,9 +162,8 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
- 'order_type' => 'order_type',
- 'time_in_force' => 'time_in_force',
- 'price' => 'price'
+ 'brokerage_order_id' => 'brokerage_order_id',
+ 'raw_response' => 'raw_response'
];
/**
@@ -176,9 +172,8 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
- 'order_type' => 'setOrderType',
- 'time_in_force' => 'setTimeInForce',
- 'price' => 'setPrice'
+ 'brokerage_order_id' => 'setBrokerageOrderId',
+ 'raw_response' => 'setRawResponse'
];
/**
@@ -187,9 +182,8 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
- 'order_type' => 'getOrderType',
- 'time_in_force' => 'getTimeInForce',
- 'price' => 'getPrice'
+ 'brokerage_order_id' => 'getBrokerageOrderId',
+ 'raw_response' => 'getRawResponse'
];
/**
@@ -249,9 +243,8 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
- $this->setIfExists('order_type', $data ?? [], null);
- $this->setIfExists('time_in_force', $data ?? [], null);
- $this->setIfExists('price', $data ?? [], null);
+ $this->setIfExists('brokerage_order_id', $data ?? [], null);
+ $this->setIfExists('raw_response', $data ?? [], null);
}
/**
@@ -281,11 +274,8 @@ public function listInvalidProperties()
{
$invalidProperties = [];
- if ($this->container['order_type'] === null) {
- $invalidProperties[] = "'order_type' can't be null";
- }
- if ($this->container['time_in_force'] === null) {
- $invalidProperties[] = "'time_in_force' can't be null";
+ if ($this->container['brokerage_order_id'] === null) {
+ $invalidProperties[] = "'brokerage_order_id' can't be null";
}
return $invalidProperties;
}
@@ -303,95 +293,66 @@ public function valid()
/**
- * Gets order_type
+ * Gets brokerage_order_id
*
- * @return \SnapTrade\Model\OrderTypeStrict
- */
- public function getOrderType()
- {
- return $this->container['order_type'];
- }
-
- /**
- * Sets order_type
- *
- * @param \SnapTrade\Model\OrderTypeStrict $order_type order_type
- *
- * @return self
- */
- public function setOrderType($order_type)
- {
-
- if (is_null($order_type)) {
- throw new \InvalidArgumentException('non-nullable order_type cannot be null');
- }
-
- $this->container['order_type'] = $order_type;
-
- return $this;
- }
-
- /**
- * Gets time_in_force
- *
- * @return \SnapTrade\Model\TimeInForceStrict
+ * @return string
*/
- public function getTimeInForce()
+ public function getBrokerageOrderId()
{
- return $this->container['time_in_force'];
+ return $this->container['brokerage_order_id'];
}
/**
- * Sets time_in_force
+ * Sets brokerage_order_id
*
- * @param \SnapTrade\Model\TimeInForceStrict $time_in_force time_in_force
+ * @param string $brokerage_order_id Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
*
* @return self
*/
- public function setTimeInForce($time_in_force)
+ public function setBrokerageOrderId($brokerage_order_id)
{
- if (is_null($time_in_force)) {
- throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ if (is_null($brokerage_order_id)) {
+ throw new \InvalidArgumentException('non-nullable brokerage_order_id cannot be null');
}
- $this->container['time_in_force'] = $time_in_force;
+ $this->container['brokerage_order_id'] = $brokerage_order_id;
return $this;
}
/**
- * Gets price
+ * Gets raw_response
*
- * @return float|null
+ * @return array|null
*/
- public function getPrice()
+ public function getRawResponse()
{
- return $this->container['price'];
+ return $this->container['raw_response'];
}
/**
- * Sets price
+ * Sets raw_response
*
- * @param float|null $price Trade Price if limit or stop limit order
+ * @param array|null $raw_response The raw response from the brokerage.
*
* @return self
*/
- public function setPrice($price)
+ public function setRawResponse($raw_response)
{
- if (is_null($price)) {
- array_push($this->openAPINullablesSetToNull, 'price');
+ if (is_null($raw_response)) {
+ array_push($this->openAPINullablesSetToNull, 'raw_response');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('price', $nullablesSetToNull);
+ $index = array_search('raw_response', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['price'] = $price;
+ $this->container['raw_response'] = $raw_response;
return $this;
}
diff --git a/lib/Model/ChildBrokerageOrderIDs.php b/lib/Model/ChildBrokerageOrderIDs.php
new file mode 100644
index 0000000..919c7ac
--- /dev/null
+++ b/lib/Model/ChildBrokerageOrderIDs.php
@@ -0,0 +1,440 @@
+
+ */
+class ChildBrokerageOrderIDs implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'ChildBrokerageOrderIDs';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'take_profit_order_id' => 'string',
+ 'stop_loss_order_id' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'take_profit_order_id' => null,
+ 'stop_loss_order_id' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'take_profit_order_id' => false,
+ 'stop_loss_order_id' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'take_profit_order_id' => 'take_profit_order_id',
+ 'stop_loss_order_id' => 'stop_loss_order_id'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'take_profit_order_id' => 'setTakeProfitOrderId',
+ 'stop_loss_order_id' => 'setStopLossOrderId'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'take_profit_order_id' => 'getTakeProfitOrderId',
+ 'stop_loss_order_id' => 'getStopLossOrderId'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('take_profit_order_id', $data ?? [], null);
+ $this->setIfExists('stop_loss_order_id', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets take_profit_order_id
+ *
+ * @return string|null
+ */
+ public function getTakeProfitOrderId()
+ {
+ return $this->container['take_profit_order_id'];
+ }
+
+ /**
+ * Sets take_profit_order_id
+ *
+ * @param string|null $take_profit_order_id The brokerage order ID for the take profit leg of the bracket order
+ *
+ * @return self
+ */
+ public function setTakeProfitOrderId($take_profit_order_id)
+ {
+
+ if (is_null($take_profit_order_id)) {
+ throw new \InvalidArgumentException('non-nullable take_profit_order_id cannot be null');
+ }
+
+ $this->container['take_profit_order_id'] = $take_profit_order_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop_loss_order_id
+ *
+ * @return string|null
+ */
+ public function getStopLossOrderId()
+ {
+ return $this->container['stop_loss_order_id'];
+ }
+
+ /**
+ * Sets stop_loss_order_id
+ *
+ * @param string|null $stop_loss_order_id The brokerage order ID for the stop loss leg of the bracket order
+ *
+ * @return self
+ */
+ public function setStopLossOrderId($stop_loss_order_id)
+ {
+
+ if (is_null($stop_loss_order_id)) {
+ throw new \InvalidArgumentException('non-nullable stop_loss_order_id cannot be null');
+ }
+
+ $this->container['stop_loss_order_id'] = $stop_loss_order_id;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/CryptoOrderForm.php b/lib/Model/CryptoOrderForm.php
new file mode 100644
index 0000000..03e6b0e
--- /dev/null
+++ b/lib/Model/CryptoOrderForm.php
@@ -0,0 +1,787 @@
+
+ */
+class CryptoOrderForm implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'CryptoOrderForm';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'instrument' => '\SnapTrade\Model\CryptoTradingInstrument',
+ 'side' => '\SnapTrade\Model\ActionStrict',
+ 'type' => 'string',
+ 'time_in_force' => 'string',
+ 'amount' => 'float',
+ 'limit_price' => 'float',
+ 'stop_price' => 'float',
+ 'post_only' => 'bool',
+ 'expiration_date' => '\DateTime'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'instrument' => null,
+ 'side' => null,
+ 'type' => null,
+ 'time_in_force' => null,
+ 'amount' => 'decimal',
+ 'limit_price' => 'decimal',
+ 'stop_price' => 'decimal',
+ 'post_only' => null,
+ 'expiration_date' => 'date-time'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'instrument' => false,
+ 'side' => false,
+ 'type' => false,
+ 'time_in_force' => false,
+ 'amount' => false,
+ 'limit_price' => false,
+ 'stop_price' => false,
+ 'post_only' => false,
+ 'expiration_date' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'instrument' => 'instrument',
+ 'side' => 'side',
+ 'type' => 'type',
+ 'time_in_force' => 'time_in_force',
+ 'amount' => 'amount',
+ 'limit_price' => 'limit_price',
+ 'stop_price' => 'stop_price',
+ 'post_only' => 'post_only',
+ 'expiration_date' => 'expiration_date'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'instrument' => 'setInstrument',
+ 'side' => 'setSide',
+ 'type' => 'setType',
+ 'time_in_force' => 'setTimeInForce',
+ 'amount' => 'setAmount',
+ 'limit_price' => 'setLimitPrice',
+ 'stop_price' => 'setStopPrice',
+ 'post_only' => 'setPostOnly',
+ 'expiration_date' => 'setExpirationDate'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'instrument' => 'getInstrument',
+ 'side' => 'getSide',
+ 'type' => 'getType',
+ 'time_in_force' => 'getTimeInForce',
+ 'amount' => 'getAmount',
+ 'limit_price' => 'getLimitPrice',
+ 'stop_price' => 'getStopPrice',
+ 'post_only' => 'getPostOnly',
+ 'expiration_date' => 'getExpirationDate'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const TYPE_MARKET = 'MARKET';
+ public const TYPE_LIMIT = 'LIMIT';
+ public const TYPE_STOP_LOSS_MARKET = 'STOP_LOSS_MARKET';
+ public const TYPE_STOP_LOSS_LIMIT = 'STOP_LOSS_LIMIT';
+ public const TYPE_TAKE_PROFIT_MARKET = 'TAKE_PROFIT_MARKET';
+ public const TYPE_TAKE_PROFIT_LIMIT = 'TAKE_PROFIT_LIMIT';
+ public const TIME_IN_FORCE_GTC = 'GTC';
+ public const TIME_IN_FORCE_FOK = 'FOK';
+ public const TIME_IN_FORCE_IOC = 'IOC';
+ public const TIME_IN_FORCE_GTD = 'GTD';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getTypeAllowableValues()
+ {
+ return [
+ self::TYPE_MARKET,
+ self::TYPE_LIMIT,
+ self::TYPE_STOP_LOSS_MARKET,
+ self::TYPE_STOP_LOSS_LIMIT,
+ self::TYPE_TAKE_PROFIT_MARKET,
+ self::TYPE_TAKE_PROFIT_LIMIT,
+ ];
+ }
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getTimeInForceAllowableValues()
+ {
+ return [
+ self::TIME_IN_FORCE_GTC,
+ self::TIME_IN_FORCE_FOK,
+ self::TIME_IN_FORCE_IOC,
+ self::TIME_IN_FORCE_GTD,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('instrument', $data ?? [], null);
+ $this->setIfExists('side', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ $this->setIfExists('time_in_force', $data ?? [], null);
+ $this->setIfExists('amount', $data ?? [], null);
+ $this->setIfExists('limit_price', $data ?? [], null);
+ $this->setIfExists('stop_price', $data ?? [], null);
+ $this->setIfExists('post_only', $data ?? [], null);
+ $this->setIfExists('expiration_date', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['instrument'] === null) {
+ $invalidProperties[] = "'instrument' can't be null";
+ }
+ if ($this->container['side'] === null) {
+ $invalidProperties[] = "'side' can't be null";
+ }
+ if ($this->container['type'] === null) {
+ $invalidProperties[] = "'type' can't be null";
+ }
+ $allowedValues = $this->getTypeAllowableValues();
+ if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'type', must be one of '%s'",
+ $this->container['type'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ if ($this->container['time_in_force'] === null) {
+ $invalidProperties[] = "'time_in_force' can't be null";
+ }
+ $allowedValues = $this->getTimeInForceAllowableValues();
+ if (!is_null($this->container['time_in_force']) && !in_array($this->container['time_in_force'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'time_in_force', must be one of '%s'",
+ $this->container['time_in_force'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ if ($this->container['amount'] === null) {
+ $invalidProperties[] = "'amount' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets instrument
+ *
+ * @return \SnapTrade\Model\CryptoTradingInstrument
+ */
+ public function getInstrument()
+ {
+ return $this->container['instrument'];
+ }
+
+ /**
+ * Sets instrument
+ *
+ * @param \SnapTrade\Model\CryptoTradingInstrument $instrument instrument
+ *
+ * @return self
+ */
+ public function setInstrument($instrument)
+ {
+
+ if (is_null($instrument)) {
+ throw new \InvalidArgumentException('non-nullable instrument cannot be null');
+ }
+
+ $this->container['instrument'] = $instrument;
+
+ return $this;
+ }
+
+ /**
+ * Gets side
+ *
+ * @return \SnapTrade\Model\ActionStrict
+ */
+ public function getSide()
+ {
+ return $this->container['side'];
+ }
+
+ /**
+ * Sets side
+ *
+ * @param \SnapTrade\Model\ActionStrict $side side
+ *
+ * @return self
+ */
+ public function setSide($side)
+ {
+
+ if (is_null($side)) {
+ throw new \InvalidArgumentException('non-nullable side cannot be null');
+ }
+
+ $this->container['side'] = $side;
+
+ return $this;
+ }
+
+ /**
+ * Gets type
+ *
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->container['type'];
+ }
+
+ /**
+ * Sets type
+ *
+ * @param string $type The type of order to place.
+ *
+ * @return self
+ */
+ public function setType($type)
+ {
+ $allowedValues = $this->getTypeAllowableValues();
+ if (!in_array($type, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'type', must be one of '%s'",
+ $type,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+
+ if (is_null($type)) {
+ throw new \InvalidArgumentException('non-nullable type cannot be null');
+ }
+
+ $this->container['type'] = $type;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_in_force
+ *
+ * @return string
+ */
+ public function getTimeInForce()
+ {
+ return $this->container['time_in_force'];
+ }
+
+ /**
+ * Sets time_in_force
+ *
+ * @param string $time_in_force The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
+ *
+ * @return self
+ */
+ public function setTimeInForce($time_in_force)
+ {
+ $allowedValues = $this->getTimeInForceAllowableValues();
+ if (!in_array($time_in_force, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'time_in_force', must be one of '%s'",
+ $time_in_force,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+
+ if (is_null($time_in_force)) {
+ throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ }
+
+ $this->container['time_in_force'] = $time_in_force;
+
+ return $this;
+ }
+
+ /**
+ * Gets amount
+ *
+ * @return float
+ */
+ public function getAmount()
+ {
+ return $this->container['amount'];
+ }
+
+ /**
+ * Sets amount
+ *
+ * @param float $amount The amount of the base currency to buy or sell.
+ *
+ * @return self
+ */
+ public function setAmount($amount)
+ {
+
+ if (is_null($amount)) {
+ throw new \InvalidArgumentException('non-nullable amount cannot be null');
+ }
+
+ $this->container['amount'] = $amount;
+
+ return $this;
+ }
+
+ /**
+ * Gets limit_price
+ *
+ * @return float|null
+ */
+ public function getLimitPrice()
+ {
+ return $this->container['limit_price'];
+ }
+
+ /**
+ * Sets limit_price
+ *
+ * @param float|null $limit_price The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
+ *
+ * @return self
+ */
+ public function setLimitPrice($limit_price)
+ {
+
+ if (is_null($limit_price)) {
+ throw new \InvalidArgumentException('non-nullable limit_price cannot be null');
+ }
+
+ $this->container['limit_price'] = $limit_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop_price
+ *
+ * @return float|null
+ */
+ public function getStopPrice()
+ {
+ return $this->container['stop_price'];
+ }
+
+ /**
+ * Sets stop_price
+ *
+ * @param float|null $stop_price The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
+ *
+ * @return self
+ */
+ public function setStopPrice($stop_price)
+ {
+
+ if (is_null($stop_price)) {
+ throw new \InvalidArgumentException('non-nullable stop_price cannot be null');
+ }
+
+ $this->container['stop_price'] = $stop_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets post_only
+ *
+ * @return bool|null
+ */
+ public function getPostOnly()
+ {
+ return $this->container['post_only'];
+ }
+
+ /**
+ * Sets post_only
+ *
+ * @param bool|null $post_only Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
+ *
+ * @return self
+ */
+ public function setPostOnly($post_only)
+ {
+
+ if (is_null($post_only)) {
+ throw new \InvalidArgumentException('non-nullable post_only cannot be null');
+ }
+
+ $this->container['post_only'] = $post_only;
+
+ return $this;
+ }
+
+ /**
+ * Gets expiration_date
+ *
+ * @return \DateTime|null
+ */
+ public function getExpirationDate()
+ {
+ return $this->container['expiration_date'];
+ }
+
+ /**
+ * Sets expiration_date
+ *
+ * @param \DateTime|null $expiration_date The expiration date of the order. Required if the time_in_force is GTD.
+ *
+ * @return self
+ */
+ public function setExpirationDate($expiration_date)
+ {
+
+ if (is_null($expiration_date)) {
+ throw new \InvalidArgumentException('non-nullable expiration_date cannot be null');
+ }
+
+ $this->container['expiration_date'] = $expiration_date;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/CryptoOrderPreview.php b/lib/Model/CryptoOrderPreview.php
new file mode 100644
index 0000000..5f1163c
--- /dev/null
+++ b/lib/Model/CryptoOrderPreview.php
@@ -0,0 +1,405 @@
+
+ */
+class CryptoOrderPreview implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'CryptoOrderPreview';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'estimated_fee' => '\SnapTrade\Model\CryptoOrderPreviewEstimatedFee'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'estimated_fee' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'estimated_fee' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'estimated_fee' => 'estimated_fee'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'estimated_fee' => 'setEstimatedFee'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'estimated_fee' => 'getEstimatedFee'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('estimated_fee', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets estimated_fee
+ *
+ * @return \SnapTrade\Model\CryptoOrderPreviewEstimatedFee|null
+ */
+ public function getEstimatedFee()
+ {
+ return $this->container['estimated_fee'];
+ }
+
+ /**
+ * Sets estimated_fee
+ *
+ * @param \SnapTrade\Model\CryptoOrderPreviewEstimatedFee|null $estimated_fee estimated_fee
+ *
+ * @return self
+ */
+ public function setEstimatedFee($estimated_fee)
+ {
+
+ if (is_null($estimated_fee)) {
+ throw new \InvalidArgumentException('non-nullable estimated_fee cannot be null');
+ }
+
+ $this->container['estimated_fee'] = $estimated_fee;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/CryptoOrderPreviewEstimatedFee.php b/lib/Model/CryptoOrderPreviewEstimatedFee.php
new file mode 100644
index 0000000..cc6da26
--- /dev/null
+++ b/lib/Model/CryptoOrderPreviewEstimatedFee.php
@@ -0,0 +1,447 @@
+
+ */
+class CryptoOrderPreviewEstimatedFee implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'CryptoOrderPreview_estimated_fee';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'currency' => 'string',
+ 'amount' => 'float'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'currency' => null,
+ 'amount' => 'decimal'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'currency' => false,
+ 'amount' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'currency' => 'currency',
+ 'amount' => 'amount'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'currency' => 'setCurrency',
+ 'amount' => 'setAmount'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'currency' => 'getCurrency',
+ 'amount' => 'getAmount'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('currency', $data ?? [], null);
+ $this->setIfExists('amount', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['currency'] === null) {
+ $invalidProperties[] = "'currency' can't be null";
+ }
+ if ($this->container['amount'] === null) {
+ $invalidProperties[] = "'amount' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets currency
+ *
+ * @return string
+ */
+ public function getCurrency()
+ {
+ return $this->container['currency'];
+ }
+
+ /**
+ * Sets currency
+ *
+ * @param string $currency Symbol to identify a cryptocurrency or fiat currency on a crypto exchange. Fiat currencies symbols are ISO-4217 codes.
+ *
+ * @return self
+ */
+ public function setCurrency($currency)
+ {
+
+ if (is_null($currency)) {
+ throw new \InvalidArgumentException('non-nullable currency cannot be null');
+ }
+
+ $this->container['currency'] = $currency;
+
+ return $this;
+ }
+
+ /**
+ * Gets amount
+ *
+ * @return float
+ */
+ public function getAmount()
+ {
+ return $this->container['amount'];
+ }
+
+ /**
+ * Sets amount
+ *
+ * @param float $amount amount
+ *
+ * @return self
+ */
+ public function setAmount($amount)
+ {
+
+ if (is_null($amount)) {
+ throw new \InvalidArgumentException('non-nullable amount cannot be null');
+ }
+
+ $this->container['amount'] = $amount;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/CryptoTradingInstrument.php b/lib/Model/CryptoTradingInstrument.php
new file mode 100644
index 0000000..6d00bb9
--- /dev/null
+++ b/lib/Model/CryptoTradingInstrument.php
@@ -0,0 +1,480 @@
+
+ */
+class CryptoTradingInstrument implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'CryptoTradingInstrument';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'symbol' => 'string',
+ 'type' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'symbol' => null,
+ 'type' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'symbol' => false,
+ 'type' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'symbol' => 'symbol',
+ 'type' => 'type'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'symbol' => 'setSymbol',
+ 'type' => 'setType'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'symbol' => 'getSymbol',
+ 'type' => 'getType'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const TYPE_CRYPTOCURRENCY = 'CRYPTOCURRENCY';
+ public const TYPE_CRYPTOCURRENCY_PAIR = 'CRYPTOCURRENCY_PAIR';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getTypeAllowableValues()
+ {
+ return [
+ self::TYPE_CRYPTOCURRENCY,
+ self::TYPE_CRYPTOCURRENCY_PAIR,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['symbol'] === null) {
+ $invalidProperties[] = "'symbol' can't be null";
+ }
+ if ($this->container['type'] === null) {
+ $invalidProperties[] = "'type' can't be null";
+ }
+ $allowedValues = $this->getTypeAllowableValues();
+ if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'type', must be one of '%s'",
+ $this->container['type'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets symbol
+ *
+ * @return string
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string $symbol The instrument's trading ticker symbol
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets type
+ *
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->container['type'];
+ }
+
+ /**
+ * Sets type
+ *
+ * @param string $type The instrument's type
+ *
+ * @return self
+ */
+ public function setType($type)
+ {
+ $allowedValues = $this->getTypeAllowableValues();
+ if (!in_array($type, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'type', must be one of '%s'",
+ $type,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+
+ if (is_null($type)) {
+ throw new \InvalidArgumentException('non-nullable type cannot be null');
+ }
+
+ $this->container['type'] = $type;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/CryptocurrencyPair.php b/lib/Model/CryptocurrencyPair.php
new file mode 100644
index 0000000..7e8d773
--- /dev/null
+++ b/lib/Model/CryptocurrencyPair.php
@@ -0,0 +1,526 @@
+
+ */
+class CryptocurrencyPair implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'CryptocurrencyPair';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'symbol' => 'string',
+ 'base' => 'string',
+ 'quote' => 'string',
+ 'increment' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'symbol' => null,
+ 'base' => null,
+ 'quote' => null,
+ 'increment' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'symbol' => false,
+ 'base' => false,
+ 'quote' => false,
+ 'increment' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'symbol' => 'symbol',
+ 'base' => 'base',
+ 'quote' => 'quote',
+ 'increment' => 'increment'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'symbol' => 'setSymbol',
+ 'base' => 'setBase',
+ 'quote' => 'setQuote',
+ 'increment' => 'setIncrement'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'symbol' => 'getSymbol',
+ 'base' => 'getBase',
+ 'quote' => 'getQuote',
+ 'increment' => 'getIncrement'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('base', $data ?? [], null);
+ $this->setIfExists('quote', $data ?? [], null);
+ $this->setIfExists('increment', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['base'] === null) {
+ $invalidProperties[] = "'base' can't be null";
+ }
+ if ($this->container['quote'] === null) {
+ $invalidProperties[] = "'quote' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets symbol
+ *
+ * @return string|null
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string|null $symbol Cryptocurrency pair instrument symbol
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets base
+ *
+ * @return string
+ */
+ public function getBase()
+ {
+ return $this->container['base'];
+ }
+
+ /**
+ * Sets base
+ *
+ * @param string $base The base currency of a pair (e.g., \"BTC\" in BTC/USD). Either fiat or cryptocurrency symbol, for fiat use ISO-4217 codes.
+ *
+ * @return self
+ */
+ public function setBase($base)
+ {
+
+ if (is_null($base)) {
+ throw new \InvalidArgumentException('non-nullable base cannot be null');
+ }
+
+ $this->container['base'] = $base;
+
+ return $this;
+ }
+
+ /**
+ * Gets quote
+ *
+ * @return string
+ */
+ public function getQuote()
+ {
+ return $this->container['quote'];
+ }
+
+ /**
+ * Sets quote
+ *
+ * @param string $quote The quote currency of a pair (e.g., \"USD\" in BTC/USD). Either fiat or cryptocurrency symbol, for fiat use ISO-4217 codes.
+ *
+ * @return self
+ */
+ public function setQuote($quote)
+ {
+
+ if (is_null($quote)) {
+ throw new \InvalidArgumentException('non-nullable quote cannot be null');
+ }
+
+ $this->container['quote'] = $quote;
+
+ return $this;
+ }
+
+ /**
+ * Gets increment
+ *
+ * @return string|null
+ */
+ public function getIncrement()
+ {
+ return $this->container['increment'];
+ }
+
+ /**
+ * Sets increment
+ *
+ * @param string|null $increment increment
+ *
+ * @return self
+ */
+ public function setIncrement($increment)
+ {
+
+ if (is_null($increment)) {
+ array_push($this->openAPINullablesSetToNull, 'increment');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('increment', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['increment'] = $increment;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/CryptocurrencyPairQuote.php b/lib/Model/CryptocurrencyPairQuote.php
new file mode 100644
index 0000000..fd6c5f3
--- /dev/null
+++ b/lib/Model/CryptocurrencyPairQuote.php
@@ -0,0 +1,518 @@
+
+ */
+class CryptocurrencyPairQuote implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'CryptocurrencyPairQuote';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'bid' => 'float',
+ 'ask' => 'float',
+ 'mid' => 'float',
+ 'timestamp' => '\DateTime'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'bid' => 'decimal',
+ 'ask' => 'decimal',
+ 'mid' => 'decimal',
+ 'timestamp' => 'date-time'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'bid' => false,
+ 'ask' => false,
+ 'mid' => false,
+ 'timestamp' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'bid' => 'bid',
+ 'ask' => 'ask',
+ 'mid' => 'mid',
+ 'timestamp' => 'timestamp'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'bid' => 'setBid',
+ 'ask' => 'setAsk',
+ 'mid' => 'setMid',
+ 'timestamp' => 'setTimestamp'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'bid' => 'getBid',
+ 'ask' => 'getAsk',
+ 'mid' => 'getMid',
+ 'timestamp' => 'getTimestamp'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('bid', $data ?? [], null);
+ $this->setIfExists('ask', $data ?? [], null);
+ $this->setIfExists('mid', $data ?? [], null);
+ $this->setIfExists('timestamp', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['bid'] === null) {
+ $invalidProperties[] = "'bid' can't be null";
+ }
+ if ($this->container['ask'] === null) {
+ $invalidProperties[] = "'ask' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets bid
+ *
+ * @return float
+ */
+ public function getBid()
+ {
+ return $this->container['bid'];
+ }
+
+ /**
+ * Sets bid
+ *
+ * @param float $bid The highest price a buyer is willing to pay.
+ *
+ * @return self
+ */
+ public function setBid($bid)
+ {
+
+ if (is_null($bid)) {
+ throw new \InvalidArgumentException('non-nullable bid cannot be null');
+ }
+
+ $this->container['bid'] = $bid;
+
+ return $this;
+ }
+
+ /**
+ * Gets ask
+ *
+ * @return float
+ */
+ public function getAsk()
+ {
+ return $this->container['ask'];
+ }
+
+ /**
+ * Sets ask
+ *
+ * @param float $ask The lowest price a seller is willing to accept.
+ *
+ * @return self
+ */
+ public function setAsk($ask)
+ {
+
+ if (is_null($ask)) {
+ throw new \InvalidArgumentException('non-nullable ask cannot be null');
+ }
+
+ $this->container['ask'] = $ask;
+
+ return $this;
+ }
+
+ /**
+ * Gets mid
+ *
+ * @return float|null
+ */
+ public function getMid()
+ {
+ return $this->container['mid'];
+ }
+
+ /**
+ * Sets mid
+ *
+ * @param float|null $mid The market mid price.
+ *
+ * @return self
+ */
+ public function setMid($mid)
+ {
+
+ if (is_null($mid)) {
+ throw new \InvalidArgumentException('non-nullable mid cannot be null');
+ }
+
+ $this->container['mid'] = $mid;
+
+ return $this;
+ }
+
+ /**
+ * Gets timestamp
+ *
+ * @return \DateTime|null
+ */
+ public function getTimestamp()
+ {
+ return $this->container['timestamp'];
+ }
+
+ /**
+ * Sets timestamp
+ *
+ * @param \DateTime|null $timestamp The timestamp of the quote.
+ *
+ * @return self
+ */
+ public function setTimestamp($timestamp)
+ {
+
+ if (is_null($timestamp)) {
+ throw new \InvalidArgumentException('non-nullable timestamp cannot be null');
+ }
+
+ $this->container['timestamp'] = $timestamp;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/DeleteUserResponse.php b/lib/Model/DeleteUserResponse.php
index 4571d1e..7d68eb2 100644
--- a/lib/Model/DeleteUserResponse.php
+++ b/lib/Model/DeleteUserResponse.php
@@ -30,7 +30,6 @@
* DeleteUserResponse Class Doc Comment
*
* @category Class
- * @description Response when delete user is successful
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -52,6 +51,7 @@ class DeleteUserResponse implements ModelInterface, ArrayAccess, \JsonSerializab
*/
protected static $openAPITypes = [
'status' => 'string',
+ 'detail' => 'string',
'user_id' => 'string'
];
@@ -64,6 +64,7 @@ class DeleteUserResponse implements ModelInterface, ArrayAccess, \JsonSerializab
*/
protected static $openAPIFormats = [
'status' => null,
+ 'detail' => null,
'user_id' => null
];
@@ -74,6 +75,7 @@ class DeleteUserResponse implements ModelInterface, ArrayAccess, \JsonSerializab
*/
protected static array $openAPINullables = [
'status' => false,
+ 'detail' => false,
'user_id' => false
];
@@ -164,6 +166,7 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $attributeMap = [
'status' => 'status',
+ 'detail' => 'detail',
'user_id' => 'userId'
];
@@ -174,6 +177,7 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $setters = [
'status' => 'setStatus',
+ 'detail' => 'setDetail',
'user_id' => 'setUserId'
];
@@ -184,6 +188,7 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $getters = [
'status' => 'getStatus',
+ 'detail' => 'getDetail',
'user_id' => 'getUserId'
];
@@ -245,6 +250,7 @@ public function getModelName()
public function __construct(array $data = null)
{
$this->setIfExists('status', $data ?? [], null);
+ $this->setIfExists('detail', $data ?? [], null);
$this->setIfExists('user_id', $data ?? [], null);
}
@@ -303,7 +309,7 @@ public function getStatus()
/**
* Sets status
*
- * @param string|null $status Delete status
+ * @param string|null $status This is always `deleted` when a user is queued for deletion.
*
* @return self
*/
@@ -319,6 +325,35 @@ public function setStatus($status)
return $this;
}
+ /**
+ * Gets detail
+ *
+ * @return string|null
+ */
+ public function getDetail()
+ {
+ return $this->container['detail'];
+ }
+
+ /**
+ * Sets detail
+ *
+ * @param string|null $detail Human friendly message about the deletion status.
+ *
+ * @return self
+ */
+ public function setDetail($detail)
+ {
+
+ if (is_null($detail)) {
+ throw new \InvalidArgumentException('non-nullable detail cannot be null');
+ }
+
+ $this->container['detail'] = $detail;
+
+ return $this;
+ }
+
/**
* Gets user_id
*
diff --git a/lib/Model/HoldingsStatus.php b/lib/Model/HoldingsStatus.php
index 9780479..eb2e905 100644
--- a/lib/Model/HoldingsStatus.php
+++ b/lib/Model/HoldingsStatus.php
@@ -74,7 +74,7 @@ class HoldingsStatus implements ModelInterface, ArrayAccess, \JsonSerializable
*/
protected static array $openAPINullables = [
'initial_sync_completed' => false,
- 'last_successful_sync' => false
+ 'last_successful_sync' => true
];
/**
@@ -340,7 +340,14 @@ public function setLastSuccessfulSync($last_successful_sync)
{
if (is_null($last_successful_sync)) {
- throw new \InvalidArgumentException('non-nullable last_successful_sync cannot be null');
+ array_push($this->openAPINullablesSetToNull, 'last_successful_sync');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('last_successful_sync', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
$this->container['last_successful_sync'] = $last_successful_sync;
diff --git a/lib/Model/LoginRedirectURI.php b/lib/Model/LoginRedirectURI.php
index 027d13f..ffc286d 100644
--- a/lib/Model/LoginRedirectURI.php
+++ b/lib/Model/LoginRedirectURI.php
@@ -51,7 +51,7 @@ class LoginRedirectURI implements ModelInterface, ArrayAccess, \JsonSerializable
* @var string[]
*/
protected static $openAPITypes = [
- 'redirect_uri' => 'mixed',
+ 'redirect_uri' => 'string',
'session_id' => 'string'
];
@@ -73,7 +73,7 @@ class LoginRedirectURI implements ModelInterface, ArrayAccess, \JsonSerializable
* @var boolean[]
*/
protected static array $openAPINullables = [
- 'redirect_uri' => true,
+ 'redirect_uri' => false,
'session_id' => false
];
@@ -293,7 +293,7 @@ public function valid()
/**
* Gets redirect_uri
*
- * @return mixed|null
+ * @return string|null
*/
public function getRedirectUri()
{
@@ -303,7 +303,7 @@ public function getRedirectUri()
/**
* Sets redirect_uri
*
- * @param mixed|null $redirect_uri redirect_uri
+ * @param string|null $redirect_uri Connection Portal link to redirect user to connect a brokerage account.
*
* @return self
*/
@@ -311,14 +311,7 @@ public function setRedirectUri($redirect_uri)
{
if (is_null($redirect_uri)) {
- array_push($this->openAPINullablesSetToNull, 'redirect_uri');
- } else {
- $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('redirect_uri', $nullablesSetToNull);
- if ($index !== FALSE) {
- unset($nullablesSetToNull[$index]);
- $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
- }
+ throw new \InvalidArgumentException('non-nullable redirect_uri cannot be null');
}
$this->container['redirect_uri'] = $redirect_uri;
@@ -339,7 +332,7 @@ public function getSessionId()
/**
* Sets session_id
*
- * @param string|null $session_id session_id
+ * @param string|null $session_id ID to identify the connection portal session.
*
* @return self
*/
diff --git a/lib/Model/ManualTrade.php b/lib/Model/ManualTrade.php
index 5beeace..f39acaa 100644
--- a/lib/Model/ManualTrade.php
+++ b/lib/Model/ManualTrade.php
@@ -30,7 +30,7 @@
* ManualTrade Class Doc Comment
*
* @category Class
- * @description A manual trade object
+ * @description Contains the details of a submitted order.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -54,7 +54,7 @@ class ManualTrade implements ModelInterface, ArrayAccess, \JsonSerializable
'id' => 'string',
'account' => 'string',
'order_type' => '\SnapTrade\Model\OrderTypeStrict',
- 'time_in_force' => 'string',
+ 'time_in_force' => '\SnapTrade\Model\TimeInForceStrict',
'symbol' => '\SnapTrade\Model\ManualTradeSymbol',
'action' => '\SnapTrade\Model\ActionStrict',
'units' => 'float',
@@ -70,7 +70,7 @@ class ManualTrade implements ModelInterface, ArrayAccess, \JsonSerializable
*/
protected static $openAPIFormats = [
'id' => 'uuid',
- 'account' => null,
+ 'account' => 'uuid',
'order_type' => null,
'time_in_force' => null,
'symbol' => null,
@@ -345,7 +345,7 @@ public function getId()
/**
* Sets id
*
- * @param string|null $id id
+ * @param string|null $id Unique identifier for the submitted order through SnapTrade.
*
* @return self
*/
@@ -374,7 +374,7 @@ public function getAccount()
/**
* Sets account
*
- * @param string|null $account account
+ * @param string|null $account Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
*
* @return self
*/
@@ -422,7 +422,7 @@ public function setOrderType($order_type)
/**
* Gets time_in_force
*
- * @return string|null
+ * @return \SnapTrade\Model\TimeInForceStrict|null
*/
public function getTimeInForce()
{
@@ -432,7 +432,7 @@ public function getTimeInForce()
/**
* Sets time_in_force
*
- * @param string|null $time_in_force Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled * GTD - Good Til Date
+ * @param \SnapTrade\Model\TimeInForceStrict|null $time_in_force time_in_force
*
* @return self
*/
diff --git a/lib/Model/ManualTradeAndImpact.php b/lib/Model/ManualTradeAndImpact.php
index 5fb47b2..0639899 100644
--- a/lib/Model/ManualTradeAndImpact.php
+++ b/lib/Model/ManualTradeAndImpact.php
@@ -30,7 +30,6 @@
* ManualTradeAndImpact Class Doc Comment
*
* @category Class
- * @description Manual Trade and Impact object
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -52,7 +51,7 @@ class ManualTradeAndImpact implements ModelInterface, ArrayAccess, \JsonSerializ
*/
protected static $openAPITypes = [
'trade' => '\SnapTrade\Model\ManualTrade',
- 'trade_impacts' => '\SnapTrade\Model\ManualTrade[]',
+ 'trade_impacts' => '\SnapTrade\Model\ManualTradeImpact[]',
'combined_remaining_balance' => '\SnapTrade\Model\ManualTradeBalance'
];
@@ -329,7 +328,7 @@ public function setTrade($trade)
/**
* Gets trade_impacts
*
- * @return \SnapTrade\Model\ManualTrade[]|null
+ * @return \SnapTrade\Model\ManualTradeImpact[]|null
*/
public function getTradeImpacts()
{
@@ -339,7 +338,7 @@ public function getTradeImpacts()
/**
* Sets trade_impacts
*
- * @param \SnapTrade\Model\ManualTrade[]|null $trade_impacts trade_impacts
+ * @param \SnapTrade\Model\ManualTradeImpact[]|null $trade_impacts List of impacts of the trade on the account. The list always contains one value at the moment.
*
* @return self
*/
diff --git a/lib/Model/ManualTradeBalance.php b/lib/Model/ManualTradeBalance.php
index 7ddc936..8b64369 100644
--- a/lib/Model/ManualTradeBalance.php
+++ b/lib/Model/ManualTradeBalance.php
@@ -30,7 +30,7 @@
* ManualTradeBalance Class Doc Comment
*
* @category Class
- * @description Balance
+ * @description Estimated remaining balance of the account after the trade is executed.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -51,7 +51,7 @@ class ManualTradeBalance implements ModelInterface, ArrayAccess, \JsonSerializab
* @var string[]
*/
protected static $openAPITypes = [
- 'account' => '\SnapTrade\Model\Account',
+ 'account' => '\SnapTrade\Model\AccountSimple',
'currency' => '\SnapTrade\Model\Currency',
'cash' => 'float'
];
@@ -300,7 +300,7 @@ public function valid()
/**
* Gets account
*
- * @return \SnapTrade\Model\Account|null
+ * @return \SnapTrade\Model\AccountSimple|null
*/
public function getAccount()
{
@@ -310,7 +310,7 @@ public function getAccount()
/**
* Sets account
*
- * @param \SnapTrade\Model\Account|null $account account
+ * @param \SnapTrade\Model\AccountSimple|null $account account
*
* @return self
*/
@@ -368,7 +368,7 @@ public function getCash()
/**
* Sets cash
*
- * @param float|null $cash Cash
+ * @param float|null $cash Estimated amount of cash remaining in the account after the trade. At the moment this is the same as `remaining_cash` under `trade_impacts`.
*
* @return self
*/
diff --git a/lib/Model/ManualTradeForm.php b/lib/Model/ManualTradeForm.php
index 9c9048c..7df6daf 100644
--- a/lib/Model/ManualTradeForm.php
+++ b/lib/Model/ManualTradeForm.php
@@ -30,7 +30,7 @@
* ManualTradeForm Class Doc Comment
*
* @category Class
- * @description Manual Trade Form
+ * @description Inputs for placing an order with the brokerage.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -53,12 +53,12 @@ class ManualTradeForm implements ModelInterface, ArrayAccess, \JsonSerializable
protected static $openAPITypes = [
'account_id' => 'string',
'action' => '\SnapTrade\Model\ActionStrict',
+ 'universal_symbol_id' => 'string',
'order_type' => '\SnapTrade\Model\OrderTypeStrict',
+ 'time_in_force' => '\SnapTrade\Model\TimeInForceStrict',
'price' => 'float',
'stop' => 'float',
- 'time_in_force' => '\SnapTrade\Model\TimeInForceStrict',
'units' => 'float',
- 'universal_symbol_id' => 'string',
'notional_value' => '\SnapTrade\Model\ManualTradeFormNotionalValue'
];
@@ -72,12 +72,12 @@ class ManualTradeForm implements ModelInterface, ArrayAccess, \JsonSerializable
protected static $openAPIFormats = [
'account_id' => 'uuid',
'action' => null,
+ 'universal_symbol_id' => 'uuid',
'order_type' => null,
+ 'time_in_force' => null,
'price' => null,
'stop' => null,
- 'time_in_force' => null,
'units' => null,
- 'universal_symbol_id' => 'uuid',
'notional_value' => null
];
@@ -89,12 +89,12 @@ class ManualTradeForm implements ModelInterface, ArrayAccess, \JsonSerializable
protected static array $openAPINullables = [
'account_id' => false,
'action' => false,
+ 'universal_symbol_id' => false,
'order_type' => false,
+ 'time_in_force' => false,
'price' => true,
'stop' => true,
- 'time_in_force' => false,
'units' => true,
- 'universal_symbol_id' => false,
'notional_value' => true
];
@@ -186,12 +186,12 @@ public function isNullableSetToNull(string $property): bool
protected static $attributeMap = [
'account_id' => 'account_id',
'action' => 'action',
+ 'universal_symbol_id' => 'universal_symbol_id',
'order_type' => 'order_type',
+ 'time_in_force' => 'time_in_force',
'price' => 'price',
'stop' => 'stop',
- 'time_in_force' => 'time_in_force',
'units' => 'units',
- 'universal_symbol_id' => 'universal_symbol_id',
'notional_value' => 'notional_value'
];
@@ -203,12 +203,12 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'account_id' => 'setAccountId',
'action' => 'setAction',
+ 'universal_symbol_id' => 'setUniversalSymbolId',
'order_type' => 'setOrderType',
+ 'time_in_force' => 'setTimeInForce',
'price' => 'setPrice',
'stop' => 'setStop',
- 'time_in_force' => 'setTimeInForce',
'units' => 'setUnits',
- 'universal_symbol_id' => 'setUniversalSymbolId',
'notional_value' => 'setNotionalValue'
];
@@ -220,12 +220,12 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'account_id' => 'getAccountId',
'action' => 'getAction',
+ 'universal_symbol_id' => 'getUniversalSymbolId',
'order_type' => 'getOrderType',
+ 'time_in_force' => 'getTimeInForce',
'price' => 'getPrice',
'stop' => 'getStop',
- 'time_in_force' => 'getTimeInForce',
'units' => 'getUnits',
- 'universal_symbol_id' => 'getUniversalSymbolId',
'notional_value' => 'getNotionalValue'
];
@@ -288,12 +288,12 @@ public function __construct(array $data = null)
{
$this->setIfExists('account_id', $data ?? [], null);
$this->setIfExists('action', $data ?? [], null);
+ $this->setIfExists('universal_symbol_id', $data ?? [], null);
$this->setIfExists('order_type', $data ?? [], null);
+ $this->setIfExists('time_in_force', $data ?? [], null);
$this->setIfExists('price', $data ?? [], null);
$this->setIfExists('stop', $data ?? [], null);
- $this->setIfExists('time_in_force', $data ?? [], null);
$this->setIfExists('units', $data ?? [], null);
- $this->setIfExists('universal_symbol_id', $data ?? [], null);
$this->setIfExists('notional_value', $data ?? [], null);
}
@@ -324,6 +324,21 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if ($this->container['account_id'] === null) {
+ $invalidProperties[] = "'account_id' can't be null";
+ }
+ if ($this->container['action'] === null) {
+ $invalidProperties[] = "'action' can't be null";
+ }
+ if ($this->container['universal_symbol_id'] === null) {
+ $invalidProperties[] = "'universal_symbol_id' can't be null";
+ }
+ if ($this->container['order_type'] === null) {
+ $invalidProperties[] = "'order_type' can't be null";
+ }
+ if ($this->container['time_in_force'] === null) {
+ $invalidProperties[] = "'time_in_force' can't be null";
+ }
return $invalidProperties;
}
@@ -342,7 +357,7 @@ public function valid()
/**
* Gets account_id
*
- * @return string|null
+ * @return string
*/
public function getAccountId()
{
@@ -352,7 +367,7 @@ public function getAccountId()
/**
* Sets account_id
*
- * @param string|null $account_id account_id
+ * @param string $account_id Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
*
* @return self
*/
@@ -371,7 +386,7 @@ public function setAccountId($account_id)
/**
* Gets action
*
- * @return \SnapTrade\Model\ActionStrict|null
+ * @return \SnapTrade\Model\ActionStrict
*/
public function getAction()
{
@@ -381,7 +396,7 @@ public function getAction()
/**
* Sets action
*
- * @param \SnapTrade\Model\ActionStrict|null $action action
+ * @param \SnapTrade\Model\ActionStrict $action action
*
* @return self
*/
@@ -397,10 +412,39 @@ public function setAction($action)
return $this;
}
+ /**
+ * Gets universal_symbol_id
+ *
+ * @return string
+ */
+ public function getUniversalSymbolId()
+ {
+ return $this->container['universal_symbol_id'];
+ }
+
+ /**
+ * Sets universal_symbol_id
+ *
+ * @param string $universal_symbol_id Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
+ *
+ * @return self
+ */
+ public function setUniversalSymbolId($universal_symbol_id)
+ {
+
+ if (is_null($universal_symbol_id)) {
+ throw new \InvalidArgumentException('non-nullable universal_symbol_id cannot be null');
+ }
+
+ $this->container['universal_symbol_id'] = $universal_symbol_id;
+
+ return $this;
+ }
+
/**
* Gets order_type
*
- * @return \SnapTrade\Model\OrderTypeStrict|null
+ * @return \SnapTrade\Model\OrderTypeStrict
*/
public function getOrderType()
{
@@ -410,7 +454,7 @@ public function getOrderType()
/**
* Sets order_type
*
- * @param \SnapTrade\Model\OrderTypeStrict|null $order_type order_type
+ * @param \SnapTrade\Model\OrderTypeStrict $order_type order_type
*
* @return self
*/
@@ -426,6 +470,35 @@ public function setOrderType($order_type)
return $this;
}
+ /**
+ * Gets time_in_force
+ *
+ * @return \SnapTrade\Model\TimeInForceStrict
+ */
+ public function getTimeInForce()
+ {
+ return $this->container['time_in_force'];
+ }
+
+ /**
+ * Sets time_in_force
+ *
+ * @param \SnapTrade\Model\TimeInForceStrict $time_in_force time_in_force
+ *
+ * @return self
+ */
+ public function setTimeInForce($time_in_force)
+ {
+
+ if (is_null($time_in_force)) {
+ throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ }
+
+ $this->container['time_in_force'] = $time_in_force;
+
+ return $this;
+ }
+
/**
* Gets price
*
@@ -439,7 +512,7 @@ public function getPrice()
/**
* Sets price
*
- * @param float|null $price Trade Price if limit or stop limit order
+ * @param float|null $price The limit price for `Limit` and `StopLimit` orders.
*
* @return self
*/
@@ -475,7 +548,7 @@ public function getStop()
/**
* Sets stop
*
- * @param float|null $stop Stop Price. If stop loss or stop limit order, the price to trigger the stop
+ * @param float|null $stop The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
*
* @return self
*/
@@ -498,35 +571,6 @@ public function setStop($stop)
return $this;
}
- /**
- * Gets time_in_force
- *
- * @return \SnapTrade\Model\TimeInForceStrict|null
- */
- public function getTimeInForce()
- {
- return $this->container['time_in_force'];
- }
-
- /**
- * Sets time_in_force
- *
- * @param \SnapTrade\Model\TimeInForceStrict|null $time_in_force time_in_force
- *
- * @return self
- */
- public function setTimeInForce($time_in_force)
- {
-
- if (is_null($time_in_force)) {
- throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
- }
-
- $this->container['time_in_force'] = $time_in_force;
-
- return $this;
- }
-
/**
* Gets units
*
@@ -563,35 +607,6 @@ public function setUnits($units)
return $this;
}
- /**
- * Gets universal_symbol_id
- *
- * @return string|null
- */
- public function getUniversalSymbolId()
- {
- return $this->container['universal_symbol_id'];
- }
-
- /**
- * Sets universal_symbol_id
- *
- * @param string|null $universal_symbol_id universal_symbol_id
- *
- * @return self
- */
- public function setUniversalSymbolId($universal_symbol_id)
- {
-
- if (is_null($universal_symbol_id)) {
- throw new \InvalidArgumentException('non-nullable universal_symbol_id cannot be null');
- }
-
- $this->container['universal_symbol_id'] = $universal_symbol_id;
-
- return $this;
- }
-
/**
* Gets notional_value
*
diff --git a/lib/Model/ManualTradeFormBracket.php b/lib/Model/ManualTradeFormBracket.php
new file mode 100644
index 0000000..8b38b89
--- /dev/null
+++ b/lib/Model/ManualTradeFormBracket.php
@@ -0,0 +1,725 @@
+
+ */
+class ManualTradeFormBracket implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'ManualTradeFormBracket';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'action' => '\SnapTrade\Model\ActionStrictWithOptions',
+ 'instrument' => '\SnapTrade\Model\TradingInstrument',
+ 'order_type' => '\SnapTrade\Model\OrderTypeStrict',
+ 'time_in_force' => '\SnapTrade\Model\TimeInForceStrict',
+ 'price' => 'float',
+ 'stop' => 'float',
+ 'units' => 'float',
+ 'stop_loss' => '\SnapTrade\Model\StopLoss',
+ 'take_profit' => '\SnapTrade\Model\TakeProfit'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'action' => null,
+ 'instrument' => null,
+ 'order_type' => null,
+ 'time_in_force' => null,
+ 'price' => null,
+ 'stop' => null,
+ 'units' => null,
+ 'stop_loss' => null,
+ 'take_profit' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'action' => false,
+ 'instrument' => false,
+ 'order_type' => false,
+ 'time_in_force' => false,
+ 'price' => true,
+ 'stop' => true,
+ 'units' => false,
+ 'stop_loss' => false,
+ 'take_profit' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'action' => 'action',
+ 'instrument' => 'instrument',
+ 'order_type' => 'order_type',
+ 'time_in_force' => 'time_in_force',
+ 'price' => 'price',
+ 'stop' => 'stop',
+ 'units' => 'units',
+ 'stop_loss' => 'stop_loss',
+ 'take_profit' => 'take_profit'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'action' => 'setAction',
+ 'instrument' => 'setInstrument',
+ 'order_type' => 'setOrderType',
+ 'time_in_force' => 'setTimeInForce',
+ 'price' => 'setPrice',
+ 'stop' => 'setStop',
+ 'units' => 'setUnits',
+ 'stop_loss' => 'setStopLoss',
+ 'take_profit' => 'setTakeProfit'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'action' => 'getAction',
+ 'instrument' => 'getInstrument',
+ 'order_type' => 'getOrderType',
+ 'time_in_force' => 'getTimeInForce',
+ 'price' => 'getPrice',
+ 'stop' => 'getStop',
+ 'units' => 'getUnits',
+ 'stop_loss' => 'getStopLoss',
+ 'take_profit' => 'getTakeProfit'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('action', $data ?? [], null);
+ $this->setIfExists('instrument', $data ?? [], null);
+ $this->setIfExists('order_type', $data ?? [], null);
+ $this->setIfExists('time_in_force', $data ?? [], null);
+ $this->setIfExists('price', $data ?? [], null);
+ $this->setIfExists('stop', $data ?? [], null);
+ $this->setIfExists('units', $data ?? [], null);
+ $this->setIfExists('stop_loss', $data ?? [], null);
+ $this->setIfExists('take_profit', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['action'] === null) {
+ $invalidProperties[] = "'action' can't be null";
+ }
+ if ($this->container['instrument'] === null) {
+ $invalidProperties[] = "'instrument' can't be null";
+ }
+ if ($this->container['order_type'] === null) {
+ $invalidProperties[] = "'order_type' can't be null";
+ }
+ if ($this->container['time_in_force'] === null) {
+ $invalidProperties[] = "'time_in_force' can't be null";
+ }
+ if ($this->container['stop_loss'] === null) {
+ $invalidProperties[] = "'stop_loss' can't be null";
+ }
+ if ($this->container['take_profit'] === null) {
+ $invalidProperties[] = "'take_profit' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets action
+ *
+ * @return \SnapTrade\Model\ActionStrictWithOptions
+ */
+ public function getAction()
+ {
+ return $this->container['action'];
+ }
+
+ /**
+ * Sets action
+ *
+ * @param \SnapTrade\Model\ActionStrictWithOptions $action action
+ *
+ * @return self
+ */
+ public function setAction($action)
+ {
+
+ if (is_null($action)) {
+ throw new \InvalidArgumentException('non-nullable action cannot be null');
+ }
+
+ $this->container['action'] = $action;
+
+ return $this;
+ }
+
+ /**
+ * Gets instrument
+ *
+ * @return \SnapTrade\Model\TradingInstrument
+ */
+ public function getInstrument()
+ {
+ return $this->container['instrument'];
+ }
+
+ /**
+ * Sets instrument
+ *
+ * @param \SnapTrade\Model\TradingInstrument $instrument instrument
+ *
+ * @return self
+ */
+ public function setInstrument($instrument)
+ {
+
+ if (is_null($instrument)) {
+ throw new \InvalidArgumentException('non-nullable instrument cannot be null');
+ }
+
+ $this->container['instrument'] = $instrument;
+
+ return $this;
+ }
+
+ /**
+ * Gets order_type
+ *
+ * @return \SnapTrade\Model\OrderTypeStrict
+ */
+ public function getOrderType()
+ {
+ return $this->container['order_type'];
+ }
+
+ /**
+ * Sets order_type
+ *
+ * @param \SnapTrade\Model\OrderTypeStrict $order_type order_type
+ *
+ * @return self
+ */
+ public function setOrderType($order_type)
+ {
+
+ if (is_null($order_type)) {
+ throw new \InvalidArgumentException('non-nullable order_type cannot be null');
+ }
+
+ $this->container['order_type'] = $order_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_in_force
+ *
+ * @return \SnapTrade\Model\TimeInForceStrict
+ */
+ public function getTimeInForce()
+ {
+ return $this->container['time_in_force'];
+ }
+
+ /**
+ * Sets time_in_force
+ *
+ * @param \SnapTrade\Model\TimeInForceStrict $time_in_force time_in_force
+ *
+ * @return self
+ */
+ public function setTimeInForce($time_in_force)
+ {
+
+ if (is_null($time_in_force)) {
+ throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ }
+
+ $this->container['time_in_force'] = $time_in_force;
+
+ return $this;
+ }
+
+ /**
+ * Gets price
+ *
+ * @return float|null
+ */
+ public function getPrice()
+ {
+ return $this->container['price'];
+ }
+
+ /**
+ * Sets price
+ *
+ * @param float|null $price The limit price for `Limit` and `StopLimit` orders.
+ *
+ * @return self
+ */
+ public function setPrice($price)
+ {
+
+ if (is_null($price)) {
+ array_push($this->openAPINullablesSetToNull, 'price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['price'] = $price;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop
+ *
+ * @return float|null
+ */
+ public function getStop()
+ {
+ return $this->container['stop'];
+ }
+
+ /**
+ * Sets stop
+ *
+ * @param float|null $stop The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
+ *
+ * @return self
+ */
+ public function setStop($stop)
+ {
+
+ if (is_null($stop)) {
+ array_push($this->openAPINullablesSetToNull, 'stop');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('stop', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['stop'] = $stop;
+
+ return $this;
+ }
+
+ /**
+ * Gets units
+ *
+ * @return float|null
+ */
+ public function getUnits()
+ {
+ return $this->container['units'];
+ }
+
+ /**
+ * Sets units
+ *
+ * @param float|null $units Number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided.
+ *
+ * @return self
+ */
+ public function setUnits($units)
+ {
+
+ if (is_null($units)) {
+ throw new \InvalidArgumentException('non-nullable units cannot be null');
+ }
+
+ $this->container['units'] = $units;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop_loss
+ *
+ * @return \SnapTrade\Model\StopLoss
+ */
+ public function getStopLoss()
+ {
+ return $this->container['stop_loss'];
+ }
+
+ /**
+ * Sets stop_loss
+ *
+ * @param \SnapTrade\Model\StopLoss $stop_loss stop_loss
+ *
+ * @return self
+ */
+ public function setStopLoss($stop_loss)
+ {
+
+ if (is_null($stop_loss)) {
+ throw new \InvalidArgumentException('non-nullable stop_loss cannot be null');
+ }
+
+ $this->container['stop_loss'] = $stop_loss;
+
+ return $this;
+ }
+
+ /**
+ * Gets take_profit
+ *
+ * @return \SnapTrade\Model\TakeProfit
+ */
+ public function getTakeProfit()
+ {
+ return $this->container['take_profit'];
+ }
+
+ /**
+ * Sets take_profit
+ *
+ * @param \SnapTrade\Model\TakeProfit $take_profit take_profit
+ *
+ * @return self
+ */
+ public function setTakeProfit($take_profit)
+ {
+
+ if (is_null($take_profit)) {
+ throw new \InvalidArgumentException('non-nullable take_profit cannot be null');
+ }
+
+ $this->container['take_profit'] = $take_profit;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/ManualTradeFormWithOptions.php b/lib/Model/ManualTradeFormWithOptions.php
new file mode 100644
index 0000000..05760f4
--- /dev/null
+++ b/lib/Model/ManualTradeFormWithOptions.php
@@ -0,0 +1,819 @@
+
+ */
+class ManualTradeFormWithOptions implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'ManualTradeFormWithOptions';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'account_id' => 'string',
+ 'action' => '\SnapTrade\Model\ActionStrictWithOptions',
+ 'universal_symbol_id' => 'string',
+ 'symbol' => 'string',
+ 'order_type' => '\SnapTrade\Model\OrderTypeStrict',
+ 'time_in_force' => '\SnapTrade\Model\TimeInForceStrict',
+ 'trading_session' => '\SnapTrade\Model\TradingSession',
+ 'price' => 'float',
+ 'stop' => 'float',
+ 'units' => 'float',
+ 'notional_value' => '\SnapTrade\Model\ManualTradeFormNotionalValue'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'account_id' => 'uuid',
+ 'action' => null,
+ 'universal_symbol_id' => null,
+ 'symbol' => null,
+ 'order_type' => null,
+ 'time_in_force' => null,
+ 'trading_session' => null,
+ 'price' => null,
+ 'stop' => null,
+ 'units' => null,
+ 'notional_value' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'account_id' => false,
+ 'action' => false,
+ 'universal_symbol_id' => true,
+ 'symbol' => true,
+ 'order_type' => false,
+ 'time_in_force' => false,
+ 'trading_session' => false,
+ 'price' => true,
+ 'stop' => true,
+ 'units' => true,
+ 'notional_value' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'account_id' => 'account_id',
+ 'action' => 'action',
+ 'universal_symbol_id' => 'universal_symbol_id',
+ 'symbol' => 'symbol',
+ 'order_type' => 'order_type',
+ 'time_in_force' => 'time_in_force',
+ 'trading_session' => 'trading_session',
+ 'price' => 'price',
+ 'stop' => 'stop',
+ 'units' => 'units',
+ 'notional_value' => 'notional_value'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'account_id' => 'setAccountId',
+ 'action' => 'setAction',
+ 'universal_symbol_id' => 'setUniversalSymbolId',
+ 'symbol' => 'setSymbol',
+ 'order_type' => 'setOrderType',
+ 'time_in_force' => 'setTimeInForce',
+ 'trading_session' => 'setTradingSession',
+ 'price' => 'setPrice',
+ 'stop' => 'setStop',
+ 'units' => 'setUnits',
+ 'notional_value' => 'setNotionalValue'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'account_id' => 'getAccountId',
+ 'action' => 'getAction',
+ 'universal_symbol_id' => 'getUniversalSymbolId',
+ 'symbol' => 'getSymbol',
+ 'order_type' => 'getOrderType',
+ 'time_in_force' => 'getTimeInForce',
+ 'trading_session' => 'getTradingSession',
+ 'price' => 'getPrice',
+ 'stop' => 'getStop',
+ 'units' => 'getUnits',
+ 'notional_value' => 'getNotionalValue'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('account_id', $data ?? [], null);
+ $this->setIfExists('action', $data ?? [], null);
+ $this->setIfExists('universal_symbol_id', $data ?? [], null);
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('order_type', $data ?? [], null);
+ $this->setIfExists('time_in_force', $data ?? [], null);
+ $this->setIfExists('trading_session', $data ?? [], null);
+ $this->setIfExists('price', $data ?? [], null);
+ $this->setIfExists('stop', $data ?? [], null);
+ $this->setIfExists('units', $data ?? [], null);
+ $this->setIfExists('notional_value', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['account_id'] === null) {
+ $invalidProperties[] = "'account_id' can't be null";
+ }
+ if ($this->container['action'] === null) {
+ $invalidProperties[] = "'action' can't be null";
+ }
+ if ($this->container['order_type'] === null) {
+ $invalidProperties[] = "'order_type' can't be null";
+ }
+ if ($this->container['time_in_force'] === null) {
+ $invalidProperties[] = "'time_in_force' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets account_id
+ *
+ * @return string
+ */
+ public function getAccountId()
+ {
+ return $this->container['account_id'];
+ }
+
+ /**
+ * Sets account_id
+ *
+ * @param string $account_id Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
+ *
+ * @return self
+ */
+ public function setAccountId($account_id)
+ {
+
+ if (is_null($account_id)) {
+ throw new \InvalidArgumentException('non-nullable account_id cannot be null');
+ }
+
+ $this->container['account_id'] = $account_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets action
+ *
+ * @return \SnapTrade\Model\ActionStrictWithOptions
+ */
+ public function getAction()
+ {
+ return $this->container['action'];
+ }
+
+ /**
+ * Sets action
+ *
+ * @param \SnapTrade\Model\ActionStrictWithOptions $action action
+ *
+ * @return self
+ */
+ public function setAction($action)
+ {
+
+ if (is_null($action)) {
+ throw new \InvalidArgumentException('non-nullable action cannot be null');
+ }
+
+ $this->container['action'] = $action;
+
+ return $this;
+ }
+
+ /**
+ * Gets universal_symbol_id
+ *
+ * @return string|null
+ */
+ public function getUniversalSymbolId()
+ {
+ return $this->container['universal_symbol_id'];
+ }
+
+ /**
+ * Sets universal_symbol_id
+ *
+ * @param string|null $universal_symbol_id The universal symbol ID of the security to trade. Must be 'null' if `symbol` is provided, otherwise must be provided.
+ *
+ * @return self
+ */
+ public function setUniversalSymbolId($universal_symbol_id)
+ {
+
+ if (is_null($universal_symbol_id)) {
+ array_push($this->openAPINullablesSetToNull, 'universal_symbol_id');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('universal_symbol_id', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['universal_symbol_id'] = $universal_symbol_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets symbol
+ *
+ * @return string|null
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string|null $symbol The security's trading ticker symbol. If 'symbol' is provided, then 'universal_symbol_id' must be 'null'.
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ array_push($this->openAPINullablesSetToNull, 'symbol');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('symbol', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets order_type
+ *
+ * @return \SnapTrade\Model\OrderTypeStrict
+ */
+ public function getOrderType()
+ {
+ return $this->container['order_type'];
+ }
+
+ /**
+ * Sets order_type
+ *
+ * @param \SnapTrade\Model\OrderTypeStrict $order_type order_type
+ *
+ * @return self
+ */
+ public function setOrderType($order_type)
+ {
+
+ if (is_null($order_type)) {
+ throw new \InvalidArgumentException('non-nullable order_type cannot be null');
+ }
+
+ $this->container['order_type'] = $order_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_in_force
+ *
+ * @return \SnapTrade\Model\TimeInForceStrict
+ */
+ public function getTimeInForce()
+ {
+ return $this->container['time_in_force'];
+ }
+
+ /**
+ * Sets time_in_force
+ *
+ * @param \SnapTrade\Model\TimeInForceStrict $time_in_force time_in_force
+ *
+ * @return self
+ */
+ public function setTimeInForce($time_in_force)
+ {
+
+ if (is_null($time_in_force)) {
+ throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ }
+
+ $this->container['time_in_force'] = $time_in_force;
+
+ return $this;
+ }
+
+ /**
+ * Gets trading_session
+ *
+ * @return \SnapTrade\Model\TradingSession|null
+ */
+ public function getTradingSession()
+ {
+ return $this->container['trading_session'];
+ }
+
+ /**
+ * Sets trading_session
+ *
+ * @param \SnapTrade\Model\TradingSession|null $trading_session trading_session
+ *
+ * @return self
+ */
+ public function setTradingSession($trading_session)
+ {
+
+ if (is_null($trading_session)) {
+ throw new \InvalidArgumentException('non-nullable trading_session cannot be null');
+ }
+
+ $this->container['trading_session'] = $trading_session;
+
+ return $this;
+ }
+
+ /**
+ * Gets price
+ *
+ * @return float|null
+ */
+ public function getPrice()
+ {
+ return $this->container['price'];
+ }
+
+ /**
+ * Sets price
+ *
+ * @param float|null $price The limit price for `Limit` and `StopLimit` orders.
+ *
+ * @return self
+ */
+ public function setPrice($price)
+ {
+
+ if (is_null($price)) {
+ array_push($this->openAPINullablesSetToNull, 'price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['price'] = $price;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop
+ *
+ * @return float|null
+ */
+ public function getStop()
+ {
+ return $this->container['stop'];
+ }
+
+ /**
+ * Sets stop
+ *
+ * @param float|null $stop The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
+ *
+ * @return self
+ */
+ public function setStop($stop)
+ {
+
+ if (is_null($stop)) {
+ array_push($this->openAPINullablesSetToNull, 'stop');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('stop', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['stop'] = $stop;
+
+ return $this;
+ }
+
+ /**
+ * Gets units
+ *
+ * @return float|null
+ */
+ public function getUnits()
+ {
+ return $this->container['units'];
+ }
+
+ /**
+ * Sets units
+ *
+ * @param float|null $units For Equity orders, this represents the number of shares for the order. This can be a decimal for fractional orders. Must be `null` if `notional_value` is provided. If placing an Option order, this field represents the number of contracts to buy or sell. (e.g., 1 contract = 100 shares).
+ *
+ * @return self
+ */
+ public function setUnits($units)
+ {
+
+ if (is_null($units)) {
+ array_push($this->openAPINullablesSetToNull, 'units');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('units', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['units'] = $units;
+
+ return $this;
+ }
+
+ /**
+ * Gets notional_value
+ *
+ * @return \SnapTrade\Model\ManualTradeFormNotionalValue|null
+ */
+ public function getNotionalValue()
+ {
+ return $this->container['notional_value'];
+ }
+
+ /**
+ * Sets notional_value
+ *
+ * @param \SnapTrade\Model\ManualTradeFormNotionalValue|null $notional_value notional_value
+ *
+ * @return self
+ */
+ public function setNotionalValue($notional_value)
+ {
+
+ if (is_null($notional_value)) {
+ array_push($this->openAPINullablesSetToNull, 'notional_value');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('notional_value', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['notional_value'] = $notional_value;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/ManualTradeImpact.php b/lib/Model/ManualTradeImpact.php
new file mode 100644
index 0000000..360ca4a
--- /dev/null
+++ b/lib/Model/ManualTradeImpact.php
@@ -0,0 +1,569 @@
+
+ */
+class ManualTradeImpact implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'ManualTradeImpact';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'account' => 'string',
+ 'currency' => 'string',
+ 'remaining_cash' => 'float',
+ 'estimated_commission' => 'float',
+ 'forex_fees' => 'float'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'account' => 'uuid',
+ 'currency' => 'uuid',
+ 'remaining_cash' => null,
+ 'estimated_commission' => null,
+ 'forex_fees' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'account' => false,
+ 'currency' => false,
+ 'remaining_cash' => true,
+ 'estimated_commission' => true,
+ 'forex_fees' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'account' => 'account',
+ 'currency' => 'currency',
+ 'remaining_cash' => 'remaining_cash',
+ 'estimated_commission' => 'estimated_commission',
+ 'forex_fees' => 'forex_fees'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'account' => 'setAccount',
+ 'currency' => 'setCurrency',
+ 'remaining_cash' => 'setRemainingCash',
+ 'estimated_commission' => 'setEstimatedCommission',
+ 'forex_fees' => 'setForexFees'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'account' => 'getAccount',
+ 'currency' => 'getCurrency',
+ 'remaining_cash' => 'getRemainingCash',
+ 'estimated_commission' => 'getEstimatedCommission',
+ 'forex_fees' => 'getForexFees'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('account', $data ?? [], null);
+ $this->setIfExists('currency', $data ?? [], null);
+ $this->setIfExists('remaining_cash', $data ?? [], null);
+ $this->setIfExists('estimated_commission', $data ?? [], null);
+ $this->setIfExists('forex_fees', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets account
+ *
+ * @return string|null
+ */
+ public function getAccount()
+ {
+ return $this->container['account'];
+ }
+
+ /**
+ * Sets account
+ *
+ * @param string|null $account Unique identifier for the connected brokerage account. This is the UUID used to reference the account in SnapTrade.
+ *
+ * @return self
+ */
+ public function setAccount($account)
+ {
+
+ if (is_null($account)) {
+ throw new \InvalidArgumentException('non-nullable account cannot be null');
+ }
+
+ $this->container['account'] = $account;
+
+ return $this;
+ }
+
+ /**
+ * Gets currency
+ *
+ * @return string|null
+ */
+ public function getCurrency()
+ {
+ return $this->container['currency'];
+ }
+
+ /**
+ * Sets currency
+ *
+ * @param string|null $currency Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
+ *
+ * @return self
+ */
+ public function setCurrency($currency)
+ {
+
+ if (is_null($currency)) {
+ throw new \InvalidArgumentException('non-nullable currency cannot be null');
+ }
+
+ $this->container['currency'] = $currency;
+
+ return $this;
+ }
+
+ /**
+ * Gets remaining_cash
+ *
+ * @return float|null
+ */
+ public function getRemainingCash()
+ {
+ return $this->container['remaining_cash'];
+ }
+
+ /**
+ * Sets remaining_cash
+ *
+ * @param float|null $remaining_cash Estimated amount of cash remaining in the account after the trade.
+ *
+ * @return self
+ */
+ public function setRemainingCash($remaining_cash)
+ {
+
+ if (is_null($remaining_cash)) {
+ array_push($this->openAPINullablesSetToNull, 'remaining_cash');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('remaining_cash', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['remaining_cash'] = $remaining_cash;
+
+ return $this;
+ }
+
+ /**
+ * Gets estimated_commission
+ *
+ * @return float|null
+ */
+ public function getEstimatedCommission()
+ {
+ return $this->container['estimated_commission'];
+ }
+
+ /**
+ * Sets estimated_commission
+ *
+ * @param float|null $estimated_commission Estimated commission for the trade.
+ *
+ * @return self
+ */
+ public function setEstimatedCommission($estimated_commission)
+ {
+
+ if (is_null($estimated_commission)) {
+ array_push($this->openAPINullablesSetToNull, 'estimated_commission');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('estimated_commission', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['estimated_commission'] = $estimated_commission;
+
+ return $this;
+ }
+
+ /**
+ * Gets forex_fees
+ *
+ * @return float|null
+ */
+ public function getForexFees()
+ {
+ return $this->container['forex_fees'];
+ }
+
+ /**
+ * Sets forex_fees
+ *
+ * @param float|null $forex_fees Estimated foreign transaction fees for the trade.
+ *
+ * @return self
+ */
+ public function setForexFees($forex_fees)
+ {
+
+ if (is_null($forex_fees)) {
+ array_push($this->openAPINullablesSetToNull, 'forex_fees');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('forex_fees', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['forex_fees'] = $forex_fees;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/ManualTradeReplaceForm.php b/lib/Model/ManualTradeReplaceForm.php
new file mode 100644
index 0000000..7c20009
--- /dev/null
+++ b/lib/Model/ManualTradeReplaceForm.php
@@ -0,0 +1,690 @@
+
+ */
+class ManualTradeReplaceForm implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'ManualTradeReplaceForm';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'brokerage_order_id' => 'string',
+ 'action' => '\SnapTrade\Model\ActionStrict',
+ 'order_type' => '\SnapTrade\Model\OrderTypeStrict',
+ 'time_in_force' => '\SnapTrade\Model\TimeInForceStrict',
+ 'price' => 'float',
+ 'symbol' => 'string',
+ 'stop' => 'float',
+ 'units' => 'float'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'brokerage_order_id' => null,
+ 'action' => null,
+ 'order_type' => null,
+ 'time_in_force' => null,
+ 'price' => null,
+ 'symbol' => null,
+ 'stop' => null,
+ 'units' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'brokerage_order_id' => false,
+ 'action' => false,
+ 'order_type' => false,
+ 'time_in_force' => false,
+ 'price' => true,
+ 'symbol' => false,
+ 'stop' => true,
+ 'units' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'brokerage_order_id' => 'brokerage_order_id',
+ 'action' => 'action',
+ 'order_type' => 'order_type',
+ 'time_in_force' => 'time_in_force',
+ 'price' => 'price',
+ 'symbol' => 'symbol',
+ 'stop' => 'stop',
+ 'units' => 'units'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'brokerage_order_id' => 'setBrokerageOrderId',
+ 'action' => 'setAction',
+ 'order_type' => 'setOrderType',
+ 'time_in_force' => 'setTimeInForce',
+ 'price' => 'setPrice',
+ 'symbol' => 'setSymbol',
+ 'stop' => 'setStop',
+ 'units' => 'setUnits'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'brokerage_order_id' => 'getBrokerageOrderId',
+ 'action' => 'getAction',
+ 'order_type' => 'getOrderType',
+ 'time_in_force' => 'getTimeInForce',
+ 'price' => 'getPrice',
+ 'symbol' => 'getSymbol',
+ 'stop' => 'getStop',
+ 'units' => 'getUnits'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('brokerage_order_id', $data ?? [], null);
+ $this->setIfExists('action', $data ?? [], null);
+ $this->setIfExists('order_type', $data ?? [], null);
+ $this->setIfExists('time_in_force', $data ?? [], null);
+ $this->setIfExists('price', $data ?? [], null);
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('stop', $data ?? [], null);
+ $this->setIfExists('units', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['brokerage_order_id'] === null) {
+ $invalidProperties[] = "'brokerage_order_id' can't be null";
+ }
+ if ($this->container['action'] === null) {
+ $invalidProperties[] = "'action' can't be null";
+ }
+ if ($this->container['order_type'] === null) {
+ $invalidProperties[] = "'order_type' can't be null";
+ }
+ if ($this->container['time_in_force'] === null) {
+ $invalidProperties[] = "'time_in_force' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets brokerage_order_id
+ *
+ * @return string
+ */
+ public function getBrokerageOrderId()
+ {
+ return $this->container['brokerage_order_id'];
+ }
+
+ /**
+ * Sets brokerage_order_id
+ *
+ * @param string $brokerage_order_id Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
+ *
+ * @return self
+ */
+ public function setBrokerageOrderId($brokerage_order_id)
+ {
+
+ if (is_null($brokerage_order_id)) {
+ throw new \InvalidArgumentException('non-nullable brokerage_order_id cannot be null');
+ }
+
+ $this->container['brokerage_order_id'] = $brokerage_order_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets action
+ *
+ * @return \SnapTrade\Model\ActionStrict
+ */
+ public function getAction()
+ {
+ return $this->container['action'];
+ }
+
+ /**
+ * Sets action
+ *
+ * @param \SnapTrade\Model\ActionStrict $action action
+ *
+ * @return self
+ */
+ public function setAction($action)
+ {
+
+ if (is_null($action)) {
+ throw new \InvalidArgumentException('non-nullable action cannot be null');
+ }
+
+ $this->container['action'] = $action;
+
+ return $this;
+ }
+
+ /**
+ * Gets order_type
+ *
+ * @return \SnapTrade\Model\OrderTypeStrict
+ */
+ public function getOrderType()
+ {
+ return $this->container['order_type'];
+ }
+
+ /**
+ * Sets order_type
+ *
+ * @param \SnapTrade\Model\OrderTypeStrict $order_type order_type
+ *
+ * @return self
+ */
+ public function setOrderType($order_type)
+ {
+
+ if (is_null($order_type)) {
+ throw new \InvalidArgumentException('non-nullable order_type cannot be null');
+ }
+
+ $this->container['order_type'] = $order_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_in_force
+ *
+ * @return \SnapTrade\Model\TimeInForceStrict
+ */
+ public function getTimeInForce()
+ {
+ return $this->container['time_in_force'];
+ }
+
+ /**
+ * Sets time_in_force
+ *
+ * @param \SnapTrade\Model\TimeInForceStrict $time_in_force time_in_force
+ *
+ * @return self
+ */
+ public function setTimeInForce($time_in_force)
+ {
+
+ if (is_null($time_in_force)) {
+ throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ }
+
+ $this->container['time_in_force'] = $time_in_force;
+
+ return $this;
+ }
+
+ /**
+ * Gets price
+ *
+ * @return float|null
+ */
+ public function getPrice()
+ {
+ return $this->container['price'];
+ }
+
+ /**
+ * Sets price
+ *
+ * @param float|null $price The limit price for `Limit` and `StopLimit` orders.
+ *
+ * @return self
+ */
+ public function setPrice($price)
+ {
+
+ if (is_null($price)) {
+ array_push($this->openAPINullablesSetToNull, 'price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['price'] = $price;
+
+ return $this;
+ }
+
+ /**
+ * Gets symbol
+ *
+ * @return string|null
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string|null $symbol The security's trading ticker symbol
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop
+ *
+ * @return float|null
+ */
+ public function getStop()
+ {
+ return $this->container['stop'];
+ }
+
+ /**
+ * Sets stop
+ *
+ * @param float|null $stop The price at which a stop order is triggered for `Stop` and `StopLimit` orders.
+ *
+ * @return self
+ */
+ public function setStop($stop)
+ {
+
+ if (is_null($stop)) {
+ array_push($this->openAPINullablesSetToNull, 'stop');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('stop', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['stop'] = $stop;
+
+ return $this;
+ }
+
+ /**
+ * Gets units
+ *
+ * @return float|null
+ */
+ public function getUnits()
+ {
+ return $this->container['units'];
+ }
+
+ /**
+ * Sets units
+ *
+ * @param float|null $units units
+ *
+ * @return self
+ */
+ public function setUnits($units)
+ {
+
+ if (is_null($units)) {
+ array_push($this->openAPINullablesSetToNull, 'units');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('units', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['units'] = $units;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/ManualTradeSymbol.php b/lib/Model/ManualTradeSymbol.php
index ff46c66..b65f5f7 100644
--- a/lib/Model/ManualTradeSymbol.php
+++ b/lib/Model/ManualTradeSymbol.php
@@ -30,7 +30,7 @@
* ManualTradeSymbol Class Doc Comment
*
* @category Class
- * @description Manual trade symbol object
+ * @description Information about the security for the order.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -51,12 +51,12 @@ class ManualTradeSymbol implements ModelInterface, ArrayAccess, \JsonSerializabl
* @var string[]
*/
protected static $openAPITypes = [
- 'brokerage_symbol_id' => 'string',
'universal_symbol_id' => 'string',
'currency' => '\SnapTrade\Model\Currency',
'local_id' => 'string',
'description' => 'string',
- 'symbol' => 'string'
+ 'symbol' => 'string',
+ 'brokerage_symbol_id' => 'string'
];
/**
@@ -67,12 +67,12 @@ class ManualTradeSymbol implements ModelInterface, ArrayAccess, \JsonSerializabl
* @psalm-var array
*/
protected static $openAPIFormats = [
- 'brokerage_symbol_id' => 'uuid',
'universal_symbol_id' => 'uuid',
'currency' => null,
'local_id' => null,
'description' => null,
- 'symbol' => null
+ 'symbol' => null,
+ 'brokerage_symbol_id' => 'uuid'
];
/**
@@ -81,12 +81,12 @@ class ManualTradeSymbol implements ModelInterface, ArrayAccess, \JsonSerializabl
* @var boolean[]
*/
protected static array $openAPINullables = [
- 'brokerage_symbol_id' => false,
- 'universal_symbol_id' => false,
+ 'universal_symbol_id' => false,
'currency' => false,
'local_id' => false,
'description' => true,
- 'symbol' => false
+ 'symbol' => false,
+ 'brokerage_symbol_id' => false
];
/**
@@ -175,12 +175,12 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
- 'brokerage_symbol_id' => 'brokerage_symbol_id',
'universal_symbol_id' => 'universal_symbol_id',
'currency' => 'currency',
'local_id' => 'local_id',
'description' => 'description',
- 'symbol' => 'symbol'
+ 'symbol' => 'symbol',
+ 'brokerage_symbol_id' => 'brokerage_symbol_id'
];
/**
@@ -189,12 +189,12 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
- 'brokerage_symbol_id' => 'setBrokerageSymbolId',
'universal_symbol_id' => 'setUniversalSymbolId',
'currency' => 'setCurrency',
'local_id' => 'setLocalId',
'description' => 'setDescription',
- 'symbol' => 'setSymbol'
+ 'symbol' => 'setSymbol',
+ 'brokerage_symbol_id' => 'setBrokerageSymbolId'
];
/**
@@ -203,12 +203,12 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
- 'brokerage_symbol_id' => 'getBrokerageSymbolId',
'universal_symbol_id' => 'getUniversalSymbolId',
'currency' => 'getCurrency',
'local_id' => 'getLocalId',
'description' => 'getDescription',
- 'symbol' => 'getSymbol'
+ 'symbol' => 'getSymbol',
+ 'brokerage_symbol_id' => 'getBrokerageSymbolId'
];
/**
@@ -268,12 +268,12 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
- $this->setIfExists('brokerage_symbol_id', $data ?? [], null);
$this->setIfExists('universal_symbol_id', $data ?? [], null);
$this->setIfExists('currency', $data ?? [], null);
$this->setIfExists('local_id', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('brokerage_symbol_id', $data ?? [], null);
}
/**
@@ -318,35 +318,6 @@ public function valid()
}
- /**
- * Gets brokerage_symbol_id
- *
- * @return string|null
- */
- public function getBrokerageSymbolId()
- {
- return $this->container['brokerage_symbol_id'];
- }
-
- /**
- * Sets brokerage_symbol_id
- *
- * @param string|null $brokerage_symbol_id brokerage_symbol_id
- *
- * @return self
- */
- public function setBrokerageSymbolId($brokerage_symbol_id)
- {
-
- if (is_null($brokerage_symbol_id)) {
- throw new \InvalidArgumentException('non-nullable brokerage_symbol_id cannot be null');
- }
-
- $this->container['brokerage_symbol_id'] = $brokerage_symbol_id;
-
- return $this;
- }
-
/**
* Gets universal_symbol_id
*
@@ -360,7 +331,7 @@ public function getUniversalSymbolId()
/**
* Sets universal_symbol_id
*
- * @param string|null $universal_symbol_id universal_symbol_id
+ * @param string|null $universal_symbol_id Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
*
* @return self
*/
@@ -409,6 +380,7 @@ public function setCurrency($currency)
* Gets local_id
*
* @return string|null
+ * @deprecated
*/
public function getLocalId()
{
@@ -418,9 +390,10 @@ public function getLocalId()
/**
* Sets local_id
*
- * @param string|null $local_id local_id
+ * @param string|null $local_id This field is deprecated and should not be used.
*
* @return self
+ * @deprecated
*/
public function setLocalId($local_id)
{
@@ -438,6 +411,7 @@ public function setLocalId($local_id)
* Gets description
*
* @return string|null
+ * @deprecated
*/
public function getDescription()
{
@@ -447,9 +421,10 @@ public function getDescription()
/**
* Sets description
*
- * @param string|null $description description
+ * @param string|null $description This field is deprecated and should not be used.
*
* @return self
+ * @deprecated
*/
public function setDescription($description)
{
@@ -474,6 +449,7 @@ public function setDescription($description)
* Gets symbol
*
* @return string|null
+ * @deprecated
*/
public function getSymbol()
{
@@ -483,9 +459,10 @@ public function getSymbol()
/**
* Sets symbol
*
- * @param string|null $symbol symbol
+ * @param string|null $symbol This field is deprecated and should not be used.
*
* @return self
+ * @deprecated
*/
public function setSymbol($symbol)
{
@@ -498,6 +475,37 @@ public function setSymbol($symbol)
return $this;
}
+
+ /**
+ * Gets brokerage_symbol_id
+ *
+ * @return string|null
+ * @deprecated
+ */
+ public function getBrokerageSymbolId()
+ {
+ return $this->container['brokerage_symbol_id'];
+ }
+
+ /**
+ * Sets brokerage_symbol_id
+ *
+ * @param string|null $brokerage_symbol_id A unique ID for the security within SnapTrade, scoped to the brokerage account that the security belongs to. This is a legacy field and should not be used. Do not rely on this being a stable ID as it can change.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setBrokerageSymbolId($brokerage_symbol_id)
+ {
+
+ if (is_null($brokerage_symbol_id)) {
+ throw new \InvalidArgumentException('non-nullable brokerage_symbol_id cannot be null');
+ }
+
+ $this->container['brokerage_symbol_id'] = $brokerage_symbol_id;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/MlegActionStrict.php b/lib/Model/MlegActionStrict.php
new file mode 100644
index 0000000..18137d4
--- /dev/null
+++ b/lib/Model/MlegActionStrict.php
@@ -0,0 +1,68 @@
+
+ */
+class MlegLeg implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'MlegLeg';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'instrument' => '\SnapTrade\Model\MlegTradingInstrument',
+ 'action' => '\SnapTrade\Model\MlegActionStrict',
+ 'units' => 'int'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'instrument' => null,
+ 'action' => null,
+ 'units' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'instrument' => false,
+ 'action' => false,
+ 'units' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'instrument' => 'instrument',
+ 'action' => 'action',
+ 'units' => 'units'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'instrument' => 'setInstrument',
+ 'action' => 'setAction',
+ 'units' => 'setUnits'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'instrument' => 'getInstrument',
+ 'action' => 'getAction',
+ 'units' => 'getUnits'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('instrument', $data ?? [], null);
+ $this->setIfExists('action', $data ?? [], null);
+ $this->setIfExists('units', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['instrument'] === null) {
+ $invalidProperties[] = "'instrument' can't be null";
+ }
+ if ($this->container['action'] === null) {
+ $invalidProperties[] = "'action' can't be null";
+ }
+ if ($this->container['units'] === null) {
+ $invalidProperties[] = "'units' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets instrument
+ *
+ * @return \SnapTrade\Model\MlegTradingInstrument
+ */
+ public function getInstrument()
+ {
+ return $this->container['instrument'];
+ }
+
+ /**
+ * Sets instrument
+ *
+ * @param \SnapTrade\Model\MlegTradingInstrument $instrument instrument
+ *
+ * @return self
+ */
+ public function setInstrument($instrument)
+ {
+
+ if (is_null($instrument)) {
+ throw new \InvalidArgumentException('non-nullable instrument cannot be null');
+ }
+
+ $this->container['instrument'] = $instrument;
+
+ return $this;
+ }
+
+ /**
+ * Gets action
+ *
+ * @return \SnapTrade\Model\MlegActionStrict
+ */
+ public function getAction()
+ {
+ return $this->container['action'];
+ }
+
+ /**
+ * Sets action
+ *
+ * @param \SnapTrade\Model\MlegActionStrict $action action
+ *
+ * @return self
+ */
+ public function setAction($action)
+ {
+
+ if (is_null($action)) {
+ throw new \InvalidArgumentException('non-nullable action cannot be null');
+ }
+
+ $this->container['action'] = $action;
+
+ return $this;
+ }
+
+ /**
+ * Gets units
+ *
+ * @return int
+ */
+ public function getUnits()
+ {
+ return $this->container['units'];
+ }
+
+ /**
+ * Sets units
+ *
+ * @param int $units The quantity to trade. For options this represents the number of contracts. For equity this represents the number of shares.
+ *
+ * @return self
+ */
+ public function setUnits($units)
+ {
+
+ if (is_null($units)) {
+ throw new \InvalidArgumentException('non-nullable units cannot be null');
+ }
+
+ $this->container['units'] = $units;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/MlegOrderResponse.php b/lib/Model/MlegOrderResponse.php
new file mode 100644
index 0000000..73f9553
--- /dev/null
+++ b/lib/Model/MlegOrderResponse.php
@@ -0,0 +1,446 @@
+
+ */
+class MlegOrderResponse implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'MlegOrderResponse';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'brokerage_order_id' => 'string',
+ 'orders' => '\SnapTrade\Model\AccountOrderRecord[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'brokerage_order_id' => null,
+ 'orders' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'brokerage_order_id' => false,
+ 'orders' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'brokerage_order_id' => 'brokerage_order_id',
+ 'orders' => 'orders'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'brokerage_order_id' => 'setBrokerageOrderId',
+ 'orders' => 'setOrders'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'brokerage_order_id' => 'getBrokerageOrderId',
+ 'orders' => 'getOrders'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('brokerage_order_id', $data ?? [], null);
+ $this->setIfExists('orders', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['brokerage_order_id'] === null) {
+ $invalidProperties[] = "'brokerage_order_id' can't be null";
+ }
+ if ($this->container['orders'] === null) {
+ $invalidProperties[] = "'orders' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets brokerage_order_id
+ *
+ * @return string
+ */
+ public function getBrokerageOrderId()
+ {
+ return $this->container['brokerage_order_id'];
+ }
+
+ /**
+ * Sets brokerage_order_id
+ *
+ * @param string $brokerage_order_id Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
+ *
+ * @return self
+ */
+ public function setBrokerageOrderId($brokerage_order_id)
+ {
+
+ if (is_null($brokerage_order_id)) {
+ throw new \InvalidArgumentException('non-nullable brokerage_order_id cannot be null');
+ }
+
+ $this->container['brokerage_order_id'] = $brokerage_order_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets orders
+ *
+ * @return \SnapTrade\Model\AccountOrderRecord[]
+ */
+ public function getOrders()
+ {
+ return $this->container['orders'];
+ }
+
+ /**
+ * Sets orders
+ *
+ * @param \SnapTrade\Model\AccountOrderRecord[] $orders orders
+ *
+ * @return self
+ */
+ public function setOrders($orders)
+ {
+
+ if (is_null($orders)) {
+ throw new \InvalidArgumentException('non-nullable orders cannot be null');
+ }
+
+ $this->container['orders'] = $orders;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/MlegOrderTypeStrict.php b/lib/Model/MlegOrderTypeStrict.php
new file mode 100644
index 0000000..d50c396
--- /dev/null
+++ b/lib/Model/MlegOrderTypeStrict.php
@@ -0,0 +1,62 @@
+
+ */
+class MlegTradeForm implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'MlegTradeForm';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'order_type' => '\SnapTrade\Model\MlegOrderTypeStrict',
+ 'time_in_force' => '\SnapTrade\Model\TimeInForceStrict',
+ 'limit_price' => 'float',
+ 'stop_price' => 'float',
+ 'price_effect' => 'MlegPriceEffectStrict',
+ 'legs' => '\SnapTrade\Model\MlegLeg[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'order_type' => null,
+ 'time_in_force' => null,
+ 'limit_price' => 'decimal',
+ 'stop_price' => 'decimal',
+ 'price_effect' => null,
+ 'legs' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'order_type' => false,
+ 'time_in_force' => false,
+ 'limit_price' => true,
+ 'stop_price' => true,
+ 'price_effect' => true,
+ 'legs' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'order_type' => 'order_type',
+ 'time_in_force' => 'time_in_force',
+ 'limit_price' => 'limit_price',
+ 'stop_price' => 'stop_price',
+ 'price_effect' => 'price_effect',
+ 'legs' => 'legs'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'order_type' => 'setOrderType',
+ 'time_in_force' => 'setTimeInForce',
+ 'limit_price' => 'setLimitPrice',
+ 'stop_price' => 'setStopPrice',
+ 'price_effect' => 'setPriceEffect',
+ 'legs' => 'setLegs'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'order_type' => 'getOrderType',
+ 'time_in_force' => 'getTimeInForce',
+ 'limit_price' => 'getLimitPrice',
+ 'stop_price' => 'getStopPrice',
+ 'price_effect' => 'getPriceEffect',
+ 'legs' => 'getLegs'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('order_type', $data ?? [], null);
+ $this->setIfExists('time_in_force', $data ?? [], null);
+ $this->setIfExists('limit_price', $data ?? [], null);
+ $this->setIfExists('stop_price', $data ?? [], null);
+ $this->setIfExists('price_effect', $data ?? [], null);
+ $this->setIfExists('legs', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['order_type'] === null) {
+ $invalidProperties[] = "'order_type' can't be null";
+ }
+ if ($this->container['time_in_force'] === null) {
+ $invalidProperties[] = "'time_in_force' can't be null";
+ }
+ if ($this->container['legs'] === null) {
+ $invalidProperties[] = "'legs' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets order_type
+ *
+ * @return \SnapTrade\Model\MlegOrderTypeStrict
+ */
+ public function getOrderType()
+ {
+ return $this->container['order_type'];
+ }
+
+ /**
+ * Sets order_type
+ *
+ * @param \SnapTrade\Model\MlegOrderTypeStrict $order_type order_type
+ *
+ * @return self
+ */
+ public function setOrderType($order_type)
+ {
+
+ if (is_null($order_type)) {
+ throw new \InvalidArgumentException('non-nullable order_type cannot be null');
+ }
+
+ $this->container['order_type'] = $order_type;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_in_force
+ *
+ * @return \SnapTrade\Model\TimeInForceStrict
+ */
+ public function getTimeInForce()
+ {
+ return $this->container['time_in_force'];
+ }
+
+ /**
+ * Sets time_in_force
+ *
+ * @param \SnapTrade\Model\TimeInForceStrict $time_in_force time_in_force
+ *
+ * @return self
+ */
+ public function setTimeInForce($time_in_force)
+ {
+
+ if (is_null($time_in_force)) {
+ throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ }
+
+ $this->container['time_in_force'] = $time_in_force;
+
+ return $this;
+ }
+
+ /**
+ * Gets limit_price
+ *
+ * @return float|null
+ */
+ public function getLimitPrice()
+ {
+ return $this->container['limit_price'];
+ }
+
+ /**
+ * Sets limit_price
+ *
+ * @param float|null $limit_price The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT.
+ *
+ * @return self
+ */
+ public function setLimitPrice($limit_price)
+ {
+
+ if (is_null($limit_price)) {
+ array_push($this->openAPINullablesSetToNull, 'limit_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('limit_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['limit_price'] = $limit_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop_price
+ *
+ * @return float|null
+ */
+ public function getStopPrice()
+ {
+ return $this->container['stop_price'];
+ }
+
+ /**
+ * Sets stop_price
+ *
+ * @param float|null $stop_price The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT.
+ *
+ * @return self
+ */
+ public function setStopPrice($stop_price)
+ {
+
+ if (is_null($stop_price)) {
+ array_push($this->openAPINullablesSetToNull, 'stop_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('stop_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['stop_price'] = $stop_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets price_effect
+ *
+ * @return MlegPriceEffectStrict|null
+ */
+ public function getPriceEffect()
+ {
+ return $this->container['price_effect'];
+ }
+
+ /**
+ * Sets price_effect
+ *
+ * @param MlegPriceEffectStrict|null $price_effect price_effect
+ *
+ * @return self
+ */
+ public function setPriceEffect($price_effect)
+ {
+
+ if (is_null($price_effect)) {
+ array_push($this->openAPINullablesSetToNull, 'price_effect');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('price_effect', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['price_effect'] = $price_effect;
+
+ return $this;
+ }
+
+ /**
+ * Gets legs
+ *
+ * @return \SnapTrade\Model\MlegLeg[]
+ */
+ public function getLegs()
+ {
+ return $this->container['legs'];
+ }
+
+ /**
+ * Sets legs
+ *
+ * @param \SnapTrade\Model\MlegLeg[] $legs legs
+ *
+ * @return self
+ */
+ public function setLegs($legs)
+ {
+
+ if (is_null($legs)) {
+ throw new \InvalidArgumentException('non-nullable legs cannot be null');
+ }
+
+ $this->container['legs'] = $legs;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/MlegTradingInstrument.php b/lib/Model/MlegTradingInstrument.php
new file mode 100644
index 0000000..88fb851
--- /dev/null
+++ b/lib/Model/MlegTradingInstrument.php
@@ -0,0 +1,446 @@
+
+ */
+class MlegTradingInstrument implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'MlegTradingInstrument';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'symbol' => 'string',
+ 'instrument_type' => '\SnapTrade\Model\MlegInstrumentType'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'symbol' => null,
+ 'instrument_type' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'symbol' => false,
+ 'instrument_type' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'symbol' => 'symbol',
+ 'instrument_type' => 'instrument_type'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'symbol' => 'setSymbol',
+ 'instrument_type' => 'setInstrumentType'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'symbol' => 'getSymbol',
+ 'instrument_type' => 'getInstrumentType'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('instrument_type', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['symbol'] === null) {
+ $invalidProperties[] = "'symbol' can't be null";
+ }
+ if ($this->container['instrument_type'] === null) {
+ $invalidProperties[] = "'instrument_type' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets symbol
+ *
+ * @return string
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string $symbol The security's trading ticker symbol. This currently supports stock symbols and Options symbols 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)
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets instrument_type
+ *
+ * @return \SnapTrade\Model\MlegInstrumentType
+ */
+ public function getInstrumentType()
+ {
+ return $this->container['instrument_type'];
+ }
+
+ /**
+ * Sets instrument_type
+ *
+ * @param \SnapTrade\Model\MlegInstrumentType $instrument_type instrument_type
+ *
+ * @return self
+ */
+ public function setInstrumentType($instrument_type)
+ {
+
+ if (is_null($instrument_type)) {
+ throw new \InvalidArgumentException('non-nullable instrument_type cannot be null');
+ }
+
+ $this->container['instrument_type'] = $instrument_type;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/Model425FailedRequestResponse.php b/lib/Model/Model425FailedRequestResponse.php
new file mode 100644
index 0000000..0f43719
--- /dev/null
+++ b/lib/Model/Model425FailedRequestResponse.php
@@ -0,0 +1,455 @@
+
+ */
+class Model425FailedRequestResponse implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = '425FailedRequestResponse';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'detail' => 'mixed',
+ 'code' => 'mixed'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'detail' => null,
+ 'code' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'detail' => true,
+ 'code' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'detail' => 'detail',
+ 'code' => 'code'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'detail' => 'setDetail',
+ 'code' => 'setCode'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'detail' => 'getDetail',
+ 'code' => 'getCode'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('detail', $data ?? [], null);
+ $this->setIfExists('code', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets detail
+ *
+ * @return mixed|null
+ */
+ public function getDetail()
+ {
+ return $this->container['detail'];
+ }
+
+ /**
+ * Sets detail
+ *
+ * @param mixed|null $detail detail
+ *
+ * @return self
+ */
+ public function setDetail($detail)
+ {
+
+ if (is_null($detail)) {
+ array_push($this->openAPINullablesSetToNull, 'detail');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('detail', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['detail'] = $detail;
+
+ return $this;
+ }
+
+ /**
+ * Gets code
+ *
+ * @return mixed|null
+ */
+ public function getCode()
+ {
+ return $this->container['code'];
+ }
+
+ /**
+ * Sets code
+ *
+ * @param mixed|null $code code
+ *
+ * @return self
+ */
+ public function setCode($code)
+ {
+
+ if (is_null($code)) {
+ array_push($this->openAPINullablesSetToNull, 'code');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('code', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['code'] = $code;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/NotionalValue.php b/lib/Model/NotionalValue.php
index c4a3fd9..96c7c25 100644
--- a/lib/Model/NotionalValue.php
+++ b/lib/Model/NotionalValue.php
@@ -30,7 +30,7 @@
* NotionalValue Class Doc Comment
*
* @category Class
- * @description Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force. **Only available for Alpaca, Alpaca Paper, and Robinhood.**
+ * @description Total notional amount for the order. Must be `null` if `units` is provided. Can only work with `Market` for `order_type` and `Day` for `time_in_force`. This is only available for certain brokerages. Please check the [integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=e7bbcbf9f272441593f93decde660687) for more information.
* @package SnapTrade
* @implements \ArrayAccess
*/
diff --git a/lib/Model/OptionBrokerageSymbol.php b/lib/Model/OptionBrokerageSymbol.php
index 088b2c5..f67813e 100644
--- a/lib/Model/OptionBrokerageSymbol.php
+++ b/lib/Model/OptionBrokerageSymbol.php
@@ -51,9 +51,9 @@ class OptionBrokerageSymbol implements ModelInterface, ArrayAccess, \JsonSeriali
* @var string[]
*/
protected static $openAPITypes = [
+ 'option_symbol' => '\SnapTrade\Model\OptionsSymbol',
'id' => 'string',
- 'description' => 'string',
- 'option_symbol' => '\SnapTrade\Model\OptionsSymbol'
+ 'description' => 'string'
];
/**
@@ -64,9 +64,9 @@ class OptionBrokerageSymbol implements ModelInterface, ArrayAccess, \JsonSeriali
* @psalm-var array
*/
protected static $openAPIFormats = [
+ 'option_symbol' => null,
'id' => 'uuid',
- 'description' => null,
- 'option_symbol' => null
+ 'description' => null
];
/**
@@ -75,9 +75,9 @@ class OptionBrokerageSymbol implements ModelInterface, ArrayAccess, \JsonSeriali
* @var boolean[]
*/
protected static array $openAPINullables = [
- 'id' => false,
- 'description' => false,
- 'option_symbol' => false
+ 'option_symbol' => false,
+ 'id' => false,
+ 'description' => false
];
/**
@@ -166,9 +166,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
+ 'option_symbol' => 'option_symbol',
'id' => 'id',
- 'description' => 'description',
- 'option_symbol' => 'option_symbol'
+ 'description' => 'description'
];
/**
@@ -177,9 +177,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
+ 'option_symbol' => 'setOptionSymbol',
'id' => 'setId',
- 'description' => 'setDescription',
- 'option_symbol' => 'setOptionSymbol'
+ 'description' => 'setDescription'
];
/**
@@ -188,9 +188,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
+ 'option_symbol' => 'getOptionSymbol',
'id' => 'getId',
- 'description' => 'getDescription',
- 'option_symbol' => 'getOptionSymbol'
+ 'description' => 'getDescription'
];
/**
@@ -250,9 +250,9 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
+ $this->setIfExists('option_symbol', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
- $this->setIfExists('option_symbol', $data ?? [], null);
}
/**
@@ -297,6 +297,35 @@ public function valid()
}
+ /**
+ * Gets option_symbol
+ *
+ * @return \SnapTrade\Model\OptionsSymbol|null
+ */
+ public function getOptionSymbol()
+ {
+ return $this->container['option_symbol'];
+ }
+
+ /**
+ * Sets option_symbol
+ *
+ * @param \SnapTrade\Model\OptionsSymbol|null $option_symbol option_symbol
+ *
+ * @return self
+ */
+ public function setOptionSymbol($option_symbol)
+ {
+
+ if (is_null($option_symbol)) {
+ throw new \InvalidArgumentException('non-nullable option_symbol cannot be null');
+ }
+
+ $this->container['option_symbol'] = $option_symbol;
+
+ return $this;
+ }
+
/**
* Gets id
*
@@ -358,35 +387,6 @@ public function setDescription($description)
return $this;
}
-
- /**
- * Gets option_symbol
- *
- * @return \SnapTrade\Model\OptionsSymbol|null
- */
- public function getOptionSymbol()
- {
- return $this->container['option_symbol'];
- }
-
- /**
- * Sets option_symbol
- *
- * @param \SnapTrade\Model\OptionsSymbol|null $option_symbol option_symbol
- *
- * @return self
- */
- public function setOptionSymbol($option_symbol)
- {
-
- if (is_null($option_symbol)) {
- throw new \InvalidArgumentException('non-nullable option_symbol cannot be null');
- }
-
- $this->container['option_symbol'] = $option_symbol;
-
- return $this;
- }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/OptionsPosition.php b/lib/Model/OptionsPosition.php
index e533867..a3dc7d3 100644
--- a/lib/Model/OptionsPosition.php
+++ b/lib/Model/OptionsPosition.php
@@ -54,8 +54,8 @@ class OptionsPosition implements ModelInterface, ArrayAccess, \JsonSerializable
'symbol' => '\SnapTrade\Model\OptionBrokerageSymbol',
'price' => 'float',
'units' => 'float',
- 'currency' => '\SnapTrade\Model\OptionsPositionCurrency',
- 'average_purchase_price' => 'float'
+ 'average_purchase_price' => 'float',
+ 'currency' => '\SnapTrade\Model\OptionsPositionCurrency'
];
/**
@@ -69,8 +69,8 @@ class OptionsPosition implements ModelInterface, ArrayAccess, \JsonSerializable
'symbol' => null,
'price' => null,
'units' => null,
- 'currency' => null,
- 'average_purchase_price' => null
+ 'average_purchase_price' => null,
+ 'currency' => null
];
/**
@@ -82,8 +82,8 @@ class OptionsPosition implements ModelInterface, ArrayAccess, \JsonSerializable
'symbol' => false,
'price' => true,
'units' => false,
- 'currency' => true,
- 'average_purchase_price' => true
+ 'average_purchase_price' => true,
+ 'currency' => true
];
/**
@@ -175,8 +175,8 @@ public function isNullableSetToNull(string $property): bool
'symbol' => 'symbol',
'price' => 'price',
'units' => 'units',
- 'currency' => 'currency',
- 'average_purchase_price' => 'average_purchase_price'
+ 'average_purchase_price' => 'average_purchase_price',
+ 'currency' => 'currency'
];
/**
@@ -188,8 +188,8 @@ public function isNullableSetToNull(string $property): bool
'symbol' => 'setSymbol',
'price' => 'setPrice',
'units' => 'setUnits',
- 'currency' => 'setCurrency',
- 'average_purchase_price' => 'setAveragePurchasePrice'
+ 'average_purchase_price' => 'setAveragePurchasePrice',
+ 'currency' => 'setCurrency'
];
/**
@@ -201,8 +201,8 @@ public function isNullableSetToNull(string $property): bool
'symbol' => 'getSymbol',
'price' => 'getPrice',
'units' => 'getUnits',
- 'currency' => 'getCurrency',
- 'average_purchase_price' => 'getAveragePurchasePrice'
+ 'average_purchase_price' => 'getAveragePurchasePrice',
+ 'currency' => 'getCurrency'
];
/**
@@ -265,8 +265,8 @@ public function __construct(array $data = null)
$this->setIfExists('symbol', $data ?? [], null);
$this->setIfExists('price', $data ?? [], null);
$this->setIfExists('units', $data ?? [], null);
- $this->setIfExists('currency', $data ?? [], null);
$this->setIfExists('average_purchase_price', $data ?? [], null);
+ $this->setIfExists('currency', $data ?? [], null);
}
/**
@@ -353,7 +353,7 @@ public function getPrice()
/**
* Sets price
*
- * @param float|null $price Last known market price for the option contract. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices.
+ * @param float|null $price Last known market price _per share_ of the option contract. The freshness of this price depends on the brokerage. Some brokerages provide real-time prices, while others provide delayed prices. It is recommended that you rely on your own third-party market data provider for most up to date prices.
*
* @return self
*/
@@ -406,75 +406,75 @@ public function setUnits($units)
}
/**
- * Gets currency
+ * Gets average_purchase_price
*
- * @return \SnapTrade\Model\OptionsPositionCurrency|null
- * @deprecated
+ * @return float|null
*/
- public function getCurrency()
+ public function getAveragePurchasePrice()
{
- return $this->container['currency'];
+ return $this->container['average_purchase_price'];
}
/**
- * Sets currency
+ * Sets average_purchase_price
*
- * @param \SnapTrade\Model\OptionsPositionCurrency|null $currency currency
+ * @param float|null $average_purchase_price Cost basis _per contract_ of this option position. To get the cost basis _per share_, divide this value by the number of shares per contract (usually 100).
*
* @return self
- * @deprecated
*/
- public function setCurrency($currency)
+ public function setAveragePurchasePrice($average_purchase_price)
{
- if (is_null($currency)) {
- array_push($this->openAPINullablesSetToNull, 'currency');
+ if (is_null($average_purchase_price)) {
+ array_push($this->openAPINullablesSetToNull, 'average_purchase_price');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('currency', $nullablesSetToNull);
+ $index = array_search('average_purchase_price', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['currency'] = $currency;
+ $this->container['average_purchase_price'] = $average_purchase_price;
return $this;
}
/**
- * Gets average_purchase_price
+ * Gets currency
*
- * @return float|null
+ * @return \SnapTrade\Model\OptionsPositionCurrency|null
+ * @deprecated
*/
- public function getAveragePurchasePrice()
+ public function getCurrency()
{
- return $this->container['average_purchase_price'];
+ return $this->container['currency'];
}
/**
- * Sets average_purchase_price
+ * Sets currency
*
- * @param float|null $average_purchase_price Cost basis _per contract_ of this option position. To get the cost basis _per share_, divide this value by the number of shares per contract (usually 100).
+ * @param \SnapTrade\Model\OptionsPositionCurrency|null $currency currency
*
* @return self
+ * @deprecated
*/
- public function setAveragePurchasePrice($average_purchase_price)
+ public function setCurrency($currency)
{
- if (is_null($average_purchase_price)) {
- array_push($this->openAPINullablesSetToNull, 'average_purchase_price');
+ if (is_null($currency)) {
+ array_push($this->openAPINullablesSetToNull, 'currency');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('average_purchase_price', $nullablesSetToNull);
+ $index = array_search('currency', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['average_purchase_price'] = $average_purchase_price;
+ $this->container['currency'] = $currency;
return $this;
}
diff --git a/lib/Model/OrderTypeStrict.php b/lib/Model/OrderTypeStrict.php
index bef8532..1a09675 100644
--- a/lib/Model/OrderTypeStrict.php
+++ b/lib/Model/OrderTypeStrict.php
@@ -28,7 +28,7 @@
* OrderTypeStrict Class Doc Comment
*
* @category Class
- * @description Order Type
+ * @description The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
* @package SnapTrade
*/
class OrderTypeStrict
diff --git a/lib/Model/OrderUpdatedResponse.php b/lib/Model/OrderUpdatedResponse.php
new file mode 100644
index 0000000..3fac5da
--- /dev/null
+++ b/lib/Model/OrderUpdatedResponse.php
@@ -0,0 +1,443 @@
+
+ */
+class OrderUpdatedResponse implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'OrderUpdatedResponse';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'brokerage_order_id' => 'string',
+ 'order' => '\SnapTrade\Model\AccountOrderRecord'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'brokerage_order_id' => null,
+ 'order' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'brokerage_order_id' => false,
+ 'order' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'brokerage_order_id' => 'brokerage_order_id',
+ 'order' => 'order'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'brokerage_order_id' => 'setBrokerageOrderId',
+ 'order' => 'setOrder'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'brokerage_order_id' => 'getBrokerageOrderId',
+ 'order' => 'getOrder'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('brokerage_order_id', $data ?? [], null);
+ $this->setIfExists('order', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['brokerage_order_id'] === null) {
+ $invalidProperties[] = "'brokerage_order_id' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets brokerage_order_id
+ *
+ * @return string
+ */
+ public function getBrokerageOrderId()
+ {
+ return $this->container['brokerage_order_id'];
+ }
+
+ /**
+ * Sets brokerage_order_id
+ *
+ * @param string $brokerage_order_id Order ID returned by brokerage. This is the unique identifier for the order in the brokerage system.
+ *
+ * @return self
+ */
+ public function setBrokerageOrderId($brokerage_order_id)
+ {
+
+ if (is_null($brokerage_order_id)) {
+ throw new \InvalidArgumentException('non-nullable brokerage_order_id cannot be null');
+ }
+
+ $this->container['brokerage_order_id'] = $brokerage_order_id;
+
+ return $this;
+ }
+
+ /**
+ * Gets order
+ *
+ * @return \SnapTrade\Model\AccountOrderRecord|null
+ */
+ public function getOrder()
+ {
+ return $this->container['order'];
+ }
+
+ /**
+ * Sets order
+ *
+ * @param \SnapTrade\Model\AccountOrderRecord|null $order order
+ *
+ * @return self
+ */
+ public function setOrder($order)
+ {
+
+ if (is_null($order)) {
+ throw new \InvalidArgumentException('non-nullable order cannot be null');
+ }
+
+ $this->container['order'] = $order;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/PaginatedUniversalActivity.php b/lib/Model/PaginatedUniversalActivity.php
new file mode 100644
index 0000000..3fe7006
--- /dev/null
+++ b/lib/Model/PaginatedUniversalActivity.php
@@ -0,0 +1,441 @@
+
+ */
+class PaginatedUniversalActivity implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'PaginatedUniversalActivity';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'data' => '\SnapTrade\Model\AccountUniversalActivity[]',
+ 'pagination' => '\SnapTrade\Model\PaginationDetails'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'data' => null,
+ 'pagination' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'data' => false,
+ 'pagination' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'data' => 'data',
+ 'pagination' => 'pagination'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'data' => 'setData',
+ 'pagination' => 'setPagination'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'data' => 'getData',
+ 'pagination' => 'getPagination'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('data', $data ?? [], null);
+ $this->setIfExists('pagination', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets data
+ *
+ * @return \SnapTrade\Model\AccountUniversalActivity[]|null
+ */
+ public function getData()
+ {
+ return $this->container['data'];
+ }
+
+ /**
+ * Sets data
+ *
+ * @param \SnapTrade\Model\AccountUniversalActivity[]|null $data data
+ *
+ * @return self
+ */
+ public function setData($data)
+ {
+
+ if (is_null($data)) {
+ throw new \InvalidArgumentException('non-nullable data cannot be null');
+ }
+
+ $this->container['data'] = $data;
+
+ return $this;
+ }
+
+ /**
+ * Gets pagination
+ *
+ * @return \SnapTrade\Model\PaginationDetails|null
+ */
+ public function getPagination()
+ {
+ return $this->container['pagination'];
+ }
+
+ /**
+ * Sets pagination
+ *
+ * @param \SnapTrade\Model\PaginationDetails|null $pagination pagination
+ *
+ * @return self
+ */
+ public function setPagination($pagination)
+ {
+
+ if (is_null($pagination)) {
+ throw new \InvalidArgumentException('non-nullable pagination cannot be null');
+ }
+
+ $this->container['pagination'] = $pagination;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/PaginationDetails.php b/lib/Model/PaginationDetails.php
new file mode 100644
index 0000000..885e151
--- /dev/null
+++ b/lib/Model/PaginationDetails.php
@@ -0,0 +1,477 @@
+
+ */
+class PaginationDetails implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'PaginationDetails';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'offset' => 'int',
+ 'limit' => 'int',
+ 'total' => 'int'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'offset' => null,
+ 'limit' => null,
+ 'total' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'offset' => false,
+ 'limit' => false,
+ 'total' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'offset' => 'offset',
+ 'limit' => 'limit',
+ 'total' => 'total'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'offset' => 'setOffset',
+ 'limit' => 'setLimit',
+ 'total' => 'setTotal'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'offset' => 'getOffset',
+ 'limit' => 'getLimit',
+ 'total' => 'getTotal'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('offset', $data ?? [], null);
+ $this->setIfExists('limit', $data ?? [], null);
+ $this->setIfExists('total', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets offset
+ *
+ * @return int|null
+ */
+ public function getOffset()
+ {
+ return $this->container['offset'];
+ }
+
+ /**
+ * Sets offset
+ *
+ * @param int|null $offset The starting point of the paginated results.
+ *
+ * @return self
+ */
+ public function setOffset($offset)
+ {
+
+ if (is_null($offset)) {
+ throw new \InvalidArgumentException('non-nullable offset cannot be null');
+ }
+
+ $this->container['offset'] = $offset;
+
+ return $this;
+ }
+
+ /**
+ * Gets limit
+ *
+ * @return int|null
+ */
+ public function getLimit()
+ {
+ return $this->container['limit'];
+ }
+
+ /**
+ * Sets limit
+ *
+ * @param int|null $limit The maximum number of items to return in the response.
+ *
+ * @return self
+ */
+ public function setLimit($limit)
+ {
+
+ if (is_null($limit)) {
+ throw new \InvalidArgumentException('non-nullable limit cannot be null');
+ }
+
+ $this->container['limit'] = $limit;
+
+ return $this;
+ }
+
+ /**
+ * Gets total
+ *
+ * @return int|null
+ */
+ public function getTotal()
+ {
+ return $this->container['total'];
+ }
+
+ /**
+ * Sets total
+ *
+ * @param int|null $total The total number of items available to be returned over the API.
+ *
+ * @return self
+ */
+ public function setTotal($total)
+ {
+
+ if (is_null($total)) {
+ throw new \InvalidArgumentException('non-nullable total cannot be null');
+ }
+
+ $this->container['total'] = $total;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/PartnerData.php b/lib/Model/PartnerData.php
index 15e20a6..5e18096 100644
--- a/lib/Model/PartnerData.php
+++ b/lib/Model/PartnerData.php
@@ -30,7 +30,7 @@
* PartnerData Class Doc Comment
*
* @category Class
- * @description SnapTrade Partner metadata
+ * @description Configurations for your SnapTrade Client ID, including allowed brokerages and data access.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -51,18 +51,18 @@ class PartnerData implements ModelInterface, ArrayAccess, \JsonSerializable
* @var string[]
*/
protected static $openAPITypes = [
- 'redirect_uri' => 'string',
- 'allowed_brokerages' => '\SnapTrade\Model\Brokerage[]',
- 'name' => 'string',
'slug' => 'string',
+ 'name' => 'string',
'logo_url' => 'string',
- 'pin_required' => 'bool',
+ 'allowed_brokerages' => '\SnapTrade\Model\Brokerage[]',
'can_access_trades' => 'bool',
'can_access_holdings' => 'bool',
'can_access_account_history' => 'bool',
'can_access_reference_data' => 'bool',
'can_access_portfolio_management' => 'bool',
- 'can_access_orders' => 'bool'
+ 'can_access_orders' => 'bool',
+ 'redirect_uri' => 'string',
+ 'pin_required' => 'bool'
];
/**
@@ -73,18 +73,18 @@ class PartnerData implements ModelInterface, ArrayAccess, \JsonSerializable
* @psalm-var array
*/
protected static $openAPIFormats = [
- 'redirect_uri' => null,
- 'allowed_brokerages' => null,
- 'name' => null,
'slug' => null,
+ 'name' => null,
'logo_url' => null,
- 'pin_required' => null,
+ 'allowed_brokerages' => null,
'can_access_trades' => null,
'can_access_holdings' => null,
'can_access_account_history' => null,
'can_access_reference_data' => null,
'can_access_portfolio_management' => null,
- 'can_access_orders' => null
+ 'can_access_orders' => null,
+ 'redirect_uri' => null,
+ 'pin_required' => null
];
/**
@@ -93,18 +93,18 @@ class PartnerData implements ModelInterface, ArrayAccess, \JsonSerializable
* @var boolean[]
*/
protected static array $openAPINullables = [
- 'redirect_uri' => false,
- 'allowed_brokerages' => false,
+ 'slug' => false,
'name' => false,
- 'slug' => false,
'logo_url' => false,
- 'pin_required' => false,
+ 'allowed_brokerages' => false,
'can_access_trades' => false,
'can_access_holdings' => false,
'can_access_account_history' => false,
'can_access_reference_data' => false,
'can_access_portfolio_management' => false,
- 'can_access_orders' => false
+ 'can_access_orders' => false,
+ 'redirect_uri' => false,
+ 'pin_required' => false
];
/**
@@ -193,18 +193,18 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
- 'redirect_uri' => 'redirect_uri',
- 'allowed_brokerages' => 'allowed_brokerages',
- 'name' => 'name',
'slug' => 'slug',
+ 'name' => 'name',
'logo_url' => 'logo_url',
- 'pin_required' => 'pin_required',
+ 'allowed_brokerages' => 'allowed_brokerages',
'can_access_trades' => 'can_access_trades',
'can_access_holdings' => 'can_access_holdings',
'can_access_account_history' => 'can_access_account_history',
'can_access_reference_data' => 'can_access_reference_data',
'can_access_portfolio_management' => 'can_access_portfolio_management',
- 'can_access_orders' => 'can_access_orders'
+ 'can_access_orders' => 'can_access_orders',
+ 'redirect_uri' => 'redirect_uri',
+ 'pin_required' => 'pin_required'
];
/**
@@ -213,18 +213,18 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
- 'redirect_uri' => 'setRedirectUri',
- 'allowed_brokerages' => 'setAllowedBrokerages',
- 'name' => 'setName',
'slug' => 'setSlug',
+ 'name' => 'setName',
'logo_url' => 'setLogoUrl',
- 'pin_required' => 'setPinRequired',
+ 'allowed_brokerages' => 'setAllowedBrokerages',
'can_access_trades' => 'setCanAccessTrades',
'can_access_holdings' => 'setCanAccessHoldings',
'can_access_account_history' => 'setCanAccessAccountHistory',
'can_access_reference_data' => 'setCanAccessReferenceData',
'can_access_portfolio_management' => 'setCanAccessPortfolioManagement',
- 'can_access_orders' => 'setCanAccessOrders'
+ 'can_access_orders' => 'setCanAccessOrders',
+ 'redirect_uri' => 'setRedirectUri',
+ 'pin_required' => 'setPinRequired'
];
/**
@@ -233,18 +233,18 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
- 'redirect_uri' => 'getRedirectUri',
- 'allowed_brokerages' => 'getAllowedBrokerages',
- 'name' => 'getName',
'slug' => 'getSlug',
+ 'name' => 'getName',
'logo_url' => 'getLogoUrl',
- 'pin_required' => 'getPinRequired',
+ 'allowed_brokerages' => 'getAllowedBrokerages',
'can_access_trades' => 'getCanAccessTrades',
'can_access_holdings' => 'getCanAccessHoldings',
'can_access_account_history' => 'getCanAccessAccountHistory',
'can_access_reference_data' => 'getCanAccessReferenceData',
'can_access_portfolio_management' => 'getCanAccessPortfolioManagement',
- 'can_access_orders' => 'getCanAccessOrders'
+ 'can_access_orders' => 'getCanAccessOrders',
+ 'redirect_uri' => 'getRedirectUri',
+ 'pin_required' => 'getPinRequired'
];
/**
@@ -304,18 +304,18 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
- $this->setIfExists('redirect_uri', $data ?? [], null);
- $this->setIfExists('allowed_brokerages', $data ?? [], null);
- $this->setIfExists('name', $data ?? [], null);
$this->setIfExists('slug', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
$this->setIfExists('logo_url', $data ?? [], null);
- $this->setIfExists('pin_required', $data ?? [], null);
+ $this->setIfExists('allowed_brokerages', $data ?? [], null);
$this->setIfExists('can_access_trades', $data ?? [], null);
$this->setIfExists('can_access_holdings', $data ?? [], null);
$this->setIfExists('can_access_account_history', $data ?? [], null);
$this->setIfExists('can_access_reference_data', $data ?? [], null);
$this->setIfExists('can_access_portfolio_management', $data ?? [], null);
$this->setIfExists('can_access_orders', $data ?? [], null);
+ $this->setIfExists('redirect_uri', $data ?? [], null);
+ $this->setIfExists('pin_required', $data ?? [], null);
}
/**
@@ -361,59 +361,30 @@ public function valid()
/**
- * Gets redirect_uri
+ * Gets slug
*
* @return string|null
*/
- public function getRedirectUri()
- {
- return $this->container['redirect_uri'];
- }
-
- /**
- * Sets redirect_uri
- *
- * @param string|null $redirect_uri URI to redirect user back to after user is done adding brokerage connections
- *
- * @return self
- */
- public function setRedirectUri($redirect_uri)
- {
-
- if (is_null($redirect_uri)) {
- throw new \InvalidArgumentException('non-nullable redirect_uri cannot be null');
- }
-
- $this->container['redirect_uri'] = $redirect_uri;
-
- return $this;
- }
-
- /**
- * Gets allowed_brokerages
- *
- * @return \SnapTrade\Model\Brokerage[]|null
- */
- public function getAllowedBrokerages()
+ public function getSlug()
{
- return $this->container['allowed_brokerages'];
+ return $this->container['slug'];
}
/**
- * Sets allowed_brokerages
+ * Sets slug
*
- * @param \SnapTrade\Model\Brokerage[]|null $allowed_brokerages Brokerages that can be accessed by partners
+ * @param string|null $slug A short, unique identifier for your company or product.
*
* @return self
*/
- public function setAllowedBrokerages($allowed_brokerages)
+ public function setSlug($slug)
{
- if (is_null($allowed_brokerages)) {
- throw new \InvalidArgumentException('non-nullable allowed_brokerages cannot be null');
+ if (is_null($slug)) {
+ throw new \InvalidArgumentException('non-nullable slug cannot be null');
}
- $this->container['allowed_brokerages'] = $allowed_brokerages;
+ $this->container['slug'] = $slug;
return $this;
}
@@ -431,7 +402,7 @@ public function getName()
/**
* Sets name
*
- * @param string|null $name Name of Snaptrade Partner
+ * @param string|null $name Your company or product name.
*
* @return self
*/
@@ -447,35 +418,6 @@ public function setName($name)
return $this;
}
- /**
- * Gets slug
- *
- * @return string|null
- */
- public function getSlug()
- {
- return $this->container['slug'];
- }
-
- /**
- * Sets slug
- *
- * @param string|null $slug Slug of Snaptrade Partner
- *
- * @return self
- */
- public function setSlug($slug)
- {
-
- if (is_null($slug)) {
- throw new \InvalidArgumentException('non-nullable slug cannot be null');
- }
-
- $this->container['slug'] = $slug;
-
- return $this;
- }
-
/**
* Gets logo_url
*
@@ -489,7 +431,7 @@ public function getLogoUrl()
/**
* Sets logo_url
*
- * @param string|null $logo_url URL to partner's logo
+ * @param string|null $logo_url URL to your company or product logo.
*
* @return self
*/
@@ -506,30 +448,30 @@ public function setLogoUrl($logo_url)
}
/**
- * Gets pin_required
+ * Gets allowed_brokerages
*
- * @return bool|null
+ * @return \SnapTrade\Model\Brokerage[]|null
*/
- public function getPinRequired()
+ public function getAllowedBrokerages()
{
- return $this->container['pin_required'];
+ return $this->container['allowed_brokerages'];
}
/**
- * Sets pin_required
+ * Sets allowed_brokerages
*
- * @param bool|null $pin_required Shows if pin is required by users to access connection page
+ * @param \SnapTrade\Model\Brokerage[]|null $allowed_brokerages Brokerages that can be accessed by your Client ID.
*
* @return self
*/
- public function setPinRequired($pin_required)
+ public function setAllowedBrokerages($allowed_brokerages)
{
- if (is_null($pin_required)) {
- throw new \InvalidArgumentException('non-nullable pin_required cannot be null');
+ if (is_null($allowed_brokerages)) {
+ throw new \InvalidArgumentException('non-nullable allowed_brokerages cannot be null');
}
- $this->container['pin_required'] = $pin_required;
+ $this->container['allowed_brokerages'] = $allowed_brokerages;
return $this;
}
@@ -547,7 +489,7 @@ public function getCanAccessTrades()
/**
* Sets can_access_trades
*
- * @param bool|null $can_access_trades Shows if users of Snaptrade partners can access trade endpoints
+ * @param bool|null $can_access_trades Whether trading is enabled for your SnapTrade Client ID.
*
* @return self
*/
@@ -576,7 +518,7 @@ public function getCanAccessHoldings()
/**
* Sets can_access_holdings
*
- * @param bool|null $can_access_holdings Shows if Snaptrade partners can get user holdings data
+ * @param bool|null $can_access_holdings Whether holdings data is enabled for your SnapTrade Client ID.
*
* @return self
*/
@@ -605,7 +547,7 @@ public function getCanAccessAccountHistory()
/**
* Sets can_access_account_history
*
- * @param bool|null $can_access_account_history Shows if Snaptrade partners can get users account history data
+ * @param bool|null $can_access_account_history Whether account historical transactions is enabled for your SnapTrade Client ID.
*
* @return self
*/
@@ -634,7 +576,7 @@ public function getCanAccessReferenceData()
/**
* Sets can_access_reference_data
*
- * @param bool|null $can_access_reference_data Shows if Snaptrade partners can get users holdings data
+ * @param bool|null $can_access_reference_data Whether reference data is enabled for your SnapTrade Client ID.
*
* @return self
*/
@@ -663,7 +605,7 @@ public function getCanAccessPortfolioManagement()
/**
* Sets can_access_portfolio_management
*
- * @param bool|null $can_access_portfolio_management Shows if users Snaptrade partners can access portfolio group management features
+ * @param bool|null $can_access_portfolio_management Whether portfolio management is enabled for your SnapTrade Client ID.
*
* @return self
*/
@@ -692,7 +634,7 @@ public function getCanAccessOrders()
/**
* Sets can_access_orders
*
- * @param bool|null $can_access_orders Shows if Snaptrade partners can get users account order history
+ * @param bool|null $can_access_orders Whether recent order history is enabled for your SnapTrade Client ID.
*
* @return self
*/
@@ -707,6 +649,66 @@ public function setCanAccessOrders($can_access_orders)
return $this;
}
+
+ /**
+ * Gets redirect_uri
+ *
+ * @return string|null
+ */
+ public function getRedirectUri()
+ {
+ return $this->container['redirect_uri'];
+ }
+
+ /**
+ * Sets redirect_uri
+ *
+ * @param string|null $redirect_uri URI to redirect user back to after user is done adding brokerage connections.
+ *
+ * @return self
+ */
+ public function setRedirectUri($redirect_uri)
+ {
+
+ if (is_null($redirect_uri)) {
+ throw new \InvalidArgumentException('non-nullable redirect_uri cannot be null');
+ }
+
+ $this->container['redirect_uri'] = $redirect_uri;
+
+ return $this;
+ }
+
+ /**
+ * Gets pin_required
+ *
+ * @return bool|null
+ * @deprecated
+ */
+ public function getPinRequired()
+ {
+ return $this->container['pin_required'];
+ }
+
+ /**
+ * Sets pin_required
+ *
+ * @param bool|null $pin_required Shows if pin is required by users to access connection page. This field has been deprecated.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setPinRequired($pin_required)
+ {
+
+ if (is_null($pin_required)) {
+ throw new \InvalidArgumentException('non-nullable pin_required cannot be null');
+ }
+
+ $this->container['pin_required'] = $pin_required;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/Position.php b/lib/Model/Position.php
index 8cad4a2..a5911d1 100644
--- a/lib/Model/Position.php
+++ b/lib/Model/Position.php
@@ -55,8 +55,11 @@ class Position implements ModelInterface, ArrayAccess, \JsonSerializable
'units' => 'float',
'price' => 'float',
'open_pnl' => 'float',
+ 'average_purchase_price' => 'float',
'fractional_units' => 'float',
- 'average_purchase_price' => 'float'
+ 'currency' => '\SnapTrade\Model\PositionCurrency',
+ 'cash_equivalent' => 'bool',
+ 'tax_lots' => '\SnapTrade\Model\TaxLot[]'
];
/**
@@ -71,8 +74,11 @@ class Position implements ModelInterface, ArrayAccess, \JsonSerializable
'units' => null,
'price' => null,
'open_pnl' => null,
+ 'average_purchase_price' => null,
'fractional_units' => null,
- 'average_purchase_price' => null
+ 'currency' => null,
+ 'cash_equivalent' => null,
+ 'tax_lots' => null
];
/**
@@ -85,8 +91,11 @@ class Position implements ModelInterface, ArrayAccess, \JsonSerializable
'units' => true,
'price' => true,
'open_pnl' => true,
+ 'average_purchase_price' => true,
'fractional_units' => true,
- 'average_purchase_price' => true
+ 'currency' => false,
+ 'cash_equivalent' => true,
+ 'tax_lots' => false
];
/**
@@ -179,8 +188,11 @@ public function isNullableSetToNull(string $property): bool
'units' => 'units',
'price' => 'price',
'open_pnl' => 'open_pnl',
+ 'average_purchase_price' => 'average_purchase_price',
'fractional_units' => 'fractional_units',
- 'average_purchase_price' => 'average_purchase_price'
+ 'currency' => 'currency',
+ 'cash_equivalent' => 'cash_equivalent',
+ 'tax_lots' => 'tax_lots'
];
/**
@@ -193,8 +205,11 @@ public function isNullableSetToNull(string $property): bool
'units' => 'setUnits',
'price' => 'setPrice',
'open_pnl' => 'setOpenPnl',
+ 'average_purchase_price' => 'setAveragePurchasePrice',
'fractional_units' => 'setFractionalUnits',
- 'average_purchase_price' => 'setAveragePurchasePrice'
+ 'currency' => 'setCurrency',
+ 'cash_equivalent' => 'setCashEquivalent',
+ 'tax_lots' => 'setTaxLots'
];
/**
@@ -207,8 +222,11 @@ public function isNullableSetToNull(string $property): bool
'units' => 'getUnits',
'price' => 'getPrice',
'open_pnl' => 'getOpenPnl',
+ 'average_purchase_price' => 'getAveragePurchasePrice',
'fractional_units' => 'getFractionalUnits',
- 'average_purchase_price' => 'getAveragePurchasePrice'
+ 'currency' => 'getCurrency',
+ 'cash_equivalent' => 'getCashEquivalent',
+ 'tax_lots' => 'getTaxLots'
];
/**
@@ -272,8 +290,11 @@ public function __construct(array $data = null)
$this->setIfExists('units', $data ?? [], null);
$this->setIfExists('price', $data ?? [], null);
$this->setIfExists('open_pnl', $data ?? [], null);
- $this->setIfExists('fractional_units', $data ?? [], null);
$this->setIfExists('average_purchase_price', $data ?? [], null);
+ $this->setIfExists('fractional_units', $data ?? [], null);
+ $this->setIfExists('currency', $data ?? [], null);
+ $this->setIfExists('cash_equivalent', $data ?? [], null);
+ $this->setIfExists('tax_lots', $data ?? [], null);
}
/**
@@ -455,6 +476,42 @@ public function setOpenPnl($open_pnl)
return $this;
}
+ /**
+ * Gets average_purchase_price
+ *
+ * @return float|null
+ */
+ public function getAveragePurchasePrice()
+ {
+ return $this->container['average_purchase_price'];
+ }
+
+ /**
+ * Sets average_purchase_price
+ *
+ * @param float|null $average_purchase_price Cost basis _per share_ of this position.
+ *
+ * @return self
+ */
+ public function setAveragePurchasePrice($average_purchase_price)
+ {
+
+ if (is_null($average_purchase_price)) {
+ array_push($this->openAPINullablesSetToNull, 'average_purchase_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('average_purchase_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['average_purchase_price'] = $average_purchase_price;
+
+ return $this;
+ }
+
/**
* Gets fractional_units
*
@@ -494,37 +551,95 @@ public function setFractionalUnits($fractional_units)
}
/**
- * Gets average_purchase_price
+ * Gets currency
*
- * @return float|null
+ * @return \SnapTrade\Model\PositionCurrency|null
*/
- public function getAveragePurchasePrice()
+ public function getCurrency()
{
- return $this->container['average_purchase_price'];
+ return $this->container['currency'];
}
/**
- * Sets average_purchase_price
+ * Sets currency
*
- * @param float|null $average_purchase_price Cost basis _per share_ of this position.
+ * @param \SnapTrade\Model\PositionCurrency|null $currency currency
*
* @return self
*/
- public function setAveragePurchasePrice($average_purchase_price)
+ public function setCurrency($currency)
{
- if (is_null($average_purchase_price)) {
- array_push($this->openAPINullablesSetToNull, 'average_purchase_price');
+ if (is_null($currency)) {
+ throw new \InvalidArgumentException('non-nullable currency cannot be null');
+ }
+
+ $this->container['currency'] = $currency;
+
+ return $this;
+ }
+
+ /**
+ * Gets cash_equivalent
+ *
+ * @return bool|null
+ */
+ public function getCashEquivalent()
+ {
+ return $this->container['cash_equivalent'];
+ }
+
+ /**
+ * Sets cash_equivalent
+ *
+ * @param bool|null $cash_equivalent If the position is a cash equivalent (usually a money market fund) that is also counted in account cash balance and buying power
+ *
+ * @return self
+ */
+ public function setCashEquivalent($cash_equivalent)
+ {
+
+ if (is_null($cash_equivalent)) {
+ array_push($this->openAPINullablesSetToNull, 'cash_equivalent');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('average_purchase_price', $nullablesSetToNull);
+ $index = array_search('cash_equivalent', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['average_purchase_price'] = $average_purchase_price;
+ $this->container['cash_equivalent'] = $cash_equivalent;
+
+ return $this;
+ }
+
+ /**
+ * Gets tax_lots
+ *
+ * @return \SnapTrade\Model\TaxLot[]|null
+ */
+ public function getTaxLots()
+ {
+ return $this->container['tax_lots'];
+ }
+
+ /**
+ * Sets tax_lots
+ *
+ * @param \SnapTrade\Model\TaxLot[]|null $tax_lots List of tax lots for the given position (disabled by default, contact support if needed)
+ *
+ * @return self
+ */
+ public function setTaxLots($tax_lots)
+ {
+
+ if (is_null($tax_lots)) {
+ throw new \InvalidArgumentException('non-nullable tax_lots cannot be null');
+ }
+
+ $this->container['tax_lots'] = $tax_lots;
return $this;
}
diff --git a/lib/Model/PositionCurrency.php b/lib/Model/PositionCurrency.php
new file mode 100644
index 0000000..623bc3a
--- /dev/null
+++ b/lib/Model/PositionCurrency.php
@@ -0,0 +1,477 @@
+
+ */
+class PositionCurrency implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'Position_currency';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'id' => 'string',
+ 'code' => 'string',
+ 'name' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'id' => 'uuid',
+ 'code' => null,
+ 'name' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'id' => false,
+ 'code' => false,
+ 'name' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'id' => 'id',
+ 'code' => 'code',
+ 'name' => 'name'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'id' => 'setId',
+ 'code' => 'setCode',
+ 'name' => 'setName'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'id' => 'getId',
+ 'code' => 'getCode',
+ 'name' => 'getName'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('id', $data ?? [], null);
+ $this->setIfExists('code', $data ?? [], null);
+ $this->setIfExists('name', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets id
+ *
+ * @return string|null
+ */
+ public function getId()
+ {
+ return $this->container['id'];
+ }
+
+ /**
+ * Sets id
+ *
+ * @param string|null $id Unique identifier for the currency. This is the UUID used to reference the currency in SnapTrade.
+ *
+ * @return self
+ */
+ public function setId($id)
+ {
+
+ if (is_null($id)) {
+ throw new \InvalidArgumentException('non-nullable id cannot be null');
+ }
+
+ $this->container['id'] = $id;
+
+ return $this;
+ }
+
+ /**
+ * Gets code
+ *
+ * @return string|null
+ */
+ public function getCode()
+ {
+ return $this->container['code'];
+ }
+
+ /**
+ * Sets code
+ *
+ * @param string|null $code The ISO-4217 currency code for the currency.
+ *
+ * @return self
+ */
+ public function setCode($code)
+ {
+
+ if (is_null($code)) {
+ throw new \InvalidArgumentException('non-nullable code cannot be null');
+ }
+
+ $this->container['code'] = $code;
+
+ return $this;
+ }
+
+ /**
+ * Gets name
+ *
+ * @return string|null
+ */
+ public function getName()
+ {
+ return $this->container['name'];
+ }
+
+ /**
+ * Sets name
+ *
+ * @param string|null $name A human-friendly name of the currency.
+ *
+ * @return self
+ */
+ public function setName($name)
+ {
+
+ if (is_null($name)) {
+ throw new \InvalidArgumentException('non-nullable name cannot be null');
+ }
+
+ $this->container['name'] = $name;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/PositionSymbol.php b/lib/Model/PositionSymbol.php
index 489266f..d442d95 100644
--- a/lib/Model/PositionSymbol.php
+++ b/lib/Model/PositionSymbol.php
@@ -51,9 +51,9 @@ class PositionSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
* @var string[]
*/
protected static $openAPITypes = [
+ 'symbol' => '\SnapTrade\Model\UniversalSymbol',
'id' => 'string',
'description' => 'string',
- 'symbol' => '\SnapTrade\Model\UniversalSymbol',
'local_id' => 'string',
'is_quotable' => 'bool',
'is_tradable' => 'bool'
@@ -67,9 +67,9 @@ class PositionSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
* @psalm-var array
*/
protected static $openAPIFormats = [
+ 'symbol' => null,
'id' => 'uuid',
'description' => null,
- 'symbol' => null,
'local_id' => null,
'is_quotable' => null,
'is_tradable' => null
@@ -81,9 +81,9 @@ class PositionSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
* @var boolean[]
*/
protected static array $openAPINullables = [
- 'id' => false,
+ 'symbol' => false,
+ 'id' => false,
'description' => false,
- 'symbol' => false,
'local_id' => true,
'is_quotable' => false,
'is_tradable' => false
@@ -175,9 +175,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
+ 'symbol' => 'symbol',
'id' => 'id',
'description' => 'description',
- 'symbol' => 'symbol',
'local_id' => 'local_id',
'is_quotable' => 'is_quotable',
'is_tradable' => 'is_tradable'
@@ -189,9 +189,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
+ 'symbol' => 'setSymbol',
'id' => 'setId',
'description' => 'setDescription',
- 'symbol' => 'setSymbol',
'local_id' => 'setLocalId',
'is_quotable' => 'setIsQuotable',
'is_tradable' => 'setIsTradable'
@@ -203,9 +203,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
+ 'symbol' => 'getSymbol',
'id' => 'getId',
'description' => 'getDescription',
- 'symbol' => 'getSymbol',
'local_id' => 'getLocalId',
'is_quotable' => 'getIsQuotable',
'is_tradable' => 'getIsTradable'
@@ -268,9 +268,9 @@ public function getModelName()
*/
public function __construct(array $data = null)
{
+ $this->setIfExists('symbol', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
- $this->setIfExists('symbol', $data ?? [], null);
$this->setIfExists('local_id', $data ?? [], null);
$this->setIfExists('is_quotable', $data ?? [], null);
$this->setIfExists('is_tradable', $data ?? [], null);
@@ -318,6 +318,35 @@ public function valid()
}
+ /**
+ * Gets symbol
+ *
+ * @return \SnapTrade\Model\UniversalSymbol|null
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param \SnapTrade\Model\UniversalSymbol|null $symbol symbol
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
/**
* Gets id
*
@@ -380,35 +409,6 @@ public function setDescription($description)
return $this;
}
- /**
- * Gets symbol
- *
- * @return \SnapTrade\Model\UniversalSymbol|null
- */
- public function getSymbol()
- {
- return $this->container['symbol'];
- }
-
- /**
- * Sets symbol
- *
- * @param \SnapTrade\Model\UniversalSymbol|null $symbol symbol
- *
- * @return self
- */
- public function setSymbol($symbol)
- {
-
- if (is_null($symbol)) {
- throw new \InvalidArgumentException('non-nullable symbol cannot be null');
- }
-
- $this->container['symbol'] = $symbol;
-
- return $this;
- }
-
/**
* Gets local_id
*
diff --git a/lib/Model/OptionsGetOptionStrategyRequest.php b/lib/Model/RateOfReturnObject.php
similarity index 71%
rename from lib/Model/OptionsGetOptionStrategyRequest.php
rename to lib/Model/RateOfReturnObject.php
index 591ab06..6843c47 100644
--- a/lib/Model/OptionsGetOptionStrategyRequest.php
+++ b/lib/Model/RateOfReturnObject.php
@@ -1,6 +1,6 @@
*/
-class OptionsGetOptionStrategyRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+class RateOfReturnObject implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
@@ -42,7 +43,7 @@ class OptionsGetOptionStrategyRequest implements ModelInterface, ArrayAccess, \J
*
* @var string
*/
- protected static $openAPIModelName = 'Options_getOptionStrategy_request';
+ protected static $openAPIModelName = 'RateOfReturnObject';
/**
* Array of property to type mappings. Used for (de)serialization
@@ -50,9 +51,9 @@ class OptionsGetOptionStrategyRequest implements ModelInterface, ArrayAccess, \J
* @var string[]
*/
protected static $openAPITypes = [
- 'underlying_symbol_id' => 'string',
- 'legs' => '\SnapTrade\Model\OptionLeg[]',
- 'strategy_type' => 'string'
+ 'timeframe' => 'string',
+ 'return_percent' => 'float',
+ 'created_date' => '\DateTime'
];
/**
@@ -63,9 +64,9 @@ class OptionsGetOptionStrategyRequest implements ModelInterface, ArrayAccess, \J
* @psalm-var array
*/
protected static $openAPIFormats = [
- 'underlying_symbol_id' => 'uuid',
- 'legs' => null,
- 'strategy_type' => null
+ 'timeframe' => null,
+ 'return_percent' => null,
+ 'created_date' => 'date-time'
];
/**
@@ -74,9 +75,9 @@ class OptionsGetOptionStrategyRequest implements ModelInterface, ArrayAccess, \J
* @var boolean[]
*/
protected static array $openAPINullables = [
- 'underlying_symbol_id' => false,
- 'legs' => false,
- 'strategy_type' => false
+ 'timeframe' => false,
+ 'return_percent' => false,
+ 'created_date' => false
];
/**
@@ -165,9 +166,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $attributeMap = [
- 'underlying_symbol_id' => 'underlying_symbol_id',
- 'legs' => 'legs',
- 'strategy_type' => 'strategy_type'
+ 'timeframe' => 'timeframe',
+ 'return_percent' => 'return_percent',
+ 'created_date' => 'created_date'
];
/**
@@ -176,9 +177,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $setters = [
- 'underlying_symbol_id' => 'setUnderlyingSymbolId',
- 'legs' => 'setLegs',
- 'strategy_type' => 'setStrategyType'
+ 'timeframe' => 'setTimeframe',
+ 'return_percent' => 'setReturnPercent',
+ 'created_date' => 'setCreatedDate'
];
/**
@@ -187,9 +188,9 @@ public function isNullableSetToNull(string $property): bool
* @var string[]
*/
protected static $getters = [
- 'underlying_symbol_id' => 'getUnderlyingSymbolId',
- 'legs' => 'getLegs',
- 'strategy_type' => 'getStrategyType'
+ 'timeframe' => 'getTimeframe',
+ 'return_percent' => 'getReturnPercent',
+ 'created_date' => 'getCreatedDate'
];
/**
@@ -233,17 +234,25 @@ public function getModelName()
return self::$openAPIModelName;
}
- public const STRATEGY_TYPE_CUSTOM = 'CUSTOM';
+ public const TIMEFRAME_ALL = 'ALL';
+ public const TIMEFRAME__1_Y = '1Y';
+ public const TIMEFRAME__6_M = '6M';
+ public const TIMEFRAME__3_M = '3M';
+ public const TIMEFRAME__1_M = '1M';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
- public function getStrategyTypeAllowableValues()
+ public function getTimeframeAllowableValues()
{
return [
- self::STRATEGY_TYPE_CUSTOM,
+ self::TIMEFRAME_ALL,
+ self::TIMEFRAME__1_Y,
+ self::TIMEFRAME__6_M,
+ self::TIMEFRAME__3_M,
+ self::TIMEFRAME__1_M,
];
}
@@ -262,9 +271,9 @@ public function getStrategyTypeAllowableValues()
*/
public function __construct(array $data = null)
{
- $this->setIfExists('underlying_symbol_id', $data ?? [], null);
- $this->setIfExists('legs', $data ?? [], null);
- $this->setIfExists('strategy_type', $data ?? [], null);
+ $this->setIfExists('timeframe', $data ?? [], null);
+ $this->setIfExists('return_percent', $data ?? [], null);
+ $this->setIfExists('created_date', $data ?? [], null);
}
/**
@@ -294,20 +303,11 @@ public function listInvalidProperties()
{
$invalidProperties = [];
- if ($this->container['underlying_symbol_id'] === null) {
- $invalidProperties[] = "'underlying_symbol_id' can't be null";
- }
- if ($this->container['legs'] === null) {
- $invalidProperties[] = "'legs' can't be null";
- }
- if ($this->container['strategy_type'] === null) {
- $invalidProperties[] = "'strategy_type' can't be null";
- }
- $allowedValues = $this->getStrategyTypeAllowableValues();
- if (!is_null($this->container['strategy_type']) && !in_array($this->container['strategy_type'], $allowedValues, true)) {
+ $allowedValues = $this->getTimeframeAllowableValues();
+ if (!is_null($this->container['timeframe']) && !in_array($this->container['timeframe'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
- "invalid value '%s' for 'strategy_type', must be one of '%s'",
- $this->container['strategy_type'],
+ "invalid value '%s' for 'timeframe', must be one of '%s'",
+ $this->container['timeframe'],
implode("', '", $allowedValues)
);
}
@@ -328,98 +328,98 @@ public function valid()
/**
- * Gets underlying_symbol_id
+ * Gets timeframe
*
- * @return string
+ * @return string|null
*/
- public function getUnderlyingSymbolId()
+ public function getTimeframe()
{
- return $this->container['underlying_symbol_id'];
+ return $this->container['timeframe'];
}
/**
- * Sets underlying_symbol_id
+ * Sets timeframe
*
- * @param string $underlying_symbol_id underlying_symbol_id
+ * @param string|null $timeframe The timeframe this return percent is reflecting
*
* @return self
*/
- public function setUnderlyingSymbolId($underlying_symbol_id)
+ public function setTimeframe($timeframe)
{
+ $allowedValues = $this->getTimeframeAllowableValues();
+ if (!is_null($timeframe) && !in_array($timeframe, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'timeframe', must be one of '%s'",
+ $timeframe,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
- if (is_null($underlying_symbol_id)) {
- throw new \InvalidArgumentException('non-nullable underlying_symbol_id cannot be null');
+ if (is_null($timeframe)) {
+ throw new \InvalidArgumentException('non-nullable timeframe cannot be null');
}
- $this->container['underlying_symbol_id'] = $underlying_symbol_id;
+ $this->container['timeframe'] = $timeframe;
return $this;
}
/**
- * Gets legs
+ * Gets return_percent
*
- * @return \SnapTrade\Model\OptionLeg[]
+ * @return float|null
*/
- public function getLegs()
+ public function getReturnPercent()
{
- return $this->container['legs'];
+ return $this->container['return_percent'];
}
/**
- * Sets legs
+ * Sets return_percent
*
- * @param \SnapTrade\Model\OptionLeg[] $legs legs
+ * @param float|null $return_percent The percent return of the portfolio, directly from the brokerage. 5.97 indicates a 5.97% return over the timeframe
*
* @return self
*/
- public function setLegs($legs)
+ public function setReturnPercent($return_percent)
{
- if (is_null($legs)) {
- throw new \InvalidArgumentException('non-nullable legs cannot be null');
+ if (is_null($return_percent)) {
+ throw new \InvalidArgumentException('non-nullable return_percent cannot be null');
}
- $this->container['legs'] = $legs;
+ $this->container['return_percent'] = $return_percent;
return $this;
}
/**
- * Gets strategy_type
+ * Gets created_date
*
- * @return string
+ * @return \DateTime|null
*/
- public function getStrategyType()
+ public function getCreatedDate()
{
- return $this->container['strategy_type'];
+ return $this->container['created_date'];
}
/**
- * Sets strategy_type
+ * Sets created_date
*
- * @param string $strategy_type strategy_type
+ * @param \DateTime|null $created_date The date this was fetched
*
* @return self
*/
- public function setStrategyType($strategy_type)
+ public function setCreatedDate($created_date)
{
- $allowedValues = $this->getStrategyTypeAllowableValues();
- if (!in_array($strategy_type, $allowedValues, true)) {
- throw new \InvalidArgumentException(
- sprintf(
- "Invalid value '%s' for 'strategy_type', must be one of '%s'",
- $strategy_type,
- implode("', '", $allowedValues)
- )
- );
- }
- if (is_null($strategy_type)) {
- throw new \InvalidArgumentException('non-nullable strategy_type cannot be null');
+ if (is_null($created_date)) {
+ throw new \InvalidArgumentException('non-nullable created_date cannot be null');
}
- $this->container['strategy_type'] = $strategy_type;
+ $this->container['created_date'] = $created_date;
return $this;
}
diff --git a/lib/Model/RateOfReturnResponse.php b/lib/Model/RateOfReturnResponse.php
new file mode 100644
index 0000000..963660c
--- /dev/null
+++ b/lib/Model/RateOfReturnResponse.php
@@ -0,0 +1,405 @@
+
+ */
+class RateOfReturnResponse implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'RateOfReturnResponse';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'data' => '\SnapTrade\Model\RateOfReturnObject[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'data' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'data' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'data' => 'data'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'data' => 'setData'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'data' => 'getData'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('data', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets data
+ *
+ * @return \SnapTrade\Model\RateOfReturnObject[]|null
+ */
+ public function getData()
+ {
+ return $this->container['data'];
+ }
+
+ /**
+ * Sets data
+ *
+ * @param \SnapTrade\Model\RateOfReturnObject[]|null $data List of return percentages
+ *
+ * @return self
+ */
+ public function setData($data)
+ {
+
+ if (is_null($data)) {
+ throw new \InvalidArgumentException('non-nullable data cannot be null');
+ }
+
+ $this->container['data'] = $data;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/RecentOrdersResponse.php b/lib/Model/RecentOrdersResponse.php
new file mode 100644
index 0000000..1ff1a49
--- /dev/null
+++ b/lib/Model/RecentOrdersResponse.php
@@ -0,0 +1,405 @@
+
+ */
+class RecentOrdersResponse implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'RecentOrdersResponse';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'orders' => '\SnapTrade\Model\AccountOrderRecord[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'orders' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'orders' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'orders' => 'orders'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'orders' => 'setOrders'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'orders' => 'getOrders'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('orders', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets orders
+ *
+ * @return \SnapTrade\Model\AccountOrderRecord[]|null
+ */
+ public function getOrders()
+ {
+ return $this->container['orders'];
+ }
+
+ /**
+ * Sets orders
+ *
+ * @param \SnapTrade\Model\AccountOrderRecord[]|null $orders List of orders executed in the last 24 hours
+ *
+ * @return self
+ */
+ public function setOrders($orders)
+ {
+
+ if (is_null($orders)) {
+ throw new \InvalidArgumentException('non-nullable orders cannot be null');
+ }
+
+ $this->container['orders'] = $orders;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/SecurityType.php b/lib/Model/SecurityType.php
index c56b89a..29c3f31 100644
--- a/lib/Model/SecurityType.php
+++ b/lib/Model/SecurityType.php
@@ -346,7 +346,7 @@ public function getCode()
/**
* Sets code
*
- * @param string|null $code A short code representing the security type. For example, \"cs\" for Common Stock. Here are some common values: ad - ADR bnd - Bond cs - Common Stock cef - Closed End Fund et - ETF oef - Open Ended Fund ps - Preferred Stock rt - Right struct - Structured Product ut - Unit wi - When Issued wt - Warrant
+ * @param string|null $code A short code representing the security type. For example, \"cs\" for Common Stock. Here are some common values: - `ad` - ADR - `bnd` - Bond - `cs` - Common Stock - `cef` - Closed End Fund - `crypto` - Cryptocurrency - `et` - ETF - `oef` - Open Ended Fund - `pm` - Precious Metals - `ps` - Preferred Stock - `rt` - Right - `struct` - Structured Product - `ut` - Unit - `wi` - When Issued - `wt` - Warrant
*
* @return self
*/
diff --git a/lib/Model/SimpleOrderForm.php b/lib/Model/SimpleOrderForm.php
new file mode 100644
index 0000000..ff62728
--- /dev/null
+++ b/lib/Model/SimpleOrderForm.php
@@ -0,0 +1,787 @@
+
+ */
+class SimpleOrderForm implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'SimpleOrderForm';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'instrument' => '\SnapTrade\Model\TradingInstrument',
+ 'side' => '\SnapTrade\Model\ActionStrict',
+ 'type' => 'string',
+ 'time_in_force' => 'string',
+ 'amount' => 'float',
+ 'limit_price' => 'float',
+ 'stop_price' => 'float',
+ 'post_only' => 'bool',
+ 'expiration_date' => '\DateTime'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'instrument' => null,
+ 'side' => null,
+ 'type' => null,
+ 'time_in_force' => null,
+ 'amount' => 'decimal',
+ 'limit_price' => 'decimal',
+ 'stop_price' => 'decimal',
+ 'post_only' => null,
+ 'expiration_date' => 'date-time'
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'instrument' => false,
+ 'side' => false,
+ 'type' => false,
+ 'time_in_force' => false,
+ 'amount' => false,
+ 'limit_price' => false,
+ 'stop_price' => false,
+ 'post_only' => false,
+ 'expiration_date' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'instrument' => 'instrument',
+ 'side' => 'side',
+ 'type' => 'type',
+ 'time_in_force' => 'time_in_force',
+ 'amount' => 'amount',
+ 'limit_price' => 'limit_price',
+ 'stop_price' => 'stop_price',
+ 'post_only' => 'post_only',
+ 'expiration_date' => 'expiration_date'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'instrument' => 'setInstrument',
+ 'side' => 'setSide',
+ 'type' => 'setType',
+ 'time_in_force' => 'setTimeInForce',
+ 'amount' => 'setAmount',
+ 'limit_price' => 'setLimitPrice',
+ 'stop_price' => 'setStopPrice',
+ 'post_only' => 'setPostOnly',
+ 'expiration_date' => 'setExpirationDate'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'instrument' => 'getInstrument',
+ 'side' => 'getSide',
+ 'type' => 'getType',
+ 'time_in_force' => 'getTimeInForce',
+ 'amount' => 'getAmount',
+ 'limit_price' => 'getLimitPrice',
+ 'stop_price' => 'getStopPrice',
+ 'post_only' => 'getPostOnly',
+ 'expiration_date' => 'getExpirationDate'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const TYPE_MARKET = 'MARKET';
+ public const TYPE_LIMIT = 'LIMIT';
+ public const TYPE_STOP_LOSS_MARKET = 'STOP_LOSS_MARKET';
+ public const TYPE_STOP_LOSS_LIMIT = 'STOP_LOSS_LIMIT';
+ public const TYPE_TAKE_PROFIT_MARKET = 'TAKE_PROFIT_MARKET';
+ public const TYPE_TAKE_PROFIT_LIMIT = 'TAKE_PROFIT_LIMIT';
+ public const TIME_IN_FORCE_GTC = 'GTC';
+ public const TIME_IN_FORCE_FOK = 'FOK';
+ public const TIME_IN_FORCE_IOC = 'IOC';
+ public const TIME_IN_FORCE_GTD = 'GTD';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getTypeAllowableValues()
+ {
+ return [
+ self::TYPE_MARKET,
+ self::TYPE_LIMIT,
+ self::TYPE_STOP_LOSS_MARKET,
+ self::TYPE_STOP_LOSS_LIMIT,
+ self::TYPE_TAKE_PROFIT_MARKET,
+ self::TYPE_TAKE_PROFIT_LIMIT,
+ ];
+ }
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getTimeInForceAllowableValues()
+ {
+ return [
+ self::TIME_IN_FORCE_GTC,
+ self::TIME_IN_FORCE_FOK,
+ self::TIME_IN_FORCE_IOC,
+ self::TIME_IN_FORCE_GTD,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('instrument', $data ?? [], null);
+ $this->setIfExists('side', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ $this->setIfExists('time_in_force', $data ?? [], null);
+ $this->setIfExists('amount', $data ?? [], null);
+ $this->setIfExists('limit_price', $data ?? [], null);
+ $this->setIfExists('stop_price', $data ?? [], null);
+ $this->setIfExists('post_only', $data ?? [], null);
+ $this->setIfExists('expiration_date', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['instrument'] === null) {
+ $invalidProperties[] = "'instrument' can't be null";
+ }
+ if ($this->container['side'] === null) {
+ $invalidProperties[] = "'side' can't be null";
+ }
+ if ($this->container['type'] === null) {
+ $invalidProperties[] = "'type' can't be null";
+ }
+ $allowedValues = $this->getTypeAllowableValues();
+ if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'type', must be one of '%s'",
+ $this->container['type'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ if ($this->container['time_in_force'] === null) {
+ $invalidProperties[] = "'time_in_force' can't be null";
+ }
+ $allowedValues = $this->getTimeInForceAllowableValues();
+ if (!is_null($this->container['time_in_force']) && !in_array($this->container['time_in_force'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'time_in_force', must be one of '%s'",
+ $this->container['time_in_force'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ if ($this->container['amount'] === null) {
+ $invalidProperties[] = "'amount' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets instrument
+ *
+ * @return \SnapTrade\Model\TradingInstrument
+ */
+ public function getInstrument()
+ {
+ return $this->container['instrument'];
+ }
+
+ /**
+ * Sets instrument
+ *
+ * @param \SnapTrade\Model\TradingInstrument $instrument instrument
+ *
+ * @return self
+ */
+ public function setInstrument($instrument)
+ {
+
+ if (is_null($instrument)) {
+ throw new \InvalidArgumentException('non-nullable instrument cannot be null');
+ }
+
+ $this->container['instrument'] = $instrument;
+
+ return $this;
+ }
+
+ /**
+ * Gets side
+ *
+ * @return \SnapTrade\Model\ActionStrict
+ */
+ public function getSide()
+ {
+ return $this->container['side'];
+ }
+
+ /**
+ * Sets side
+ *
+ * @param \SnapTrade\Model\ActionStrict $side side
+ *
+ * @return self
+ */
+ public function setSide($side)
+ {
+
+ if (is_null($side)) {
+ throw new \InvalidArgumentException('non-nullable side cannot be null');
+ }
+
+ $this->container['side'] = $side;
+
+ return $this;
+ }
+
+ /**
+ * Gets type
+ *
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->container['type'];
+ }
+
+ /**
+ * Sets type
+ *
+ * @param string $type The type of order to place.
+ *
+ * @return self
+ */
+ public function setType($type)
+ {
+ $allowedValues = $this->getTypeAllowableValues();
+ if (!in_array($type, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'type', must be one of '%s'",
+ $type,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+
+ if (is_null($type)) {
+ throw new \InvalidArgumentException('non-nullable type cannot be null');
+ }
+
+ $this->container['type'] = $type;
+
+ return $this;
+ }
+
+ /**
+ * Gets time_in_force
+ *
+ * @return string
+ */
+ public function getTimeInForce()
+ {
+ return $this->container['time_in_force'];
+ }
+
+ /**
+ * Sets time_in_force
+ *
+ * @param string $time_in_force The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled. - `GTD` - Good Til Date. The order is valid until the specified date.
+ *
+ * @return self
+ */
+ public function setTimeInForce($time_in_force)
+ {
+ $allowedValues = $this->getTimeInForceAllowableValues();
+ if (!in_array($time_in_force, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'time_in_force', must be one of '%s'",
+ $time_in_force,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+
+ if (is_null($time_in_force)) {
+ throw new \InvalidArgumentException('non-nullable time_in_force cannot be null');
+ }
+
+ $this->container['time_in_force'] = $time_in_force;
+
+ return $this;
+ }
+
+ /**
+ * Gets amount
+ *
+ * @return float
+ */
+ public function getAmount()
+ {
+ return $this->container['amount'];
+ }
+
+ /**
+ * Sets amount
+ *
+ * @param float $amount The amount of the base currency to buy or sell.
+ *
+ * @return self
+ */
+ public function setAmount($amount)
+ {
+
+ if (is_null($amount)) {
+ throw new \InvalidArgumentException('non-nullable amount cannot be null');
+ }
+
+ $this->container['amount'] = $amount;
+
+ return $this;
+ }
+
+ /**
+ * Gets limit_price
+ *
+ * @return float|null
+ */
+ public function getLimitPrice()
+ {
+ return $this->container['limit_price'];
+ }
+
+ /**
+ * Sets limit_price
+ *
+ * @param float|null $limit_price The limit price. Required if the order type is LIMIT, STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT.
+ *
+ * @return self
+ */
+ public function setLimitPrice($limit_price)
+ {
+
+ if (is_null($limit_price)) {
+ throw new \InvalidArgumentException('non-nullable limit_price cannot be null');
+ }
+
+ $this->container['limit_price'] = $limit_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets stop_price
+ *
+ * @return float|null
+ */
+ public function getStopPrice()
+ {
+ return $this->container['stop_price'];
+ }
+
+ /**
+ * Sets stop_price
+ *
+ * @param float|null $stop_price The stop price. Required if the order type is STOP_LOSS_MARKET, STOP_LOSS_LIMIT, TAKE_PROFIT_MARKET or TAKE_PROFIT_LIMIT.
+ *
+ * @return self
+ */
+ public function setStopPrice($stop_price)
+ {
+
+ if (is_null($stop_price)) {
+ throw new \InvalidArgumentException('non-nullable stop_price cannot be null');
+ }
+
+ $this->container['stop_price'] = $stop_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets post_only
+ *
+ * @return bool|null
+ */
+ public function getPostOnly()
+ {
+ return $this->container['post_only'];
+ }
+
+ /**
+ * Sets post_only
+ *
+ * @param bool|null $post_only Valid and required only for order type LIMIT. If true orders that would be filled immediately are rejected to avoid incurring TAKER fees.
+ *
+ * @return self
+ */
+ public function setPostOnly($post_only)
+ {
+
+ if (is_null($post_only)) {
+ throw new \InvalidArgumentException('non-nullable post_only cannot be null');
+ }
+
+ $this->container['post_only'] = $post_only;
+
+ return $this;
+ }
+
+ /**
+ * Gets expiration_date
+ *
+ * @return \DateTime|null
+ */
+ public function getExpirationDate()
+ {
+ return $this->container['expiration_date'];
+ }
+
+ /**
+ * Sets expiration_date
+ *
+ * @param \DateTime|null $expiration_date The expiration date of the order. Required if the time_in_force is GTD.
+ *
+ * @return self
+ */
+ public function setExpirationDate($expiration_date)
+ {
+
+ if (is_null($expiration_date)) {
+ throw new \InvalidArgumentException('non-nullable expiration_date cannot be null');
+ }
+
+ $this->container['expiration_date'] = $expiration_date;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/SnapTradeHoldingsTotalValue.php b/lib/Model/SnapTradeHoldingsTotalValue.php
index c6beb86..16fd430 100644
--- a/lib/Model/SnapTradeHoldingsTotalValue.php
+++ b/lib/Model/SnapTradeHoldingsTotalValue.php
@@ -30,7 +30,7 @@
* SnapTradeHoldingsTotalValue Class Doc Comment
*
* @category Class
- * @description The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. To get the brokerage reported total market value of the account, refer to `account.balance.total`.
+ * @description This field is deprecated. To get the brokerage reported total market value of the account, please refer to `account.balance.total`. The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. In certain cases, this value may also be double-counting cash-equivalent assets if those assets are represented as both cash and positions in the account.
* @package SnapTrade
* @implements \ArrayAccess
*/
diff --git a/lib/Model/SnapTradeLoginUserRequestBody.php b/lib/Model/SnapTradeLoginUserRequestBody.php
index aead6c1..64f02ad 100644
--- a/lib/Model/SnapTradeLoginUserRequestBody.php
+++ b/lib/Model/SnapTradeLoginUserRequestBody.php
@@ -56,6 +56,8 @@ class SnapTradeLoginUserRequestBody implements ModelInterface, ArrayAccess, \Jso
'custom_redirect' => 'string',
'reconnect' => 'string',
'connection_type' => 'string',
+ 'show_close_button' => 'bool',
+ 'dark_mode' => 'bool',
'connection_portal_version' => 'string'
];
@@ -72,6 +74,8 @@ class SnapTradeLoginUserRequestBody implements ModelInterface, ArrayAccess, \Jso
'custom_redirect' => null,
'reconnect' => null,
'connection_type' => null,
+ 'show_close_button' => null,
+ 'dark_mode' => null,
'connection_portal_version' => null
];
@@ -86,6 +90,8 @@ class SnapTradeLoginUserRequestBody implements ModelInterface, ArrayAccess, \Jso
'custom_redirect' => false,
'reconnect' => false,
'connection_type' => false,
+ 'show_close_button' => false,
+ 'dark_mode' => false,
'connection_portal_version' => false
];
@@ -180,6 +186,8 @@ public function isNullableSetToNull(string $property): bool
'custom_redirect' => 'customRedirect',
'reconnect' => 'reconnect',
'connection_type' => 'connectionType',
+ 'show_close_button' => 'showCloseButton',
+ 'dark_mode' => 'darkMode',
'connection_portal_version' => 'connectionPortalVersion'
];
@@ -194,6 +202,8 @@ public function isNullableSetToNull(string $property): bool
'custom_redirect' => 'setCustomRedirect',
'reconnect' => 'setReconnect',
'connection_type' => 'setConnectionType',
+ 'show_close_button' => 'setShowCloseButton',
+ 'dark_mode' => 'setDarkMode',
'connection_portal_version' => 'setConnectionPortalVersion'
];
@@ -208,6 +218,8 @@ public function isNullableSetToNull(string $property): bool
'custom_redirect' => 'getCustomRedirect',
'reconnect' => 'getReconnect',
'connection_type' => 'getConnectionType',
+ 'show_close_button' => 'getShowCloseButton',
+ 'dark_mode' => 'getDarkMode',
'connection_portal_version' => 'getConnectionPortalVersion'
];
@@ -254,8 +266,10 @@ public function getModelName()
public const CONNECTION_TYPE_READ = 'read';
public const CONNECTION_TYPE_TRADE = 'trade';
- public const CONNECTION_PORTAL_VERSION_V2 = 'v2';
+ public const CONNECTION_TYPE_TRADE_IF_AVAILABLE = 'trade-if-available';
+ public const CONNECTION_PORTAL_VERSION_V4 = 'v4';
public const CONNECTION_PORTAL_VERSION_V3 = 'v3';
+ public const CONNECTION_PORTAL_VERSION_V2 = 'v2';
/**
* Gets allowable values of the enum
@@ -267,6 +281,7 @@ public function getConnectionTypeAllowableValues()
return [
self::CONNECTION_TYPE_READ,
self::CONNECTION_TYPE_TRADE,
+ self::CONNECTION_TYPE_TRADE_IF_AVAILABLE,
];
}
@@ -278,8 +293,9 @@ public function getConnectionTypeAllowableValues()
public function getConnectionPortalVersionAllowableValues()
{
return [
- self::CONNECTION_PORTAL_VERSION_V2,
+ self::CONNECTION_PORTAL_VERSION_V4,
self::CONNECTION_PORTAL_VERSION_V3,
+ self::CONNECTION_PORTAL_VERSION_V2,
];
}
@@ -302,8 +318,10 @@ public function __construct(array $data = null)
$this->setIfExists('immediate_redirect', $data ?? [], null);
$this->setIfExists('custom_redirect', $data ?? [], null);
$this->setIfExists('reconnect', $data ?? [], null);
- $this->setIfExists('connection_type', $data ?? [], null);
- $this->setIfExists('connection_portal_version', $data ?? [], null);
+ $this->setIfExists('connection_type', $data ?? [], 'read');
+ $this->setIfExists('show_close_button', $data ?? [], null);
+ $this->setIfExists('dark_mode', $data ?? [], null);
+ $this->setIfExists('connection_portal_version', $data ?? [], 'v4');
}
/**
@@ -379,7 +397,7 @@ public function getBroker()
/**
* Sets broker
*
- * @param string|null $broker Slug of the brokerage to connect the user to. See [this document](https://snaptrade.notion.site/SnapTrade-Brokerage-Integrations-f83946a714a84c3caf599f6a945f0ead) for a list of supported brokerages and their slugs.
+ * @param string|null $broker Slug of the brokerage to connect the user to. See [the integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=3cfea70ef4254afc89704e47275a7a9a&pvs=4) for a list of supported brokerages and their slugs.
*
* @return self
*/
@@ -408,7 +426,7 @@ public function getImmediateRedirect()
/**
* Sets immediate_redirect
*
- * @param bool|null $immediate_redirect When set to True, user will be redirected back to the partner's site instead of the connection portal
+ * @param bool|null $immediate_redirect When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
*
* @return self
*/
@@ -437,7 +455,7 @@ public function getCustomRedirect()
/**
* Sets custom_redirect
*
- * @param string|null $custom_redirect URL to redirect the user to after the user connects their brokerage account
+ * @param string|null $custom_redirect URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information.
*
* @return self
*/
@@ -466,7 +484,7 @@ public function getReconnect()
/**
* Sets reconnect
*
- * @param string|null $reconnect The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See βReconnecting Accountsβ for more information.
+ * @param string|null $reconnect The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information.
*
* @return self
*/
@@ -495,7 +513,7 @@ public function getConnectionType()
/**
* Sets connection_type
*
- * @param string|null $connection_type Sets whether the connection should be read or trade
+ * @param string|null $connection_type Determines connection permissions (default: read) - `read`: Data access only. - `trade`: Data and trading access. - `trade-if-available`: Attempts to establish a trading connection if the brokerage supports it, otherwise falls back to read-only access automatically.
*
* @return self
*/
@@ -521,6 +539,64 @@ public function setConnectionType($connection_type)
return $this;
}
+ /**
+ * Gets show_close_button
+ *
+ * @return bool|null
+ */
+ public function getShowCloseButton()
+ {
+ return $this->container['show_close_button'];
+ }
+
+ /**
+ * Sets show_close_button
+ *
+ * @param bool|null $show_close_button Controls whether the close (X) button is displayed in the connection portal. When false, you control closing behavior from your app. Defaults to true.
+ *
+ * @return self
+ */
+ public function setShowCloseButton($show_close_button)
+ {
+
+ if (is_null($show_close_button)) {
+ throw new \InvalidArgumentException('non-nullable show_close_button cannot be null');
+ }
+
+ $this->container['show_close_button'] = $show_close_button;
+
+ return $this;
+ }
+
+ /**
+ * Gets dark_mode
+ *
+ * @return bool|null
+ */
+ public function getDarkMode()
+ {
+ return $this->container['dark_mode'];
+ }
+
+ /**
+ * Sets dark_mode
+ *
+ * @param bool|null $dark_mode Enable dark mode for the connection portal. Defaults to false.
+ *
+ * @return self
+ */
+ public function setDarkMode($dark_mode)
+ {
+
+ if (is_null($dark_mode)) {
+ throw new \InvalidArgumentException('non-nullable dark_mode cannot be null');
+ }
+
+ $this->container['dark_mode'] = $dark_mode;
+
+ return $this;
+ }
+
/**
* Gets connection_portal_version
*
@@ -534,7 +610,7 @@ public function getConnectionPortalVersion()
/**
* Sets connection_portal_version
*
- * @param string|null $connection_portal_version Sets the version of the connection portal to render, with a default to 'v3'
+ * @param string|null $connection_portal_version Sets the connection portal version to render. Currently only v4 is supported and is the default. All other versions are deprecated and will automatically be set to v4.
*
* @return self
*/
diff --git a/lib/Model/SnapTradeRegisterUserRequestBody.php b/lib/Model/SnapTradeRegisterUserRequestBody.php
index bda577d..e46d900 100644
--- a/lib/Model/SnapTradeRegisterUserRequestBody.php
+++ b/lib/Model/SnapTradeRegisterUserRequestBody.php
@@ -268,6 +268,9 @@ public function listInvalidProperties()
{
$invalidProperties = [];
+ if ($this->container['user_id'] === null) {
+ $invalidProperties[] = "'user_id' can't be null";
+ }
return $invalidProperties;
}
@@ -286,7 +289,7 @@ public function valid()
/**
* Gets user_id
*
- * @return string|null
+ * @return string
*/
public function getUserId()
{
@@ -296,7 +299,7 @@ public function getUserId()
/**
* Sets user_id
*
- * @param string|null $user_id SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
+ * @param string $user_id SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
*
* @return self
*/
diff --git a/lib/Model/StopLoss.php b/lib/Model/StopLoss.php
new file mode 100644
index 0000000..74a06d8
--- /dev/null
+++ b/lib/Model/StopLoss.php
@@ -0,0 +1,448 @@
+
+ */
+class StopLoss implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'StopLoss';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'stop_price' => 'string',
+ 'limit_price' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'stop_price' => null,
+ 'limit_price' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'stop_price' => false,
+ 'limit_price' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'stop_price' => 'stop_price',
+ 'limit_price' => 'limit_price'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'stop_price' => 'setStopPrice',
+ 'limit_price' => 'setLimitPrice'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'stop_price' => 'getStopPrice',
+ 'limit_price' => 'getLimitPrice'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('stop_price', $data ?? [], null);
+ $this->setIfExists('limit_price', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets stop_price
+ *
+ * @return string|null
+ */
+ public function getStopPrice()
+ {
+ return $this->container['stop_price'];
+ }
+
+ /**
+ * Sets stop_price
+ *
+ * @param string|null $stop_price stop_price
+ *
+ * @return self
+ */
+ public function setStopPrice($stop_price)
+ {
+
+ if (is_null($stop_price)) {
+ throw new \InvalidArgumentException('non-nullable stop_price cannot be null');
+ }
+
+ $this->container['stop_price'] = $stop_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets limit_price
+ *
+ * @return string|null
+ */
+ public function getLimitPrice()
+ {
+ return $this->container['limit_price'];
+ }
+
+ /**
+ * Sets limit_price
+ *
+ * @param string|null $limit_price limit_price
+ *
+ * @return self
+ */
+ public function setLimitPrice($limit_price)
+ {
+
+ if (is_null($limit_price)) {
+ array_push($this->openAPINullablesSetToNull, 'limit_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('limit_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['limit_price'] = $limit_price;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/Symbol.php b/lib/Model/Symbol.php
index a04755b..c07643c 100644
--- a/lib/Model/Symbol.php
+++ b/lib/Model/Symbol.php
@@ -30,7 +30,7 @@
* Symbol Class Doc Comment
*
* @category Class
- * @description Symbol
+ * @description Uniquely describes a single security + exchange combination across all brokerages.
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -54,9 +54,9 @@ class Symbol implements ModelInterface, ArrayAccess, \JsonSerializable
'id' => 'string',
'symbol' => 'string',
'raw_symbol' => 'string',
- 'name' => 'string',
- 'currency' => '\SnapTrade\Model\Currency',
- 'exchange' => '\SnapTrade\Model\Exchange',
+ 'description' => 'string',
+ 'currency' => '\SnapTrade\Model\SymbolCurrency',
+ 'exchange' => '\SnapTrade\Model\SymbolExchange',
'type' => '\SnapTrade\Model\SecurityType',
'figi_code' => 'string',
'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument'
@@ -73,7 +73,7 @@ class Symbol implements ModelInterface, ArrayAccess, \JsonSerializable
'id' => 'uuid',
'symbol' => null,
'raw_symbol' => null,
- 'name' => null,
+ 'description' => null,
'currency' => null,
'exchange' => null,
'type' => null,
@@ -90,7 +90,7 @@ class Symbol implements ModelInterface, ArrayAccess, \JsonSerializable
'id' => false,
'symbol' => false,
'raw_symbol' => false,
- 'name' => false,
+ 'description' => true,
'currency' => false,
'exchange' => false,
'type' => false,
@@ -187,7 +187,7 @@ public function isNullableSetToNull(string $property): bool
'id' => 'id',
'symbol' => 'symbol',
'raw_symbol' => 'raw_symbol',
- 'name' => 'name',
+ 'description' => 'description',
'currency' => 'currency',
'exchange' => 'exchange',
'type' => 'type',
@@ -204,7 +204,7 @@ public function isNullableSetToNull(string $property): bool
'id' => 'setId',
'symbol' => 'setSymbol',
'raw_symbol' => 'setRawSymbol',
- 'name' => 'setName',
+ 'description' => 'setDescription',
'currency' => 'setCurrency',
'exchange' => 'setExchange',
'type' => 'setType',
@@ -221,7 +221,7 @@ public function isNullableSetToNull(string $property): bool
'id' => 'getId',
'symbol' => 'getSymbol',
'raw_symbol' => 'getRawSymbol',
- 'name' => 'getName',
+ 'description' => 'getDescription',
'currency' => 'getCurrency',
'exchange' => 'getExchange',
'type' => 'getType',
@@ -289,7 +289,7 @@ public function __construct(array $data = null)
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('symbol', $data ?? [], null);
$this->setIfExists('raw_symbol', $data ?? [], null);
- $this->setIfExists('name', $data ?? [], null);
+ $this->setIfExists('description', $data ?? [], null);
$this->setIfExists('currency', $data ?? [], null);
$this->setIfExists('exchange', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
@@ -352,7 +352,7 @@ public function getId()
/**
* Sets id
*
- * @param string|null $id id
+ * @param string|null $id Unique identifier for the symbol within SnapTrade. This is the ID used to reference the symbol in SnapTrade API calls.
*
* @return self
*/
@@ -381,7 +381,7 @@ public function getSymbol()
/**
* Sets symbol
*
- * @param string|null $symbol symbol
+ * @param string|null $symbol The security's trading ticker symbol. For example \"AAPL\" for Apple Inc. We largely follow the [Yahoo Finance ticker format](https://help.yahoo.com/kb/SLN2310.html)(click on \"Yahoo Finance Market Coverage and Data Delays\"). For example, for securities traded on the Toronto Stock Exchange, the symbol has a '.TO' suffix. For securities traded on NASDAQ or NYSE, the symbol does not have a suffix.
*
* @return self
*/
@@ -410,7 +410,7 @@ public function getRawSymbol()
/**
* Sets raw_symbol
*
- * @param string|null $raw_symbol raw_symbol
+ * @param string|null $raw_symbol The raw symbol is `symbol` with the exchange suffix removed. For example, if `symbol` is \"VAB.TO\", then `raw_symbol` is \"VAB\".
*
* @return self
*/
@@ -427,30 +427,37 @@ public function setRawSymbol($raw_symbol)
}
/**
- * Gets name
+ * Gets description
*
* @return string|null
*/
- public function getName()
+ public function getDescription()
{
- return $this->container['name'];
+ return $this->container['description'];
}
/**
- * Sets name
+ * Sets description
*
- * @param string|null $name name
+ * @param string|null $description A human-readable description of the security. This is usually the company name or ETF name.
*
* @return self
*/
- public function setName($name)
+ public function setDescription($description)
{
- if (is_null($name)) {
- throw new \InvalidArgumentException('non-nullable name cannot be null');
+ if (is_null($description)) {
+ array_push($this->openAPINullablesSetToNull, 'description');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('description', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
- $this->container['name'] = $name;
+ $this->container['description'] = $description;
return $this;
}
@@ -458,7 +465,7 @@ public function setName($name)
/**
* Gets currency
*
- * @return \SnapTrade\Model\Currency|null
+ * @return \SnapTrade\Model\SymbolCurrency|null
*/
public function getCurrency()
{
@@ -468,7 +475,7 @@ public function getCurrency()
/**
* Sets currency
*
- * @param \SnapTrade\Model\Currency|null $currency currency
+ * @param \SnapTrade\Model\SymbolCurrency|null $currency currency
*
* @return self
*/
@@ -487,7 +494,7 @@ public function setCurrency($currency)
/**
* Gets exchange
*
- * @return \SnapTrade\Model\Exchange|null
+ * @return \SnapTrade\Model\SymbolExchange|null
*/
public function getExchange()
{
@@ -497,7 +504,7 @@ public function getExchange()
/**
* Sets exchange
*
- * @param \SnapTrade\Model\Exchange|null $exchange exchange
+ * @param \SnapTrade\Model\SymbolExchange|null $exchange exchange
*
* @return self
*/
@@ -555,7 +562,7 @@ public function getFigiCode()
/**
* Sets figi_code
*
- * @param string|null $figi_code figi_code
+ * @param string|null $figi_code This identifier is unique per security per trading venue. See section 1.4.1 of the [FIGI Standard](https://www.openfigi.com/assets/local/figi-allocation-rules.pdf) for more information. This value should be the same as the `figi_code` in the `figi_instrument` child property.
*
* @return self
*/
diff --git a/lib/Model/UniversalSymbolCurrency.php b/lib/Model/SymbolCurrency.php
similarity index 97%
rename from lib/Model/UniversalSymbolCurrency.php
rename to lib/Model/SymbolCurrency.php
index a0e4a92..52381d1 100644
--- a/lib/Model/UniversalSymbolCurrency.php
+++ b/lib/Model/SymbolCurrency.php
@@ -1,6 +1,6 @@
*/
-class UniversalSymbolCurrency implements ModelInterface, ArrayAccess, \JsonSerializable
+class SymbolCurrency implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
@@ -43,7 +43,7 @@ class UniversalSymbolCurrency implements ModelInterface, ArrayAccess, \JsonSeria
*
* @var string
*/
- protected static $openAPIModelName = 'UniversalSymbol_currency';
+ protected static $openAPIModelName = 'Symbol_currency';
/**
* Array of property to type mappings. Used for (de)serialization
diff --git a/lib/Model/UniversalSymbolExchange.php b/lib/Model/SymbolExchange.php
similarity index 98%
rename from lib/Model/UniversalSymbolExchange.php
rename to lib/Model/SymbolExchange.php
index 89d533a..31e375a 100644
--- a/lib/Model/UniversalSymbolExchange.php
+++ b/lib/Model/SymbolExchange.php
@@ -1,6 +1,6 @@
*/
-class UniversalSymbolExchange implements ModelInterface, ArrayAccess, \JsonSerializable
+class SymbolExchange implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
@@ -43,7 +43,7 @@ class UniversalSymbolExchange implements ModelInterface, ArrayAccess, \JsonSeria
*
* @var string
*/
- protected static $openAPIModelName = 'UniversalSymbol_exchange';
+ protected static $openAPIModelName = 'Symbol_exchange';
/**
* Array of property to type mappings. Used for (de)serialization
diff --git a/lib/Model/SymbolQuery.php b/lib/Model/SymbolQuery.php
index 40aee0c..e944e7a 100644
--- a/lib/Model/SymbolQuery.php
+++ b/lib/Model/SymbolQuery.php
@@ -30,7 +30,6 @@
* SymbolQuery Class Doc Comment
*
* @category Class
- * @description Symbol query for searching for symbols
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -296,7 +295,7 @@ public function getSubstring()
/**
* Sets substring
*
- * @param string|null $substring substring
+ * @param string|null $substring The search query for symbols.
*
* @return self
*/
diff --git a/lib/Model/SymbolsQuotesInner.php b/lib/Model/SymbolsQuotesInner.php
index 505d2f7..5f0bbce 100644
--- a/lib/Model/SymbolsQuotesInner.php
+++ b/lib/Model/SymbolsQuotesInner.php
@@ -51,9 +51,9 @@ class SymbolsQuotesInner implements ModelInterface, ArrayAccess, \JsonSerializab
*/
protected static $openAPITypes = [
'symbol' => '\SnapTrade\Model\UniversalSymbol',
+ 'last_trade_price' => 'float',
'bid_price' => 'float',
'ask_price' => 'float',
- 'last_trade_price' => 'float',
'bid_size' => 'float',
'ask_size' => 'float'
];
@@ -67,9 +67,9 @@ class SymbolsQuotesInner implements ModelInterface, ArrayAccess, \JsonSerializab
*/
protected static $openAPIFormats = [
'symbol' => null,
+ 'last_trade_price' => null,
'bid_price' => null,
'ask_price' => null,
- 'last_trade_price' => null,
'bid_size' => null,
'ask_size' => null
];
@@ -81,9 +81,9 @@ class SymbolsQuotesInner implements ModelInterface, ArrayAccess, \JsonSerializab
*/
protected static array $openAPINullables = [
'symbol' => false,
+ 'last_trade_price' => false,
'bid_price' => false,
'ask_price' => false,
- 'last_trade_price' => false,
'bid_size' => false,
'ask_size' => false
];
@@ -175,9 +175,9 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $attributeMap = [
'symbol' => 'symbol',
+ 'last_trade_price' => 'last_trade_price',
'bid_price' => 'bid_price',
'ask_price' => 'ask_price',
- 'last_trade_price' => 'last_trade_price',
'bid_size' => 'bid_size',
'ask_size' => 'ask_size'
];
@@ -189,9 +189,9 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $setters = [
'symbol' => 'setSymbol',
+ 'last_trade_price' => 'setLastTradePrice',
'bid_price' => 'setBidPrice',
'ask_price' => 'setAskPrice',
- 'last_trade_price' => 'setLastTradePrice',
'bid_size' => 'setBidSize',
'ask_size' => 'setAskSize'
];
@@ -203,9 +203,9 @@ public function isNullableSetToNull(string $property): bool
*/
protected static $getters = [
'symbol' => 'getSymbol',
+ 'last_trade_price' => 'getLastTradePrice',
'bid_price' => 'getBidPrice',
'ask_price' => 'getAskPrice',
- 'last_trade_price' => 'getLastTradePrice',
'bid_size' => 'getBidSize',
'ask_size' => 'getAskSize'
];
@@ -268,9 +268,9 @@ public function getModelName()
public function __construct(array $data = null)
{
$this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('last_trade_price', $data ?? [], null);
$this->setIfExists('bid_price', $data ?? [], null);
$this->setIfExists('ask_price', $data ?? [], null);
- $this->setIfExists('last_trade_price', $data ?? [], null);
$this->setIfExists('bid_size', $data ?? [], null);
$this->setIfExists('ask_size', $data ?? [], null);
}
@@ -347,88 +347,88 @@ public function setSymbol($symbol)
}
/**
- * Gets bid_price
+ * Gets last_trade_price
*
* @return float|null
*/
- public function getBidPrice()
+ public function getLastTradePrice()
{
- return $this->container['bid_price'];
+ return $this->container['last_trade_price'];
}
/**
- * Sets bid_price
+ * Sets last_trade_price
*
- * @param float|null $bid_price bid_price
+ * @param float|null $last_trade_price The most recent trade price from the brokerage.
*
* @return self
*/
- public function setBidPrice($bid_price)
+ public function setLastTradePrice($last_trade_price)
{
- if (is_null($bid_price)) {
- throw new \InvalidArgumentException('non-nullable bid_price cannot be null');
+ if (is_null($last_trade_price)) {
+ throw new \InvalidArgumentException('non-nullable last_trade_price cannot be null');
}
- $this->container['bid_price'] = $bid_price;
+ $this->container['last_trade_price'] = $last_trade_price;
return $this;
}
/**
- * Gets ask_price
+ * Gets bid_price
*
* @return float|null
*/
- public function getAskPrice()
+ public function getBidPrice()
{
- return $this->container['ask_price'];
+ return $this->container['bid_price'];
}
/**
- * Sets ask_price
+ * Sets bid_price
*
- * @param float|null $ask_price ask_price
+ * @param float|null $bid_price The most recent bid price from the brokerage.
*
* @return self
*/
- public function setAskPrice($ask_price)
+ public function setBidPrice($bid_price)
{
- if (is_null($ask_price)) {
- throw new \InvalidArgumentException('non-nullable ask_price cannot be null');
+ if (is_null($bid_price)) {
+ throw new \InvalidArgumentException('non-nullable bid_price cannot be null');
}
- $this->container['ask_price'] = $ask_price;
+ $this->container['bid_price'] = $bid_price;
return $this;
}
/**
- * Gets last_trade_price
+ * Gets ask_price
*
* @return float|null
*/
- public function getLastTradePrice()
+ public function getAskPrice()
{
- return $this->container['last_trade_price'];
+ return $this->container['ask_price'];
}
/**
- * Sets last_trade_price
+ * Sets ask_price
*
- * @param float|null $last_trade_price last_trade_price
+ * @param float|null $ask_price The most recent price from the brokerage.
*
* @return self
*/
- public function setLastTradePrice($last_trade_price)
+ public function setAskPrice($ask_price)
{
- if (is_null($last_trade_price)) {
- throw new \InvalidArgumentException('non-nullable last_trade_price cannot be null');
+ if (is_null($ask_price)) {
+ throw new \InvalidArgumentException('non-nullable ask_price cannot be null');
}
- $this->container['last_trade_price'] = $last_trade_price;
+ $this->container['ask_price'] = $ask_price;
return $this;
}
@@ -446,7 +446,7 @@ public function getBidSize()
/**
* Sets bid_size
*
- * @param float|null $bid_size bid_size
+ * @param float|null $bid_size The most recent bid size from the brokerage.
*
* @return self
*/
@@ -475,7 +475,7 @@ public function getAskSize()
/**
* Sets ask_size
*
- * @param float|null $ask_size ask_size
+ * @param float|null $ask_size The most recent ask size from the brokerage.
*
* @return self
*/
diff --git a/lib/Model/TakeProfit.php b/lib/Model/TakeProfit.php
new file mode 100644
index 0000000..ae795d5
--- /dev/null
+++ b/lib/Model/TakeProfit.php
@@ -0,0 +1,405 @@
+
+ */
+class TakeProfit implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'TakeProfit';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'limit_price' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'limit_price' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'limit_price' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'limit_price' => 'limit_price'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'limit_price' => 'setLimitPrice'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'limit_price' => 'getLimitPrice'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('limit_price', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets limit_price
+ *
+ * @return string|null
+ */
+ public function getLimitPrice()
+ {
+ return $this->container['limit_price'];
+ }
+
+ /**
+ * Sets limit_price
+ *
+ * @param string|null $limit_price limit_price
+ *
+ * @return self
+ */
+ public function setLimitPrice($limit_price)
+ {
+
+ if (is_null($limit_price)) {
+ throw new \InvalidArgumentException('non-nullable limit_price cannot be null');
+ }
+
+ $this->container['limit_price'] = $limit_price;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/TaxLot.php b/lib/Model/TaxLot.php
new file mode 100644
index 0000000..b11b86b
--- /dev/null
+++ b/lib/Model/TaxLot.php
@@ -0,0 +1,627 @@
+
+ */
+class TaxLot implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'TaxLot';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'original_purchase_date' => '\DateTime',
+ 'quantity' => 'string',
+ 'purchased_price' => 'string',
+ 'cost_basis' => 'string',
+ 'current_value' => 'string',
+ 'position_type' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'original_purchase_date' => 'date-time',
+ 'quantity' => null,
+ 'purchased_price' => null,
+ 'cost_basis' => null,
+ 'current_value' => null,
+ 'position_type' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'original_purchase_date' => true,
+ 'quantity' => true,
+ 'purchased_price' => true,
+ 'cost_basis' => true,
+ 'current_value' => true,
+ 'position_type' => true
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'original_purchase_date' => 'original_purchase_date',
+ 'quantity' => 'quantity',
+ 'purchased_price' => 'purchased_price',
+ 'cost_basis' => 'cost_basis',
+ 'current_value' => 'current_value',
+ 'position_type' => 'position_type'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'original_purchase_date' => 'setOriginalPurchaseDate',
+ 'quantity' => 'setQuantity',
+ 'purchased_price' => 'setPurchasedPrice',
+ 'cost_basis' => 'setCostBasis',
+ 'current_value' => 'setCurrentValue',
+ 'position_type' => 'setPositionType'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'original_purchase_date' => 'getOriginalPurchaseDate',
+ 'quantity' => 'getQuantity',
+ 'purchased_price' => 'getPurchasedPrice',
+ 'cost_basis' => 'getCostBasis',
+ 'current_value' => 'getCurrentValue',
+ 'position_type' => 'getPositionType'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('original_purchase_date', $data ?? [], null);
+ $this->setIfExists('quantity', $data ?? [], null);
+ $this->setIfExists('purchased_price', $data ?? [], null);
+ $this->setIfExists('cost_basis', $data ?? [], null);
+ $this->setIfExists('current_value', $data ?? [], null);
+ $this->setIfExists('position_type', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets original_purchase_date
+ *
+ * @return \DateTime|null
+ */
+ public function getOriginalPurchaseDate()
+ {
+ return $this->container['original_purchase_date'];
+ }
+
+ /**
+ * Sets original_purchase_date
+ *
+ * @param \DateTime|null $original_purchase_date The date and time of the purchase.
+ *
+ * @return self
+ */
+ public function setOriginalPurchaseDate($original_purchase_date)
+ {
+
+ if (is_null($original_purchase_date)) {
+ array_push($this->openAPINullablesSetToNull, 'original_purchase_date');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('original_purchase_date', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['original_purchase_date'] = $original_purchase_date;
+
+ return $this;
+ }
+
+ /**
+ * Gets quantity
+ *
+ * @return string|null
+ */
+ public function getQuantity()
+ {
+ return $this->container['quantity'];
+ }
+
+ /**
+ * Sets quantity
+ *
+ * @param string|null $quantity The number of shares in the tax lot. This can be fractional or integer units.
+ *
+ * @return self
+ */
+ public function setQuantity($quantity)
+ {
+
+ if (is_null($quantity)) {
+ array_push($this->openAPINullablesSetToNull, 'quantity');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('quantity', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['quantity'] = $quantity;
+
+ return $this;
+ }
+
+ /**
+ * Gets purchased_price
+ *
+ * @return string|null
+ */
+ public function getPurchasedPrice()
+ {
+ return $this->container['purchased_price'];
+ }
+
+ /**
+ * Sets purchased_price
+ *
+ * @param string|null $purchased_price The purchase price per share for the tax lot.
+ *
+ * @return self
+ */
+ public function setPurchasedPrice($purchased_price)
+ {
+
+ if (is_null($purchased_price)) {
+ array_push($this->openAPINullablesSetToNull, 'purchased_price');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('purchased_price', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['purchased_price'] = $purchased_price;
+
+ return $this;
+ }
+
+ /**
+ * Gets cost_basis
+ *
+ * @return string|null
+ */
+ public function getCostBasis()
+ {
+ return $this->container['cost_basis'];
+ }
+
+ /**
+ * Sets cost_basis
+ *
+ * @param string|null $cost_basis The cost basis of the entire lot.
+ *
+ * @return self
+ */
+ public function setCostBasis($cost_basis)
+ {
+
+ if (is_null($cost_basis)) {
+ array_push($this->openAPINullablesSetToNull, 'cost_basis');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('cost_basis', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['cost_basis'] = $cost_basis;
+
+ return $this;
+ }
+
+ /**
+ * Gets current_value
+ *
+ * @return string|null
+ */
+ public function getCurrentValue()
+ {
+ return $this->container['current_value'];
+ }
+
+ /**
+ * Sets current_value
+ *
+ * @param string|null $current_value The current market value of the entire lot.
+ *
+ * @return self
+ */
+ public function setCurrentValue($current_value)
+ {
+
+ if (is_null($current_value)) {
+ array_push($this->openAPINullablesSetToNull, 'current_value');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('current_value', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['current_value'] = $current_value;
+
+ return $this;
+ }
+
+ /**
+ * Gets position_type
+ *
+ * @return string|null
+ */
+ public function getPositionType()
+ {
+ return $this->container['position_type'];
+ }
+
+ /**
+ * Sets position_type
+ *
+ * @param string|null $position_type The type of position for the tax lot (e.g., LONG, SHORT).
+ *
+ * @return self
+ */
+ public function setPositionType($position_type)
+ {
+
+ if (is_null($position_type)) {
+ array_push($this->openAPINullablesSetToNull, 'position_type');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('position_type', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
+ }
+
+ $this->container['position_type'] = $position_type;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/TimeInForceStrict.php b/lib/Model/TimeInForceStrict.php
index e1874ac..06f7bb9 100644
--- a/lib/Model/TimeInForceStrict.php
+++ b/lib/Model/TimeInForceStrict.php
@@ -28,7 +28,7 @@
* TimeInForceStrict Class Doc Comment
*
* @category Class
- * @description Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
+ * @description The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
* @package SnapTrade
*/
class TimeInForceStrict
@@ -42,6 +42,8 @@ class TimeInForceStrict
public const GTC = 'GTC';
+ public const IOC = 'IOC';
+
/**
* Gets allowable values of the enum
* @return string[]
@@ -51,7 +53,8 @@ public static function getAllowableEnumValues()
return [
self::FOK,
self::DAY,
- self::GTC
+ self::GTC,
+ self::IOC
];
}
}
diff --git a/lib/Model/TradingInstrument.php b/lib/Model/TradingInstrument.php
new file mode 100644
index 0000000..ce489b3
--- /dev/null
+++ b/lib/Model/TradingInstrument.php
@@ -0,0 +1,484 @@
+
+ */
+class TradingInstrument implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'TradingInstrument';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'symbol' => 'string',
+ 'type' => 'string'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'symbol' => null,
+ 'type' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'symbol' => false,
+ 'type' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'symbol' => 'symbol',
+ 'type' => 'type'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'symbol' => 'setSymbol',
+ 'type' => 'setType'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'symbol' => 'getSymbol',
+ 'type' => 'getType'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+ public const TYPE_EQUITY = 'EQUITY';
+ public const TYPE_OPTION = 'OPTION';
+ public const TYPE_CRYPTOCURRENCY = 'CRYPTOCURRENCY';
+ public const TYPE_CRYPTOCURRENCY_PAIR = 'CRYPTOCURRENCY_PAIR';
+
+ /**
+ * Gets allowable values of the enum
+ *
+ * @return string[]
+ */
+ public function getTypeAllowableValues()
+ {
+ return [
+ self::TYPE_EQUITY,
+ self::TYPE_OPTION,
+ self::TYPE_CRYPTOCURRENCY,
+ self::TYPE_CRYPTOCURRENCY_PAIR,
+ ];
+ }
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['symbol'] === null) {
+ $invalidProperties[] = "'symbol' can't be null";
+ }
+ if ($this->container['type'] === null) {
+ $invalidProperties[] = "'type' can't be null";
+ }
+ $allowedValues = $this->getTypeAllowableValues();
+ if (!is_null($this->container['type']) && !in_array($this->container['type'], $allowedValues, true)) {
+ $invalidProperties[] = sprintf(
+ "invalid value '%s' for 'type', must be one of '%s'",
+ $this->container['type'],
+ implode("', '", $allowedValues)
+ );
+ }
+
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets symbol
+ *
+ * @return string
+ */
+ public function getSymbol()
+ {
+ return $this->container['symbol'];
+ }
+
+ /**
+ * Sets symbol
+ *
+ * @param string $symbol The instrument's trading ticker symbol. This currently supports stock symbols and Options symbols 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)
+ *
+ * @return self
+ */
+ public function setSymbol($symbol)
+ {
+
+ if (is_null($symbol)) {
+ throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ }
+
+ $this->container['symbol'] = $symbol;
+
+ return $this;
+ }
+
+ /**
+ * Gets type
+ *
+ * @return string
+ */
+ public function getType()
+ {
+ return $this->container['type'];
+ }
+
+ /**
+ * Sets type
+ *
+ * @param string $type The instrument's type
+ *
+ * @return self
+ */
+ public function setType($type)
+ {
+ $allowedValues = $this->getTypeAllowableValues();
+ if (!in_array($type, $allowedValues, true)) {
+ throw new \InvalidArgumentException(
+ sprintf(
+ "Invalid value '%s' for 'type', must be one of '%s'",
+ $type,
+ implode("', '", $allowedValues)
+ )
+ );
+ }
+
+ if (is_null($type)) {
+ throw new \InvalidArgumentException('non-nullable type cannot be null');
+ }
+
+ $this->container['type'] = $type;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/TradingSearchCryptocurrencyPairInstruments200Response.php b/lib/Model/TradingSearchCryptocurrencyPairInstruments200Response.php
new file mode 100644
index 0000000..c1cc825
--- /dev/null
+++ b/lib/Model/TradingSearchCryptocurrencyPairInstruments200Response.php
@@ -0,0 +1,408 @@
+
+ */
+class TradingSearchCryptocurrencyPairInstruments200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+ public const DISCRIMINATOR = null;
+
+ /**
+ * The original name of the model.
+ *
+ * @var string
+ */
+ protected static $openAPIModelName = 'Trading_searchCryptocurrencyPairInstruments_200_response';
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @var string[]
+ */
+ protected static $openAPITypes = [
+ 'items' => '\SnapTrade\Model\CryptocurrencyPair[]'
+ ];
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @var string[]
+ * @phpstan-var array
+ * @psalm-var array
+ */
+ protected static $openAPIFormats = [
+ 'items' => null
+ ];
+
+ /**
+ * Array of nullable properties. Used for (de)serialization
+ *
+ * @var boolean[]
+ */
+ protected static array $openAPINullables = [
+ 'items' => false
+ ];
+
+ /**
+ * If a nullable field gets set to null, insert it here
+ *
+ * @var boolean[]
+ */
+ protected array $openAPINullablesSetToNull = [];
+
+ /**
+ * Array of property to type mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPITypes()
+ {
+ return self::$openAPITypes;
+ }
+
+ /**
+ * Array of property to format mappings. Used for (de)serialization
+ *
+ * @return array
+ */
+ public static function openAPIFormats()
+ {
+ return self::$openAPIFormats;
+ }
+
+ /**
+ * Array of nullable properties
+ *
+ * @return array
+ */
+ protected static function openAPINullables(): array
+ {
+ return self::$openAPINullables;
+ }
+
+ /**
+ * Array of nullable field names deliberately set to null
+ *
+ * @return boolean[]
+ */
+ private function getOpenAPINullablesSetToNull(): array
+ {
+ return $this->openAPINullablesSetToNull;
+ }
+
+ /**
+ * Setter - Array of nullable field names deliberately set to null
+ *
+ * @param boolean[] $openAPINullablesSetToNull
+ */
+ private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+ {
+ $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+ }
+
+ /**
+ * Checks if a property is nullable
+ *
+ * @param string $property
+ * @return bool
+ */
+ public static function isNullable(string $property): bool
+ {
+ return self::openAPINullables()[$property] ?? false;
+ }
+
+ /**
+ * Checks if a nullable property is set to null.
+ *
+ * @param string $property
+ * @return bool
+ */
+ public function isNullableSetToNull(string $property): bool
+ {
+ return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+ }
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @var string[]
+ */
+ protected static $attributeMap = [
+ 'items' => 'items'
+ ];
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @var string[]
+ */
+ protected static $setters = [
+ 'items' => 'setItems'
+ ];
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @var string[]
+ */
+ protected static $getters = [
+ 'items' => 'getItems'
+ ];
+
+ /**
+ * Array of attributes where the key is the local name,
+ * and the value is the original name
+ *
+ * @return array
+ */
+ public static function attributeMap()
+ {
+ return self::$attributeMap;
+ }
+
+ /**
+ * Array of attributes to setter functions (for deserialization of responses)
+ *
+ * @return array
+ */
+ public static function setters()
+ {
+ return self::$setters;
+ }
+
+ /**
+ * Array of attributes to getter functions (for serialization of requests)
+ *
+ * @return array
+ */
+ public static function getters()
+ {
+ return self::$getters;
+ }
+
+ /**
+ * The original name of the model.
+ *
+ * @return string
+ */
+ public function getModelName()
+ {
+ return self::$openAPIModelName;
+ }
+
+
+ /**
+ * Associative array for storing property values
+ *
+ * @var mixed[]
+ */
+ protected $container = [];
+
+ /**
+ * Constructor
+ *
+ * @param mixed[] $data Associated array of property values
+ * initializing the model
+ */
+ public function __construct(array $data = null)
+ {
+ $this->setIfExists('items', $data ?? [], null);
+ }
+
+ /**
+ * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+ * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+ * $this->openAPINullablesSetToNull array
+ *
+ * @param string $variableName
+ * @param array $fields
+ * @param mixed $defaultValue
+ */
+ private function setIfExists(string $variableName, array $fields, $defaultValue): void
+ {
+ if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+ $this->openAPINullablesSetToNull[] = $variableName;
+ }
+
+ $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+ }
+
+ /**
+ * Show all the invalid properties with reasons.
+ *
+ * @return array invalid properties with reasons
+ */
+ public function listInvalidProperties()
+ {
+ $invalidProperties = [];
+
+ if ($this->container['items'] === null) {
+ $invalidProperties[] = "'items' can't be null";
+ }
+ return $invalidProperties;
+ }
+
+ /**
+ * Validate all the properties in the model
+ * return true if all passed
+ *
+ * @return bool True if all properties are valid
+ */
+ public function valid()
+ {
+ return count($this->listInvalidProperties()) === 0;
+ }
+
+
+ /**
+ * Gets items
+ *
+ * @return \SnapTrade\Model\CryptocurrencyPair[]
+ */
+ public function getItems()
+ {
+ return $this->container['items'];
+ }
+
+ /**
+ * Sets items
+ *
+ * @param \SnapTrade\Model\CryptocurrencyPair[] $items items
+ *
+ * @return self
+ */
+ public function setItems($items)
+ {
+
+ if (is_null($items)) {
+ throw new \InvalidArgumentException('non-nullable items cannot be null');
+ }
+
+ $this->container['items'] = $items;
+
+ return $this;
+ }
+ /**
+ * Returns true if offset exists. False otherwise.
+ *
+ * @param integer $offset Offset
+ *
+ * @return boolean
+ */
+ public function offsetExists($offset): bool
+ {
+ return isset($this->container[$offset]);
+ }
+
+ /**
+ * Gets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return mixed|null
+ */
+ #[\ReturnTypeWillChange]
+ public function offsetGet($offset)
+ {
+ return $this->container[$offset] ?? null;
+ }
+
+ /**
+ * Sets value based on offset.
+ *
+ * @param int|null $offset Offset
+ * @param mixed $value Value to be set
+ *
+ * @return void
+ */
+ public function offsetSet($offset, $value): void
+ {
+ if (is_null($offset)) {
+ $this->container[] = $value;
+ } else {
+ $this->container[$offset] = $value;
+ }
+ }
+
+ /**
+ * Unsets offset.
+ *
+ * @param integer $offset Offset
+ *
+ * @return void
+ */
+ public function offsetUnset($offset): void
+ {
+ unset($this->container[$offset]);
+ }
+
+ /**
+ * Serializes the object to a value that can be serialized natively by json_encode().
+ * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+ *
+ * @return mixed Returns data which can be serialized by json_encode(), which is a value
+ * of any type other than a resource.
+ */
+ #[\ReturnTypeWillChange]
+ public function jsonSerialize()
+ {
+ return ObjectSerializer::sanitizeForSerialization($this);
+ }
+
+ /**
+ * Gets the string presentation of the object
+ *
+ * @return string
+ */
+ public function __toString()
+ {
+ return json_encode(
+ ObjectSerializer::sanitizeForSerialization($this),
+ JSON_PRETTY_PRINT
+ );
+ }
+
+ /**
+ * Gets a header-safe presentation of the object
+ *
+ * @return string
+ */
+ public function toHeaderValue()
+ {
+ return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+ }
+}
+
+
diff --git a/lib/Model/TradingSession.php b/lib/Model/TradingSession.php
new file mode 100644
index 0000000..c5cea42
--- /dev/null
+++ b/lib/Model/TradingSession.php
@@ -0,0 +1,56 @@
+ false,
- 'last_successful_sync' => false,
- 'first_transaction_date' => false
+ 'last_successful_sync' => true,
+ 'first_transaction_date' => true
];
/**
@@ -347,7 +347,14 @@ public function setLastSuccessfulSync($last_successful_sync)
{
if (is_null($last_successful_sync)) {
- throw new \InvalidArgumentException('non-nullable last_successful_sync cannot be null');
+ array_push($this->openAPINullablesSetToNull, 'last_successful_sync');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('last_successful_sync', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
$this->container['last_successful_sync'] = $last_successful_sync;
@@ -376,7 +383,14 @@ public function setFirstTransactionDate($first_transaction_date)
{
if (is_null($first_transaction_date)) {
- throw new \InvalidArgumentException('non-nullable first_transaction_date cannot be null');
+ array_push($this->openAPINullablesSetToNull, 'first_transaction_date');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('first_transaction_date', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
$this->container['first_transaction_date'] = $first_transaction_date;
diff --git a/lib/Model/UnderlyingSymbol.php b/lib/Model/UnderlyingSymbol.php
index 2e412ae..76a8fae 100644
--- a/lib/Model/UnderlyingSymbol.php
+++ b/lib/Model/UnderlyingSymbol.php
@@ -55,12 +55,12 @@ class UnderlyingSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
'symbol' => 'string',
'raw_symbol' => 'string',
'description' => 'string',
- 'currency' => '\SnapTrade\Model\UniversalSymbolCurrency',
+ 'currency' => '\SnapTrade\Model\SymbolCurrency',
'exchange' => '\SnapTrade\Model\UnderlyingSymbolExchange',
'type' => '\SnapTrade\Model\UnderlyingSymbolType',
- 'currencies' => '\SnapTrade\Model\Currency[]',
'figi_code' => 'string',
- 'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument'
+ 'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument',
+ 'currencies' => '\SnapTrade\Model\Currency[]'
];
/**
@@ -78,9 +78,9 @@ class UnderlyingSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
'currency' => null,
'exchange' => null,
'type' => null,
- 'currencies' => null,
'figi_code' => null,
- 'figi_instrument' => null
+ 'figi_instrument' => null,
+ 'currencies' => null
];
/**
@@ -96,9 +96,9 @@ class UnderlyingSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
'currency' => false,
'exchange' => false,
'type' => false,
- 'currencies' => false,
'figi_code' => true,
- 'figi_instrument' => true
+ 'figi_instrument' => true,
+ 'currencies' => false
];
/**
@@ -194,9 +194,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'currency',
'exchange' => 'exchange',
'type' => 'type',
- 'currencies' => 'currencies',
'figi_code' => 'figi_code',
- 'figi_instrument' => 'figi_instrument'
+ 'figi_instrument' => 'figi_instrument',
+ 'currencies' => 'currencies'
];
/**
@@ -212,9 +212,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'setCurrency',
'exchange' => 'setExchange',
'type' => 'setType',
- 'currencies' => 'setCurrencies',
'figi_code' => 'setFigiCode',
- 'figi_instrument' => 'setFigiInstrument'
+ 'figi_instrument' => 'setFigiInstrument',
+ 'currencies' => 'setCurrencies'
];
/**
@@ -230,9 +230,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'getCurrency',
'exchange' => 'getExchange',
'type' => 'getType',
- 'currencies' => 'getCurrencies',
'figi_code' => 'getFigiCode',
- 'figi_instrument' => 'getFigiInstrument'
+ 'figi_instrument' => 'getFigiInstrument',
+ 'currencies' => 'getCurrencies'
];
/**
@@ -299,9 +299,9 @@ public function __construct(array $data = null)
$this->setIfExists('currency', $data ?? [], null);
$this->setIfExists('exchange', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
- $this->setIfExists('currencies', $data ?? [], null);
$this->setIfExists('figi_code', $data ?? [], null);
$this->setIfExists('figi_instrument', $data ?? [], null);
+ $this->setIfExists('currencies', $data ?? [], null);
}
/**
@@ -472,7 +472,7 @@ public function setDescription($description)
/**
* Gets currency
*
- * @return \SnapTrade\Model\UniversalSymbolCurrency|null
+ * @return \SnapTrade\Model\SymbolCurrency|null
*/
public function getCurrency()
{
@@ -482,7 +482,7 @@ public function getCurrency()
/**
* Sets currency
*
- * @param \SnapTrade\Model\UniversalSymbolCurrency|null $currency currency
+ * @param \SnapTrade\Model\SymbolCurrency|null $currency currency
*
* @return self
*/
@@ -556,37 +556,6 @@ public function setType($type)
return $this;
}
- /**
- * Gets currencies
- *
- * @return \SnapTrade\Model\Currency[]|null
- * @deprecated
- */
- public function getCurrencies()
- {
- return $this->container['currencies'];
- }
-
- /**
- * Sets currencies
- *
- * @param \SnapTrade\Model\Currency[]|null $currencies This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
- *
- * @return self
- * @deprecated
- */
- public function setCurrencies($currencies)
- {
-
- if (is_null($currencies)) {
- throw new \InvalidArgumentException('non-nullable currencies cannot be null');
- }
-
- $this->container['currencies'] = $currencies;
-
- return $this;
- }
-
/**
* Gets figi_code
*
@@ -658,6 +627,37 @@ public function setFigiInstrument($figi_instrument)
return $this;
}
+
+ /**
+ * Gets currencies
+ *
+ * @return \SnapTrade\Model\Currency[]|null
+ * @deprecated
+ */
+ public function getCurrencies()
+ {
+ return $this->container['currencies'];
+ }
+
+ /**
+ * Sets currencies
+ *
+ * @param \SnapTrade\Model\Currency[]|null $currencies This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setCurrencies($currencies)
+ {
+
+ if (is_null($currencies)) {
+ throw new \InvalidArgumentException('non-nullable currencies cannot be null');
+ }
+
+ $this->container['currencies'] = $currencies;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/UnderlyingSymbolType.php b/lib/Model/UnderlyingSymbolType.php
index cbd1a0c..ff991a3 100644
--- a/lib/Model/UnderlyingSymbolType.php
+++ b/lib/Model/UnderlyingSymbolType.php
@@ -346,7 +346,7 @@ public function getCode()
/**
* Sets code
*
- * @param string|null $code A short code representing the security type. For example, \"cs\" for Common Stock. Here are some common values: ad - ADR bnd - Bond cs - Common Stock cef - Closed End Fund et - ETF oef - Open Ended Fund ps - Preferred Stock rt - Right struct - Structured Product ut - Unit wi - When Issued wt - Warrant
+ * @param string|null $code A short code representing the security type. For example, \"cs\" for Common Stock. Here are some common values: - `ad` - ADR - `bnd` - Bond - `cs` - Common Stock - `cef` - Closed End Fund - `crypto` - Cryptocurrency - `et` - ETF - `oef` - Open Ended Fund - `pm` - Precious Metals - `ps` - Preferred Stock - `rt` - Right - `struct` - Structured Product - `ut` - Unit - `wi` - When Issued - `wt` - Warrant
*
* @return self
*/
diff --git a/lib/Model/UniversalActivity.php b/lib/Model/UniversalActivity.php
index 5ea6d39..eba83b4 100644
--- a/lib/Model/UniversalActivity.php
+++ b/lib/Model/UniversalActivity.php
@@ -53,21 +53,21 @@ class UniversalActivity implements ModelInterface, ArrayAccess, \JsonSerializabl
protected static $openAPITypes = [
'id' => 'string',
'account' => '\SnapTrade\Model\AccountSimple',
+ 'symbol' => '\SnapTrade\Model\AccountUniversalActivitySymbol',
+ 'option_symbol' => '\SnapTrade\Model\AccountUniversalActivityOptionSymbol',
+ 'price' => 'float',
+ 'units' => 'float',
'amount' => 'float',
- 'currency' => '\SnapTrade\Model\Currency',
+ 'currency' => '\SnapTrade\Model\AccountUniversalActivityCurrency',
+ 'type' => 'string',
+ 'option_type' => 'string',
'description' => 'string',
+ 'trade_date' => '\DateTime',
+ 'settlement_date' => '\DateTime',
'fee' => 'float',
'fx_rate' => 'float',
'institution' => 'string',
- 'option_type' => 'string',
- 'price' => 'float',
- 'settlement_date' => 'string',
- 'external_reference_id' => 'string',
- 'symbol' => '\SnapTrade\Model\Symbol',
- 'option_symbol' => '\SnapTrade\Model\OptionsSymbol',
- 'trade_date' => 'string',
- 'type' => 'string',
- 'units' => 'float'
+ 'external_reference_id' => 'string'
];
/**
@@ -80,21 +80,21 @@ class UniversalActivity implements ModelInterface, ArrayAccess, \JsonSerializabl
protected static $openAPIFormats = [
'id' => null,
'account' => null,
+ 'symbol' => null,
+ 'option_symbol' => null,
+ 'price' => null,
+ 'units' => null,
'amount' => null,
'currency' => null,
+ 'type' => null,
+ 'option_type' => null,
'description' => null,
+ 'trade_date' => 'date-time',
+ 'settlement_date' => 'date-time',
'fee' => null,
'fx_rate' => null,
'institution' => null,
- 'option_type' => null,
- 'price' => null,
- 'settlement_date' => null,
- 'external_reference_id' => null,
- 'symbol' => null,
- 'option_symbol' => null,
- 'trade_date' => null,
- 'type' => null,
- 'units' => null
+ 'external_reference_id' => null
];
/**
@@ -105,21 +105,21 @@ class UniversalActivity implements ModelInterface, ArrayAccess, \JsonSerializabl
protected static array $openAPINullables = [
'id' => false,
'account' => false,
+ 'symbol' => true,
+ 'option_symbol' => true,
+ 'price' => false,
+ 'units' => false,
'amount' => true,
'currency' => false,
+ 'type' => false,
+ 'option_type' => false,
'description' => false,
+ 'trade_date' => true,
+ 'settlement_date' => false,
'fee' => false,
'fx_rate' => true,
'institution' => false,
- 'option_type' => false,
- 'price' => false,
- 'settlement_date' => false,
- 'external_reference_id' => true,
- 'symbol' => false,
- 'option_symbol' => false,
- 'trade_date' => true,
- 'type' => false,
- 'units' => false
+ 'external_reference_id' => true
];
/**
@@ -210,21 +210,21 @@ public function isNullableSetToNull(string $property): bool
protected static $attributeMap = [
'id' => 'id',
'account' => 'account',
+ 'symbol' => 'symbol',
+ 'option_symbol' => 'option_symbol',
+ 'price' => 'price',
+ 'units' => 'units',
'amount' => 'amount',
'currency' => 'currency',
+ 'type' => 'type',
+ 'option_type' => 'option_type',
'description' => 'description',
+ 'trade_date' => 'trade_date',
+ 'settlement_date' => 'settlement_date',
'fee' => 'fee',
'fx_rate' => 'fx_rate',
'institution' => 'institution',
- 'option_type' => 'option_type',
- 'price' => 'price',
- 'settlement_date' => 'settlement_date',
- 'external_reference_id' => 'external_reference_id',
- 'symbol' => 'symbol',
- 'option_symbol' => 'option_symbol',
- 'trade_date' => 'trade_date',
- 'type' => 'type',
- 'units' => 'units'
+ 'external_reference_id' => 'external_reference_id'
];
/**
@@ -235,21 +235,21 @@ public function isNullableSetToNull(string $property): bool
protected static $setters = [
'id' => 'setId',
'account' => 'setAccount',
+ 'symbol' => 'setSymbol',
+ 'option_symbol' => 'setOptionSymbol',
+ 'price' => 'setPrice',
+ 'units' => 'setUnits',
'amount' => 'setAmount',
'currency' => 'setCurrency',
+ 'type' => 'setType',
+ 'option_type' => 'setOptionType',
'description' => 'setDescription',
+ 'trade_date' => 'setTradeDate',
+ 'settlement_date' => 'setSettlementDate',
'fee' => 'setFee',
'fx_rate' => 'setFxRate',
'institution' => 'setInstitution',
- 'option_type' => 'setOptionType',
- 'price' => 'setPrice',
- 'settlement_date' => 'setSettlementDate',
- 'external_reference_id' => 'setExternalReferenceId',
- 'symbol' => 'setSymbol',
- 'option_symbol' => 'setOptionSymbol',
- 'trade_date' => 'setTradeDate',
- 'type' => 'setType',
- 'units' => 'setUnits'
+ 'external_reference_id' => 'setExternalReferenceId'
];
/**
@@ -260,21 +260,21 @@ public function isNullableSetToNull(string $property): bool
protected static $getters = [
'id' => 'getId',
'account' => 'getAccount',
+ 'symbol' => 'getSymbol',
+ 'option_symbol' => 'getOptionSymbol',
+ 'price' => 'getPrice',
+ 'units' => 'getUnits',
'amount' => 'getAmount',
'currency' => 'getCurrency',
+ 'type' => 'getType',
+ 'option_type' => 'getOptionType',
'description' => 'getDescription',
+ 'trade_date' => 'getTradeDate',
+ 'settlement_date' => 'getSettlementDate',
'fee' => 'getFee',
'fx_rate' => 'getFxRate',
'institution' => 'getInstitution',
- 'option_type' => 'getOptionType',
- 'price' => 'getPrice',
- 'settlement_date' => 'getSettlementDate',
- 'external_reference_id' => 'getExternalReferenceId',
- 'symbol' => 'getSymbol',
- 'option_symbol' => 'getOptionSymbol',
- 'trade_date' => 'getTradeDate',
- 'type' => 'getType',
- 'units' => 'getUnits'
+ 'external_reference_id' => 'getExternalReferenceId'
];
/**
@@ -336,21 +336,21 @@ public function __construct(array $data = null)
{
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('account', $data ?? [], null);
+ $this->setIfExists('symbol', $data ?? [], null);
+ $this->setIfExists('option_symbol', $data ?? [], null);
+ $this->setIfExists('price', $data ?? [], null);
+ $this->setIfExists('units', $data ?? [], null);
$this->setIfExists('amount', $data ?? [], null);
$this->setIfExists('currency', $data ?? [], null);
+ $this->setIfExists('type', $data ?? [], null);
+ $this->setIfExists('option_type', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
+ $this->setIfExists('trade_date', $data ?? [], null);
+ $this->setIfExists('settlement_date', $data ?? [], null);
$this->setIfExists('fee', $data ?? [], null);
$this->setIfExists('fx_rate', $data ?? [], null);
$this->setIfExists('institution', $data ?? [], null);
- $this->setIfExists('option_type', $data ?? [], null);
- $this->setIfExists('price', $data ?? [], null);
- $this->setIfExists('settlement_date', $data ?? [], null);
$this->setIfExists('external_reference_id', $data ?? [], null);
- $this->setIfExists('symbol', $data ?? [], null);
- $this->setIfExists('option_symbol', $data ?? [], null);
- $this->setIfExists('trade_date', $data ?? [], null);
- $this->setIfExists('type', $data ?? [], null);
- $this->setIfExists('units', $data ?? [], null);
}
/**
@@ -408,7 +408,7 @@ public function getId()
/**
* Sets id
*
- * @param string|null $id id
+ * @param string|null $id Unique identifier for the transaction. This is the ID used to reference the transaction in SnapTrade. Please note that this ID _can_ change if the transaction is deleted and re-added. Under normal circumstances, SnapTrade does not delete transactions. The only time this would happen is if SnapTrade re-fetches and reprocesses the data from the brokerage, which is rare. If you require a stable ID, please let us know and we can work with you to provide one.
*
* @return self
*/
@@ -454,464 +454,478 @@ public function setAccount($account)
}
/**
- * Gets amount
+ * Gets symbol
*
- * @return float|null
+ * @return \SnapTrade\Model\AccountUniversalActivitySymbol|null
*/
- public function getAmount()
+ public function getSymbol()
{
- return $this->container['amount'];
+ return $this->container['symbol'];
}
/**
- * Sets amount
+ * Sets symbol
*
- * @param float|null $amount amount
+ * @param \SnapTrade\Model\AccountUniversalActivitySymbol|null $symbol symbol
*
* @return self
*/
- public function setAmount($amount)
+ public function setSymbol($symbol)
{
- if (is_null($amount)) {
- array_push($this->openAPINullablesSetToNull, 'amount');
+ if (is_null($symbol)) {
+ array_push($this->openAPINullablesSetToNull, 'symbol');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('amount', $nullablesSetToNull);
+ $index = array_search('symbol', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['amount'] = $amount;
+ $this->container['symbol'] = $symbol;
return $this;
}
/**
- * Gets currency
+ * Gets option_symbol
*
- * @return \SnapTrade\Model\Currency|null
+ * @return \SnapTrade\Model\AccountUniversalActivityOptionSymbol|null
*/
- public function getCurrency()
+ public function getOptionSymbol()
{
- return $this->container['currency'];
+ return $this->container['option_symbol'];
}
/**
- * Sets currency
+ * Sets option_symbol
*
- * @param \SnapTrade\Model\Currency|null $currency currency
+ * @param \SnapTrade\Model\AccountUniversalActivityOptionSymbol|null $option_symbol option_symbol
*
* @return self
*/
- public function setCurrency($currency)
+ public function setOptionSymbol($option_symbol)
{
- if (is_null($currency)) {
- throw new \InvalidArgumentException('non-nullable currency cannot be null');
+ if (is_null($option_symbol)) {
+ array_push($this->openAPINullablesSetToNull, 'option_symbol');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('option_symbol', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
- $this->container['currency'] = $currency;
+ $this->container['option_symbol'] = $option_symbol;
return $this;
}
/**
- * Gets description
+ * Gets price
*
- * @return string|null
+ * @return float|null
*/
- public function getDescription()
+ public function getPrice()
{
- return $this->container['description'];
+ return $this->container['price'];
}
/**
- * Sets description
+ * Sets price
*
- * @param string|null $description description
+ * @param float|null $price The price of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
*
* @return self
*/
- public function setDescription($description)
+ public function setPrice($price)
{
- if (is_null($description)) {
- throw new \InvalidArgumentException('non-nullable description cannot be null');
+ if (is_null($price)) {
+ throw new \InvalidArgumentException('non-nullable price cannot be null');
}
- $this->container['description'] = $description;
+ $this->container['price'] = $price;
return $this;
}
/**
- * Gets fee
+ * Gets units
*
* @return float|null
*/
- public function getFee()
+ public function getUnits()
{
- return $this->container['fee'];
+ return $this->container['units'];
}
/**
- * Sets fee
+ * Sets units
*
- * @param float|null $fee fee
+ * @param float|null $units The number of units of the security for the transaction. This is mostly applicable to `BUY`, `SELL`, and `DIVIDEND` transactions.
*
* @return self
*/
- public function setFee($fee)
+ public function setUnits($units)
{
- if (is_null($fee)) {
- throw new \InvalidArgumentException('non-nullable fee cannot be null');
+ if (is_null($units)) {
+ throw new \InvalidArgumentException('non-nullable units cannot be null');
}
- $this->container['fee'] = $fee;
+ $this->container['units'] = $units;
return $this;
}
/**
- * Gets fx_rate
+ * Gets amount
*
* @return float|null
*/
- public function getFxRate()
+ public function getAmount()
{
- return $this->container['fx_rate'];
+ return $this->container['amount'];
}
/**
- * Sets fx_rate
+ * Sets amount
*
- * @param float|null $fx_rate The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency)
+ * @param float|null $amount The amount of the transaction denominated in `currency`. This can be positive or negative. In general, transactions that positively affect the account balance (like sell, deposits, dividends, etc) will have a positive amount, while transactions that negatively affect the account balance (like buy, withdrawals, fees, etc) will have a negative amount.
*
* @return self
*/
- public function setFxRate($fx_rate)
+ public function setAmount($amount)
{
- if (is_null($fx_rate)) {
- array_push($this->openAPINullablesSetToNull, 'fx_rate');
+ if (is_null($amount)) {
+ array_push($this->openAPINullablesSetToNull, 'amount');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('fx_rate', $nullablesSetToNull);
+ $index = array_search('amount', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['fx_rate'] = $fx_rate;
+ $this->container['amount'] = $amount;
return $this;
}
/**
- * Gets institution
+ * Gets currency
*
- * @return string|null
+ * @return \SnapTrade\Model\AccountUniversalActivityCurrency|null
*/
- public function getInstitution()
+ public function getCurrency()
{
- return $this->container['institution'];
+ return $this->container['currency'];
}
/**
- * Sets institution
+ * Sets currency
*
- * @param string|null $institution institution
+ * @param \SnapTrade\Model\AccountUniversalActivityCurrency|null $currency currency
*
* @return self
*/
- public function setInstitution($institution)
+ public function setCurrency($currency)
{
- if (is_null($institution)) {
- throw new \InvalidArgumentException('non-nullable institution cannot be null');
+ if (is_null($currency)) {
+ throw new \InvalidArgumentException('non-nullable currency cannot be null');
}
- $this->container['institution'] = $institution;
+ $this->container['currency'] = $currency;
return $this;
}
/**
- * Gets option_type
+ * Gets type
*
* @return string|null
*/
- public function getOptionType()
+ public function getType()
{
- return $this->container['option_type'];
+ return $this->container['type'];
}
/**
- * Sets option_type
+ * Sets type
*
- * @param string|null $option_type If an option transaction, then it's type (BUY_TO_OPEN, SELL_TO_CLOSE, etc), otherwise empty string
+ * @param string|null $type A string representing the type of transaction. SnapTrade does a best effort to categorize the brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `OPTIONEXPIRATION` - Option expiration event. `option_symbol` contains the related option contract info. - `OPTIONASSIGNMENT` - Option assignment event. `option_symbol` contains the related option contract info. - `OPTIONEXERCISE` - Option exercise event. `option_symbol` contains the related option contract info.
*
* @return self
*/
- public function setOptionType($option_type)
+ public function setType($type)
{
- if (is_null($option_type)) {
- throw new \InvalidArgumentException('non-nullable option_type cannot be null');
+ if (is_null($type)) {
+ throw new \InvalidArgumentException('non-nullable type cannot be null');
}
- $this->container['option_type'] = $option_type;
+ $this->container['type'] = $type;
return $this;
}
/**
- * Gets price
+ * Gets option_type
*
- * @return float|null
+ * @return string|null
*/
- public function getPrice()
+ public function getOptionType()
{
- return $this->container['price'];
+ return $this->container['option_type'];
}
/**
- * Sets price
+ * Sets option_type
*
- * @param float|null $price price
+ * @param string|null $option_type If an option `BUY` or `SELL` transaction, this further specifies the type of action. The possible values are: - BUY_TO_OPEN - BUY_TO_CLOSE - SELL_TO_OPEN - SELL_TO_CLOSE
*
* @return self
*/
- public function setPrice($price)
+ public function setOptionType($option_type)
{
- if (is_null($price)) {
- throw new \InvalidArgumentException('non-nullable price cannot be null');
+ if (is_null($option_type)) {
+ throw new \InvalidArgumentException('non-nullable option_type cannot be null');
}
- $this->container['price'] = $price;
+ $this->container['option_type'] = $option_type;
return $this;
}
/**
- * Gets settlement_date
+ * Gets description
*
* @return string|null
*/
- public function getSettlementDate()
+ public function getDescription()
{
- return $this->container['settlement_date'];
+ return $this->container['description'];
}
/**
- * Sets settlement_date
+ * Sets description
*
- * @param string|null $settlement_date settlement_date
+ * @param string|null $description A human-readable description of the transaction. This is usually the brokerage's description of the transaction.
*
* @return self
*/
- public function setSettlementDate($settlement_date)
+ public function setDescription($description)
{
- if (is_null($settlement_date)) {
- throw new \InvalidArgumentException('non-nullable settlement_date cannot be null');
+ if (is_null($description)) {
+ throw new \InvalidArgumentException('non-nullable description cannot be null');
}
- $this->container['settlement_date'] = $settlement_date;
+ $this->container['description'] = $description;
return $this;
}
/**
- * Gets external_reference_id
+ * Gets trade_date
*
- * @return string|null
+ * @return \DateTime|null
*/
- public function getExternalReferenceId()
+ public function getTradeDate()
{
- return $this->container['external_reference_id'];
+ return $this->container['trade_date'];
}
/**
- * Sets external_reference_id
+ * Sets trade_date
*
- * @param string|null $external_reference_id Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same external_reference_id
+ * @param \DateTime|null $trade_date The recorded time for the transaction. The granularity of this timestamp depends on the brokerage. Some brokerages provide the exact time of the transaction, while others provide only the date. Please check the [integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=6fab8012ade6441fa0c6d9af9c55ce3a) for the specific brokerage to see the granularity of the timestamps. Note that even though the field is named `trade_date`, it can represent any type of transaction, not just trades.
*
* @return self
*/
- public function setExternalReferenceId($external_reference_id)
+ public function setTradeDate($trade_date)
{
- if (is_null($external_reference_id)) {
- array_push($this->openAPINullablesSetToNull, 'external_reference_id');
+ if (is_null($trade_date)) {
+ array_push($this->openAPINullablesSetToNull, 'trade_date');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('external_reference_id', $nullablesSetToNull);
+ $index = array_search('trade_date', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['external_reference_id'] = $external_reference_id;
+ $this->container['trade_date'] = $trade_date;
return $this;
}
/**
- * Gets symbol
+ * Gets settlement_date
*
- * @return \SnapTrade\Model\Symbol|null
+ * @return \DateTime|null
*/
- public function getSymbol()
+ public function getSettlementDate()
{
- return $this->container['symbol'];
+ return $this->container['settlement_date'];
}
/**
- * Sets symbol
+ * Sets settlement_date
*
- * @param \SnapTrade\Model\Symbol|null $symbol symbol
+ * @param \DateTime|null $settlement_date The date on which the transaction is settled.
*
* @return self
*/
- public function setSymbol($symbol)
+ public function setSettlementDate($settlement_date)
{
- if (is_null($symbol)) {
- throw new \InvalidArgumentException('non-nullable symbol cannot be null');
+ if (is_null($settlement_date)) {
+ throw new \InvalidArgumentException('non-nullable settlement_date cannot be null');
}
- $this->container['symbol'] = $symbol;
+ $this->container['settlement_date'] = $settlement_date;
return $this;
}
/**
- * Gets option_symbol
+ * Gets fee
*
- * @return \SnapTrade\Model\OptionsSymbol|null
+ * @return float|null
*/
- public function getOptionSymbol()
+ public function getFee()
{
- return $this->container['option_symbol'];
+ return $this->container['fee'];
}
/**
- * Sets option_symbol
+ * Sets fee
*
- * @param \SnapTrade\Model\OptionsSymbol|null $option_symbol option_symbol
+ * @param float|null $fee Any fee associated with the transaction if provided by the brokerage.
*
* @return self
*/
- public function setOptionSymbol($option_symbol)
+ public function setFee($fee)
{
- if (is_null($option_symbol)) {
- throw new \InvalidArgumentException('non-nullable option_symbol cannot be null');
+ if (is_null($fee)) {
+ throw new \InvalidArgumentException('non-nullable fee cannot be null');
}
- $this->container['option_symbol'] = $option_symbol;
+ $this->container['fee'] = $fee;
return $this;
}
/**
- * Gets trade_date
+ * Gets fx_rate
*
- * @return string|null
+ * @return float|null
*/
- public function getTradeDate()
+ public function getFxRate()
{
- return $this->container['trade_date'];
+ return $this->container['fx_rate'];
}
/**
- * Sets trade_date
+ * Sets fx_rate
*
- * @param string|null $trade_date trade_date
+ * @param float|null $fx_rate The forex conversion rate involved in the transaction if provided by the brokerage. Used in cases where securities of one currency are purchased in a different currency, and the forex conversion is automatic. In those cases, price, amount and fee will be in the top level currency (activity -> currency)
*
* @return self
*/
- public function setTradeDate($trade_date)
+ public function setFxRate($fx_rate)
{
- if (is_null($trade_date)) {
- array_push($this->openAPINullablesSetToNull, 'trade_date');
+ if (is_null($fx_rate)) {
+ array_push($this->openAPINullablesSetToNull, 'fx_rate');
} else {
$nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
- $index = array_search('trade_date', $nullablesSetToNull);
+ $index = array_search('fx_rate', $nullablesSetToNull);
if ($index !== FALSE) {
unset($nullablesSetToNull[$index]);
$this->setOpenAPINullablesSetToNull($nullablesSetToNull);
}
}
- $this->container['trade_date'] = $trade_date;
+ $this->container['fx_rate'] = $fx_rate;
return $this;
}
/**
- * Gets type
+ * Gets institution
*
* @return string|null
*/
- public function getType()
+ public function getInstitution()
{
- return $this->container['type'];
+ return $this->container['institution'];
}
/**
- * Sets type
+ * Sets institution
*
- * @param string|null $type Potential values include (but are not limited to) - DIVIDEND - BUY - SELL - CONTRIBUTION - WITHDRAWAL - EXTERNAL_ASSET_TRANSFER_IN - EXTERNAL_ASSET_TRANSFER_OUT - INTERNAL_CASH_TRANSFER_IN - INTERNAL_CASH_TRANSFER_OUT - INTERNAL_ASSET_TRANSFER_IN - INTERNAL_ASSET_TRANSFER_OUT - INTEREST - REBATE - GOV_GRANT - TAX - FEE - REI - FXT
+ * @param string|null $institution The institution that the transaction is associated with. This is usually the brokerage name.
*
* @return self
*/
- public function setType($type)
+ public function setInstitution($institution)
{
- if (is_null($type)) {
- throw new \InvalidArgumentException('non-nullable type cannot be null');
+ if (is_null($institution)) {
+ throw new \InvalidArgumentException('non-nullable institution cannot be null');
}
- $this->container['type'] = $type;
+ $this->container['institution'] = $institution;
return $this;
}
/**
- * Gets units
+ * Gets external_reference_id
*
- * @return float|null
+ * @return string|null
*/
- public function getUnits()
+ public function getExternalReferenceId()
{
- return $this->container['units'];
+ return $this->container['external_reference_id'];
}
/**
- * Sets units
+ * Sets external_reference_id
*
- * @param float|null $units Usually but not necessarily an integer
+ * @param string|null $external_reference_id Reference ID from brokerage used to identify related transactions. For example if an order comprises of several transactions (buy, fee, fx), they can be grouped if they share the same `external_reference_id`
*
* @return self
*/
- public function setUnits($units)
+ public function setExternalReferenceId($external_reference_id)
{
- if (is_null($units)) {
- throw new \InvalidArgumentException('non-nullable units cannot be null');
+ if (is_null($external_reference_id)) {
+ array_push($this->openAPINullablesSetToNull, 'external_reference_id');
+ } else {
+ $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+ $index = array_search('external_reference_id', $nullablesSetToNull);
+ if ($index !== FALSE) {
+ unset($nullablesSetToNull[$index]);
+ $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+ }
}
- $this->container['units'] = $units;
+ $this->container['external_reference_id'] = $external_reference_id;
return $this;
}
diff --git a/lib/Model/UniversalSymbol.php b/lib/Model/UniversalSymbol.php
index 90c9276..c6acdcd 100644
--- a/lib/Model/UniversalSymbol.php
+++ b/lib/Model/UniversalSymbol.php
@@ -55,12 +55,12 @@ class UniversalSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
'symbol' => 'string',
'raw_symbol' => 'string',
'description' => 'string',
- 'currency' => '\SnapTrade\Model\UniversalSymbolCurrency',
- 'exchange' => '\SnapTrade\Model\UniversalSymbolExchange',
+ 'currency' => '\SnapTrade\Model\SymbolCurrency',
+ 'exchange' => '\SnapTrade\Model\SymbolExchange',
'type' => '\SnapTrade\Model\SecurityType',
- 'currencies' => '\SnapTrade\Model\Currency[]',
'figi_code' => 'string',
- 'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument'
+ 'figi_instrument' => '\SnapTrade\Model\SymbolFigiInstrument',
+ 'currencies' => '\SnapTrade\Model\Currency[]'
];
/**
@@ -78,9 +78,9 @@ class UniversalSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
'currency' => null,
'exchange' => null,
'type' => null,
- 'currencies' => null,
'figi_code' => null,
- 'figi_instrument' => null
+ 'figi_instrument' => null,
+ 'currencies' => null
];
/**
@@ -96,9 +96,9 @@ class UniversalSymbol implements ModelInterface, ArrayAccess, \JsonSerializable
'currency' => false,
'exchange' => false,
'type' => false,
- 'currencies' => false,
'figi_code' => true,
- 'figi_instrument' => true
+ 'figi_instrument' => true,
+ 'currencies' => false
];
/**
@@ -194,9 +194,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'currency',
'exchange' => 'exchange',
'type' => 'type',
- 'currencies' => 'currencies',
'figi_code' => 'figi_code',
- 'figi_instrument' => 'figi_instrument'
+ 'figi_instrument' => 'figi_instrument',
+ 'currencies' => 'currencies'
];
/**
@@ -212,9 +212,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'setCurrency',
'exchange' => 'setExchange',
'type' => 'setType',
- 'currencies' => 'setCurrencies',
'figi_code' => 'setFigiCode',
- 'figi_instrument' => 'setFigiInstrument'
+ 'figi_instrument' => 'setFigiInstrument',
+ 'currencies' => 'setCurrencies'
];
/**
@@ -230,9 +230,9 @@ public function isNullableSetToNull(string $property): bool
'currency' => 'getCurrency',
'exchange' => 'getExchange',
'type' => 'getType',
- 'currencies' => 'getCurrencies',
'figi_code' => 'getFigiCode',
- 'figi_instrument' => 'getFigiInstrument'
+ 'figi_instrument' => 'getFigiInstrument',
+ 'currencies' => 'getCurrencies'
];
/**
@@ -299,9 +299,9 @@ public function __construct(array $data = null)
$this->setIfExists('currency', $data ?? [], null);
$this->setIfExists('exchange', $data ?? [], null);
$this->setIfExists('type', $data ?? [], null);
- $this->setIfExists('currencies', $data ?? [], null);
$this->setIfExists('figi_code', $data ?? [], null);
$this->setIfExists('figi_instrument', $data ?? [], null);
+ $this->setIfExists('currencies', $data ?? [], null);
}
/**
@@ -490,7 +490,7 @@ public function setDescription($description)
/**
* Gets currency
*
- * @return \SnapTrade\Model\UniversalSymbolCurrency
+ * @return \SnapTrade\Model\SymbolCurrency
*/
public function getCurrency()
{
@@ -500,7 +500,7 @@ public function getCurrency()
/**
* Sets currency
*
- * @param \SnapTrade\Model\UniversalSymbolCurrency $currency currency
+ * @param \SnapTrade\Model\SymbolCurrency $currency currency
*
* @return self
*/
@@ -519,7 +519,7 @@ public function setCurrency($currency)
/**
* Gets exchange
*
- * @return \SnapTrade\Model\UniversalSymbolExchange|null
+ * @return \SnapTrade\Model\SymbolExchange|null
*/
public function getExchange()
{
@@ -529,7 +529,7 @@ public function getExchange()
/**
* Sets exchange
*
- * @param \SnapTrade\Model\UniversalSymbolExchange|null $exchange exchange
+ * @param \SnapTrade\Model\SymbolExchange|null $exchange exchange
*
* @return self
*/
@@ -574,37 +574,6 @@ public function setType($type)
return $this;
}
- /**
- * Gets currencies
- *
- * @return \SnapTrade\Model\Currency[]
- * @deprecated
- */
- public function getCurrencies()
- {
- return $this->container['currencies'];
- }
-
- /**
- * Sets currencies
- *
- * @param \SnapTrade\Model\Currency[] $currencies This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
- *
- * @return self
- * @deprecated
- */
- public function setCurrencies($currencies)
- {
-
- if (is_null($currencies)) {
- throw new \InvalidArgumentException('non-nullable currencies cannot be null');
- }
-
- $this->container['currencies'] = $currencies;
-
- return $this;
- }
-
/**
* Gets figi_code
*
@@ -676,6 +645,37 @@ public function setFigiInstrument($figi_instrument)
return $this;
}
+
+ /**
+ * Gets currencies
+ *
+ * @return \SnapTrade\Model\Currency[]
+ * @deprecated
+ */
+ public function getCurrencies()
+ {
+ return $this->container['currencies'];
+ }
+
+ /**
+ * Sets currencies
+ *
+ * @param \SnapTrade\Model\Currency[] $currencies This field is deprecated and should not be used. Please reach out to SnapTrade support if you have a valid usecase for this.
+ *
+ * @return self
+ * @deprecated
+ */
+ public function setCurrencies($currencies)
+ {
+
+ if (is_null($currencies)) {
+ throw new \InvalidArgumentException('non-nullable currencies cannot be null');
+ }
+
+ $this->container['currencies'] = $currencies;
+
+ return $this;
+ }
/**
* Returns true if offset exists. False otherwise.
*
diff --git a/lib/Model/UserIDandSecret.php b/lib/Model/UserIDandSecret.php
index 831d173..be17fcd 100644
--- a/lib/Model/UserIDandSecret.php
+++ b/lib/Model/UserIDandSecret.php
@@ -30,7 +30,6 @@
* UserIDandSecret Class Doc Comment
*
* @category Class
- * @description Response when register user is successful
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -332,7 +331,7 @@ public function getUserSecret()
/**
* Sets user_secret
*
- * @param string|null $user_secret SnapTrade User Secret randomly generated by SnapTrade. This is privileged information and if compromised, should be rotated via the SnapTrade API.
+ * @param string|null $user_secret SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret).
*
* @return self
*/
diff --git a/lib/Model/ValidatedTradeBody.php b/lib/Model/ValidatedTradeBody.php
index 893308d..77fd981 100644
--- a/lib/Model/ValidatedTradeBody.php
+++ b/lib/Model/ValidatedTradeBody.php
@@ -30,7 +30,6 @@
* ValidatedTradeBody Class Doc Comment
*
* @category Class
- * @description Validated Trade Form
* @package SnapTrade
* @implements \ArrayAccess
*/
@@ -296,7 +295,7 @@ public function getWaitToConfirm()
/**
* Sets wait_to_confirm
*
- * @param bool|null $wait_to_confirm Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status PENDING as we will not wait to check on the status before responding to the request
+ * @param bool|null $wait_to_confirm Optional, defaults to true. Determines if a wait is performed to check on order status. If false, latency will be reduced but orders returned will be more likely to be of status `PENDING` as we will not wait to check on the status before responding to the request.
*
* @return self
*/
diff --git a/test/Api/AccountInformationApiTest.php b/test/Api/AccountInformationApiTest.php
index 1297707..c2f46ed 100644
--- a/test/Api/AccountInformationApiTest.php
+++ b/test/Api/AccountInformationApiTest.php
@@ -58,6 +58,18 @@ public static function tearDownAfterClass(): void
{
}
+ /**
+ * Test case for getAccountActivities
+ *
+ * List account activities.
+ *
+ */
+ public function testGetAccountActivities()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for getAllUserHoldings
*
@@ -94,10 +106,22 @@ public function testGetUserAccountDetails()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test case for getUserAccountOrderDetail
+ *
+ * Get account order detail.
+ *
+ */
+ public function testGetUserAccountOrderDetail()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for getUserAccountOrders
*
- * List account recent orders.
+ * List account orders.
*
*/
public function testGetUserAccountOrders()
@@ -118,6 +142,30 @@ public function testGetUserAccountPositions()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test case for getUserAccountRecentOrders
+ *
+ * List account recent orders (last 24 hours only).
+ *
+ */
+ public function testGetUserAccountRecentOrders()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for getUserAccountReturnRates
+ *
+ * List account rate of returns.
+ *
+ */
+ public function testGetUserAccountReturnRates()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for getUserHoldings
*
diff --git a/test/Api/AuthenticationApiTest.php b/test/Api/AuthenticationApiTest.php
index 5b9803c..f670ab8 100644
--- a/test/Api/AuthenticationApiTest.php
+++ b/test/Api/AuthenticationApiTest.php
@@ -61,7 +61,7 @@ public static function tearDownAfterClass(): void
/**
* Test case for deleteSnapTradeUser
*
- * Delete SnapTrade user.
+ * Delete user.
*
*/
public function testDeleteSnapTradeUser()
@@ -73,7 +73,7 @@ public function testDeleteSnapTradeUser()
/**
* Test case for listSnapTradeUsers
*
- * List SnapTrade users.
+ * List all users.
*
*/
public function testListSnapTradeUsers()
@@ -85,7 +85,7 @@ public function testListSnapTradeUsers()
/**
* Test case for loginSnapTradeUser
*
- * Login user & generate connection link.
+ * Generate Connection Portal URL.
*
*/
public function testLoginSnapTradeUser()
@@ -97,7 +97,7 @@ public function testLoginSnapTradeUser()
/**
* Test case for registerSnapTradeUser
*
- * Create SnapTrade user.
+ * Register user.
*
*/
public function testRegisterSnapTradeUser()
@@ -109,7 +109,7 @@ public function testRegisterSnapTradeUser()
/**
* Test case for resetSnapTradeUserSecret
*
- * Obtain a new user secret for a user.
+ * Rotate user secret.
*
*/
public function testResetSnapTradeUserSecret()
diff --git a/test/Api/ConnectionsApiTest.php b/test/Api/ConnectionsApiTest.php
index 61ae906..d4d21e0 100644
--- a/test/Api/ConnectionsApiTest.php
+++ b/test/Api/ConnectionsApiTest.php
@@ -61,7 +61,7 @@ public static function tearDownAfterClass(): void
/**
* Test case for detailBrokerageAuthorization
*
- * Get brokerage authorization details.
+ * Get connection detail.
*
*/
public function testDetailBrokerageAuthorization()
@@ -73,7 +73,7 @@ public function testDetailBrokerageAuthorization()
/**
* Test case for disableBrokerageAuthorization
*
- * Manually disable a connection for testing.
+ * Force disable connection.
*
*/
public function testDisableBrokerageAuthorization()
@@ -85,7 +85,7 @@ public function testDisableBrokerageAuthorization()
/**
* Test case for listBrokerageAuthorizations
*
- * List all brokerage authorizations for the User.
+ * List all connections.
*
*/
public function testListBrokerageAuthorizations()
@@ -109,7 +109,7 @@ public function testRefreshBrokerageAuthorization()
/**
* Test case for removeBrokerageAuthorization
*
- * Delete brokerage authorization.
+ * Delete connection.
*
*/
public function testRemoveBrokerageAuthorization()
@@ -118,6 +118,18 @@ public function testRemoveBrokerageAuthorization()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test case for returnRates
+ *
+ * List connection rate of returns.
+ *
+ */
+ public function testReturnRates()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for sessionEvents
*
diff --git a/test/Api/ExperimentalEndpointsApiTest.php b/test/Api/ExperimentalEndpointsApiTest.php
new file mode 100644
index 0000000..26c1cc0
--- /dev/null
+++ b/test/Api/ExperimentalEndpointsApiTest.php
@@ -0,0 +1,96 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for getUserAccountOrdersV2
+ *
+ * List account orders v2.
+ *
+ */
+ public function testGetUserAccountOrdersV2()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for getUserAccountRecentOrdersV2
+ *
+ * List account recent orders (V2, last 24 hours only).
+ *
+ */
+ public function testGetUserAccountRecentOrdersV2()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Api/OptionsApiTest.php b/test/Api/OptionsApiTest.php
index 0a5fd8a..3d7e119 100644
--- a/test/Api/OptionsApiTest.php
+++ b/test/Api/OptionsApiTest.php
@@ -58,18 +58,6 @@ public static function tearDownAfterClass(): void
{
}
- /**
- * Test case for getOptionStrategy
- *
- * Create options strategy.
- *
- */
- public function testGetOptionStrategy()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
/**
* Test case for getOptionsChain
*
@@ -82,18 +70,6 @@ public function testGetOptionsChain()
$this->markTestIncomplete('Not implemented');
}
- /**
- * Test case for getOptionsStrategyQuote
- *
- * Get options strategy quotes.
- *
- */
- public function testGetOptionsStrategyQuote()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
/**
* Test case for listOptionHoldings
*
@@ -105,16 +81,4 @@ public function testListOptionHoldings()
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
-
- /**
- * Test case for placeOptionStrategy
- *
- * Place an option strategy order.
- *
- */
- public function testPlaceOptionStrategy()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
}
diff --git a/test/Api/ReferenceDataApiTest.php b/test/Api/ReferenceDataApiTest.php
index 45f477c..04f5636 100644
--- a/test/Api/ReferenceDataApiTest.php
+++ b/test/Api/ReferenceDataApiTest.php
@@ -73,7 +73,7 @@ public function testGetCurrencyExchangeRatePair()
/**
* Test case for getPartnerInfo
*
- * Get metadata related to Snaptrade partner.
+ * Get Client Info.
*
*/
public function testGetPartnerInfo()
@@ -85,7 +85,7 @@ public function testGetPartnerInfo()
/**
* Test case for getSecurityTypes
*
- * List of all security types.
+ * List security types.
*
*/
public function testGetSecurityTypes()
@@ -109,7 +109,7 @@ public function testGetStockExchanges()
/**
* Test case for getSymbols
*
- * Search for symbols.
+ * Search symbols.
*
*/
public function testGetSymbols()
@@ -121,7 +121,7 @@ public function testGetSymbols()
/**
* Test case for getSymbolsByTicker
*
- * Get details of a symbol.
+ * Get symbol detail.
*
*/
public function testGetSymbolsByTicker()
@@ -142,6 +142,18 @@ public function testListAllBrokerageAuthorizationType()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test case for listAllBrokerageInstruments
+ *
+ * Get brokerage instruments.
+ *
+ */
+ public function testListAllBrokerageInstruments()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for listAllBrokerages
*
@@ -181,7 +193,7 @@ public function testListAllCurrenciesRates()
/**
* Test case for symbolSearchUserAccount
*
- * Search for symbols available in an account.
+ * Search account symbols.
*
*/
public function testSymbolSearchUserAccount()
diff --git a/test/Api/TradingApiTest.php b/test/Api/TradingApiTest.php
index 55e4928..ff91b5b 100644
--- a/test/Api/TradingApiTest.php
+++ b/test/Api/TradingApiTest.php
@@ -58,10 +58,22 @@ public static function tearDownAfterClass(): void
{
}
+ /**
+ * Test case for cancelOrder
+ *
+ * Cancel order.
+ *
+ */
+ public function testCancelOrder()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for cancelUserAccountOrder
*
- * Cancel open order in account.
+ * Cancel equity order.
*
*/
public function testCancelUserAccountOrder()
@@ -70,10 +82,22 @@ public function testCancelUserAccountOrder()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test case for getCryptocurrencyPairQuote
+ *
+ * Get crypto pair quote.
+ *
+ */
+ public function testGetCryptocurrencyPairQuote()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for getOrderImpact
*
- * Check the impact of a trade on an account.
+ * Check equity order impact.
*
*/
public function testGetOrderImpact()
@@ -85,7 +109,7 @@ public function testGetOrderImpact()
/**
* Test case for getUserAccountQuotes
*
- * Get symbol quotes.
+ * Get equity symbol quotes.
*
*/
public function testGetUserAccountQuotes()
@@ -94,10 +118,34 @@ public function testGetUserAccountQuotes()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test case for placeBracketOrder
+ *
+ * Place bracket order.
+ *
+ */
+ public function testPlaceBracketOrder()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for placeCryptoOrder
+ *
+ * Place crypto order.
+ *
+ */
+ public function testPlaceCryptoOrder()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for placeForceOrder
*
- * Place a trade with NO validation..
+ * Place equity order.
*
*/
public function testPlaceForceOrder()
@@ -106,10 +154,22 @@ public function testPlaceForceOrder()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test case for placeMlegOrder
+ *
+ * Place option order.
+ *
+ */
+ public function testPlaceMlegOrder()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test case for placeOrder
*
- * Place order.
+ * Place checked equity order.
*
*/
public function testPlaceOrder()
@@ -117,4 +177,40 @@ public function testPlaceOrder()
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
+
+ /**
+ * Test case for previewCryptoOrder
+ *
+ * Preview crypto order.
+ *
+ */
+ public function testPreviewCryptoOrder()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for replaceOrder
+ *
+ * Replace order.
+ *
+ */
+ public function testReplaceOrder()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test case for searchCryptocurrencyPairInstruments
+ *
+ * Get crypto pairs.
+ *
+ */
+ public function testSearchCryptocurrencyPairInstruments()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
}
diff --git a/test/Model/AccountInformationGetUserAccountOrderDetailRequestTest.php b/test/Model/AccountInformationGetUserAccountOrderDetailRequestTest.php
new file mode 100644
index 0000000..483faf2
--- /dev/null
+++ b/test/Model/AccountInformationGetUserAccountOrderDetailRequestTest.php
@@ -0,0 +1,83 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "brokerage_order_id"
+ */
+ public function testPropertyBrokerageOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountOrderRecordChildBrokerageOrderIdsTest.php b/test/Model/AccountOrderRecordChildBrokerageOrderIdsTest.php
new file mode 100644
index 0000000..b05e583
--- /dev/null
+++ b/test/Model/AccountOrderRecordChildBrokerageOrderIdsTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "take_profit_order_id"
+ */
+ public function testPropertyTakeProfitOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop_loss_order_id"
+ */
+ public function testPropertyStopLossOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountOrderRecordLegInstrumentTest.php b/test/Model/AccountOrderRecordLegInstrumentTest.php
new file mode 100644
index 0000000..dca9f3a
--- /dev/null
+++ b/test/Model/AccountOrderRecordLegInstrumentTest.php
@@ -0,0 +1,119 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "description"
+ */
+ public function testPropertyDescription()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "asset_type"
+ */
+ public function testPropertyAssetType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "exchange_mic_code"
+ */
+ public function testPropertyExchangeMicCode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "figi_code"
+ */
+ public function testPropertyFigiCode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountOrderRecordLegTest.php b/test/Model/AccountOrderRecordLegTest.php
new file mode 100644
index 0000000..4881b9e
--- /dev/null
+++ b/test/Model/AccountOrderRecordLegTest.php
@@ -0,0 +1,146 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "leg_id"
+ */
+ public function testPropertyLegId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "instrument"
+ */
+ public function testPropertyInstrument()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "action"
+ */
+ public function testPropertyAction()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "execution_price"
+ */
+ public function testPropertyExecutionPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "total_quantity"
+ */
+ public function testPropertyTotalQuantity()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "canceled_quantity"
+ */
+ public function testPropertyCanceledQuantity()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "filled_quantity"
+ */
+ public function testPropertyFilledQuantity()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "status"
+ */
+ public function testPropertyStatus()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountOrderRecordQuoteCurrencyTest.php b/test/Model/AccountOrderRecordQuoteCurrencyTest.php
new file mode 100644
index 0000000..6c49b7a
--- /dev/null
+++ b/test/Model/AccountOrderRecordQuoteCurrencyTest.php
@@ -0,0 +1,101 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "code"
+ */
+ public function testPropertyCode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "name"
+ */
+ public function testPropertyName()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountOrderRecordQuoteUniversalSymbolTest.php b/test/Model/AccountOrderRecordQuoteUniversalSymbolTest.php
new file mode 100644
index 0000000..0e4655a
--- /dev/null
+++ b/test/Model/AccountOrderRecordQuoteUniversalSymbolTest.php
@@ -0,0 +1,164 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "raw_symbol"
+ */
+ public function testPropertyRawSymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "description"
+ */
+ public function testPropertyDescription()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "currency"
+ */
+ public function testPropertyCurrency()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "exchange"
+ */
+ public function testPropertyExchange()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "type"
+ */
+ public function testPropertyType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "figi_code"
+ */
+ public function testPropertyFigiCode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "figi_instrument"
+ */
+ public function testPropertyFigiInstrument()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "currencies"
+ */
+ public function testPropertyCurrencies()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountOrderRecordStatusTest.php b/test/Model/AccountOrderRecordStatusTest.php
index 003e9be..c969bb4 100644
--- a/test/Model/AccountOrderRecordStatusTest.php
+++ b/test/Model/AccountOrderRecordStatusTest.php
@@ -29,7 +29,7 @@
* AccountOrderRecordStatusTest Class Doc Comment
*
* @category Class
- * @description Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum.
+ * @description Indicates the status of an order. SnapTrade does a best effort to map brokerage statuses to statuses in this enum. Possible values include: - NONE - PENDING - ACCEPTED - FAILED - REJECTED - CANCELED - PARTIAL_CANCELED - CANCEL_PENDING - EXECUTED - PARTIAL - REPLACE_PENDING - REPLACED - EXPIRED - QUEUED - TRIGGERED - ACTIVATED
* @package SnapTrade
*/
class AccountOrderRecordStatusTest extends TestCase
diff --git a/test/Model/AccountOrderRecordStatusV2Test.php b/test/Model/AccountOrderRecordStatusV2Test.php
new file mode 100644
index 0000000..a03a61c
--- /dev/null
+++ b/test/Model/AccountOrderRecordStatusV2Test.php
@@ -0,0 +1,74 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountOrderRecordTest.php b/test/Model/AccountOrderRecordTest.php
index 4ac726e..d747ba3 100644
--- a/test/Model/AccountOrderRecordTest.php
+++ b/test/Model/AccountOrderRecordTest.php
@@ -91,27 +91,36 @@ public function testPropertyStatus()
}
/**
- * Test attribute "symbol"
+ * Test attribute "universal_symbol"
*/
- public function testPropertySymbol()
+ public function testPropertyUniversalSymbol()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "universal_symbol"
+ * Test attribute "option_symbol"
*/
- public function testPropertyUniversalSymbol()
+ public function testPropertyOptionSymbol()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "option_symbol"
+ * Test attribute "quote_universal_symbol"
*/
- public function testPropertyOptionSymbol()
+ public function testPropertyQuoteUniversalSymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "quote_currency"
+ */
+ public function testPropertyQuoteCurrency()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
@@ -242,4 +251,22 @@ public function testPropertyExpiryDate()
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "child_brokerage_order_ids"
+ */
+ public function testPropertyChildBrokerageOrderIds()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
}
diff --git a/test/Model/AccountOrderRecordUniversalSymbolTest.php b/test/Model/AccountOrderRecordUniversalSymbolTest.php
index 6c4439a..1b306ba 100644
--- a/test/Model/AccountOrderRecordUniversalSymbolTest.php
+++ b/test/Model/AccountOrderRecordUniversalSymbolTest.php
@@ -136,27 +136,27 @@ public function testPropertyType()
}
/**
- * Test attribute "currencies"
+ * Test attribute "figi_code"
*/
- public function testPropertyCurrencies()
+ public function testPropertyFigiCode()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "figi_code"
+ * Test attribute "figi_instrument"
*/
- public function testPropertyFigiCode()
+ public function testPropertyFigiInstrument()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "figi_instrument"
+ * Test attribute "currencies"
*/
- public function testPropertyFigiInstrument()
+ public function testPropertyCurrencies()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/AccountOrderRecordV2Test.php b/test/Model/AccountOrderRecordV2Test.php
new file mode 100644
index 0000000..96785f2
--- /dev/null
+++ b/test/Model/AccountOrderRecordV2Test.php
@@ -0,0 +1,173 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "brokerage_order_id"
+ */
+ public function testPropertyBrokerageOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "status"
+ */
+ public function testPropertyStatus()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "order_type"
+ */
+ public function testPropertyOrderType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_in_force"
+ */
+ public function testPropertyTimeInForce()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_placed"
+ */
+ public function testPropertyTimePlaced()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_executed"
+ */
+ public function testPropertyTimeExecuted()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "quote_currency"
+ */
+ public function testPropertyQuoteCurrency()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "execution_price"
+ */
+ public function testPropertyExecutionPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "limit_price"
+ */
+ public function testPropertyLimitPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop_price"
+ */
+ public function testPropertyStopPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "legs"
+ */
+ public function testPropertyLegs()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountOrdersV2ResponseTest.php b/test/Model/AccountOrdersV2ResponseTest.php
new file mode 100644
index 0000000..5b665cc
--- /dev/null
+++ b/test/Model/AccountOrdersV2ResponseTest.php
@@ -0,0 +1,83 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "orders"
+ */
+ public function testPropertyOrders()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountSimpleTest.php b/test/Model/AccountSimpleTest.php
index ec124c6..173fb71 100644
--- a/test/Model/AccountSimpleTest.php
+++ b/test/Model/AccountSimpleTest.php
@@ -29,7 +29,7 @@
* AccountSimpleTest Class Doc Comment
*
* @category Class
- * @description SnapTradeUser Investment Account
+ * @description A single account at a brokerage.
* @package SnapTrade
*/
class AccountSimpleTest extends TestCase
diff --git a/test/Model/AccountTest.php b/test/Model/AccountTest.php
index 913d525..73eac59 100644
--- a/test/Model/AccountTest.php
+++ b/test/Model/AccountTest.php
@@ -29,7 +29,7 @@
* AccountTest Class Doc Comment
*
* @category Class
- * @description A single brokerage account at a financial institution.
+ * @description A single account at a brokerage.
* @package SnapTrade
*/
class AccountTest extends TestCase
@@ -90,15 +90,6 @@ public function testPropertyBrokerageAuthorization()
$this->markTestIncomplete('Not implemented');
}
- /**
- * Test attribute "portfolio_group"
- */
- public function testPropertyPortfolioGroup()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
/**
* Test attribute "name"
*/
@@ -136,18 +127,18 @@ public function testPropertyCreatedDate()
}
/**
- * Test attribute "meta"
+ * Test attribute "funding_date"
*/
- public function testPropertyMeta()
+ public function testPropertyFundingDate()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "cash_restrictions"
+ * Test attribute "opening_date"
*/
- public function testPropertyCashRestrictions()
+ public function testPropertyOpeningDate()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
@@ -170,4 +161,58 @@ public function testPropertyBalance()
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
+
+ /**
+ * Test attribute "status"
+ */
+ public function testPropertyStatus()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "raw_type"
+ */
+ public function testPropertyRawType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "meta"
+ */
+ public function testPropertyMeta()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "portfolio_group"
+ */
+ public function testPropertyPortfolioGroup()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "cash_restrictions"
+ */
+ public function testPropertyCashRestrictions()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "is_paper"
+ */
+ public function testPropertyIsPaper()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
}
diff --git a/test/Model/AccountUniversalActivityCurrencyTest.php b/test/Model/AccountUniversalActivityCurrencyTest.php
new file mode 100644
index 0000000..b0ebe52
--- /dev/null
+++ b/test/Model/AccountUniversalActivityCurrencyTest.php
@@ -0,0 +1,101 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "code"
+ */
+ public function testPropertyCode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "name"
+ */
+ public function testPropertyName()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountUniversalActivityOptionSymbolTest.php b/test/Model/AccountUniversalActivityOptionSymbolTest.php
new file mode 100644
index 0000000..aea44d1
--- /dev/null
+++ b/test/Model/AccountUniversalActivityOptionSymbolTest.php
@@ -0,0 +1,137 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "ticker"
+ */
+ public function testPropertyTicker()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "option_type"
+ */
+ public function testPropertyOptionType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "strike_price"
+ */
+ public function testPropertyStrikePrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "expiration_date"
+ */
+ public function testPropertyExpirationDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "is_mini_option"
+ */
+ public function testPropertyIsMiniOption()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "underlying_symbol"
+ */
+ public function testPropertyUnderlyingSymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountUniversalActivitySymbolTest.php b/test/Model/AccountUniversalActivitySymbolTest.php
new file mode 100644
index 0000000..e590ba1
--- /dev/null
+++ b/test/Model/AccountUniversalActivitySymbolTest.php
@@ -0,0 +1,155 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "raw_symbol"
+ */
+ public function testPropertyRawSymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "description"
+ */
+ public function testPropertyDescription()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "currency"
+ */
+ public function testPropertyCurrency()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "exchange"
+ */
+ public function testPropertyExchange()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "type"
+ */
+ public function testPropertyType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "figi_code"
+ */
+ public function testPropertyFigiCode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "figi_instrument"
+ */
+ public function testPropertyFigiInstrument()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/AccountUniversalActivityTest.php b/test/Model/AccountUniversalActivityTest.php
new file mode 100644
index 0000000..d904a35
--- /dev/null
+++ b/test/Model/AccountUniversalActivityTest.php
@@ -0,0 +1,218 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "option_symbol"
+ */
+ public function testPropertyOptionSymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "price"
+ */
+ public function testPropertyPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "units"
+ */
+ public function testPropertyUnits()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "amount"
+ */
+ public function testPropertyAmount()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "currency"
+ */
+ public function testPropertyCurrency()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "type"
+ */
+ public function testPropertyType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "option_type"
+ */
+ public function testPropertyOptionType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "description"
+ */
+ public function testPropertyDescription()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "trade_date"
+ */
+ public function testPropertyTradeDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "settlement_date"
+ */
+ public function testPropertySettlementDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "fee"
+ */
+ public function testPropertyFee()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "fx_rate"
+ */
+ public function testPropertyFxRate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "institution"
+ */
+ public function testPropertyInstitution()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "external_reference_id"
+ */
+ public function testPropertyExternalReferenceId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/ActionStrictTest.php b/test/Model/ActionStrictTest.php
index b74cf72..6bfe9b9 100644
--- a/test/Model/ActionStrictTest.php
+++ b/test/Model/ActionStrictTest.php
@@ -29,7 +29,7 @@
* ActionStrictTest Class Doc Comment
*
* @category Class
- * @description Trade Action
+ * @description The action describes the intent or side of a trade. This is either `BUY` or `SELL`.
* @package SnapTrade
*/
class ActionStrictTest extends TestCase
diff --git a/test/Model/ActionStrictWithOptionsTest.php b/test/Model/ActionStrictWithOptionsTest.php
new file mode 100644
index 0000000..cdaafa7
--- /dev/null
+++ b/test/Model/ActionStrictWithOptionsTest.php
@@ -0,0 +1,74 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/BrokerageAuthorizationDisabledConfirmationTest.php b/test/Model/BrokerageAuthorizationDisabledConfirmationTest.php
index 3c21dad..666f883 100644
--- a/test/Model/BrokerageAuthorizationDisabledConfirmationTest.php
+++ b/test/Model/BrokerageAuthorizationDisabledConfirmationTest.php
@@ -29,7 +29,7 @@
* BrokerageAuthorizationDisabledConfirmationTest Class Doc Comment
*
* @category Class
- * @description BrokerageAuthorizationDisabledConfirmation
+ * @description Confirmation that the connection has been disabled.
* @package SnapTrade
*/
class BrokerageAuthorizationDisabledConfirmationTest extends TestCase
diff --git a/test/Model/BrokerageAuthorizationRefreshConfirmationTest.php b/test/Model/BrokerageAuthorizationRefreshConfirmationTest.php
index 3da580b..a908783 100644
--- a/test/Model/BrokerageAuthorizationRefreshConfirmationTest.php
+++ b/test/Model/BrokerageAuthorizationRefreshConfirmationTest.php
@@ -29,7 +29,7 @@
* BrokerageAuthorizationRefreshConfirmationTest Class Doc Comment
*
* @category Class
- * @description BrokerageAuthorizationRefreshConfirmation
+ * @description Confirmation that the syncs have been scheduled.
* @package SnapTrade
*/
class BrokerageAuthorizationRefreshConfirmationTest extends TestCase
diff --git a/test/Model/BrokerageAuthorizationTest.php b/test/Model/BrokerageAuthorizationTest.php
index a285a17..3f08757 100644
--- a/test/Model/BrokerageAuthorizationTest.php
+++ b/test/Model/BrokerageAuthorizationTest.php
@@ -29,7 +29,7 @@
* BrokerageAuthorizationTest Class Doc Comment
*
* @category Class
- * @description BrokerageAuthorization
+ * @description A single connection with a brokerage. Note that `Connection` and `Brokerage Authorization` are interchangeable, but the term `Connection` is preferred and used in the doc for consistency. A connection is usually tied to a single login at a brokerage. A single connection can contain multiple brokerage accounts. SnapTrade performs de-duping on connections for a given user. If the user has an existing connection with the brokerage, when connecting the brokerage with the same credentials, SnapTrade will return the existing connection instead of creating a new one.
* @package SnapTrade
*/
class BrokerageAuthorizationTest extends TestCase
@@ -90,15 +90,6 @@ public function testPropertyCreatedDate()
$this->markTestIncomplete('Not implemented');
}
- /**
- * Test attribute "updated_date"
- */
- public function testPropertyUpdatedDate()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
/**
* Test attribute "brokerage"
*/
@@ -152,4 +143,22 @@ public function testPropertyMeta()
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
+
+ /**
+ * Test attribute "updated_date"
+ */
+ public function testPropertyUpdatedDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "is_eligible_for_payout"
+ */
+ public function testPropertyIsEligibleForPayout()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
}
diff --git a/test/Model/BrokerageInstrumentTest.php b/test/Model/BrokerageInstrumentTest.php
new file mode 100644
index 0000000..c568cb1
--- /dev/null
+++ b/test/Model/BrokerageInstrumentTest.php
@@ -0,0 +1,119 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "exchange_mic"
+ */
+ public function testPropertyExchangeMic()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "tradeable"
+ */
+ public function testPropertyTradeable()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "fractionable"
+ */
+ public function testPropertyFractionable()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "universal_symbol_id"
+ */
+ public function testPropertyUniversalSymbolId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/BrokerageInstrumentsResponseTest.php b/test/Model/BrokerageInstrumentsResponseTest.php
new file mode 100644
index 0000000..bb15f8c
--- /dev/null
+++ b/test/Model/BrokerageInstrumentsResponseTest.php
@@ -0,0 +1,83 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "instruments"
+ */
+ public function testPropertyInstruments()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/BrokerageTest.php b/test/Model/BrokerageTest.php
index afabe73..9673909 100644
--- a/test/Model/BrokerageTest.php
+++ b/test/Model/BrokerageTest.php
@@ -29,7 +29,7 @@
* BrokerageTest Class Doc Comment
*
* @category Class
- * @description Brokerage
+ * @description Describes a brokerage that SnapTrade supports.
* @package SnapTrade
*/
class BrokerageTest extends TestCase
@@ -81,6 +81,15 @@ public function testPropertyId()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test attribute "slug"
+ */
+ public function testPropertySlug()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test attribute "name"
*/
@@ -126,24 +135,6 @@ public function testPropertyAwsS3SquareLogoUrl()
$this->markTestIncomplete('Not implemented');
}
- /**
- * Test attribute "open_url"
- */
- public function testPropertyOpenUrl()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
- /**
- * Test attribute "slug"
- */
- public function testPropertySlug()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
/**
* Test attribute "url"
*/
@@ -172,18 +163,18 @@ public function testPropertyMaintenanceMode()
}
/**
- * Test attribute "allows_fractional_units"
+ * Test attribute "allows_trading"
*/
- public function testPropertyAllowsFractionalUnits()
+ public function testPropertyAllowsTrading()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "allows_trading"
+ * Test attribute "allows_fractional_units"
*/
- public function testPropertyAllowsTrading()
+ public function testPropertyAllowsFractionalUnits()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
@@ -208,45 +199,27 @@ public function testPropertyIsRealTimeConnection()
}
/**
- * Test attribute "allows_trading_through_snaptrade_api"
- */
- public function testPropertyAllowsTradingThroughSnaptradeApi()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
- /**
- * Test attribute "is_scraping_integration"
- */
- public function testPropertyIsScrapingIntegration()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
- /**
- * Test attribute "default_currency"
+ * Test attribute "brokerage_type"
*/
- public function testPropertyDefaultCurrency()
+ public function testPropertyBrokerageType()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "brokerage_type"
+ * Test attribute "exchanges"
*/
- public function testPropertyBrokerageType()
+ public function testPropertyExchanges()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "exchanges"
+ * Test attribute "open_url"
*/
- public function testPropertyExchanges()
+ public function testPropertyOpenUrl()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/BrokerageTypeTest.php b/test/Model/BrokerageTypeTest.php
index 530afc2..3298e91 100644
--- a/test/Model/BrokerageTypeTest.php
+++ b/test/Model/BrokerageTypeTest.php
@@ -29,7 +29,7 @@
* BrokerageTypeTest Class Doc Comment
*
* @category Class
- * @description Type of brokerage
+ * @description Type of brokerage. Currently supports traditional brokerages and crypto exchanges.
* @package SnapTrade
*/
class BrokerageTypeTest extends TestCase
diff --git a/test/Model/CancelOrderResponseTest.php b/test/Model/CancelOrderResponseTest.php
new file mode 100644
index 0000000..ce54c8e
--- /dev/null
+++ b/test/Model/CancelOrderResponseTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "brokerage_order_id"
+ */
+ public function testPropertyBrokerageOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "raw_response"
+ */
+ public function testPropertyRawResponse()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/ChildBrokerageOrderIDsTest.php b/test/Model/ChildBrokerageOrderIDsTest.php
new file mode 100644
index 0000000..0c4c12c
--- /dev/null
+++ b/test/Model/ChildBrokerageOrderIDsTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "take_profit_order_id"
+ */
+ public function testPropertyTakeProfitOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop_loss_order_id"
+ */
+ public function testPropertyStopLossOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/CryptoOrderFormTest.php b/test/Model/CryptoOrderFormTest.php
new file mode 100644
index 0000000..c898423
--- /dev/null
+++ b/test/Model/CryptoOrderFormTest.php
@@ -0,0 +1,155 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "instrument"
+ */
+ public function testPropertyInstrument()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "side"
+ */
+ public function testPropertySide()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "type"
+ */
+ public function testPropertyType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_in_force"
+ */
+ public function testPropertyTimeInForce()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "amount"
+ */
+ public function testPropertyAmount()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "limit_price"
+ */
+ public function testPropertyLimitPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop_price"
+ */
+ public function testPropertyStopPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "post_only"
+ */
+ public function testPropertyPostOnly()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "expiration_date"
+ */
+ public function testPropertyExpirationDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/CryptoOrderPreviewEstimatedFeeTest.php b/test/Model/CryptoOrderPreviewEstimatedFeeTest.php
new file mode 100644
index 0000000..9ce792f
--- /dev/null
+++ b/test/Model/CryptoOrderPreviewEstimatedFeeTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "currency"
+ */
+ public function testPropertyCurrency()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "amount"
+ */
+ public function testPropertyAmount()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/CryptoOrderPreviewTest.php b/test/Model/CryptoOrderPreviewTest.php
new file mode 100644
index 0000000..059e62a
--- /dev/null
+++ b/test/Model/CryptoOrderPreviewTest.php
@@ -0,0 +1,83 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "estimated_fee"
+ */
+ public function testPropertyEstimatedFee()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/CryptoTradingInstrumentTest.php b/test/Model/CryptoTradingInstrumentTest.php
new file mode 100644
index 0000000..8ab63f8
--- /dev/null
+++ b/test/Model/CryptoTradingInstrumentTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "type"
+ */
+ public function testPropertyType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/CryptocurrencyPairQuoteTest.php b/test/Model/CryptocurrencyPairQuoteTest.php
new file mode 100644
index 0000000..778591f
--- /dev/null
+++ b/test/Model/CryptocurrencyPairQuoteTest.php
@@ -0,0 +1,110 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "bid"
+ */
+ public function testPropertyBid()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "ask"
+ */
+ public function testPropertyAsk()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "mid"
+ */
+ public function testPropertyMid()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "timestamp"
+ */
+ public function testPropertyTimestamp()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/CryptocurrencyPairTest.php b/test/Model/CryptocurrencyPairTest.php
new file mode 100644
index 0000000..06f92f3
--- /dev/null
+++ b/test/Model/CryptocurrencyPairTest.php
@@ -0,0 +1,110 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "base"
+ */
+ public function testPropertyBase()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "quote"
+ */
+ public function testPropertyQuote()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "increment"
+ */
+ public function testPropertyIncrement()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/DeleteUserResponseTest.php b/test/Model/DeleteUserResponseTest.php
index b17ecc1..a56ac8e 100644
--- a/test/Model/DeleteUserResponseTest.php
+++ b/test/Model/DeleteUserResponseTest.php
@@ -29,7 +29,7 @@
* DeleteUserResponseTest Class Doc Comment
*
* @category Class
- * @description Response when delete user is successful
+ * @description DeleteUserResponse
* @package SnapTrade
*/
class DeleteUserResponseTest extends TestCase
@@ -81,6 +81,15 @@ public function testPropertyStatus()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test attribute "detail"
+ */
+ public function testPropertyDetail()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test attribute "user_id"
*/
diff --git a/test/Model/ManualTradeAndImpactTest.php b/test/Model/ManualTradeAndImpactTest.php
index c81698e..4d5fbde 100644
--- a/test/Model/ManualTradeAndImpactTest.php
+++ b/test/Model/ManualTradeAndImpactTest.php
@@ -29,7 +29,7 @@
* ManualTradeAndImpactTest Class Doc Comment
*
* @category Class
- * @description Manual Trade and Impact object
+ * @description ManualTradeAndImpact
* @package SnapTrade
*/
class ManualTradeAndImpactTest extends TestCase
diff --git a/test/Model/ManualTradeBalanceTest.php b/test/Model/ManualTradeBalanceTest.php
index cc9fac4..a7e0c85 100644
--- a/test/Model/ManualTradeBalanceTest.php
+++ b/test/Model/ManualTradeBalanceTest.php
@@ -29,7 +29,7 @@
* ManualTradeBalanceTest Class Doc Comment
*
* @category Class
- * @description Balance
+ * @description Estimated remaining balance of the account after the trade is executed.
* @package SnapTrade
*/
class ManualTradeBalanceTest extends TestCase
diff --git a/test/Model/ManualTradeFormBracketTest.php b/test/Model/ManualTradeFormBracketTest.php
new file mode 100644
index 0000000..b30b06e
--- /dev/null
+++ b/test/Model/ManualTradeFormBracketTest.php
@@ -0,0 +1,155 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "action"
+ */
+ public function testPropertyAction()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "instrument"
+ */
+ public function testPropertyInstrument()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "order_type"
+ */
+ public function testPropertyOrderType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_in_force"
+ */
+ public function testPropertyTimeInForce()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "price"
+ */
+ public function testPropertyPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop"
+ */
+ public function testPropertyStop()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "units"
+ */
+ public function testPropertyUnits()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop_loss"
+ */
+ public function testPropertyStopLoss()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "take_profit"
+ */
+ public function testPropertyTakeProfit()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/ManualTradeFormTest.php b/test/Model/ManualTradeFormTest.php
index 424f600..2c596d1 100644
--- a/test/Model/ManualTradeFormTest.php
+++ b/test/Model/ManualTradeFormTest.php
@@ -29,7 +29,7 @@
* ManualTradeFormTest Class Doc Comment
*
* @category Class
- * @description Manual Trade Form
+ * @description Inputs for placing an order with the brokerage.
* @package SnapTrade
*/
class ManualTradeFormTest extends TestCase
@@ -91,54 +91,54 @@ public function testPropertyAction()
}
/**
- * Test attribute "order_type"
+ * Test attribute "universal_symbol_id"
*/
- public function testPropertyOrderType()
+ public function testPropertyUniversalSymbolId()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "price"
+ * Test attribute "order_type"
*/
- public function testPropertyPrice()
+ public function testPropertyOrderType()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "stop"
+ * Test attribute "time_in_force"
*/
- public function testPropertyStop()
+ public function testPropertyTimeInForce()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "time_in_force"
+ * Test attribute "price"
*/
- public function testPropertyTimeInForce()
+ public function testPropertyPrice()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "units"
+ * Test attribute "stop"
*/
- public function testPropertyUnits()
+ public function testPropertyStop()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "universal_symbol_id"
+ * Test attribute "units"
*/
- public function testPropertyUniversalSymbolId()
+ public function testPropertyUnits()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/ManualTradeFormWithOptionsTest.php b/test/Model/ManualTradeFormWithOptionsTest.php
new file mode 100644
index 0000000..14167a9
--- /dev/null
+++ b/test/Model/ManualTradeFormWithOptionsTest.php
@@ -0,0 +1,173 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "account_id"
+ */
+ public function testPropertyAccountId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "action"
+ */
+ public function testPropertyAction()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "universal_symbol_id"
+ */
+ public function testPropertyUniversalSymbolId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "order_type"
+ */
+ public function testPropertyOrderType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_in_force"
+ */
+ public function testPropertyTimeInForce()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "trading_session"
+ */
+ public function testPropertyTradingSession()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "price"
+ */
+ public function testPropertyPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop"
+ */
+ public function testPropertyStop()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "units"
+ */
+ public function testPropertyUnits()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "notional_value"
+ */
+ public function testPropertyNotionalValue()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/ManualTradeImpactTest.php b/test/Model/ManualTradeImpactTest.php
new file mode 100644
index 0000000..2393215
--- /dev/null
+++ b/test/Model/ManualTradeImpactTest.php
@@ -0,0 +1,119 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "account"
+ */
+ public function testPropertyAccount()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "currency"
+ */
+ public function testPropertyCurrency()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "remaining_cash"
+ */
+ public function testPropertyRemainingCash()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "estimated_commission"
+ */
+ public function testPropertyEstimatedCommission()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "forex_fees"
+ */
+ public function testPropertyForexFees()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/ManualTradeReplaceFormTest.php b/test/Model/ManualTradeReplaceFormTest.php
new file mode 100644
index 0000000..4b12b96
--- /dev/null
+++ b/test/Model/ManualTradeReplaceFormTest.php
@@ -0,0 +1,146 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "brokerage_order_id"
+ */
+ public function testPropertyBrokerageOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "action"
+ */
+ public function testPropertyAction()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "order_type"
+ */
+ public function testPropertyOrderType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_in_force"
+ */
+ public function testPropertyTimeInForce()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "price"
+ */
+ public function testPropertyPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop"
+ */
+ public function testPropertyStop()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "units"
+ */
+ public function testPropertyUnits()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/ManualTradeSymbolTest.php b/test/Model/ManualTradeSymbolTest.php
index 158da6d..f3dff82 100644
--- a/test/Model/ManualTradeSymbolTest.php
+++ b/test/Model/ManualTradeSymbolTest.php
@@ -29,7 +29,7 @@
* ManualTradeSymbolTest Class Doc Comment
*
* @category Class
- * @description Manual trade symbol object
+ * @description Information about the security for the order.
* @package SnapTrade
*/
class ManualTradeSymbolTest extends TestCase
@@ -72,15 +72,6 @@ public function testManualTradeSymbol()
$this->markTestIncomplete('Not implemented');
}
- /**
- * Test attribute "brokerage_symbol_id"
- */
- public function testPropertyBrokerageSymbolId()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
/**
* Test attribute "universal_symbol_id"
*/
@@ -125,4 +116,13 @@ public function testPropertySymbol()
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
+
+ /**
+ * Test attribute "brokerage_symbol_id"
+ */
+ public function testPropertyBrokerageSymbolId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
}
diff --git a/test/Model/ManualTradeTest.php b/test/Model/ManualTradeTest.php
index 77bf928..a1364ab 100644
--- a/test/Model/ManualTradeTest.php
+++ b/test/Model/ManualTradeTest.php
@@ -29,7 +29,7 @@
* ManualTradeTest Class Doc Comment
*
* @category Class
- * @description A manual trade object
+ * @description Contains the details of a submitted order.
* @package SnapTrade
*/
class ManualTradeTest extends TestCase
diff --git a/test/Model/MlegActionStrictTest.php b/test/Model/MlegActionStrictTest.php
new file mode 100644
index 0000000..ed89490
--- /dev/null
+++ b/test/Model/MlegActionStrictTest.php
@@ -0,0 +1,74 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/MlegInstrumentTypeTest.php b/test/Model/MlegInstrumentTypeTest.php
new file mode 100644
index 0000000..faae046
--- /dev/null
+++ b/test/Model/MlegInstrumentTypeTest.php
@@ -0,0 +1,74 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/OptionsPlaceOptionStrategyRequestTest.php b/test/Model/MlegLegTest.php
similarity index 71%
rename from test/Model/OptionsPlaceOptionStrategyRequestTest.php
rename to test/Model/MlegLegTest.php
index fc2aa32..9fb2f12 100644
--- a/test/Model/OptionsPlaceOptionStrategyRequestTest.php
+++ b/test/Model/MlegLegTest.php
@@ -1,6 +1,6 @@
markTestIncomplete('Not implemented');
}
/**
- * Test attribute "order_type"
+ * Test attribute "instrument"
*/
- public function testPropertyOrderType()
+ public function testPropertyInstrument()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "time_in_force"
+ * Test attribute "action"
*/
- public function testPropertyTimeInForce()
+ public function testPropertyAction()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "price"
+ * Test attribute "units"
*/
- public function testPropertyPrice()
+ public function testPropertyUnits()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/TradingCancelUserAccountOrderRequestTest.php b/test/Model/MlegOrderResponseTest.php
similarity index 75%
rename from test/Model/TradingCancelUserAccountOrderRequestTest.php
rename to test/Model/MlegOrderResponseTest.php
index ae1078a..1c29091 100644
--- a/test/Model/TradingCancelUserAccountOrderRequestTest.php
+++ b/test/Model/MlegOrderResponseTest.php
@@ -1,6 +1,6 @@
markTestIncomplete('Not implemented');
@@ -80,4 +80,13 @@ public function testPropertyBrokerageOrderId()
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
+
+ /**
+ * Test attribute "orders"
+ */
+ public function testPropertyOrders()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
}
diff --git a/test/Model/MlegOrderTypeStrictTest.php b/test/Model/MlegOrderTypeStrictTest.php
new file mode 100644
index 0000000..0a4c3a9
--- /dev/null
+++ b/test/Model/MlegOrderTypeStrictTest.php
@@ -0,0 +1,74 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/MlegPriceEffectStrictTest.php b/test/Model/MlegPriceEffectStrictTest.php
new file mode 100644
index 0000000..f57c98b
--- /dev/null
+++ b/test/Model/MlegPriceEffectStrictTest.php
@@ -0,0 +1,74 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/MlegTradeFormTest.php b/test/Model/MlegTradeFormTest.php
new file mode 100644
index 0000000..651ff8c
--- /dev/null
+++ b/test/Model/MlegTradeFormTest.php
@@ -0,0 +1,128 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "order_type"
+ */
+ public function testPropertyOrderType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_in_force"
+ */
+ public function testPropertyTimeInForce()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "limit_price"
+ */
+ public function testPropertyLimitPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop_price"
+ */
+ public function testPropertyStopPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "price_effect"
+ */
+ public function testPropertyPriceEffect()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "legs"
+ */
+ public function testPropertyLegs()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/MlegTradingInstrumentTest.php b/test/Model/MlegTradingInstrumentTest.php
new file mode 100644
index 0000000..9e5e159
--- /dev/null
+++ b/test/Model/MlegTradingInstrumentTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "instrument_type"
+ */
+ public function testPropertyInstrumentType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/Model425FailedRequestResponseTest.php b/test/Model/Model425FailedRequestResponseTest.php
new file mode 100644
index 0000000..bfe9ab2
--- /dev/null
+++ b/test/Model/Model425FailedRequestResponseTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "detail"
+ */
+ public function testPropertyDetail()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "code"
+ */
+ public function testPropertyCode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/NotionalValueTest.php b/test/Model/NotionalValueTest.php
index 03caf24..e0d6e70 100644
--- a/test/Model/NotionalValueTest.php
+++ b/test/Model/NotionalValueTest.php
@@ -29,7 +29,7 @@
* NotionalValueTest Class Doc Comment
*
* @category Class
- * @description Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force. **Only available for Alpaca, Alpaca Paper, and Robinhood.**
+ * @description Total notional amount for the order. Must be `null` if `units` is provided. Can only work with `Market` for `order_type` and `Day` for `time_in_force`. This is only available for certain brokerages. Please check the [integrations doc](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=e7bbcbf9f272441593f93decde660687) for more information.
* @package SnapTrade
*/
class NotionalValueTest extends TestCase
diff --git a/test/Model/OptionBrokerageSymbolTest.php b/test/Model/OptionBrokerageSymbolTest.php
index 21f94dc..9ee6515 100644
--- a/test/Model/OptionBrokerageSymbolTest.php
+++ b/test/Model/OptionBrokerageSymbolTest.php
@@ -73,27 +73,27 @@ public function testOptionBrokerageSymbol()
}
/**
- * Test attribute "id"
+ * Test attribute "option_symbol"
*/
- public function testPropertyId()
+ public function testPropertyOptionSymbol()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "description"
+ * Test attribute "id"
*/
- public function testPropertyDescription()
+ public function testPropertyId()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "option_symbol"
+ * Test attribute "description"
*/
- public function testPropertyOptionSymbol()
+ public function testPropertyDescription()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/OptionsPositionTest.php b/test/Model/OptionsPositionTest.php
index 2dc874e..76123bc 100644
--- a/test/Model/OptionsPositionTest.php
+++ b/test/Model/OptionsPositionTest.php
@@ -100,18 +100,18 @@ public function testPropertyUnits()
}
/**
- * Test attribute "currency"
+ * Test attribute "average_purchase_price"
*/
- public function testPropertyCurrency()
+ public function testPropertyAveragePurchasePrice()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "average_purchase_price"
+ * Test attribute "currency"
*/
- public function testPropertyAveragePurchasePrice()
+ public function testPropertyCurrency()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/OrderTypeStrictTest.php b/test/Model/OrderTypeStrictTest.php
index b9e4d47..ac99fce 100644
--- a/test/Model/OrderTypeStrictTest.php
+++ b/test/Model/OrderTypeStrictTest.php
@@ -29,7 +29,7 @@
* OrderTypeStrictTest Class Doc Comment
*
* @category Class
- * @description Order Type
+ * @description The type of order to place. - For `Limit` and `StopLimit` orders, the `price` field is required. - For `Stop` and `StopLimit` orders, the `stop` field is required.
* @package SnapTrade
*/
class OrderTypeStrictTest extends TestCase
diff --git a/test/Model/OrderUpdatedResponseTest.php b/test/Model/OrderUpdatedResponseTest.php
new file mode 100644
index 0000000..a6d7c68
--- /dev/null
+++ b/test/Model/OrderUpdatedResponseTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "brokerage_order_id"
+ */
+ public function testPropertyBrokerageOrderId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "order"
+ */
+ public function testPropertyOrder()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/PaginatedUniversalActivityTest.php b/test/Model/PaginatedUniversalActivityTest.php
new file mode 100644
index 0000000..7c42c0b
--- /dev/null
+++ b/test/Model/PaginatedUniversalActivityTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "data"
+ */
+ public function testPropertyData()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "pagination"
+ */
+ public function testPropertyPagination()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/OptionsGetOptionStrategyRequestTest.php b/test/Model/PaginationDetailsTest.php
similarity index 71%
rename from test/Model/OptionsGetOptionStrategyRequestTest.php
rename to test/Model/PaginationDetailsTest.php
index de6cfcd..ea54f6a 100644
--- a/test/Model/OptionsGetOptionStrategyRequestTest.php
+++ b/test/Model/PaginationDetailsTest.php
@@ -1,6 +1,6 @@
markTestIncomplete('Not implemented');
}
/**
- * Test attribute "underlying_symbol_id"
+ * Test attribute "offset"
*/
- public function testPropertyUnderlyingSymbolId()
+ public function testPropertyOffset()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "legs"
+ * Test attribute "limit"
*/
- public function testPropertyLegs()
+ public function testPropertyLimit()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "strategy_type"
+ * Test attribute "total"
*/
- public function testPropertyStrategyType()
+ public function testPropertyTotal()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/PartnerDataTest.php b/test/Model/PartnerDataTest.php
index a09c6c1..697850b 100644
--- a/test/Model/PartnerDataTest.php
+++ b/test/Model/PartnerDataTest.php
@@ -29,7 +29,7 @@
* PartnerDataTest Class Doc Comment
*
* @category Class
- * @description SnapTrade Partner metadata
+ * @description Configurations for your SnapTrade Client ID, including allowed brokerages and data access.
* @package SnapTrade
*/
class PartnerDataTest extends TestCase
@@ -73,18 +73,9 @@ public function testPartnerData()
}
/**
- * Test attribute "redirect_uri"
- */
- public function testPropertyRedirectUri()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
- /**
- * Test attribute "allowed_brokerages"
+ * Test attribute "slug"
*/
- public function testPropertyAllowedBrokerages()
+ public function testPropertySlug()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
@@ -99,15 +90,6 @@ public function testPropertyName()
$this->markTestIncomplete('Not implemented');
}
- /**
- * Test attribute "slug"
- */
- public function testPropertySlug()
- {
- // TODO: implement
- $this->markTestIncomplete('Not implemented');
- }
-
/**
* Test attribute "logo_url"
*/
@@ -118,9 +100,9 @@ public function testPropertyLogoUrl()
}
/**
- * Test attribute "pin_required"
+ * Test attribute "allowed_brokerages"
*/
- public function testPropertyPinRequired()
+ public function testPropertyAllowedBrokerages()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
@@ -179,4 +161,22 @@ public function testPropertyCanAccessOrders()
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
+
+ /**
+ * Test attribute "redirect_uri"
+ */
+ public function testPropertyRedirectUri()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "pin_required"
+ */
+ public function testPropertyPinRequired()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
}
diff --git a/test/Model/PositionCurrencyTest.php b/test/Model/PositionCurrencyTest.php
new file mode 100644
index 0000000..67d515f
--- /dev/null
+++ b/test/Model/PositionCurrencyTest.php
@@ -0,0 +1,101 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "id"
+ */
+ public function testPropertyId()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "code"
+ */
+ public function testPropertyCode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "name"
+ */
+ public function testPropertyName()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/PositionSymbolTest.php b/test/Model/PositionSymbolTest.php
index 1a07d95..cda6e76 100644
--- a/test/Model/PositionSymbolTest.php
+++ b/test/Model/PositionSymbolTest.php
@@ -73,27 +73,27 @@ public function testPositionSymbol()
}
/**
- * Test attribute "id"
+ * Test attribute "symbol"
*/
- public function testPropertyId()
+ public function testPropertySymbol()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "description"
+ * Test attribute "id"
*/
- public function testPropertyDescription()
+ public function testPropertyId()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "symbol"
+ * Test attribute "description"
*/
- public function testPropertySymbol()
+ public function testPropertyDescription()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/PositionTest.php b/test/Model/PositionTest.php
index fad4e7f..05acb88 100644
--- a/test/Model/PositionTest.php
+++ b/test/Model/PositionTest.php
@@ -108,6 +108,15 @@ public function testPropertyOpenPnl()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test attribute "average_purchase_price"
+ */
+ public function testPropertyAveragePurchasePrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test attribute "fractional_units"
*/
@@ -118,9 +127,27 @@ public function testPropertyFractionalUnits()
}
/**
- * Test attribute "average_purchase_price"
+ * Test attribute "currency"
*/
- public function testPropertyAveragePurchasePrice()
+ public function testPropertyCurrency()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "cash_equivalent"
+ */
+ public function testPropertyCashEquivalent()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "tax_lots"
+ */
+ public function testPropertyTaxLots()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/RateOfReturnObjectTest.php b/test/Model/RateOfReturnObjectTest.php
new file mode 100644
index 0000000..d7dea25
--- /dev/null
+++ b/test/Model/RateOfReturnObjectTest.php
@@ -0,0 +1,101 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "timeframe"
+ */
+ public function testPropertyTimeframe()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "return_percent"
+ */
+ public function testPropertyReturnPercent()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "created_date"
+ */
+ public function testPropertyCreatedDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/RateOfReturnResponseTest.php b/test/Model/RateOfReturnResponseTest.php
new file mode 100644
index 0000000..4772839
--- /dev/null
+++ b/test/Model/RateOfReturnResponseTest.php
@@ -0,0 +1,83 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "data"
+ */
+ public function testPropertyData()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/RecentOrdersResponseTest.php b/test/Model/RecentOrdersResponseTest.php
new file mode 100644
index 0000000..00f764d
--- /dev/null
+++ b/test/Model/RecentOrdersResponseTest.php
@@ -0,0 +1,83 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "orders"
+ */
+ public function testPropertyOrders()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/SimpleOrderFormTest.php b/test/Model/SimpleOrderFormTest.php
new file mode 100644
index 0000000..465e72f
--- /dev/null
+++ b/test/Model/SimpleOrderFormTest.php
@@ -0,0 +1,155 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "instrument"
+ */
+ public function testPropertyInstrument()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "side"
+ */
+ public function testPropertySide()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "type"
+ */
+ public function testPropertyType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "time_in_force"
+ */
+ public function testPropertyTimeInForce()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "amount"
+ */
+ public function testPropertyAmount()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "limit_price"
+ */
+ public function testPropertyLimitPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop_price"
+ */
+ public function testPropertyStopPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "post_only"
+ */
+ public function testPropertyPostOnly()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "expiration_date"
+ */
+ public function testPropertyExpirationDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/SnapTradeHoldingsTotalValueTest.php b/test/Model/SnapTradeHoldingsTotalValueTest.php
index e6f5962..ce9dd13 100644
--- a/test/Model/SnapTradeHoldingsTotalValueTest.php
+++ b/test/Model/SnapTradeHoldingsTotalValueTest.php
@@ -29,7 +29,7 @@
* SnapTradeHoldingsTotalValueTest Class Doc Comment
*
* @category Class
- * @description The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. To get the brokerage reported total market value of the account, refer to `account.balance.total`.
+ * @description This field is deprecated. To get the brokerage reported total market value of the account, please refer to `account.balance.total`. The total market value of the account. Note that this field is calculated based on the sum of the values of account positions and cash balances known to SnapTrade. It may not be accurate if the brokerage account has holdings that SnapTrade is not aware of. For example, if the brokerage account holds assets that SnapTrade does not support, the total value may be underreported. In certain cases, this value may also be double-counting cash-equivalent assets if those assets are represented as both cash and positions in the account.
* @package SnapTrade
*/
class SnapTradeHoldingsTotalValueTest extends TestCase
diff --git a/test/Model/SnapTradeLoginUserRequestBodyTest.php b/test/Model/SnapTradeLoginUserRequestBodyTest.php
index fec0ffe..2ca48b2 100644
--- a/test/Model/SnapTradeLoginUserRequestBodyTest.php
+++ b/test/Model/SnapTradeLoginUserRequestBodyTest.php
@@ -117,6 +117,24 @@ public function testPropertyConnectionType()
$this->markTestIncomplete('Not implemented');
}
+ /**
+ * Test attribute "show_close_button"
+ */
+ public function testPropertyShowCloseButton()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "dark_mode"
+ */
+ public function testPropertyDarkMode()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
/**
* Test attribute "connection_portal_version"
*/
diff --git a/test/Model/StopLossTest.php b/test/Model/StopLossTest.php
new file mode 100644
index 0000000..607f755
--- /dev/null
+++ b/test/Model/StopLossTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "stop_price"
+ */
+ public function testPropertyStopPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "limit_price"
+ */
+ public function testPropertyLimitPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/UniversalSymbolCurrencyTest.php b/test/Model/SymbolCurrencyTest.php
similarity index 88%
rename from test/Model/UniversalSymbolCurrencyTest.php
rename to test/Model/SymbolCurrencyTest.php
index 2ff2502..208649b 100644
--- a/test/Model/UniversalSymbolCurrencyTest.php
+++ b/test/Model/SymbolCurrencyTest.php
@@ -1,6 +1,6 @@
markTestIncomplete('Not implemented');
diff --git a/test/Model/UniversalSymbolExchangeTest.php b/test/Model/SymbolExchangeTest.php
similarity index 92%
rename from test/Model/UniversalSymbolExchangeTest.php
rename to test/Model/SymbolExchangeTest.php
index 7cd361f..089eea7 100644
--- a/test/Model/UniversalSymbolExchangeTest.php
+++ b/test/Model/SymbolExchangeTest.php
@@ -1,6 +1,6 @@
markTestIncomplete('Not implemented');
diff --git a/test/Model/SymbolQueryTest.php b/test/Model/SymbolQueryTest.php
index 60fa376..7bf8a53 100644
--- a/test/Model/SymbolQueryTest.php
+++ b/test/Model/SymbolQueryTest.php
@@ -29,7 +29,7 @@
* SymbolQueryTest Class Doc Comment
*
* @category Class
- * @description Symbol query for searching for symbols
+ * @description SymbolQuery
* @package SnapTrade
*/
class SymbolQueryTest extends TestCase
diff --git a/test/Model/SymbolTest.php b/test/Model/SymbolTest.php
index 64dd26d..d947992 100644
--- a/test/Model/SymbolTest.php
+++ b/test/Model/SymbolTest.php
@@ -29,7 +29,7 @@
* SymbolTest Class Doc Comment
*
* @category Class
- * @description Symbol
+ * @description Uniquely describes a single security + exchange combination across all brokerages.
* @package SnapTrade
*/
class SymbolTest extends TestCase
@@ -100,9 +100,9 @@ public function testPropertyRawSymbol()
}
/**
- * Test attribute "name"
+ * Test attribute "description"
*/
- public function testPropertyName()
+ public function testPropertyDescription()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/SymbolsQuotesInnerTest.php b/test/Model/SymbolsQuotesInnerTest.php
index dc70272..cd9ae3e 100644
--- a/test/Model/SymbolsQuotesInnerTest.php
+++ b/test/Model/SymbolsQuotesInnerTest.php
@@ -82,27 +82,27 @@ public function testPropertySymbol()
}
/**
- * Test attribute "bid_price"
+ * Test attribute "last_trade_price"
*/
- public function testPropertyBidPrice()
+ public function testPropertyLastTradePrice()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "ask_price"
+ * Test attribute "bid_price"
*/
- public function testPropertyAskPrice()
+ public function testPropertyBidPrice()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "last_trade_price"
+ * Test attribute "ask_price"
*/
- public function testPropertyLastTradePrice()
+ public function testPropertyAskPrice()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/TakeProfitTest.php b/test/Model/TakeProfitTest.php
new file mode 100644
index 0000000..ee1f127
--- /dev/null
+++ b/test/Model/TakeProfitTest.php
@@ -0,0 +1,83 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "limit_price"
+ */
+ public function testPropertyLimitPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/TaxLotTest.php b/test/Model/TaxLotTest.php
new file mode 100644
index 0000000..f5a9059
--- /dev/null
+++ b/test/Model/TaxLotTest.php
@@ -0,0 +1,128 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "original_purchase_date"
+ */
+ public function testPropertyOriginalPurchaseDate()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "quantity"
+ */
+ public function testPropertyQuantity()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "purchased_price"
+ */
+ public function testPropertyPurchasedPrice()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "cost_basis"
+ */
+ public function testPropertyCostBasis()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "current_value"
+ */
+ public function testPropertyCurrentValue()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "position_type"
+ */
+ public function testPropertyPositionType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/TimeInForceStrictTest.php b/test/Model/TimeInForceStrictTest.php
index 05b2fa9..45d137f 100644
--- a/test/Model/TimeInForceStrictTest.php
+++ b/test/Model/TimeInForceStrictTest.php
@@ -29,7 +29,7 @@
* TimeInForceStrictTest Class Doc Comment
*
* @category Class
- * @description Trade time in force examples: * FOK - Fill Or Kill * Day - Day * GTC - Good Til Canceled
+ * @description The Time in Force type for the order. This field indicates how long the order will remain active before it is executed or expires. Here are the supported values: - `Day` - Day. The order is valid only for the trading day on which it is placed. - `GTC` - Good Til Canceled. The order is valid until it is executed or canceled. - `FOK` - Fill Or Kill. The order must be executed in its entirety immediately or be canceled completely. - `IOC` - Immediate Or Cancel. The order must be executed immediately. Any portion of the order that cannot be filled immediately will be canceled.
* @package SnapTrade
*/
class TimeInForceStrictTest extends TestCase
diff --git a/test/Model/TradingInstrumentTest.php b/test/Model/TradingInstrumentTest.php
new file mode 100644
index 0000000..aeb8de2
--- /dev/null
+++ b/test/Model/TradingInstrumentTest.php
@@ -0,0 +1,92 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "symbol"
+ */
+ public function testPropertySymbol()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "type"
+ */
+ public function testPropertyType()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/TradingSearchCryptocurrencyPairInstruments200ResponseTest.php b/test/Model/TradingSearchCryptocurrencyPairInstruments200ResponseTest.php
new file mode 100644
index 0000000..2390927
--- /dev/null
+++ b/test/Model/TradingSearchCryptocurrencyPairInstruments200ResponseTest.php
@@ -0,0 +1,83 @@
+markTestIncomplete('Not implemented');
+ }
+
+ /**
+ * Test attribute "items"
+ */
+ public function testPropertyItems()
+ {
+ // TODO: implement
+ $this->markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/TradingSessionTest.php b/test/Model/TradingSessionTest.php
new file mode 100644
index 0000000..2bd37fe
--- /dev/null
+++ b/test/Model/TradingSessionTest.php
@@ -0,0 +1,74 @@
+markTestIncomplete('Not implemented');
+ }
+}
diff --git a/test/Model/UnderlyingSymbolTest.php b/test/Model/UnderlyingSymbolTest.php
index 1e18600..eb63c9f 100644
--- a/test/Model/UnderlyingSymbolTest.php
+++ b/test/Model/UnderlyingSymbolTest.php
@@ -136,27 +136,27 @@ public function testPropertyType()
}
/**
- * Test attribute "currencies"
+ * Test attribute "figi_code"
*/
- public function testPropertyCurrencies()
+ public function testPropertyFigiCode()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "figi_code"
+ * Test attribute "figi_instrument"
*/
- public function testPropertyFigiCode()
+ public function testPropertyFigiInstrument()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "figi_instrument"
+ * Test attribute "currencies"
*/
- public function testPropertyFigiInstrument()
+ public function testPropertyCurrencies()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/UniversalActivityTest.php b/test/Model/UniversalActivityTest.php
index 1fa588d..7c835a8 100644
--- a/test/Model/UniversalActivityTest.php
+++ b/test/Model/UniversalActivityTest.php
@@ -91,135 +91,135 @@ public function testPropertyAccount()
}
/**
- * Test attribute "amount"
+ * Test attribute "symbol"
*/
- public function testPropertyAmount()
+ public function testPropertySymbol()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "currency"
+ * Test attribute "option_symbol"
*/
- public function testPropertyCurrency()
+ public function testPropertyOptionSymbol()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "description"
+ * Test attribute "price"
*/
- public function testPropertyDescription()
+ public function testPropertyPrice()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "fee"
+ * Test attribute "units"
*/
- public function testPropertyFee()
+ public function testPropertyUnits()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "fx_rate"
+ * Test attribute "amount"
*/
- public function testPropertyFxRate()
+ public function testPropertyAmount()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "institution"
+ * Test attribute "currency"
*/
- public function testPropertyInstitution()
+ public function testPropertyCurrency()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "option_type"
+ * Test attribute "type"
*/
- public function testPropertyOptionType()
+ public function testPropertyType()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "price"
+ * Test attribute "option_type"
*/
- public function testPropertyPrice()
+ public function testPropertyOptionType()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "settlement_date"
+ * Test attribute "description"
*/
- public function testPropertySettlementDate()
+ public function testPropertyDescription()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "external_reference_id"
+ * Test attribute "trade_date"
*/
- public function testPropertyExternalReferenceId()
+ public function testPropertyTradeDate()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "symbol"
+ * Test attribute "settlement_date"
*/
- public function testPropertySymbol()
+ public function testPropertySettlementDate()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "option_symbol"
+ * Test attribute "fee"
*/
- public function testPropertyOptionSymbol()
+ public function testPropertyFee()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "trade_date"
+ * Test attribute "fx_rate"
*/
- public function testPropertyTradeDate()
+ public function testPropertyFxRate()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "type"
+ * Test attribute "institution"
*/
- public function testPropertyType()
+ public function testPropertyInstitution()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "units"
+ * Test attribute "external_reference_id"
*/
- public function testPropertyUnits()
+ public function testPropertyExternalReferenceId()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/UniversalSymbolTest.php b/test/Model/UniversalSymbolTest.php
index f8b424f..052756f 100644
--- a/test/Model/UniversalSymbolTest.php
+++ b/test/Model/UniversalSymbolTest.php
@@ -136,27 +136,27 @@ public function testPropertyType()
}
/**
- * Test attribute "currencies"
+ * Test attribute "figi_code"
*/
- public function testPropertyCurrencies()
+ public function testPropertyFigiCode()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "figi_code"
+ * Test attribute "figi_instrument"
*/
- public function testPropertyFigiCode()
+ public function testPropertyFigiInstrument()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
}
/**
- * Test attribute "figi_instrument"
+ * Test attribute "currencies"
*/
- public function testPropertyFigiInstrument()
+ public function testPropertyCurrencies()
{
// TODO: implement
$this->markTestIncomplete('Not implemented');
diff --git a/test/Model/UserIDandSecretTest.php b/test/Model/UserIDandSecretTest.php
index 9b8f44a..db98450 100644
--- a/test/Model/UserIDandSecretTest.php
+++ b/test/Model/UserIDandSecretTest.php
@@ -29,7 +29,7 @@
* UserIDandSecretTest Class Doc Comment
*
* @category Class
- * @description Response when register user is successful
+ * @description UserIDandSecret
* @package SnapTrade
*/
class UserIDandSecretTest extends TestCase
diff --git a/test/Model/ValidatedTradeBodyTest.php b/test/Model/ValidatedTradeBodyTest.php
index ec859b3..ca000ee 100644
--- a/test/Model/ValidatedTradeBodyTest.php
+++ b/test/Model/ValidatedTradeBodyTest.php
@@ -29,7 +29,7 @@
* ValidatedTradeBodyTest Class Doc Comment
*
* @category Class
- * @description Validated Trade Form
+ * @description ValidatedTradeBody
* @package SnapTrade
*/
class ValidatedTradeBodyTest extends TestCase