snaptrade-python-sdk 13.1.5__py3-none-any.whl → 13.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snaptrade_client/__init__.py +3 -2
- snaptrade_client/api_client.py +1 -1
- snaptrade_client/apis/path_to_api.py +9 -9
- snaptrade_client/apis/tags/account_information_api_generated.py +6 -0
- snaptrade_client/apis/tags/experimental_endpoints_api_generated.py +0 -6
- snaptrade_client/auth.py +13 -0
- snaptrade_client/client.py +4 -0
- snaptrade_client/client.pyi +16 -0
- snaptrade_client/configuration.py +20 -2
- snaptrade_client/oauth_device.py +160 -0
- snaptrade_client/operation_parameter_map.py +33 -33
- snaptrade_client/paths/__init__.py +3 -3
- snaptrade_client/paths/accounts/get.py +5 -0
- snaptrade_client/paths/accounts/get.pyi +21 -0
- snaptrade_client/paths/accounts_account_id/get.py +5 -0
- snaptrade_client/paths/accounts_account_id/get.pyi +25 -0
- snaptrade_client/paths/accounts_account_id/put.py +5 -0
- snaptrade_client/paths/accounts_account_id/put.pyi +25 -0
- snaptrade_client/paths/accounts_account_id_activities/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_activities/get.pyi +35 -0
- snaptrade_client/paths/accounts_account_id_balance_history/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_balance_history/get.pyi +25 -0
- snaptrade_client/paths/accounts_account_id_balances/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_balances/get.pyi +25 -0
- snaptrade_client/paths/accounts_account_id_details/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_details/get.pyi +25 -0
- snaptrade_client/paths/accounts_account_id_holdings/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_holdings/get.pyi +25 -0
- snaptrade_client/paths/accounts_account_id_orders/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_orders/get.pyi +29 -0
- snaptrade_client/paths/accounts_account_id_orders_all/get.py +2 -2
- snaptrade_client/paths/accounts_account_id_orders_brokerage_order_id/get.py +2 -2
- snaptrade_client/paths/accounts_account_id_orders_details/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_orders_details/post.pyi +27 -0
- snaptrade_client/paths/accounts_account_id_orders_details_v2_brokerage_order_id/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_orders_details_v2_brokerage_order_id/get.pyi +27 -0
- snaptrade_client/paths/accounts_account_id_orders_recent/get.py +2 -2
- snaptrade_client/paths/accounts_account_id_orders_v2/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_orders_v2/get.pyi +29 -0
- snaptrade_client/paths/accounts_account_id_positions_all/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_positions_all/get.pyi +25 -0
- snaptrade_client/paths/accounts_account_id_quotes/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_quotes/get.pyi +29 -0
- snaptrade_client/paths/accounts_account_id_recent_orders/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_recent_orders/get.pyi +27 -0
- snaptrade_client/paths/accounts_account_id_recent_orders_v2/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_recent_orders_v2/get.pyi +27 -0
- snaptrade_client/paths/accounts_account_id_symbols/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_symbols/post.pyi +27 -0
- snaptrade_client/paths/accounts_account_id_trading_cancel/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_cancel/post.pyi +27 -0
- snaptrade_client/paths/accounts_account_id_trading_complex/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_complex/post.pyi +31 -0
- snaptrade_client/paths/accounts_account_id_trading_crypto/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_crypto/post.pyi +43 -0
- snaptrade_client/paths/accounts_account_id_trading_crypto_preview/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_crypto_preview/post.pyi +43 -0
- snaptrade_client/paths/accounts_account_id_trading_instruments_cryptocurrency_pairs/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_instruments_cryptocurrency_pairs/get.pyi +29 -0
- snaptrade_client/paths/accounts_account_id_trading_instruments_cryptocurrency_pairs_instrument_symbol_quote/get.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_instruments_cryptocurrency_pairs_instrument_symbol_quote/get.pyi +27 -0
- snaptrade_client/paths/accounts_account_id_trading_options/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_options/post.pyi +37 -0
- snaptrade_client/paths/accounts_account_id_trading_options_impact/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_options_impact/post.pyi +37 -0
- snaptrade_client/paths/accounts_account_id_trading_replace/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_replace/post.pyi +41 -0
- snaptrade_client/paths/accounts_account_id_trading_simple/post.py +5 -0
- snaptrade_client/paths/accounts_account_id_trading_simple/post.pyi +45 -0
- snaptrade_client/paths/accounts_all/get.py +5 -0
- snaptrade_client/paths/accounts_all/get.pyi +21 -0
- snaptrade_client/paths/authorizations/get.py +5 -0
- snaptrade_client/paths/authorizations/get.pyi +21 -0
- snaptrade_client/paths/authorizations_authorization_id/get.py +5 -0
- snaptrade_client/paths/authorizations_authorization_id/get.pyi +25 -0
- snaptrade_client/paths/authorizations_authorization_id_accounts/get.py +5 -0
- snaptrade_client/paths/authorizations_authorization_id_accounts/get.pyi +25 -0
- snaptrade_client/paths/authorizations_authorization_id_disable/post.py +5 -0
- snaptrade_client/paths/authorizations_authorization_id_disable/post.pyi +25 -0
- snaptrade_client/paths/authorizations_authorization_id_refresh/post.py +5 -0
- snaptrade_client/paths/authorizations_authorization_id_refresh/post.pyi +25 -0
- snaptrade_client/paths/authorizations_authorization_id_transactions_sync/post.py +5 -0
- snaptrade_client/paths/authorizations_authorization_id_transactions_sync/post.pyi +25 -0
- snaptrade_client/paths/brokerages/get.py +5 -0
- snaptrade_client/paths/brokerages/get.pyi +13 -0
- snaptrade_client/paths/brokerages_slug_instruments/get.py +5 -0
- snaptrade_client/paths/brokerages_slug_instruments/get.pyi +17 -0
- snaptrade_client/paths/connections_connection_id_accounts/get.py +5 -0
- snaptrade_client/paths/connections_connection_id_accounts/get.pyi +25 -0
- snaptrade_client/paths/exchanges/get.py +5 -0
- snaptrade_client/paths/exchanges/get.pyi +13 -0
- snaptrade_client/paths/snap_trade_login/post.py +5 -0
- snaptrade_client/paths/snap_trade_login/post.pyi +39 -0
- snaptrade_client/paths/snap_trade_partners/get.py +5 -0
- snaptrade_client/paths/snap_trade_partners/get.pyi +13 -0
- snaptrade_client/paths/symbols/post.py +5 -0
- snaptrade_client/paths/symbols/post.pyi +15 -0
- snaptrade_client/paths/symbols_query/get.py +5 -0
- snaptrade_client/paths/symbols_query/get.pyi +17 -0
- snaptrade_client/paths/trade_impact/post.py +5 -0
- snaptrade_client/paths/trade_impact/post.pyi +39 -0
- snaptrade_client/paths/trade_place/post.py +5 -0
- snaptrade_client/paths/trade_place/post.pyi +47 -0
- snaptrade_client/paths/trade_trade_id/post.py +5 -0
- snaptrade_client/paths/trade_trade_id/post.pyi +27 -0
- snaptrade_client/request_after_hook.py +2 -1
- {snaptrade_python_sdk-13.1.5.dist-info → snaptrade_python_sdk-13.2.1.dist-info}/METADATA +983 -325
- {snaptrade_python_sdk-13.1.5.dist-info → snaptrade_python_sdk-13.2.1.dist-info}/RECORD +110 -109
- {snaptrade_python_sdk-13.1.5.dist-info → snaptrade_python_sdk-13.2.1.dist-info}/LICENSE +0 -0
- {snaptrade_python_sdk-13.1.5.dist-info → snaptrade_python_sdk-13.2.1.dist-info}/WHEEL +0 -0
snaptrade_client/__init__.py
CHANGED
|
@@ -12,14 +12,15 @@
|
|
|
12
12
|
Created by: https://snaptrade.com/
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
-
__version__ = "13.1
|
|
15
|
+
__version__ = "13.2.1"
|
|
16
16
|
|
|
17
17
|
# import ApiClient
|
|
18
18
|
from snaptrade_client.api_client import ApiClient
|
|
19
19
|
|
|
20
20
|
# import Configuration
|
|
21
21
|
from snaptrade_client.configuration import Configuration
|
|
22
|
-
from snaptrade_client.auth import SnapTradeAuth, AuthMode, CommercialApiKeyAuth, PersonalApiKeyAuth
|
|
22
|
+
from snaptrade_client.auth import SnapTradeAuth, AuthMode, CommercialApiKeyAuth, PersonalApiKeyAuth, OAuthAuth
|
|
23
|
+
from snaptrade_client.oauth_device import SnapTradeOAuthDevice, SnapTradeDeviceAuthorization, SnapTradeDeviceTokens, SnapTradeOAuthDeviceError
|
|
23
24
|
|
|
24
25
|
# import exceptions
|
|
25
26
|
from snaptrade_client.exceptions import OpenApiException
|
snaptrade_client/api_client.py
CHANGED
|
@@ -1175,7 +1175,7 @@ class ApiClient(typing.Generic[TAuth]):
|
|
|
1175
1175
|
self.default_headers[header_name] = header_value
|
|
1176
1176
|
self.cookie = cookie
|
|
1177
1177
|
# Set default User-Agent.
|
|
1178
|
-
self.user_agent = 'Konfig/13.1
|
|
1178
|
+
self.user_agent = 'Konfig/13.2.1/python'
|
|
1179
1179
|
|
|
1180
1180
|
def __enter__(self):
|
|
1181
1181
|
return self
|
|
@@ -25,11 +25,14 @@ from snaptrade_client.apis.paths.accounts_account_id_balances import AccountsAcc
|
|
|
25
25
|
from snaptrade_client.apis.paths.accounts_account_id_balances_v2 import AccountsAccountIdBalancesV2
|
|
26
26
|
from snaptrade_client.apis.paths.accounts_account_id_positions_all import AccountsAccountIdPositionsAll
|
|
27
27
|
from snaptrade_client.apis.paths.accounts_account_id_orders import AccountsAccountIdOrders
|
|
28
|
+
from snaptrade_client.apis.paths.accounts_account_id_orders_all import AccountsAccountIdOrdersAll
|
|
28
29
|
from snaptrade_client.apis.paths.accounts_account_id_balance_history import AccountsAccountIdBalanceHistory
|
|
29
30
|
from snaptrade_client.apis.paths.accounts_account_id_recent_orders import AccountsAccountIdRecentOrders
|
|
31
|
+
from snaptrade_client.apis.paths.accounts_account_id_orders_recent import AccountsAccountIdOrdersRecent
|
|
30
32
|
from snaptrade_client.apis.paths.accounts_account_id_return_rates import AccountsAccountIdReturnRates
|
|
31
33
|
from snaptrade_client.apis.paths.accounts_account_id_activities import AccountsAccountIdActivities
|
|
32
34
|
from snaptrade_client.apis.paths.accounts_account_id_orders_details import AccountsAccountIdOrdersDetails
|
|
35
|
+
from snaptrade_client.apis.paths.accounts_account_id_orders_brokerage_order_id import AccountsAccountIdOrdersBrokerageOrderId
|
|
33
36
|
from snaptrade_client.apis.paths.accounts_account_id_quotes import AccountsAccountIdQuotes
|
|
34
37
|
from snaptrade_client.apis.paths.trade_impact import TradeImpact
|
|
35
38
|
from snaptrade_client.apis.paths.accounts_account_id_trading_options_impact import AccountsAccountIdTradingOptionsImpact
|
|
@@ -50,9 +53,7 @@ from snaptrade_client.apis.paths.snap_trade_trade_detection_subscriptions_cancel
|
|
|
50
53
|
from snaptrade_client.apis.paths.management_stats import ManagementStats
|
|
51
54
|
from snaptrade_client.apis.paths.snap_trade_stats import SnapTradeStats
|
|
52
55
|
from snaptrade_client.apis.paths.accounts_account_id_orders_v2 import AccountsAccountIdOrdersV2
|
|
53
|
-
from snaptrade_client.apis.paths.accounts_account_id_orders_all import AccountsAccountIdOrdersAll
|
|
54
56
|
from snaptrade_client.apis.paths.accounts_account_id_recent_orders_v2 import AccountsAccountIdRecentOrdersV2
|
|
55
|
-
from snaptrade_client.apis.paths.accounts_account_id_orders_recent import AccountsAccountIdOrdersRecent
|
|
56
57
|
from snaptrade_client.apis.paths.accounts_account_id_symbols import AccountsAccountIdSymbols
|
|
57
58
|
from snaptrade_client.apis.paths.brokerages import Brokerages
|
|
58
59
|
from snaptrade_client.apis.paths.institutions import Institutions
|
|
@@ -63,7 +64,6 @@ from snaptrade_client.apis.paths.symbols import Symbols
|
|
|
63
64
|
from snaptrade_client.apis.paths.symbols_query import SymbolsQuery
|
|
64
65
|
from snaptrade_client.apis.paths.accounts_account_id_trading_simple import AccountsAccountIdTradingSimple
|
|
65
66
|
from snaptrade_client.apis.paths.accounts_account_id_orders_details_v2_brokerage_order_id import AccountsAccountIdOrdersDetailsV2BrokerageOrderId
|
|
66
|
-
from snaptrade_client.apis.paths.accounts_account_id_orders_brokerage_order_id import AccountsAccountIdOrdersBrokerageOrderId
|
|
67
67
|
|
|
68
68
|
PathToApi = typing_extensions.TypedDict(
|
|
69
69
|
'PathToApi',
|
|
@@ -92,11 +92,14 @@ PathToApi = typing_extensions.TypedDict(
|
|
|
92
92
|
PathValues.ACCOUNTS_ACCOUNT_ID_BALANCES_V2: AccountsAccountIdBalancesV2,
|
|
93
93
|
PathValues.ACCOUNTS_ACCOUNT_ID_POSITIONS_ALL: AccountsAccountIdPositionsAll,
|
|
94
94
|
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS: AccountsAccountIdOrders,
|
|
95
|
+
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_ALL: AccountsAccountIdOrdersAll,
|
|
95
96
|
PathValues.ACCOUNTS_ACCOUNT_ID_BALANCE_HISTORY: AccountsAccountIdBalanceHistory,
|
|
96
97
|
PathValues.ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS: AccountsAccountIdRecentOrders,
|
|
98
|
+
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT: AccountsAccountIdOrdersRecent,
|
|
97
99
|
PathValues.ACCOUNTS_ACCOUNT_ID_RETURN_RATES: AccountsAccountIdReturnRates,
|
|
98
100
|
PathValues.ACCOUNTS_ACCOUNT_ID_ACTIVITIES: AccountsAccountIdActivities,
|
|
99
101
|
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_DETAILS: AccountsAccountIdOrdersDetails,
|
|
102
|
+
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_BROKERAGE_ORDER_ID: AccountsAccountIdOrdersBrokerageOrderId,
|
|
100
103
|
PathValues.ACCOUNTS_ACCOUNT_ID_QUOTES: AccountsAccountIdQuotes,
|
|
101
104
|
PathValues.TRADE_IMPACT: TradeImpact,
|
|
102
105
|
PathValues.ACCOUNTS_ACCOUNT_ID_TRADING_OPTIONS_IMPACT: AccountsAccountIdTradingOptionsImpact,
|
|
@@ -117,9 +120,7 @@ PathToApi = typing_extensions.TypedDict(
|
|
|
117
120
|
PathValues.MANAGEMENT_STATS: ManagementStats,
|
|
118
121
|
PathValues.SNAP_TRADE_STATS: SnapTradeStats,
|
|
119
122
|
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_V2: AccountsAccountIdOrdersV2,
|
|
120
|
-
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_ALL: AccountsAccountIdOrdersAll,
|
|
121
123
|
PathValues.ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS_V2: AccountsAccountIdRecentOrdersV2,
|
|
122
|
-
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT: AccountsAccountIdOrdersRecent,
|
|
123
124
|
PathValues.ACCOUNTS_ACCOUNT_ID_SYMBOLS: AccountsAccountIdSymbols,
|
|
124
125
|
PathValues.BROKERAGES: Brokerages,
|
|
125
126
|
PathValues.INSTITUTIONS: Institutions,
|
|
@@ -130,7 +131,6 @@ PathToApi = typing_extensions.TypedDict(
|
|
|
130
131
|
PathValues.SYMBOLS_QUERY: SymbolsQuery,
|
|
131
132
|
PathValues.ACCOUNTS_ACCOUNT_ID_TRADING_SIMPLE: AccountsAccountIdTradingSimple,
|
|
132
133
|
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_DETAILS_V2_BROKERAGE_ORDER_ID: AccountsAccountIdOrdersDetailsV2BrokerageOrderId,
|
|
133
|
-
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_BROKERAGE_ORDER_ID: AccountsAccountIdOrdersBrokerageOrderId,
|
|
134
134
|
}
|
|
135
135
|
)
|
|
136
136
|
|
|
@@ -160,11 +160,14 @@ path_to_api = PathToApi(
|
|
|
160
160
|
PathValues.ACCOUNTS_ACCOUNT_ID_BALANCES_V2: AccountsAccountIdBalancesV2,
|
|
161
161
|
PathValues.ACCOUNTS_ACCOUNT_ID_POSITIONS_ALL: AccountsAccountIdPositionsAll,
|
|
162
162
|
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS: AccountsAccountIdOrders,
|
|
163
|
+
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_ALL: AccountsAccountIdOrdersAll,
|
|
163
164
|
PathValues.ACCOUNTS_ACCOUNT_ID_BALANCE_HISTORY: AccountsAccountIdBalanceHistory,
|
|
164
165
|
PathValues.ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS: AccountsAccountIdRecentOrders,
|
|
166
|
+
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT: AccountsAccountIdOrdersRecent,
|
|
165
167
|
PathValues.ACCOUNTS_ACCOUNT_ID_RETURN_RATES: AccountsAccountIdReturnRates,
|
|
166
168
|
PathValues.ACCOUNTS_ACCOUNT_ID_ACTIVITIES: AccountsAccountIdActivities,
|
|
167
169
|
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_DETAILS: AccountsAccountIdOrdersDetails,
|
|
170
|
+
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_BROKERAGE_ORDER_ID: AccountsAccountIdOrdersBrokerageOrderId,
|
|
168
171
|
PathValues.ACCOUNTS_ACCOUNT_ID_QUOTES: AccountsAccountIdQuotes,
|
|
169
172
|
PathValues.TRADE_IMPACT: TradeImpact,
|
|
170
173
|
PathValues.ACCOUNTS_ACCOUNT_ID_TRADING_OPTIONS_IMPACT: AccountsAccountIdTradingOptionsImpact,
|
|
@@ -185,9 +188,7 @@ path_to_api = PathToApi(
|
|
|
185
188
|
PathValues.MANAGEMENT_STATS: ManagementStats,
|
|
186
189
|
PathValues.SNAP_TRADE_STATS: SnapTradeStats,
|
|
187
190
|
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_V2: AccountsAccountIdOrdersV2,
|
|
188
|
-
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_ALL: AccountsAccountIdOrdersAll,
|
|
189
191
|
PathValues.ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS_V2: AccountsAccountIdRecentOrdersV2,
|
|
190
|
-
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT: AccountsAccountIdOrdersRecent,
|
|
191
192
|
PathValues.ACCOUNTS_ACCOUNT_ID_SYMBOLS: AccountsAccountIdSymbols,
|
|
192
193
|
PathValues.BROKERAGES: Brokerages,
|
|
193
194
|
PathValues.INSTITUTIONS: Institutions,
|
|
@@ -198,6 +199,5 @@ path_to_api = PathToApi(
|
|
|
198
199
|
PathValues.SYMBOLS_QUERY: SymbolsQuery,
|
|
199
200
|
PathValues.ACCOUNTS_ACCOUNT_ID_TRADING_SIMPLE: AccountsAccountIdTradingSimple,
|
|
200
201
|
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_DETAILS_V2_BROKERAGE_ORDER_ID: AccountsAccountIdOrdersDetailsV2BrokerageOrderId,
|
|
201
|
-
PathValues.ACCOUNTS_ACCOUNT_ID_ORDERS_BROKERAGE_ORDER_ID: AccountsAccountIdOrdersBrokerageOrderId,
|
|
202
202
|
}
|
|
203
203
|
)
|
|
@@ -13,7 +13,10 @@ from snaptrade_client.paths.accounts_account_id_activities.get import GetAccount
|
|
|
13
13
|
from snaptrade_client.paths.accounts_account_id_balance_history.get import GetAccountBalanceHistory
|
|
14
14
|
from snaptrade_client.paths.accounts_account_id_balances_v2.get import GetAccountBalancesV2
|
|
15
15
|
from snaptrade_client.paths.accounts_account_id_details.get import GetAccountDetails
|
|
16
|
+
from snaptrade_client.paths.accounts_account_id_orders_brokerage_order_id.get import GetAccountOrder
|
|
17
|
+
from snaptrade_client.paths.accounts_account_id_orders_all.get import GetAllAccountOrders
|
|
16
18
|
from snaptrade_client.paths.accounts_account_id_positions_all.get import GetAllAccountPositions
|
|
19
|
+
from snaptrade_client.paths.accounts_account_id_orders_recent.get import GetAllAccountRecentOrders
|
|
17
20
|
from snaptrade_client.paths.accounts_account_id_balances.get import GetUserAccountBalance
|
|
18
21
|
from snaptrade_client.paths.accounts_account_id.get import GetUserAccountDetails
|
|
19
22
|
from snaptrade_client.paths.accounts_account_id_orders_details.post import GetUserAccountOrderDetail
|
|
@@ -35,7 +38,10 @@ class AccountInformationApiGenerated(
|
|
|
35
38
|
GetAccountBalanceHistory[TAuth],
|
|
36
39
|
GetAccountBalancesV2[TAuth],
|
|
37
40
|
GetAccountDetails[TAuth],
|
|
41
|
+
GetAccountOrder[TAuth],
|
|
42
|
+
GetAllAccountOrders[TAuth],
|
|
38
43
|
GetAllAccountPositions[TAuth],
|
|
44
|
+
GetAllAccountRecentOrders[TAuth],
|
|
39
45
|
GetUserAccountBalance[TAuth],
|
|
40
46
|
GetUserAccountDetails[TAuth],
|
|
41
47
|
GetUserAccountOrderDetail[TAuth],
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
|
|
12
12
|
from snaptrade_client.paths.snap_trade_trade_detection_subscriptions.post import AddSubscription
|
|
13
13
|
from snaptrade_client.paths.snap_trade_trade_detection_subscriptions_cancel.post import CancelSubscription
|
|
14
|
-
from snaptrade_client.paths.accounts_account_id_orders_brokerage_order_id.get import GetAccountOrder
|
|
15
|
-
from snaptrade_client.paths.accounts_account_id_orders_all.get import GetAllAccountOrders
|
|
16
|
-
from snaptrade_client.paths.accounts_account_id_orders_recent.get import GetAllAccountRecentOrders
|
|
17
14
|
from snaptrade_client.paths.accounts_account_id_orders_details_v2_brokerage_order_id.get import GetUserAccountOrderDetailV2
|
|
18
15
|
from snaptrade_client.paths.accounts_account_id_orders_v2.get import GetUserAccountOrdersV2
|
|
19
16
|
from snaptrade_client.paths.accounts_account_id_recent_orders_v2.get import GetUserAccountRecentOrdersV2
|
|
@@ -28,9 +25,6 @@ TAuth = typing.TypeVar("TAuth", bound=AuthMode)
|
|
|
28
25
|
class ExperimentalEndpointsApiGenerated(
|
|
29
26
|
AddSubscription[TAuth],
|
|
30
27
|
CancelSubscription[TAuth],
|
|
31
|
-
GetAccountOrder[TAuth],
|
|
32
|
-
GetAllAccountOrders[TAuth],
|
|
33
|
-
GetAllAccountRecentOrders[TAuth],
|
|
34
28
|
GetUserAccountOrderDetailV2[TAuth],
|
|
35
29
|
GetUserAccountOrdersV2[TAuth],
|
|
36
30
|
GetUserAccountRecentOrdersV2[TAuth],
|
snaptrade_client/auth.py
CHANGED
|
@@ -28,6 +28,10 @@ class PersonalApiKeyAuth(AuthMode):
|
|
|
28
28
|
pass
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
class OAuthAuth(AuthMode):
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
|
|
31
35
|
class SnapTradeAuth:
|
|
32
36
|
def __init__(self):
|
|
33
37
|
raise RuntimeError("SnapTradeAuth should not be instantiated")
|
|
@@ -48,3 +52,12 @@ class SnapTradeAuth:
|
|
|
48
52
|
client_id=client_id
|
|
49
53
|
)
|
|
50
54
|
|
|
55
|
+
@staticmethod
|
|
56
|
+
def oauth(access_token: typing.Optional[str] = None) -> OAuthAuth:
|
|
57
|
+
if not isinstance(access_token, str) or not access_token.strip():
|
|
58
|
+
raise ValueError("access_token must be a nonempty string.")
|
|
59
|
+
return OAuthAuth(
|
|
60
|
+
"oauth",
|
|
61
|
+
access_token=access_token
|
|
62
|
+
)
|
|
63
|
+
|
snaptrade_client/client.py
CHANGED
|
@@ -38,6 +38,7 @@ class SnapTrade(ClientCustom, typing.Generic[TAuth]):
|
|
|
38
38
|
auth: typing.Optional[TAuth],
|
|
39
39
|
consumer_key: None = None,
|
|
40
40
|
client_id: None = None,
|
|
41
|
+
access_token: None = None,
|
|
41
42
|
**kwargs,
|
|
42
43
|
):
|
|
43
44
|
"""Create a client.
|
|
@@ -45,11 +46,14 @@ class SnapTrade(ClientCustom, typing.Generic[TAuth]):
|
|
|
45
46
|
Authentication credentials must be provided through ``auth``.
|
|
46
47
|
:param consumer_key: Unsupported. Pass this credential through ``auth``.
|
|
47
48
|
:param client_id: Unsupported. Pass this credential through ``auth``.
|
|
49
|
+
:param access_token: Unsupported. Pass this credential through ``auth``.
|
|
48
50
|
"""
|
|
49
51
|
if consumer_key is not None:
|
|
50
52
|
raise TypeError("consumer_key must be passed through 'auth'")
|
|
51
53
|
if client_id is not None:
|
|
52
54
|
raise TypeError("client_id must be passed through 'auth'")
|
|
55
|
+
if access_token is not None:
|
|
56
|
+
raise TypeError("access_token must be passed through 'auth'")
|
|
53
57
|
if len(kwargs) > 0 or configuration is None:
|
|
54
58
|
configuration = Configuration(auth=auth, **kwargs)
|
|
55
59
|
super().__init__(configuration)
|
snaptrade_client/client.pyi
CHANGED
|
@@ -13,6 +13,7 @@ import typing
|
|
|
13
13
|
from snaptrade_client.auth import AuthMode
|
|
14
14
|
from snaptrade_client.auth import CommercialApiKeyAuth
|
|
15
15
|
from snaptrade_client.auth import PersonalApiKeyAuth
|
|
16
|
+
from snaptrade_client.auth import OAuthAuth
|
|
16
17
|
from snaptrade_client.configuration import Configuration
|
|
17
18
|
from snaptrade_client.apis.tags.account_information_api import AccountInformationApi
|
|
18
19
|
from snaptrade_client.apis.tags.api_status_api import APIStatusApi
|
|
@@ -36,6 +37,7 @@ class SnapTrade(ClientCustom, typing.Generic[TAuth]):
|
|
|
36
37
|
auth: CommercialApiKeyAuth,
|
|
37
38
|
consumer_key: None = None,
|
|
38
39
|
client_id: None = None,
|
|
40
|
+
access_token: None = None,
|
|
39
41
|
**kwargs: typing.Any,
|
|
40
42
|
) -> None: ...
|
|
41
43
|
@typing.overload
|
|
@@ -46,6 +48,18 @@ class SnapTrade(ClientCustom, typing.Generic[TAuth]):
|
|
|
46
48
|
auth: PersonalApiKeyAuth,
|
|
47
49
|
consumer_key: None = None,
|
|
48
50
|
client_id: None = None,
|
|
51
|
+
access_token: None = None,
|
|
52
|
+
**kwargs: typing.Any,
|
|
53
|
+
) -> None: ...
|
|
54
|
+
@typing.overload
|
|
55
|
+
def __init__(
|
|
56
|
+
self: "SnapTrade[OAuthAuth]",
|
|
57
|
+
configuration: None = None,
|
|
58
|
+
*,
|
|
59
|
+
auth: OAuthAuth,
|
|
60
|
+
consumer_key: None = None,
|
|
61
|
+
client_id: None = None,
|
|
62
|
+
access_token: None = None,
|
|
49
63
|
**kwargs: typing.Any,
|
|
50
64
|
) -> None: ...
|
|
51
65
|
@typing.overload
|
|
@@ -56,6 +70,7 @@ class SnapTrade(ClientCustom, typing.Generic[TAuth]):
|
|
|
56
70
|
auth: None,
|
|
57
71
|
consumer_key: None = None,
|
|
58
72
|
client_id: None = None,
|
|
73
|
+
access_token: None = None,
|
|
59
74
|
**kwargs: typing.Any,
|
|
60
75
|
) -> None: ...
|
|
61
76
|
def __init__(
|
|
@@ -65,6 +80,7 @@ class SnapTrade(ClientCustom, typing.Generic[TAuth]):
|
|
|
65
80
|
auth: typing.Optional[TAuth],
|
|
66
81
|
consumer_key: None = None,
|
|
67
82
|
client_id: None = None,
|
|
83
|
+
access_token: None = None,
|
|
68
84
|
**kwargs: typing.Any,
|
|
69
85
|
) -> None:
|
|
70
86
|
...
|
|
@@ -114,6 +114,7 @@ conf = snaptrade_client.Configuration(
|
|
|
114
114
|
def __init__(self, host=None,
|
|
115
115
|
auth: typing.Optional[TAuth] = None,
|
|
116
116
|
api_key=None, api_key_prefix=None,
|
|
117
|
+
access_token=None,
|
|
117
118
|
username=None, password=None,
|
|
118
119
|
discard_unknown_keys=False,
|
|
119
120
|
client_id=None,
|
|
@@ -154,6 +155,9 @@ conf = snaptrade_client.Configuration(
|
|
|
154
155
|
client_id = getattr(auth, "client_id")
|
|
155
156
|
if getattr(auth, "consumer_key", None) is not None:
|
|
156
157
|
self.consumer_key = getattr(auth, "consumer_key")
|
|
158
|
+
if self.auth_mode == "oauth":
|
|
159
|
+
if getattr(auth, "access_token", None) is not None:
|
|
160
|
+
access_token = getattr(auth, "access_token")
|
|
157
161
|
self.server_variables = server_variables or {}
|
|
158
162
|
self.server_operation_variables = server_operation_variables or {}
|
|
159
163
|
"""Default server variables
|
|
@@ -192,6 +196,9 @@ conf = snaptrade_client.Configuration(
|
|
|
192
196
|
self.refresh_api_key_hook = None
|
|
193
197
|
"""function hook to refresh API key if expired
|
|
194
198
|
"""
|
|
199
|
+
self.access_token = access_token
|
|
200
|
+
"""Token for HTTP Basic Bearer Authentication
|
|
201
|
+
"""
|
|
195
202
|
self.username = username
|
|
196
203
|
"""Username for HTTP basic authentication
|
|
197
204
|
"""
|
|
@@ -426,6 +433,13 @@ conf = snaptrade_client.Configuration(
|
|
|
426
433
|
:return: The Auth Settings information dict.
|
|
427
434
|
"""
|
|
428
435
|
auth = {}
|
|
436
|
+
if self.access_token is not None:
|
|
437
|
+
auth['OAuthBearer'] = {
|
|
438
|
+
'type': 'bearer',
|
|
439
|
+
'in': 'header',
|
|
440
|
+
'key': 'Authorization',
|
|
441
|
+
'value': 'Bearer ' + self.access_token
|
|
442
|
+
}
|
|
429
443
|
if 'PartnerClientId' in self.api_key:
|
|
430
444
|
auth['PartnerClientId'] = {
|
|
431
445
|
'type': 'api_key',
|
|
@@ -508,7 +522,11 @@ conf = snaptrade_client.Configuration(
|
|
|
508
522
|
return fallback_auth_settings
|
|
509
523
|
if self.auth_mode is None:
|
|
510
524
|
return fallback_auth_settings
|
|
511
|
-
|
|
525
|
+
if self.auth_mode not in auth_modes:
|
|
526
|
+
raise ClientConfigurationError(
|
|
527
|
+
"This operation does not support the selected auth mode: %s" % self.auth_mode
|
|
528
|
+
)
|
|
529
|
+
return auth_modes[self.auth_mode]
|
|
512
530
|
|
|
513
531
|
def to_debug_report(self):
|
|
514
532
|
"""Gets the essential information for debugging.
|
|
@@ -519,7 +537,7 @@ conf = snaptrade_client.Configuration(
|
|
|
519
537
|
"OS: {env}\n"\
|
|
520
538
|
"Python Version: {pyversion}\n"\
|
|
521
539
|
"Version of the API: 1.0.0\n"\
|
|
522
|
-
"SDK Package Version: 13.1
|
|
540
|
+
"SDK Package Version: 13.2.1".\
|
|
523
541
|
format(env=sys.platform, pyversion=sys.version)
|
|
524
542
|
|
|
525
543
|
def get_host_settings(self):
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
SnapTrade
|
|
5
|
+
|
|
6
|
+
Connect brokerage accounts to your app for live positions and trading. ## Rate limiting Two limits apply to requests signed with your `clientId`. The stricter one wins, and exceeding either returns `429 Too Many Requests`. - **Customer-level** — 250 requests/minute by default, scoped to your `clientId` and applied across all endpoints. Reported in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. - **Account-level** — 10 requests/minute per account, scoped to (`clientId`, `accountId`). All covered operations for one account draw on the same bucket — reading balances and reading positions share it — and enforcement does not depend on the HTTP method, so updating an account consumes the same bucket as reading it. Only enforced for Personal users, and only for integrations it has been rolled out to — it is not yet in force for every Personal integration. It also does not apply on every operation that documents a 429 below. Where it applies it is reported in `X-RateLimit-Account-Limit`, `X-RateLimit-Account-Remaining` and `X-RateLimit-Account-Reset`. Do not read the absence of those headers as proof the limit is off — some configurations omit the rate limit headers while still enforcing the limit, so header absence tells you nothing about your allowance. On a 429, `X-RateLimit-Remaining: 0` means you hit the customer-level limit and `X-RateLimit-Account-Remaining: 0` means the account-level one. Wait for the corresponding `*-Reset` value (seconds) before retrying, or fall back to exponential backoff with jitter. Not every 429 is explained by those headers. A separate per-authenticated-user limit, reported in no `X-RateLimit-*` header, covers OAuth-authenticated requests and signed requests in configurations where the customer-level limit is not in effect — on the operations that use the default throttles. A few operations override those and are governed by the customer-level limit alone. The two do not stack: a signed request governed by the customer-level limit above is not additionally subject to the per-user one. If a 429 arrives with no header at zero — or with no `X-RateLimit-*` headers at all — honour `Retry-After` and back off. Treat the remaining counts as a hint, not a guarantee that the next request will succeed. Because the customer-level limit applies everywhere, any signed request can return 429. **OAuth-authenticated requests are an exception.** They are not subject to the customer-level limit and do not receive `X-RateLimit-Limit`, `X-RateLimit-Remaining` or `X-RateLimit-Reset` — do not wait on those headers or design around a customer-level allowance on this path. The account-level limit still applies to them on the account-data endpoints above, reported in the `X-RateLimit-Account-*` headers. On operations using the default throttles the per-user limit above applies to them as well, so an OAuth request can be rejected while the account headers still show capacity; on the few operations that override those throttles, OAuth callers have no per-user ceiling at all. Drive retries from `Retry-After` and exponential backoff with jitter rather than from the headers. See https://docs.snaptrade.com/docs/ratelimiting.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Contact: api@snaptrade.com
|
|
10
|
+
Created by: https://snaptrade.com/
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
import json
|
|
15
|
+
import math
|
|
16
|
+
import socket
|
|
17
|
+
import threading
|
|
18
|
+
import time
|
|
19
|
+
import typing
|
|
20
|
+
import urllib.error
|
|
21
|
+
import urllib.parse
|
|
22
|
+
import urllib.request
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class SnapTradeOAuthDeviceError(RuntimeError):
|
|
26
|
+
"""OAuth error code without response bodies or private device/token values."""
|
|
27
|
+
|
|
28
|
+
def __init__(self, error: str):
|
|
29
|
+
self.error = error
|
|
30
|
+
super().__init__(f"Device authorization failed: {error}")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True)
|
|
34
|
+
class SnapTradeDeviceAuthorization:
|
|
35
|
+
device_code: str = field(repr=False)
|
|
36
|
+
user_code: str
|
|
37
|
+
verification_uri: str
|
|
38
|
+
verification_uri_complete: typing.Optional[str]
|
|
39
|
+
# Process-local monotonic deadline in seconds; do not persist this object.
|
|
40
|
+
expires_at: float
|
|
41
|
+
interval: float
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True)
|
|
45
|
+
class SnapTradeDeviceTokens:
|
|
46
|
+
access_token: str = field(repr=False)
|
|
47
|
+
refresh_token: typing.Optional[str] = field(repr=False)
|
|
48
|
+
token_type: typing.Optional[str]
|
|
49
|
+
expires_in: typing.Optional[int]
|
|
50
|
+
scope: typing.Optional[str]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _positive_number(value: typing.Any) -> bool:
|
|
54
|
+
return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) and value > 0
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class SnapTradeOAuthDevice:
|
|
58
|
+
"""Initial read-only device login for a pre-registered public device client.
|
|
59
|
+
|
|
60
|
+
The application displays the code/URL and owns token storage and refresh.
|
|
61
|
+
Cancellation interrupts polling waits; an in-flight HTTP call is bounded by
|
|
62
|
+
timeout and the authorization deadline.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
def __init__(self, issuer: typing.Optional[str] = None, timeout: float = 30):
|
|
66
|
+
parsed = urllib.parse.urlsplit(issuer or "https://api.snaptrade.com")
|
|
67
|
+
if parsed.scheme not in ("https", "http") or not parsed.netloc:
|
|
68
|
+
raise ValueError("OAuth issuer must be an absolute HTTP(S) URL.")
|
|
69
|
+
if not _positive_number(timeout):
|
|
70
|
+
raise ValueError("timeout must be a positive finite number.")
|
|
71
|
+
self.issuer = urllib.parse.urlunsplit((parsed.scheme, parsed.netloc, "", "", ""))
|
|
72
|
+
self.timeout = timeout
|
|
73
|
+
|
|
74
|
+
def start_device_authorization(self, *, client_id: str) -> SnapTradeDeviceAuthorization:
|
|
75
|
+
"""Display user_code and verification_uri; keep device_code private."""
|
|
76
|
+
started_at = time.monotonic()
|
|
77
|
+
raw = self._post("device_authorization", {"client_id": client_id, "scope": "read"}, self.timeout)
|
|
78
|
+
interval = raw.get("interval", 5)
|
|
79
|
+
if not all(isinstance(raw.get(key), str) and raw[key] for key in ("device_code", "user_code", "verification_uri")) or not _positive_number(raw.get("expires_in")) or not _positive_number(interval):
|
|
80
|
+
raise SnapTradeOAuthDeviceError("invalid_response")
|
|
81
|
+
return SnapTradeDeviceAuthorization(
|
|
82
|
+
device_code=raw["device_code"], user_code=raw["user_code"],
|
|
83
|
+
verification_uri=raw["verification_uri"],
|
|
84
|
+
verification_uri_complete=raw.get("verification_uri_complete"),
|
|
85
|
+
expires_at=started_at + raw["expires_in"], interval=interval,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
def wait_for_device_token(
|
|
89
|
+
self, *, client_id: str, authorization: SnapTradeDeviceAuthorization,
|
|
90
|
+
cancel: typing.Optional[threading.Event] = None,
|
|
91
|
+
) -> SnapTradeDeviceTokens:
|
|
92
|
+
"""Poll until approval; raise OAuthDeviceError on denial, expiry or cancellation."""
|
|
93
|
+
stop = cancel if cancel is not None else threading.Event()
|
|
94
|
+
interval = authorization.interval
|
|
95
|
+
if not _positive_number(interval) or not _positive_number(authorization.expires_at):
|
|
96
|
+
raise ValueError("Invalid device authorization deadline or interval.")
|
|
97
|
+
while True:
|
|
98
|
+
if stop.is_set():
|
|
99
|
+
raise SnapTradeOAuthDeviceError("cancelled")
|
|
100
|
+
remaining = authorization.expires_at - time.monotonic()
|
|
101
|
+
if remaining <= 0:
|
|
102
|
+
raise SnapTradeOAuthDeviceError("expired_token")
|
|
103
|
+
if stop.wait(min(interval, remaining)):
|
|
104
|
+
raise SnapTradeOAuthDeviceError("cancelled")
|
|
105
|
+
remaining = authorization.expires_at - time.monotonic()
|
|
106
|
+
if remaining <= 0:
|
|
107
|
+
raise SnapTradeOAuthDeviceError("expired_token")
|
|
108
|
+
try:
|
|
109
|
+
raw = self._post("token", {
|
|
110
|
+
"client_id": client_id, "device_code": authorization.device_code,
|
|
111
|
+
"grant_type": "urn:ietf:params:oauth:grant-type:device_code",
|
|
112
|
+
}, min(self.timeout, remaining))
|
|
113
|
+
except SnapTradeOAuthDeviceError as exc:
|
|
114
|
+
if exc.error == "authorization_pending":
|
|
115
|
+
continue
|
|
116
|
+
if exc.error == "slow_down":
|
|
117
|
+
interval += 5
|
|
118
|
+
continue
|
|
119
|
+
raise
|
|
120
|
+
except (TimeoutError, socket.timeout):
|
|
121
|
+
interval *= 2
|
|
122
|
+
continue
|
|
123
|
+
if stop.is_set():
|
|
124
|
+
raise SnapTradeOAuthDeviceError("cancelled")
|
|
125
|
+
if time.monotonic() >= authorization.expires_at:
|
|
126
|
+
raise SnapTradeOAuthDeviceError("expired_token")
|
|
127
|
+
if not isinstance(raw.get("access_token"), str) or not raw["access_token"]:
|
|
128
|
+
raise SnapTradeOAuthDeviceError("invalid_response")
|
|
129
|
+
return SnapTradeDeviceTokens(
|
|
130
|
+
access_token=raw["access_token"], refresh_token=raw.get("refresh_token"),
|
|
131
|
+
token_type=raw.get("token_type"), expires_in=raw.get("expires_in"), scope=raw.get("scope"),
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
def _post(self, endpoint: str, body: typing.Dict[str, str], timeout: float) -> typing.Dict[str, typing.Any]:
|
|
135
|
+
request = urllib.request.Request(
|
|
136
|
+
f"{self.issuer}/oauth/{endpoint}/", data=urllib.parse.urlencode(body).encode("utf-8"),
|
|
137
|
+
headers={"Content-Type": "application/x-www-form-urlencoded"}, method="POST",
|
|
138
|
+
)
|
|
139
|
+
try:
|
|
140
|
+
with urllib.request.urlopen(request, timeout=timeout) as response:
|
|
141
|
+
raw = json.load(response)
|
|
142
|
+
except urllib.error.HTTPError as exc:
|
|
143
|
+
try:
|
|
144
|
+
raw = json.load(exc)
|
|
145
|
+
except (ValueError, UnicodeError):
|
|
146
|
+
raise SnapTradeOAuthDeviceError("http_error") from None
|
|
147
|
+
error = raw.get("error") if isinstance(raw, dict) else None
|
|
148
|
+
allowed = {"authorization_pending", "slow_down", "access_denied", "expired_token", "invalid_client", "invalid_grant", "invalid_request", "unauthorized_client", "unsupported_grant_type", "invalid_scope"}
|
|
149
|
+
if not isinstance(error, str) or error not in allowed:
|
|
150
|
+
error = "http_error"
|
|
151
|
+
raise SnapTradeOAuthDeviceError(error) from None
|
|
152
|
+
except urllib.error.URLError as exc:
|
|
153
|
+
if isinstance(exc.reason, (TimeoutError, socket.timeout)):
|
|
154
|
+
raise TimeoutError("OAuth request timed out.") from None
|
|
155
|
+
raise SnapTradeOAuthDeviceError("network_error") from None
|
|
156
|
+
except (ValueError, UnicodeError):
|
|
157
|
+
raise SnapTradeOAuthDeviceError("invalid_response") from None
|
|
158
|
+
if not isinstance(raw, dict):
|
|
159
|
+
raise SnapTradeOAuthDeviceError("invalid_response")
|
|
160
|
+
return raw
|
|
@@ -42,6 +42,29 @@ operation_parameter_map = {
|
|
|
42
42
|
},
|
|
43
43
|
]
|
|
44
44
|
},
|
|
45
|
+
'/accounts/{accountId}/orders/{brokerageOrderId}-GET': {
|
|
46
|
+
'parameters': [
|
|
47
|
+
{
|
|
48
|
+
'name': 'accountId'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
'name': 'brokerageOrderId'
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
'/accounts/{accountId}/orders/all-GET': {
|
|
56
|
+
'parameters': [
|
|
57
|
+
{
|
|
58
|
+
'name': 'accountId'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
'name': 'state'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
'name': 'days'
|
|
65
|
+
},
|
|
66
|
+
]
|
|
67
|
+
},
|
|
45
68
|
'/accounts/{accountId}/positions/all-GET': {
|
|
46
69
|
'parameters': [
|
|
47
70
|
{
|
|
@@ -49,6 +72,16 @@ operation_parameter_map = {
|
|
|
49
72
|
},
|
|
50
73
|
]
|
|
51
74
|
},
|
|
75
|
+
'/accounts/{accountId}/orders/recent-GET': {
|
|
76
|
+
'parameters': [
|
|
77
|
+
{
|
|
78
|
+
'name': 'accountId'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
'name': 'only_executed'
|
|
82
|
+
},
|
|
83
|
+
]
|
|
84
|
+
},
|
|
52
85
|
'/accounts/{accountId}/balances-GET': {
|
|
53
86
|
'parameters': [
|
|
54
87
|
{
|
|
@@ -268,39 +301,6 @@ operation_parameter_map = {
|
|
|
268
301
|
},
|
|
269
302
|
]
|
|
270
303
|
},
|
|
271
|
-
'/accounts/{accountId}/orders/{brokerageOrderId}-GET': {
|
|
272
|
-
'parameters': [
|
|
273
|
-
{
|
|
274
|
-
'name': 'accountId'
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
'name': 'brokerageOrderId'
|
|
278
|
-
},
|
|
279
|
-
]
|
|
280
|
-
},
|
|
281
|
-
'/accounts/{accountId}/orders/all-GET': {
|
|
282
|
-
'parameters': [
|
|
283
|
-
{
|
|
284
|
-
'name': 'accountId'
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
'name': 'state'
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
'name': 'days'
|
|
291
|
-
},
|
|
292
|
-
]
|
|
293
|
-
},
|
|
294
|
-
'/accounts/{accountId}/orders/recent-GET': {
|
|
295
|
-
'parameters': [
|
|
296
|
-
{
|
|
297
|
-
'name': 'accountId'
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
'name': 'only_executed'
|
|
301
|
-
},
|
|
302
|
-
]
|
|
303
|
-
},
|
|
304
304
|
'/accounts/{accountId}/orders/details/v2/{brokerageOrderId}-GET': {
|
|
305
305
|
'parameters': [
|
|
306
306
|
{
|
|
@@ -30,11 +30,14 @@ class PathValues(str, enum.Enum):
|
|
|
30
30
|
ACCOUNTS_ACCOUNT_ID_BALANCES_V2 = "/accounts/{accountId}/balances/v2"
|
|
31
31
|
ACCOUNTS_ACCOUNT_ID_POSITIONS_ALL = "/accounts/{accountId}/positions/all"
|
|
32
32
|
ACCOUNTS_ACCOUNT_ID_ORDERS = "/accounts/{accountId}/orders"
|
|
33
|
+
ACCOUNTS_ACCOUNT_ID_ORDERS_ALL = "/accounts/{accountId}/orders/all"
|
|
33
34
|
ACCOUNTS_ACCOUNT_ID_BALANCE_HISTORY = "/accounts/{accountId}/balanceHistory"
|
|
34
35
|
ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS = "/accounts/{accountId}/recentOrders"
|
|
36
|
+
ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT = "/accounts/{accountId}/orders/recent"
|
|
35
37
|
ACCOUNTS_ACCOUNT_ID_RETURN_RATES = "/accounts/{accountId}/returnRates"
|
|
36
38
|
ACCOUNTS_ACCOUNT_ID_ACTIVITIES = "/accounts/{accountId}/activities"
|
|
37
39
|
ACCOUNTS_ACCOUNT_ID_ORDERS_DETAILS = "/accounts/{accountId}/orders/details"
|
|
40
|
+
ACCOUNTS_ACCOUNT_ID_ORDERS_BROKERAGE_ORDER_ID = "/accounts/{accountId}/orders/{brokerageOrderId}"
|
|
38
41
|
ACCOUNTS_ACCOUNT_ID_QUOTES = "/accounts/{accountId}/quotes"
|
|
39
42
|
TRADE_IMPACT = "/trade/impact"
|
|
40
43
|
ACCOUNTS_ACCOUNT_ID_TRADING_OPTIONS_IMPACT = "/accounts/{accountId}/trading/options/impact"
|
|
@@ -55,9 +58,7 @@ class PathValues(str, enum.Enum):
|
|
|
55
58
|
MANAGEMENT_STATS = "/management/stats"
|
|
56
59
|
SNAP_TRADE_STATS = "/snapTrade/stats"
|
|
57
60
|
ACCOUNTS_ACCOUNT_ID_ORDERS_V2 = "/accounts/{accountId}/orders/v2"
|
|
58
|
-
ACCOUNTS_ACCOUNT_ID_ORDERS_ALL = "/accounts/{accountId}/orders/all"
|
|
59
61
|
ACCOUNTS_ACCOUNT_ID_RECENT_ORDERS_V2 = "/accounts/{accountId}/recentOrders/v2"
|
|
60
|
-
ACCOUNTS_ACCOUNT_ID_ORDERS_RECENT = "/accounts/{accountId}/orders/recent"
|
|
61
62
|
ACCOUNTS_ACCOUNT_ID_SYMBOLS = "/accounts/{accountId}/symbols"
|
|
62
63
|
BROKERAGES = "/brokerages"
|
|
63
64
|
INSTITUTIONS = "/institutions"
|
|
@@ -68,4 +69,3 @@ class PathValues(str, enum.Enum):
|
|
|
68
69
|
SYMBOLS_QUERY = "/symbols/{query}"
|
|
69
70
|
ACCOUNTS_ACCOUNT_ID_TRADING_SIMPLE = "/accounts/{accountId}/trading/simple"
|
|
70
71
|
ACCOUNTS_ACCOUNT_ID_ORDERS_DETAILS_V2_BROKERAGE_ORDER_ID = "/accounts/{accountId}/orders/details/v2/{brokerageOrderId}"
|
|
71
|
-
ACCOUNTS_ACCOUNT_ID_ORDERS_BROKERAGE_ORDER_ID = "/accounts/{accountId}/orders/{brokerageOrderId}"
|
|
@@ -53,11 +53,15 @@ _auth_modes = {
|
|
|
53
53
|
"PersonalClientId",
|
|
54
54
|
"PersonalTimestamp",
|
|
55
55
|
],
|
|
56
|
+
"oauth": [
|
|
57
|
+
"OAuthBearer",
|
|
58
|
+
],
|
|
56
59
|
}
|
|
57
60
|
_operation_auth_context = {
|
|
58
61
|
"auth_modes": [
|
|
59
62
|
"commercialApiKey",
|
|
60
63
|
"personalApiKey",
|
|
64
|
+
"oauth",
|
|
61
65
|
],
|
|
62
66
|
"request_signing_by_auth_mode": {
|
|
63
67
|
"commercialApiKey": {
|
|
@@ -77,6 +81,7 @@ _operation_auth_context = {
|
|
|
77
81
|
},
|
|
78
82
|
}
|
|
79
83
|
_legacy_auth = [
|
|
84
|
+
'OAuthBearer',
|
|
80
85
|
'PartnerClientId',
|
|
81
86
|
'PartnerSignature',
|
|
82
87
|
'PartnerTimestamp',
|