finance_dev 0.9.0__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.
- finance_dev/__init__.py +18 -0
- finance_dev/_hooks/__init__.py +7 -0
- finance_dev/_hooks/clientcredentials.py +319 -0
- finance_dev/_hooks/oauth2scopes.py +50 -0
- finance_dev/_hooks/registration.py +13 -0
- finance_dev/_hooks/sdkhooks.py +82 -0
- finance_dev/_hooks/types.py +125 -0
- finance_dev/_version.py +16 -0
- finance_dev/accounts.py +797 -0
- finance_dev/alternativedata.py +4830 -0
- finance_dev/analytics.py +3757 -0
- finance_dev/basesdk.py +393 -0
- finance_dev/calendar.py +1523 -0
- finance_dev/chart.py +1881 -0
- finance_dev/company.py +1105 -0
- finance_dev/corporateactions.py +1795 -0
- finance_dev/economy.py +1153 -0
- finance_dev/errors/__init__.py +94 -0
- finance_dev/errors/apierror.py +41 -0
- finance_dev/errors/authenticationerrorenvelope.py +43 -0
- finance_dev/errors/badrequest.py +34 -0
- finance_dev/errors/errorenvelope.py +42 -0
- finance_dev/errors/errorresponse.py +45 -0
- finance_dev/errors/financedevapierror.py +31 -0
- finance_dev/errors/forbidden.py +34 -0
- finance_dev/errors/internalservererror.py +35 -0
- finance_dev/errors/no_response_error.py +18 -0
- finance_dev/errors/notfound.py +34 -0
- finance_dev/errors/orderhistorybadrequest.py +35 -0
- finance_dev/errors/predorderserrorenvelope.py +42 -0
- finance_dev/errors/responsevalidationerror.py +28 -0
- finance_dev/errors/unauthorized.py +34 -0
- finance_dev/estimates.py +1906 -0
- finance_dev/etf.py +1108 -0
- finance_dev/filings.py +586 -0
- finance_dev/financials.py +4079 -0
- finance_dev/history.py +477 -0
- finance_dev/httpclient.py +126 -0
- finance_dev/indices.py +2308 -0
- finance_dev/logos.py +692 -0
- finance_dev/market.py +1825 -0
- finance_dev/markets.py +952 -0
- finance_dev/models/__init__.py +4568 -0
- finance_dev/models/accountbalancev2.py +340 -0
- finance_dev/models/accountitem.py +78 -0
- finance_dev/models/accountposition.py +147 -0
- finance_dev/models/aggregatetechnicalindicatorsresponse.py +192 -0
- finance_dev/models/analystinsightitem.py +161 -0
- finance_dev/models/analystinsightsresponse.py +39 -0
- finance_dev/models/apperror.py +123 -0
- finance_dev/models/authenticationerrordetail.py +58 -0
- finance_dev/models/bankbranchesresponse.py +96 -0
- finance_dev/models/basicfinancials.py +243 -0
- finance_dev/models/bullbearanalysisresponse.py +150 -0
- finance_dev/models/cancelorderop.py +40 -0
- finance_dev/models/cancelordrequest_union.py +287 -0
- finance_dev/models/cancelordresponse.py +115 -0
- finance_dev/models/cashflowstatement.py +290 -0
- finance_dev/models/cashflowstatementsresponse.py +61 -0
- finance_dev/models/chartbars.py +111 -0
- finance_dev/models/chartconfig.py +81 -0
- finance_dev/models/chartresolution.py +46 -0
- finance_dev/models/companyesgresponse.py +408 -0
- finance_dev/models/companyexecutive.py +70 -0
- finance_dev/models/companyexecutiveresponse.py +39 -0
- finance_dev/models/companypeersresponse.py +38 -0
- finance_dev/models/companypresentationresponse.py +96 -0
- finance_dev/models/companyprofile.py +255 -0
- finance_dev/models/conferencecallsresponse.py +169 -0
- finance_dev/models/congressionaltradingresponse.py +138 -0
- finance_dev/models/covid19uscasesresponse.py +79 -0
- finance_dev/models/createconfigwatchlistop.py +40 -0
- finance_dev/models/createwatchlistrequest.py +43 -0
- finance_dev/models/dailymarketsummaryresponse.py +73 -0
- finance_dev/models/deleteconfigwatchlistbyidop.py +53 -0
- finance_dev/models/dividenditem.py +125 -0
- finance_dev/models/dividendsresponse.py +61 -0
- finance_dev/models/earningrelease.py +291 -0
- finance_dev/models/earningscallliveresponse.py +103 -0
- finance_dev/models/earningsqualityscoreresponse.py +140 -0
- finance_dev/models/earningssurprisesresponse.py +125 -0
- finance_dev/models/ebitdaestimatesresponse.py +176 -0
- finance_dev/models/ebitestimatesresponse.py +176 -0
- finance_dev/models/economicscalendarevent.py +160 -0
- finance_dev/models/economicsindicator.py +87 -0
- finance_dev/models/epsestimatesresponse.py +176 -0
- finance_dev/models/equitydetailsdto.py +569 -0
- finance_dev/models/errorcode.py +48 -0
- finance_dev/models/etblistresponse.py +43 -0
- finance_dev/models/etbsearchrequest.py +21 -0
- finance_dev/models/etbsearchresponse.py +43 -0
- finance_dev/models/etfcountryallocationresponse.py +113 -0
- finance_dev/models/etfholdingsresponse.py +163 -0
- finance_dev/models/etfprofileresponse.py +234 -0
- finance_dev/models/etfsectorallocationresponse.py +113 -0
- finance_dev/models/exchangecode.py +90 -0
- finance_dev/models/fdaadvisorycommitteecalendarresponse.py +88 -0
- finance_dev/models/filingsimilarityrecord.py +115 -0
- finance_dev/models/filingssimilarityindexdatawrapper.py +52 -0
- finance_dev/models/filingssimilarityindexresponse.py +42 -0
- finance_dev/models/financialratiosresponse.py +252 -0
- finance_dev/models/financialsreporteddatawrapper.py +49 -0
- finance_dev/models/financialsreportedresponse.py +42 -0
- finance_dev/models/financialsrevenuebreakdowndatawrapper.py +49 -0
- finance_dev/models/financialsrevenuebreakdownresponse.py +42 -0
- finance_dev/models/financialsstatementsdatawrapper.py +44 -0
- finance_dev/models/financialsstatementsresponse.py +42 -0
- finance_dev/models/financialstatement.py +171 -0
- finance_dev/models/financialstatementtype.py +14 -0
- finance_dev/models/getaccountbalanceop.py +53 -0
- finance_dev/models/getaccountpositionsop.py +53 -0
- finance_dev/models/getaccountsresponse.py +22 -0
- finance_dev/models/getaggregatetechnicalindicatorsop.py +94 -0
- finance_dev/models/getanalystinsightsop.py +164 -0
- finance_dev/models/getbankbranchesop.py +53 -0
- finance_dev/models/getbaseeventop.py +87 -0
- finance_dev/models/getbullbearanalysisop.py +91 -0
- finance_dev/models/getcashflowstatementsop.py +564 -0
- finance_dev/models/getchartconfigop.py +40 -0
- finance_dev/models/getcharthistoryop.py +122 -0
- finance_dev/models/getcharttimeop.py +39 -0
- finance_dev/models/getcompanyesgop.py +53 -0
- finance_dev/models/getcompanyexecutivesop.py +56 -0
- finance_dev/models/getcompanymetricsop.py +68 -0
- finance_dev/models/getcompanypeersop.py +53 -0
- finance_dev/models/getcompanypresentationop.py +56 -0
- finance_dev/models/getcompanyprofileop.py +86 -0
- finance_dev/models/getconferencecallsop.py +111 -0
- finance_dev/models/getconfigwatchlistbyidop.py +53 -0
- finance_dev/models/getconfigwatchlistsop.py +40 -0
- finance_dev/models/getcongressionaltradingop.py +73 -0
- finance_dev/models/getcovid19uscasesop.py +43 -0
- finance_dev/models/getdailymarketsummaryop.py +92 -0
- finance_dev/models/getdividendsop.py +294 -0
- finance_dev/models/getearningscalendarop.py +87 -0
- finance_dev/models/getearningscallliveop.py +91 -0
- finance_dev/models/getearningsqualityscoreop.py +81 -0
- finance_dev/models/getearningssurprisesop.py +80 -0
- finance_dev/models/getebitdaestimatesop.py +91 -0
- finance_dev/models/getebitestimatesop.py +88 -0
- finance_dev/models/geteconomicscalendarop.py +92 -0
- finance_dev/models/geteconomicscalendarresponse.py +56 -0
- finance_dev/models/getepsestimatesop.py +88 -0
- finance_dev/models/getequitydetailsop.py +56 -0
- finance_dev/models/getequitydetailsresponse.py +45 -0
- finance_dev/models/getetblistop.py +40 -0
- finance_dev/models/getetfcountryallocationop.py +80 -0
- finance_dev/models/getetfholdingsop.py +96 -0
- finance_dev/models/getetfprofileop.py +77 -0
- finance_dev/models/getetfsectorallocationop.py +80 -0
- finance_dev/models/geteventcontractsop.py +87 -0
- finance_dev/models/getfdaadvisorycommitteecalendarop.py +47 -0
- finance_dev/models/getfilingssimilarityindexop.py +102 -0
- finance_dev/models/getfinancialratiosop.py +612 -0
- finance_dev/models/getfinancialstatementsop.py +117 -0
- finance_dev/models/getfundownershipop.py +77 -0
- finance_dev/models/gethistoricaldataop.py +61 -0
- finance_dev/models/gethistoricalesgop.py +53 -0
- finance_dev/models/gethistorybatchop.py +74 -0
- finance_dev/models/gethistoryop.py +123 -0
- finance_dev/models/getincomestatementsop.py +564 -0
- finance_dev/models/getindexbarop.py +140 -0
- finance_dev/models/getindexbarsop.py +149 -0
- finance_dev/models/getindexchartbarsop.py +178 -0
- finance_dev/models/getindexrealtimevaluesop.py +94 -0
- finance_dev/models/getinflationexpectationsop.py +157 -0
- finance_dev/models/getinflationop.py +154 -0
- finance_dev/models/getinsidertransactionsop.py +90 -0
- finance_dev/models/getinstitutionalownershipop.py +99 -0
- finance_dev/models/getinstitutionalportfolioop.py +75 -0
- finance_dev/models/getinvestmentthemeop.py +68 -0
- finance_dev/models/getipocalendarop.py +63 -0
- finance_dev/models/getlobbyingop.py +70 -0
- finance_dev/models/getmarketbreadthop.py +40 -0
- finance_dev/models/getmarketholidaysop.py +65 -0
- finance_dev/models/getmarketstatusop.py +65 -0
- finance_dev/models/getmergersandacquisitionsop.py +113 -0
- finance_dev/models/getnetinflowop.py +40 -0
- finance_dev/models/getnewsbyidop.py +73 -0
- finance_dev/models/getnewsop.py +98 -0
- finance_dev/models/getnewssentimentop.py +53 -0
- finance_dev/models/getoptionchainsnapshotop.py +244 -0
- finance_dev/models/getoptioncontractsnapshotop.py +69 -0
- finance_dev/models/getoptiondetailsop.py +56 -0
- finance_dev/models/getoptiondetailsresponse.py +45 -0
- finance_dev/models/getoptionlasttradeop.py +56 -0
- finance_dev/models/getoptionopencloseop.py +66 -0
- finance_dev/models/getoptionpreviousdayop.py +56 -0
- finance_dev/models/getoptionquotesop.py +177 -0
- finance_dev/models/getoptionsactivityop.py +111 -0
- finance_dev/models/getoptionsetfstopvolumeop.py +70 -0
- finance_dev/models/getoptionsstockstopgainersop.py +70 -0
- finance_dev/models/getoptionsstockstopvolumeop.py +70 -0
- finance_dev/models/getoptionsunusualactivityop.py +100 -0
- finance_dev/models/getoptiontradesop.py +177 -0
- finance_dev/models/getordersv2response.py +66 -0
- finance_dev/models/getownershipdataop.py +77 -0
- finance_dev/models/getpositionsresponse.py +39 -0
- finance_dev/models/getpredictionorderop.py +88 -0
- finance_dev/models/getpricetargetop.py +53 -0
- finance_dev/models/getquotesop.py +53 -0
- finance_dev/models/getratingsop.py +164 -0
- finance_dev/models/getratingsresponse.py +39 -0
- finance_dev/models/getreportedfinancialsop.py +127 -0
- finance_dev/models/getrevenuebreakdownop.py +85 -0
- finance_dev/models/getrevenueestimatesop.py +91 -0
- finance_dev/models/getsecfilingsop.py +113 -0
- finance_dev/models/getsectortickersop.py +124 -0
- finance_dev/models/getsectorwisechangeop.py +84 -0
- finance_dev/models/getshortinterestop.py +334 -0
- finance_dev/models/getshortvolumeop.py +333 -0
- finance_dev/models/getsocialsentimentop.py +90 -0
- finance_dev/models/getspinoffsop.py +112 -0
- finance_dev/models/getstockaggregatesop.py +174 -0
- finance_dev/models/getstocklastquoteop.py +56 -0
- finance_dev/models/getstocklasttradeop.py +56 -0
- finance_dev/models/getstockopencloseop.py +90 -0
- finance_dev/models/getstockpreviousdayop.py +80 -0
- finance_dev/models/getstockquotesop.py +177 -0
- finance_dev/models/getstocksnapshotsop.py +82 -0
- finance_dev/models/getstocksplitsop.py +243 -0
- finance_dev/models/getstocktradesop.py +177 -0
- finance_dev/models/getsupplychainop.py +53 -0
- finance_dev/models/getsupportresistancelevelsop.py +90 -0
- finance_dev/models/getsymbolinfoop.py +53 -0
- finance_dev/models/gettechnicalindicatorop.py +172 -0
- finance_dev/models/gettechnicalpatternsop.py +88 -0
- finance_dev/models/gettenderoffersop.py +112 -0
- finance_dev/models/gettickhistoryop.py +104 -0
- finance_dev/models/gettopgainersop.py +78 -0
- finance_dev/models/gettoplosersop.py +78 -0
- finance_dev/models/gettopmostactiveop.py +78 -0
- finance_dev/models/gettranscriptop.py +53 -0
- finance_dev/models/gettreasuryyieldsop.py +157 -0
- finance_dev/models/getunifiedsnapshotop.py +223 -0
- finance_dev/models/getupgradesdowngradesop.py +91 -0
- finance_dev/models/getusaspendingop.py +70 -0
- finance_dev/models/getuseraccountsop.py +40 -0
- finance_dev/models/getusptopatentsop.py +70 -0
- finance_dev/models/getvisaapplicationsop.py +73 -0
- finance_dev/models/historicalesgresponse.py +439 -0
- finance_dev/models/httpmetadata.py +24 -0
- finance_dev/models/incomestatement.py +296 -0
- finance_dev/models/incomestatementsresponse.py +61 -0
- finance_dev/models/indexbarresponse.py +194 -0
- finance_dev/models/indexbarsresponse.py +123 -0
- finance_dev/models/indexchartbarsresponse.py +213 -0
- finance_dev/models/indexgroupsresponse.py +78 -0
- finance_dev/models/indexlistresponse.py +95 -0
- finance_dev/models/indexsearchresponse.py +93 -0
- finance_dev/models/indicesbygroupresponse.py +93 -0
- finance_dev/models/indicesidentifiertype.py +28 -0
- finance_dev/models/indicesrealtimeindexinfo.py +67 -0
- finance_dev/models/indicesrealtimeindexvalue.py +157 -0
- finance_dev/models/indicesrealtimevaluesitem.py +80 -0
- finance_dev/models/indicesrealtimevaluesresponse.py +42 -0
- finance_dev/models/inflationexpectationsresponse.py +140 -0
- finance_dev/models/inflationresponse.py +132 -0
- finance_dev/models/insidertransaction.py +97 -0
- finance_dev/models/insidertransactionsresponse.py +39 -0
- finance_dev/models/institutionalholding.py +77 -0
- finance_dev/models/institutionalownershipresponse.py +39 -0
- finance_dev/models/institutionalportfolioresponse.py +39 -0
- finance_dev/models/investmentthemeid.py +35 -0
- finance_dev/models/investmentthemeresponse.py +80 -0
- finance_dev/models/ipocalendarresponse.py +39 -0
- finance_dev/models/ipoitem.py +93 -0
- finance_dev/models/listactiveordersop.py +87 -0
- finance_dev/models/listcategoriesop.py +79 -0
- finance_dev/models/listindexgroupsop.py +40 -0
- finance_dev/models/listindicesbygroupop.py +58 -0
- finance_dev/models/listindicesop.py +91 -0
- finance_dev/models/listoptioncontractsop.py +66 -0
- finance_dev/models/listoptionexpirydatesop.py +56 -0
- finance_dev/models/listorderhistoryop.py +139 -0
- finance_dev/models/listpredictionordersop.py +134 -0
- finance_dev/models/listtranscriptsop.py +53 -0
- finance_dev/models/lobbyingresponse.py +166 -0
- finance_dev/models/logosearchresponse.py +152 -0
- finance_dev/models/logosyncresponse.py +277 -0
- finance_dev/models/marketbreadth.py +97 -0
- finance_dev/models/marketbreadthresponse.py +44 -0
- finance_dev/models/marketholiday.py +56 -0
- finance_dev/models/marketholidayresponse.py +39 -0
- finance_dev/models/marketstatus.py +67 -0
- finance_dev/models/mergersandacquisitionsresponse.py +186 -0
- finance_dev/models/metricseriespoint.py +43 -0
- finance_dev/models/netinflow.py +81 -0
- finance_dev/models/netinflowresponse.py +44 -0
- finance_dev/models/newsitem.py +102 -0
- finance_dev/models/newslistresponse.py +128 -0
- finance_dev/models/newssentimentresponse.py +176 -0
- finance_dev/models/newstypeenum.py +16 -0
- finance_dev/models/optionchainsnapshotresponse.py +64 -0
- finance_dev/models/optioncontractsnapshotresponse.py +64 -0
- finance_dev/models/optioncontractsnapshotrow.py +164 -0
- finance_dev/models/optioncontractsresponse.py +131 -0
- finance_dev/models/optiondetailsdto.py +72 -0
- finance_dev/models/optionexpirydatesresponse.py +53 -0
- finance_dev/models/optionlasttraderesponse.py +169 -0
- finance_dev/models/optionopencloseresponse.py +97 -0
- finance_dev/models/optionpreviousdayresponse.py +89 -0
- finance_dev/models/optionquotesresponse.py +138 -0
- finance_dev/models/optionsactivityresponse.py +265 -0
- finance_dev/models/optionsnapshotcontractdetails.py +85 -0
- finance_dev/models/optionsnapshotdaybar.py +107 -0
- finance_dev/models/optionsnapshotgreeks.py +67 -0
- finance_dev/models/optionsnapshotlastquote.py +116 -0
- finance_dev/models/optionsnapshotlasttrade.py +102 -0
- finance_dev/models/optionsnapshotunderlying.py +86 -0
- finance_dev/models/optionsscreeneritem.py +151 -0
- finance_dev/models/optionsunusualactivityresponse.py +62 -0
- finance_dev/models/optionsunusualactivitytrade.py +103 -0
- finance_dev/models/optiontradesresponse.py +132 -0
- finance_dev/models/orderrequesttimeinforceenum.py +29 -0
- finance_dev/models/ordersideenum.py +20 -0
- finance_dev/models/ordertypeenum.py +20 -0
- finance_dev/models/ordleg.py +162 -0
- finance_dev/models/ordresponse.py +202 -0
- finance_dev/models/ownershipdataresponse.py +39 -0
- finance_dev/models/ownershiprecord.py +74 -0
- finance_dev/models/placeorderop.py +40 -0
- finance_dev/models/placeordrequest_union.py +335 -0
- finance_dev/models/placepredictionorderop.py +114 -0
- finance_dev/models/predmdbaseevent.py +62 -0
- finance_dev/models/predmdbaseeventhit.py +53 -0
- finance_dev/models/predmdbaseeventsearchresult.py +46 -0
- finance_dev/models/predmdbaseeventwithevents.py +32 -0
- finance_dev/models/predmdbatchhistoryrequest.py +16 -0
- finance_dev/models/predmdbatchhistoryresponse.py +16 -0
- finance_dev/models/predmdcategory.py +48 -0
- finance_dev/models/predmdcontract.py +177 -0
- finance_dev/models/predmdcontracthit.py +157 -0
- finance_dev/models/predmdcontractsearchresult.py +46 -0
- finance_dev/models/predmdevent.py +136 -0
- finance_dev/models/predmdeventhit.py +73 -0
- finance_dev/models/predmdeventsearchresult.py +46 -0
- finance_dev/models/predmdeventwithcontracts.py +22 -0
- finance_dev/models/predmdhistoryrequest.py +59 -0
- finance_dev/models/predmdhistoryresponse.py +53 -0
- finance_dev/models/predmdtick.py +53 -0
- finance_dev/models/predordersapperror.py +78 -0
- finance_dev/models/predordersorder.py +267 -0
- finance_dev/models/predordersorderdetail.py +26 -0
- finance_dev/models/predordersorderpage.py +45 -0
- finance_dev/models/predordersorderreport.py +88 -0
- finance_dev/models/predordersplaceorderrequest.py +159 -0
- finance_dev/models/previeworderop.py +40 -0
- finance_dev/models/previeworderresponse.py +127 -0
- finance_dev/models/pricetargetresponse.py +89 -0
- finance_dev/models/quotedata.py +49 -0
- finance_dev/models/quotesresponse.py +62 -0
- finance_dev/models/quotevalues.py +114 -0
- finance_dev/models/rating.py +193 -0
- finance_dev/models/ratingsaccuracy.py +242 -0
- finance_dev/models/replaceconfigwatchlistsop.py +40 -0
- finance_dev/models/replaceorderop.py +40 -0
- finance_dev/models/replaceordrequest_union.py +367 -0
- finance_dev/models/replaceordresponse.py +144 -0
- finance_dev/models/reportedbsitem.py +53 -0
- finance_dev/models/reportedfiling.py +110 -0
- finance_dev/models/reportedreport.py +39 -0
- finance_dev/models/reportingfrequency.py +16 -0
- finance_dev/models/revenuebreakdownaxis.py +52 -0
- finance_dev/models/revenuebreakdowndatapoint.py +58 -0
- finance_dev/models/revenuebreakdownentry.py +51 -0
- finance_dev/models/revenuebreakdowninner.py +75 -0
- finance_dev/models/revenueestimatesresponse.py +176 -0
- finance_dev/models/screenclause.py +70 -0
- finance_dev/models/screengroup.py +75 -0
- finance_dev/models/searchetbsymbolsop.py +40 -0
- finance_dev/models/searchindicesop.py +55 -0
- finance_dev/models/searchlogosop.py +158 -0
- finance_dev/models/searchmarketsymbolsop.py +80 -0
- finance_dev/models/searchop.py +232 -0
- finance_dev/models/searchsymbolitem.py +76 -0
- finance_dev/models/searchsymbolresponseitem.py +71 -0
- finance_dev/models/searchsymbolsop.py +77 -0
- finance_dev/models/secfiling.py +91 -0
- finance_dev/models/secfilingsresponse.py +39 -0
- finance_dev/models/sectoravgchange.py +50 -0
- finance_dev/models/security.py +59 -0
- finance_dev/models/securitytypeenum.py +16 -0
- finance_dev/models/shortinterestresponse.py +126 -0
- finance_dev/models/shortvolumeresponse.py +198 -0
- finance_dev/models/socialsentimentresponse.py +124 -0
- finance_dev/models/sortorderenum.py +13 -0
- finance_dev/models/spinoffsresponse.py +136 -0
- finance_dev/models/stockaggregatesresponse.py +92 -0
- finance_dev/models/stocklastquoteresponse.py +175 -0
- finance_dev/models/stocklasttraderesponse.py +169 -0
- finance_dev/models/stockohlcbar.py +85 -0
- finance_dev/models/stockopencloseresponse.py +109 -0
- finance_dev/models/stockpreviousdayresponse.py +86 -0
- finance_dev/models/stockquotesresponse.py +170 -0
- finance_dev/models/stockscreenerop.py +144 -0
- finance_dev/models/stockscreenerrequest.py +131 -0
- finance_dev/models/stockscreenerresponse.py +197 -0
- finance_dev/models/stocksnapshotsresponse.py +454 -0
- finance_dev/models/stocksplitsresponse.py +144 -0
- finance_dev/models/stocktradesresponse.py +164 -0
- finance_dev/models/supplychainresponse.py +158 -0
- finance_dev/models/supportresistancelevelsresponse.py +68 -0
- finance_dev/models/symboldetails.py +119 -0
- finance_dev/models/symbolerror.py +43 -0
- finance_dev/models/symbolinfo.py +183 -0
- finance_dev/models/synclogosop.py +146 -0
- finance_dev/models/technicalindicatorresponse.py +43 -0
- finance_dev/models/technicalindicatortype.py +21 -0
- finance_dev/models/technicalpatternsresponse.py +249 -0
- finance_dev/models/tenderofferidentifiertype.py +26 -0
- finance_dev/models/tenderoffersresponse.py +548 -0
- finance_dev/models/tickchartbars.py +104 -0
- finance_dev/models/tickresolution.py +20 -0
- finance_dev/models/timeinforceenum.py +26 -0
- finance_dev/models/tradeorderlegv2.py +164 -0
- finance_dev/models/tradeorderv2.py +434 -0
- finance_dev/models/transcriptresponse.py +162 -0
- finance_dev/models/transcriptsresponse.py +89 -0
- finance_dev/models/treasuryyieldsresponse.py +160 -0
- finance_dev/models/unifiedsnapshotresponse.py +308 -0
- finance_dev/models/updateconfigwatchlistbyidop.py +65 -0
- finance_dev/models/updatewatchlistrequest_union.py +134 -0
- finance_dev/models/upgradesdowngradesresponse.py +98 -0
- finance_dev/models/usaspendingresponse.py +222 -0
- finance_dev/models/usptopatentsresponse.py +134 -0
- finance_dev/models/visaapplicationsresponse.py +228 -0
- finance_dev/models/watchlist.py +68 -0
- finance_dev/models/watchlistrequest.py +43 -0
- finance_dev/models/watchlistresponse.py +44 -0
- finance_dev/news_sdk.py +829 -0
- finance_dev/options.py +3443 -0
- finance_dev/orders.py +1907 -0
- finance_dev/ownership.py +1386 -0
- finance_dev/predictions.py +29 -0
- finance_dev/predictions_orders.py +852 -0
- finance_dev/py.typed +1 -0
- finance_dev/sdk.py +347 -0
- finance_dev/sdkconfiguration.py +50 -0
- finance_dev/signals.py +338 -0
- finance_dev/stocks.py +3131 -0
- finance_dev/technicalanalysis_sdk.py +1137 -0
- finance_dev/types/__init__.py +25 -0
- finance_dev/types/base64fileinput.py +44 -0
- finance_dev/types/basemodel.py +78 -0
- finance_dev/utils/__init__.py +181 -0
- finance_dev/utils/annotations.py +80 -0
- finance_dev/utils/datetimes.py +42 -0
- finance_dev/utils/dynamic_imports.py +55 -0
- finance_dev/utils/enums.py +135 -0
- finance_dev/utils/eventstreaming.py +327 -0
- finance_dev/utils/forms.py +240 -0
- finance_dev/utils/headers.py +137 -0
- finance_dev/utils/logger.py +23 -0
- finance_dev/utils/metadata.py +120 -0
- finance_dev/utils/queryparams.py +218 -0
- finance_dev/utils/requestbodies.py +68 -0
- finance_dev/utils/retries.py +373 -0
- finance_dev/utils/security.py +199 -0
- finance_dev/utils/serializers.py +327 -0
- finance_dev/utils/unmarshal_json_response.py +39 -0
- finance_dev/utils/url.py +155 -0
- finance_dev/utils/values.py +143 -0
- finance_dev/watchlist_sdk.py +1583 -0
- finance_dev/websocket/__init__.py +57 -0
- finance_dev/websocket/account.py +5 -0
- finance_dev/websocket/auth.py +124 -0
- finance_dev/websocket/chart.py +5 -0
- finance_dev/websocket/codec.py +66 -0
- finance_dev/websocket/config.py +52 -0
- finance_dev/websocket/errors.py +54 -0
- finance_dev/websocket/market.py +5 -0
- finance_dev/websocket/models/__init__.py +52 -0
- finance_dev/websocket/models/account.py +60 -0
- finance_dev/websocket/models/chart.py +44 -0
- finance_dev/websocket/models/common.py +85 -0
- finance_dev/websocket/models/market.py +113 -0
- finance_dev/websocket/resources.py +327 -0
- finance_dev/websocket/sdk.py +13 -0
- finance_dev/websocket/transport/async_connection.py +493 -0
- finance_dev/websocket/transport/base.py +78 -0
- finance_dev/websocket/transport/sync_connection.py +470 -0
- finance_dev-0.9.0.dist-info/METADATA +913 -0
- finance_dev-0.9.0.dist-info/RECORD +486 -0
- finance_dev-0.9.0.dist-info/WHEEL +5 -0
- finance_dev-0.9.0.dist-info/top_level.txt +1 -0
finance_dev/options.py
ADDED
|
@@ -0,0 +1,3443 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
# @generated-id: 858ac761fa0b
|
|
3
|
+
|
|
4
|
+
from .basesdk import BaseSDK
|
|
5
|
+
from datetime import date
|
|
6
|
+
from finance_dev import errors, models, utils
|
|
7
|
+
from finance_dev._hooks import HookContext
|
|
8
|
+
from finance_dev.types import OptionalNullable, UNSET
|
|
9
|
+
from finance_dev.utils.unmarshal_json_response import unmarshal_json_response
|
|
10
|
+
from jsonpath import JSONPath
|
|
11
|
+
from typing import Any, Dict, List, Mapping, Optional, Union
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Options(BaseSDK):
|
|
15
|
+
def get_options_activity(
|
|
16
|
+
self,
|
|
17
|
+
*,
|
|
18
|
+
date_from: Optional[date] = None,
|
|
19
|
+
date_to: Optional[date] = None,
|
|
20
|
+
tickers: Optional[str] = None,
|
|
21
|
+
page: Optional[int] = None,
|
|
22
|
+
page_size: Optional[int] = None,
|
|
23
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
24
|
+
server_url: Optional[str] = None,
|
|
25
|
+
timeout_ms: Optional[int] = None,
|
|
26
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
27
|
+
) -> Optional[models.GetOptionsActivityResponse]:
|
|
28
|
+
r"""Get Options Activity
|
|
29
|
+
|
|
30
|
+
Retrieve unusual options activity including large block trades, high volume contracts, and significant changes in open interest.
|
|
31
|
+
|
|
32
|
+
If set, this operation will use `client_id` from the global security.
|
|
33
|
+
|
|
34
|
+
:param date_from: Start date for filtering options activity in YYYY-MM-DD format
|
|
35
|
+
:param date_to: End date for filtering options activity in YYYY-MM-DD format
|
|
36
|
+
:param tickers: Comma-separated list of ticker symbols to filter results
|
|
37
|
+
:param page: Page number for pagination (zero-based)
|
|
38
|
+
:param page_size: Number of results per page. Use this to control pagination size in list views. (default: 100, max: 1000)
|
|
39
|
+
:param retries: Override the default retry configuration for this method
|
|
40
|
+
:param server_url: Override the default server URL for this method
|
|
41
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
42
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
43
|
+
"""
|
|
44
|
+
base_url = None
|
|
45
|
+
url_variables = None
|
|
46
|
+
if timeout_ms is None:
|
|
47
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
48
|
+
|
|
49
|
+
if timeout_ms is None:
|
|
50
|
+
timeout_ms = 30000
|
|
51
|
+
|
|
52
|
+
if server_url is not None:
|
|
53
|
+
base_url = server_url
|
|
54
|
+
else:
|
|
55
|
+
base_url = self._get_url(base_url, url_variables)
|
|
56
|
+
|
|
57
|
+
request = models.GetOptionsActivityRequest(
|
|
58
|
+
date_from=date_from,
|
|
59
|
+
date_to=date_to,
|
|
60
|
+
tickers=tickers,
|
|
61
|
+
page=page,
|
|
62
|
+
page_size=page_size,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
req = self._build_request(
|
|
66
|
+
method="GET",
|
|
67
|
+
path="/v1/options/activity",
|
|
68
|
+
base_url=base_url,
|
|
69
|
+
url_variables=url_variables,
|
|
70
|
+
request=request,
|
|
71
|
+
request_body_required=False,
|
|
72
|
+
request_has_path_params=False,
|
|
73
|
+
request_has_query_params=True,
|
|
74
|
+
user_agent_header="user-agent",
|
|
75
|
+
accept_header_value="application/json",
|
|
76
|
+
http_headers=http_headers,
|
|
77
|
+
security=self.sdk_configuration.security,
|
|
78
|
+
allow_empty_value=None,
|
|
79
|
+
allowed_fields=["client_id"],
|
|
80
|
+
timeout_ms=timeout_ms,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if retries == UNSET:
|
|
84
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
85
|
+
retries = self.sdk_configuration.retry_config
|
|
86
|
+
else:
|
|
87
|
+
retries = utils.RetryConfig(
|
|
88
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
retry_config = None
|
|
92
|
+
if isinstance(retries, utils.RetryConfig):
|
|
93
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
94
|
+
|
|
95
|
+
http_res = self.do_request(
|
|
96
|
+
hook_ctx=HookContext(
|
|
97
|
+
config=self.sdk_configuration,
|
|
98
|
+
base_url=base_url or "",
|
|
99
|
+
operation_id="getOptionsActivity",
|
|
100
|
+
oauth2_scopes=["market:supplemental"],
|
|
101
|
+
security_source=self.sdk_configuration.security,
|
|
102
|
+
tags=["Options"],
|
|
103
|
+
extensions=None,
|
|
104
|
+
),
|
|
105
|
+
request=req,
|
|
106
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
107
|
+
retry_config=retry_config,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
def next_func() -> Optional[models.GetOptionsActivityResponse]:
|
|
111
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
112
|
+
page = request.page if isinstance(request.page, int) else 1
|
|
113
|
+
next_page = page + 1
|
|
114
|
+
|
|
115
|
+
if not http_res.text:
|
|
116
|
+
return None
|
|
117
|
+
results = JSONPath("$.activities").parse(body)
|
|
118
|
+
if len(results) == 0 or len(results[0]) == 0:
|
|
119
|
+
return None
|
|
120
|
+
limit_ = request.page_size if isinstance(request.page_size, int) else 0
|
|
121
|
+
if len(results[0]) < limit_:
|
|
122
|
+
return None
|
|
123
|
+
|
|
124
|
+
return self.get_options_activity(
|
|
125
|
+
date_from=date_from,
|
|
126
|
+
date_to=date_to,
|
|
127
|
+
tickers=tickers,
|
|
128
|
+
page=next_page,
|
|
129
|
+
page_size=page_size,
|
|
130
|
+
retries=retries,
|
|
131
|
+
server_url=server_url,
|
|
132
|
+
timeout_ms=timeout_ms,
|
|
133
|
+
http_headers=http_headers,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
response_data: Any = None
|
|
137
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
138
|
+
return models.GetOptionsActivityResponse(
|
|
139
|
+
options_activity_response=unmarshal_json_response(
|
|
140
|
+
Optional[models.OptionsActivityResponse], http_res
|
|
141
|
+
),
|
|
142
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
143
|
+
next=next_func,
|
|
144
|
+
)
|
|
145
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
146
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
147
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
148
|
+
request=req, response=http_res
|
|
149
|
+
)
|
|
150
|
+
raise errors.BadRequest(response_data, http_res)
|
|
151
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
152
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
153
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
154
|
+
request=req, response=http_res
|
|
155
|
+
)
|
|
156
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
157
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
158
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
159
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
160
|
+
request=req, response=http_res
|
|
161
|
+
)
|
|
162
|
+
raise errors.Forbidden(response_data, http_res)
|
|
163
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
164
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
165
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
166
|
+
request=req, response=http_res
|
|
167
|
+
)
|
|
168
|
+
raise errors.NotFound(response_data, http_res)
|
|
169
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
170
|
+
response_data = unmarshal_json_response(
|
|
171
|
+
errors.InternalServerErrorUnion, http_res
|
|
172
|
+
)
|
|
173
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
174
|
+
request=req, response=http_res
|
|
175
|
+
)
|
|
176
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
177
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
178
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
179
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
180
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
181
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
182
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
183
|
+
|
|
184
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
185
|
+
|
|
186
|
+
async def get_options_activity_async(
|
|
187
|
+
self,
|
|
188
|
+
*,
|
|
189
|
+
date_from: Optional[date] = None,
|
|
190
|
+
date_to: Optional[date] = None,
|
|
191
|
+
tickers: Optional[str] = None,
|
|
192
|
+
page: Optional[int] = None,
|
|
193
|
+
page_size: Optional[int] = None,
|
|
194
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
195
|
+
server_url: Optional[str] = None,
|
|
196
|
+
timeout_ms: Optional[int] = None,
|
|
197
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
198
|
+
) -> Optional[models.GetOptionsActivityResponse]:
|
|
199
|
+
r"""Get Options Activity
|
|
200
|
+
|
|
201
|
+
Retrieve unusual options activity including large block trades, high volume contracts, and significant changes in open interest.
|
|
202
|
+
|
|
203
|
+
If set, this operation will use `client_id` from the global security.
|
|
204
|
+
|
|
205
|
+
:param date_from: Start date for filtering options activity in YYYY-MM-DD format
|
|
206
|
+
:param date_to: End date for filtering options activity in YYYY-MM-DD format
|
|
207
|
+
:param tickers: Comma-separated list of ticker symbols to filter results
|
|
208
|
+
:param page: Page number for pagination (zero-based)
|
|
209
|
+
:param page_size: Number of results per page. Use this to control pagination size in list views. (default: 100, max: 1000)
|
|
210
|
+
:param retries: Override the default retry configuration for this method
|
|
211
|
+
:param server_url: Override the default server URL for this method
|
|
212
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
213
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
214
|
+
"""
|
|
215
|
+
base_url = None
|
|
216
|
+
url_variables = None
|
|
217
|
+
if timeout_ms is None:
|
|
218
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
219
|
+
|
|
220
|
+
if timeout_ms is None:
|
|
221
|
+
timeout_ms = 30000
|
|
222
|
+
|
|
223
|
+
if server_url is not None:
|
|
224
|
+
base_url = server_url
|
|
225
|
+
else:
|
|
226
|
+
base_url = self._get_url(base_url, url_variables)
|
|
227
|
+
|
|
228
|
+
request = models.GetOptionsActivityRequest(
|
|
229
|
+
date_from=date_from,
|
|
230
|
+
date_to=date_to,
|
|
231
|
+
tickers=tickers,
|
|
232
|
+
page=page,
|
|
233
|
+
page_size=page_size,
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
req = self._build_request_async(
|
|
237
|
+
method="GET",
|
|
238
|
+
path="/v1/options/activity",
|
|
239
|
+
base_url=base_url,
|
|
240
|
+
url_variables=url_variables,
|
|
241
|
+
request=request,
|
|
242
|
+
request_body_required=False,
|
|
243
|
+
request_has_path_params=False,
|
|
244
|
+
request_has_query_params=True,
|
|
245
|
+
user_agent_header="user-agent",
|
|
246
|
+
accept_header_value="application/json",
|
|
247
|
+
http_headers=http_headers,
|
|
248
|
+
security=self.sdk_configuration.security,
|
|
249
|
+
allow_empty_value=None,
|
|
250
|
+
allowed_fields=["client_id"],
|
|
251
|
+
timeout_ms=timeout_ms,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
if retries == UNSET:
|
|
255
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
256
|
+
retries = self.sdk_configuration.retry_config
|
|
257
|
+
else:
|
|
258
|
+
retries = utils.RetryConfig(
|
|
259
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
retry_config = None
|
|
263
|
+
if isinstance(retries, utils.RetryConfig):
|
|
264
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
265
|
+
|
|
266
|
+
http_res = await self.do_request_async(
|
|
267
|
+
hook_ctx=HookContext(
|
|
268
|
+
config=self.sdk_configuration,
|
|
269
|
+
base_url=base_url or "",
|
|
270
|
+
operation_id="getOptionsActivity",
|
|
271
|
+
oauth2_scopes=["market:supplemental"],
|
|
272
|
+
security_source=self.sdk_configuration.security,
|
|
273
|
+
tags=["Options"],
|
|
274
|
+
extensions=None,
|
|
275
|
+
),
|
|
276
|
+
request=req,
|
|
277
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
278
|
+
retry_config=retry_config,
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
def next_func() -> Optional[models.GetOptionsActivityResponse]:
|
|
282
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
283
|
+
page = request.page if isinstance(request.page, int) else 1
|
|
284
|
+
next_page = page + 1
|
|
285
|
+
|
|
286
|
+
if not http_res.text:
|
|
287
|
+
return None
|
|
288
|
+
results = JSONPath("$.activities").parse(body)
|
|
289
|
+
if len(results) == 0 or len(results[0]) == 0:
|
|
290
|
+
return None
|
|
291
|
+
limit_ = request.page_size if isinstance(request.page_size, int) else 0
|
|
292
|
+
if len(results[0]) < limit_:
|
|
293
|
+
return None
|
|
294
|
+
|
|
295
|
+
return self.get_options_activity(
|
|
296
|
+
date_from=date_from,
|
|
297
|
+
date_to=date_to,
|
|
298
|
+
tickers=tickers,
|
|
299
|
+
page=next_page,
|
|
300
|
+
page_size=page_size,
|
|
301
|
+
retries=retries,
|
|
302
|
+
server_url=server_url,
|
|
303
|
+
timeout_ms=timeout_ms,
|
|
304
|
+
http_headers=http_headers,
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
response_data: Any = None
|
|
308
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
309
|
+
return models.GetOptionsActivityResponse(
|
|
310
|
+
options_activity_response=unmarshal_json_response(
|
|
311
|
+
Optional[models.OptionsActivityResponse], http_res
|
|
312
|
+
),
|
|
313
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
314
|
+
next=next_func,
|
|
315
|
+
)
|
|
316
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
317
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
318
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
319
|
+
request=req, response=http_res
|
|
320
|
+
)
|
|
321
|
+
raise errors.BadRequest(response_data, http_res)
|
|
322
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
323
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
324
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
325
|
+
request=req, response=http_res
|
|
326
|
+
)
|
|
327
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
328
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
329
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
330
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
331
|
+
request=req, response=http_res
|
|
332
|
+
)
|
|
333
|
+
raise errors.Forbidden(response_data, http_res)
|
|
334
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
335
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
336
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
337
|
+
request=req, response=http_res
|
|
338
|
+
)
|
|
339
|
+
raise errors.NotFound(response_data, http_res)
|
|
340
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
341
|
+
response_data = unmarshal_json_response(
|
|
342
|
+
errors.InternalServerErrorUnion, http_res
|
|
343
|
+
)
|
|
344
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
345
|
+
request=req, response=http_res
|
|
346
|
+
)
|
|
347
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
348
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
349
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
350
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
351
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
352
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
353
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
354
|
+
|
|
355
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
356
|
+
|
|
357
|
+
def get_option_last_trade(
|
|
358
|
+
self,
|
|
359
|
+
*,
|
|
360
|
+
ticker: str,
|
|
361
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
362
|
+
server_url: Optional[str] = None,
|
|
363
|
+
timeout_ms: Optional[int] = None,
|
|
364
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
365
|
+
) -> models.GetOptionLastTradeResponse:
|
|
366
|
+
r"""Get Options Last Trade
|
|
367
|
+
|
|
368
|
+
Get the most recent trade for an options contract.
|
|
369
|
+
|
|
370
|
+
If set, this operation will use `client_id` from the global security.
|
|
371
|
+
|
|
372
|
+
:param ticker: Options contract ticker symbol. Enter the exact option symbol returned by option search or chain endpoints.
|
|
373
|
+
:param retries: Override the default retry configuration for this method
|
|
374
|
+
:param server_url: Override the default server URL for this method
|
|
375
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
376
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
377
|
+
"""
|
|
378
|
+
base_url = None
|
|
379
|
+
url_variables = None
|
|
380
|
+
if timeout_ms is None:
|
|
381
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
382
|
+
|
|
383
|
+
if timeout_ms is None:
|
|
384
|
+
timeout_ms = 30000
|
|
385
|
+
|
|
386
|
+
if server_url is not None:
|
|
387
|
+
base_url = server_url
|
|
388
|
+
else:
|
|
389
|
+
base_url = self._get_url(base_url, url_variables)
|
|
390
|
+
|
|
391
|
+
request = models.GetOptionLastTradeRequest(
|
|
392
|
+
ticker=ticker,
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
req = self._build_request(
|
|
396
|
+
method="GET",
|
|
397
|
+
path="/v1/options/last-trade",
|
|
398
|
+
base_url=base_url,
|
|
399
|
+
url_variables=url_variables,
|
|
400
|
+
request=request,
|
|
401
|
+
request_body_required=False,
|
|
402
|
+
request_has_path_params=False,
|
|
403
|
+
request_has_query_params=True,
|
|
404
|
+
user_agent_header="user-agent",
|
|
405
|
+
accept_header_value="application/json",
|
|
406
|
+
http_headers=http_headers,
|
|
407
|
+
security=self.sdk_configuration.security,
|
|
408
|
+
allow_empty_value=None,
|
|
409
|
+
allowed_fields=["client_id"],
|
|
410
|
+
timeout_ms=timeout_ms,
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
if retries == UNSET:
|
|
414
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
415
|
+
retries = self.sdk_configuration.retry_config
|
|
416
|
+
else:
|
|
417
|
+
retries = utils.RetryConfig(
|
|
418
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
retry_config = None
|
|
422
|
+
if isinstance(retries, utils.RetryConfig):
|
|
423
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
424
|
+
|
|
425
|
+
http_res = self.do_request(
|
|
426
|
+
hook_ctx=HookContext(
|
|
427
|
+
config=self.sdk_configuration,
|
|
428
|
+
base_url=base_url or "",
|
|
429
|
+
operation_id="getOptionLastTrade",
|
|
430
|
+
oauth2_scopes=["market:supplemental"],
|
|
431
|
+
security_source=self.sdk_configuration.security,
|
|
432
|
+
tags=["Options"],
|
|
433
|
+
extensions=None,
|
|
434
|
+
),
|
|
435
|
+
request=req,
|
|
436
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
437
|
+
retry_config=retry_config,
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
response_data: Any = None
|
|
441
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
442
|
+
return models.GetOptionLastTradeResponse(
|
|
443
|
+
option_last_trade_response=unmarshal_json_response(
|
|
444
|
+
Optional[models.OptionLastTradeResponse], http_res
|
|
445
|
+
),
|
|
446
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
447
|
+
)
|
|
448
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
449
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
450
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
451
|
+
request=req, response=http_res
|
|
452
|
+
)
|
|
453
|
+
raise errors.BadRequest(response_data, http_res)
|
|
454
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
455
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
456
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
457
|
+
request=req, response=http_res
|
|
458
|
+
)
|
|
459
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
460
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
461
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
462
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
463
|
+
request=req, response=http_res
|
|
464
|
+
)
|
|
465
|
+
raise errors.Forbidden(response_data, http_res)
|
|
466
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
467
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
468
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
469
|
+
request=req, response=http_res
|
|
470
|
+
)
|
|
471
|
+
raise errors.NotFound(response_data, http_res)
|
|
472
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
473
|
+
response_data = unmarshal_json_response(
|
|
474
|
+
errors.InternalServerErrorUnion, http_res
|
|
475
|
+
)
|
|
476
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
477
|
+
request=req, response=http_res
|
|
478
|
+
)
|
|
479
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
480
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
481
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
482
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
483
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
484
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
485
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
486
|
+
|
|
487
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
488
|
+
|
|
489
|
+
async def get_option_last_trade_async(
|
|
490
|
+
self,
|
|
491
|
+
*,
|
|
492
|
+
ticker: str,
|
|
493
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
494
|
+
server_url: Optional[str] = None,
|
|
495
|
+
timeout_ms: Optional[int] = None,
|
|
496
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
497
|
+
) -> models.GetOptionLastTradeResponse:
|
|
498
|
+
r"""Get Options Last Trade
|
|
499
|
+
|
|
500
|
+
Get the most recent trade for an options contract.
|
|
501
|
+
|
|
502
|
+
If set, this operation will use `client_id` from the global security.
|
|
503
|
+
|
|
504
|
+
:param ticker: Options contract ticker symbol. Enter the exact option symbol returned by option search or chain endpoints.
|
|
505
|
+
:param retries: Override the default retry configuration for this method
|
|
506
|
+
:param server_url: Override the default server URL for this method
|
|
507
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
508
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
509
|
+
"""
|
|
510
|
+
base_url = None
|
|
511
|
+
url_variables = None
|
|
512
|
+
if timeout_ms is None:
|
|
513
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
514
|
+
|
|
515
|
+
if timeout_ms is None:
|
|
516
|
+
timeout_ms = 30000
|
|
517
|
+
|
|
518
|
+
if server_url is not None:
|
|
519
|
+
base_url = server_url
|
|
520
|
+
else:
|
|
521
|
+
base_url = self._get_url(base_url, url_variables)
|
|
522
|
+
|
|
523
|
+
request = models.GetOptionLastTradeRequest(
|
|
524
|
+
ticker=ticker,
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
req = self._build_request_async(
|
|
528
|
+
method="GET",
|
|
529
|
+
path="/v1/options/last-trade",
|
|
530
|
+
base_url=base_url,
|
|
531
|
+
url_variables=url_variables,
|
|
532
|
+
request=request,
|
|
533
|
+
request_body_required=False,
|
|
534
|
+
request_has_path_params=False,
|
|
535
|
+
request_has_query_params=True,
|
|
536
|
+
user_agent_header="user-agent",
|
|
537
|
+
accept_header_value="application/json",
|
|
538
|
+
http_headers=http_headers,
|
|
539
|
+
security=self.sdk_configuration.security,
|
|
540
|
+
allow_empty_value=None,
|
|
541
|
+
allowed_fields=["client_id"],
|
|
542
|
+
timeout_ms=timeout_ms,
|
|
543
|
+
)
|
|
544
|
+
|
|
545
|
+
if retries == UNSET:
|
|
546
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
547
|
+
retries = self.sdk_configuration.retry_config
|
|
548
|
+
else:
|
|
549
|
+
retries = utils.RetryConfig(
|
|
550
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
retry_config = None
|
|
554
|
+
if isinstance(retries, utils.RetryConfig):
|
|
555
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
556
|
+
|
|
557
|
+
http_res = await self.do_request_async(
|
|
558
|
+
hook_ctx=HookContext(
|
|
559
|
+
config=self.sdk_configuration,
|
|
560
|
+
base_url=base_url or "",
|
|
561
|
+
operation_id="getOptionLastTrade",
|
|
562
|
+
oauth2_scopes=["market:supplemental"],
|
|
563
|
+
security_source=self.sdk_configuration.security,
|
|
564
|
+
tags=["Options"],
|
|
565
|
+
extensions=None,
|
|
566
|
+
),
|
|
567
|
+
request=req,
|
|
568
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
569
|
+
retry_config=retry_config,
|
|
570
|
+
)
|
|
571
|
+
|
|
572
|
+
response_data: Any = None
|
|
573
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
574
|
+
return models.GetOptionLastTradeResponse(
|
|
575
|
+
option_last_trade_response=unmarshal_json_response(
|
|
576
|
+
Optional[models.OptionLastTradeResponse], http_res
|
|
577
|
+
),
|
|
578
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
579
|
+
)
|
|
580
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
581
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
582
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
583
|
+
request=req, response=http_res
|
|
584
|
+
)
|
|
585
|
+
raise errors.BadRequest(response_data, http_res)
|
|
586
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
587
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
588
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
589
|
+
request=req, response=http_res
|
|
590
|
+
)
|
|
591
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
592
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
593
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
594
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
595
|
+
request=req, response=http_res
|
|
596
|
+
)
|
|
597
|
+
raise errors.Forbidden(response_data, http_res)
|
|
598
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
599
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
600
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
601
|
+
request=req, response=http_res
|
|
602
|
+
)
|
|
603
|
+
raise errors.NotFound(response_data, http_res)
|
|
604
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
605
|
+
response_data = unmarshal_json_response(
|
|
606
|
+
errors.InternalServerErrorUnion, http_res
|
|
607
|
+
)
|
|
608
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
609
|
+
request=req, response=http_res
|
|
610
|
+
)
|
|
611
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
612
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
613
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
614
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
615
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
616
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
617
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
618
|
+
|
|
619
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
620
|
+
|
|
621
|
+
def get_option_open_close(
|
|
622
|
+
self,
|
|
623
|
+
*,
|
|
624
|
+
ticker: str,
|
|
625
|
+
date_: date,
|
|
626
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
627
|
+
server_url: Optional[str] = None,
|
|
628
|
+
timeout_ms: Optional[int] = None,
|
|
629
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
630
|
+
) -> models.GetOptionOpenCloseResponse:
|
|
631
|
+
r"""Get Option Open/Close Data
|
|
632
|
+
|
|
633
|
+
Retrieve option contract opening and closing prices with intraday trading ranges for specific option contracts.
|
|
634
|
+
|
|
635
|
+
If set, this operation will use `client_id` from the global security.
|
|
636
|
+
|
|
637
|
+
:param ticker: OCC option ticker symbol (e.g., O:AAPL251219C00150000)
|
|
638
|
+
:param date_: Date in YYYY-MM-DD format. Enter the specific calendar date you want to query.
|
|
639
|
+
:param retries: Override the default retry configuration for this method
|
|
640
|
+
:param server_url: Override the default server URL for this method
|
|
641
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
642
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
643
|
+
"""
|
|
644
|
+
base_url = None
|
|
645
|
+
url_variables = None
|
|
646
|
+
if timeout_ms is None:
|
|
647
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
648
|
+
|
|
649
|
+
if timeout_ms is None:
|
|
650
|
+
timeout_ms = 30000
|
|
651
|
+
|
|
652
|
+
if server_url is not None:
|
|
653
|
+
base_url = server_url
|
|
654
|
+
else:
|
|
655
|
+
base_url = self._get_url(base_url, url_variables)
|
|
656
|
+
|
|
657
|
+
request = models.GetOptionOpenCloseRequest(
|
|
658
|
+
ticker=ticker,
|
|
659
|
+
date_=date_,
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
req = self._build_request(
|
|
663
|
+
method="GET",
|
|
664
|
+
path="/v1/options/open-close",
|
|
665
|
+
base_url=base_url,
|
|
666
|
+
url_variables=url_variables,
|
|
667
|
+
request=request,
|
|
668
|
+
request_body_required=False,
|
|
669
|
+
request_has_path_params=False,
|
|
670
|
+
request_has_query_params=True,
|
|
671
|
+
user_agent_header="user-agent",
|
|
672
|
+
accept_header_value="application/json",
|
|
673
|
+
http_headers=http_headers,
|
|
674
|
+
security=self.sdk_configuration.security,
|
|
675
|
+
allow_empty_value=None,
|
|
676
|
+
allowed_fields=["client_id"],
|
|
677
|
+
timeout_ms=timeout_ms,
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
if retries == UNSET:
|
|
681
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
682
|
+
retries = self.sdk_configuration.retry_config
|
|
683
|
+
else:
|
|
684
|
+
retries = utils.RetryConfig(
|
|
685
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
686
|
+
)
|
|
687
|
+
|
|
688
|
+
retry_config = None
|
|
689
|
+
if isinstance(retries, utils.RetryConfig):
|
|
690
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
691
|
+
|
|
692
|
+
http_res = self.do_request(
|
|
693
|
+
hook_ctx=HookContext(
|
|
694
|
+
config=self.sdk_configuration,
|
|
695
|
+
base_url=base_url or "",
|
|
696
|
+
operation_id="getOptionOpenClose",
|
|
697
|
+
oauth2_scopes=["market:supplemental"],
|
|
698
|
+
security_source=self.sdk_configuration.security,
|
|
699
|
+
tags=["Options"],
|
|
700
|
+
extensions=None,
|
|
701
|
+
),
|
|
702
|
+
request=req,
|
|
703
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
704
|
+
retry_config=retry_config,
|
|
705
|
+
)
|
|
706
|
+
|
|
707
|
+
response_data: Any = None
|
|
708
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
709
|
+
return models.GetOptionOpenCloseResponse(
|
|
710
|
+
option_open_close_response=unmarshal_json_response(
|
|
711
|
+
Optional[models.OptionOpenCloseResponse], http_res
|
|
712
|
+
),
|
|
713
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
714
|
+
)
|
|
715
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
716
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
717
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
718
|
+
request=req, response=http_res
|
|
719
|
+
)
|
|
720
|
+
raise errors.BadRequest(response_data, http_res)
|
|
721
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
722
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
723
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
724
|
+
request=req, response=http_res
|
|
725
|
+
)
|
|
726
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
727
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
728
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
729
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
730
|
+
request=req, response=http_res
|
|
731
|
+
)
|
|
732
|
+
raise errors.Forbidden(response_data, http_res)
|
|
733
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
734
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
735
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
736
|
+
request=req, response=http_res
|
|
737
|
+
)
|
|
738
|
+
raise errors.NotFound(response_data, http_res)
|
|
739
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
740
|
+
response_data = unmarshal_json_response(
|
|
741
|
+
errors.InternalServerErrorUnion, http_res
|
|
742
|
+
)
|
|
743
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
744
|
+
request=req, response=http_res
|
|
745
|
+
)
|
|
746
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
747
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
748
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
749
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
750
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
751
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
752
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
753
|
+
|
|
754
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
755
|
+
|
|
756
|
+
async def get_option_open_close_async(
|
|
757
|
+
self,
|
|
758
|
+
*,
|
|
759
|
+
ticker: str,
|
|
760
|
+
date_: date,
|
|
761
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
762
|
+
server_url: Optional[str] = None,
|
|
763
|
+
timeout_ms: Optional[int] = None,
|
|
764
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
765
|
+
) -> models.GetOptionOpenCloseResponse:
|
|
766
|
+
r"""Get Option Open/Close Data
|
|
767
|
+
|
|
768
|
+
Retrieve option contract opening and closing prices with intraday trading ranges for specific option contracts.
|
|
769
|
+
|
|
770
|
+
If set, this operation will use `client_id` from the global security.
|
|
771
|
+
|
|
772
|
+
:param ticker: OCC option ticker symbol (e.g., O:AAPL251219C00150000)
|
|
773
|
+
:param date_: Date in YYYY-MM-DD format. Enter the specific calendar date you want to query.
|
|
774
|
+
:param retries: Override the default retry configuration for this method
|
|
775
|
+
:param server_url: Override the default server URL for this method
|
|
776
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
777
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
778
|
+
"""
|
|
779
|
+
base_url = None
|
|
780
|
+
url_variables = None
|
|
781
|
+
if timeout_ms is None:
|
|
782
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
783
|
+
|
|
784
|
+
if timeout_ms is None:
|
|
785
|
+
timeout_ms = 30000
|
|
786
|
+
|
|
787
|
+
if server_url is not None:
|
|
788
|
+
base_url = server_url
|
|
789
|
+
else:
|
|
790
|
+
base_url = self._get_url(base_url, url_variables)
|
|
791
|
+
|
|
792
|
+
request = models.GetOptionOpenCloseRequest(
|
|
793
|
+
ticker=ticker,
|
|
794
|
+
date_=date_,
|
|
795
|
+
)
|
|
796
|
+
|
|
797
|
+
req = self._build_request_async(
|
|
798
|
+
method="GET",
|
|
799
|
+
path="/v1/options/open-close",
|
|
800
|
+
base_url=base_url,
|
|
801
|
+
url_variables=url_variables,
|
|
802
|
+
request=request,
|
|
803
|
+
request_body_required=False,
|
|
804
|
+
request_has_path_params=False,
|
|
805
|
+
request_has_query_params=True,
|
|
806
|
+
user_agent_header="user-agent",
|
|
807
|
+
accept_header_value="application/json",
|
|
808
|
+
http_headers=http_headers,
|
|
809
|
+
security=self.sdk_configuration.security,
|
|
810
|
+
allow_empty_value=None,
|
|
811
|
+
allowed_fields=["client_id"],
|
|
812
|
+
timeout_ms=timeout_ms,
|
|
813
|
+
)
|
|
814
|
+
|
|
815
|
+
if retries == UNSET:
|
|
816
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
817
|
+
retries = self.sdk_configuration.retry_config
|
|
818
|
+
else:
|
|
819
|
+
retries = utils.RetryConfig(
|
|
820
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
821
|
+
)
|
|
822
|
+
|
|
823
|
+
retry_config = None
|
|
824
|
+
if isinstance(retries, utils.RetryConfig):
|
|
825
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
826
|
+
|
|
827
|
+
http_res = await self.do_request_async(
|
|
828
|
+
hook_ctx=HookContext(
|
|
829
|
+
config=self.sdk_configuration,
|
|
830
|
+
base_url=base_url or "",
|
|
831
|
+
operation_id="getOptionOpenClose",
|
|
832
|
+
oauth2_scopes=["market:supplemental"],
|
|
833
|
+
security_source=self.sdk_configuration.security,
|
|
834
|
+
tags=["Options"],
|
|
835
|
+
extensions=None,
|
|
836
|
+
),
|
|
837
|
+
request=req,
|
|
838
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
839
|
+
retry_config=retry_config,
|
|
840
|
+
)
|
|
841
|
+
|
|
842
|
+
response_data: Any = None
|
|
843
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
844
|
+
return models.GetOptionOpenCloseResponse(
|
|
845
|
+
option_open_close_response=unmarshal_json_response(
|
|
846
|
+
Optional[models.OptionOpenCloseResponse], http_res
|
|
847
|
+
),
|
|
848
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
849
|
+
)
|
|
850
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
851
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
852
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
853
|
+
request=req, response=http_res
|
|
854
|
+
)
|
|
855
|
+
raise errors.BadRequest(response_data, http_res)
|
|
856
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
857
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
858
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
859
|
+
request=req, response=http_res
|
|
860
|
+
)
|
|
861
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
862
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
863
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
864
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
865
|
+
request=req, response=http_res
|
|
866
|
+
)
|
|
867
|
+
raise errors.Forbidden(response_data, http_res)
|
|
868
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
869
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
870
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
871
|
+
request=req, response=http_res
|
|
872
|
+
)
|
|
873
|
+
raise errors.NotFound(response_data, http_res)
|
|
874
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
875
|
+
response_data = unmarshal_json_response(
|
|
876
|
+
errors.InternalServerErrorUnion, http_res
|
|
877
|
+
)
|
|
878
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
879
|
+
request=req, response=http_res
|
|
880
|
+
)
|
|
881
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
882
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
883
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
884
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
885
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
886
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
887
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
888
|
+
|
|
889
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
890
|
+
|
|
891
|
+
def get_option_previous_day(
|
|
892
|
+
self,
|
|
893
|
+
*,
|
|
894
|
+
ticker: str,
|
|
895
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
896
|
+
server_url: Optional[str] = None,
|
|
897
|
+
timeout_ms: Optional[int] = None,
|
|
898
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
899
|
+
) -> models.GetOptionPreviousDayResponse:
|
|
900
|
+
r"""Get Previous Day Option Data
|
|
901
|
+
|
|
902
|
+
Retrieve the previous trading day's OHLC bar (open, high, low, close), volume, volume-weighted average price (VWAP), bar timestamp, and trade count for a single option contract. Useful for change-vs-yesterday comparisons, daily charts, and volatility/volume baselines.
|
|
903
|
+
|
|
904
|
+
If set, this operation will use `client_id` from the global security.
|
|
905
|
+
|
|
906
|
+
:param ticker: Option contract identifier in OCC/OSI format. The 21-character form is `ROOT + YYMMDD + C/P + strike-in-cents` (e.g. `AAPL251219C00150000` = AAPL Dec-19-2025 $150 Call). The optional `O:` prefix is accepted and stripped (so `O:AAPL251219C00150000` works too).
|
|
907
|
+
:param retries: Override the default retry configuration for this method
|
|
908
|
+
:param server_url: Override the default server URL for this method
|
|
909
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
910
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
911
|
+
"""
|
|
912
|
+
base_url = None
|
|
913
|
+
url_variables = None
|
|
914
|
+
if timeout_ms is None:
|
|
915
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
916
|
+
|
|
917
|
+
if timeout_ms is None:
|
|
918
|
+
timeout_ms = 30000
|
|
919
|
+
|
|
920
|
+
if server_url is not None:
|
|
921
|
+
base_url = server_url
|
|
922
|
+
else:
|
|
923
|
+
base_url = self._get_url(base_url, url_variables)
|
|
924
|
+
|
|
925
|
+
request = models.GetOptionPreviousDayRequest(
|
|
926
|
+
ticker=ticker,
|
|
927
|
+
)
|
|
928
|
+
|
|
929
|
+
req = self._build_request(
|
|
930
|
+
method="GET",
|
|
931
|
+
path="/v1/options/previous-day",
|
|
932
|
+
base_url=base_url,
|
|
933
|
+
url_variables=url_variables,
|
|
934
|
+
request=request,
|
|
935
|
+
request_body_required=False,
|
|
936
|
+
request_has_path_params=False,
|
|
937
|
+
request_has_query_params=True,
|
|
938
|
+
user_agent_header="user-agent",
|
|
939
|
+
accept_header_value="application/json",
|
|
940
|
+
http_headers=http_headers,
|
|
941
|
+
security=self.sdk_configuration.security,
|
|
942
|
+
allow_empty_value=None,
|
|
943
|
+
allowed_fields=["client_id"],
|
|
944
|
+
timeout_ms=timeout_ms,
|
|
945
|
+
)
|
|
946
|
+
|
|
947
|
+
if retries == UNSET:
|
|
948
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
949
|
+
retries = self.sdk_configuration.retry_config
|
|
950
|
+
else:
|
|
951
|
+
retries = utils.RetryConfig(
|
|
952
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
953
|
+
)
|
|
954
|
+
|
|
955
|
+
retry_config = None
|
|
956
|
+
if isinstance(retries, utils.RetryConfig):
|
|
957
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
958
|
+
|
|
959
|
+
http_res = self.do_request(
|
|
960
|
+
hook_ctx=HookContext(
|
|
961
|
+
config=self.sdk_configuration,
|
|
962
|
+
base_url=base_url or "",
|
|
963
|
+
operation_id="getOptionPreviousDay",
|
|
964
|
+
oauth2_scopes=["market:supplemental"],
|
|
965
|
+
security_source=self.sdk_configuration.security,
|
|
966
|
+
tags=["Options"],
|
|
967
|
+
extensions=None,
|
|
968
|
+
),
|
|
969
|
+
request=req,
|
|
970
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
971
|
+
retry_config=retry_config,
|
|
972
|
+
)
|
|
973
|
+
|
|
974
|
+
response_data: Any = None
|
|
975
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
976
|
+
return models.GetOptionPreviousDayResponse(
|
|
977
|
+
option_previous_day_response=unmarshal_json_response(
|
|
978
|
+
Optional[models.OptionPreviousDayResponse], http_res
|
|
979
|
+
),
|
|
980
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
981
|
+
)
|
|
982
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
983
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
984
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
985
|
+
request=req, response=http_res
|
|
986
|
+
)
|
|
987
|
+
raise errors.BadRequest(response_data, http_res)
|
|
988
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
989
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
990
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
991
|
+
request=req, response=http_res
|
|
992
|
+
)
|
|
993
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
994
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
995
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
996
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
997
|
+
request=req, response=http_res
|
|
998
|
+
)
|
|
999
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1000
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
1001
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
1002
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1003
|
+
request=req, response=http_res
|
|
1004
|
+
)
|
|
1005
|
+
raise errors.NotFound(response_data, http_res)
|
|
1006
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
1007
|
+
response_data = unmarshal_json_response(
|
|
1008
|
+
errors.InternalServerErrorUnion, http_res
|
|
1009
|
+
)
|
|
1010
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1011
|
+
request=req, response=http_res
|
|
1012
|
+
)
|
|
1013
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1014
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1015
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1016
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1017
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1018
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1019
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1020
|
+
|
|
1021
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1022
|
+
|
|
1023
|
+
async def get_option_previous_day_async(
|
|
1024
|
+
self,
|
|
1025
|
+
*,
|
|
1026
|
+
ticker: str,
|
|
1027
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1028
|
+
server_url: Optional[str] = None,
|
|
1029
|
+
timeout_ms: Optional[int] = None,
|
|
1030
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1031
|
+
) -> models.GetOptionPreviousDayResponse:
|
|
1032
|
+
r"""Get Previous Day Option Data
|
|
1033
|
+
|
|
1034
|
+
Retrieve the previous trading day's OHLC bar (open, high, low, close), volume, volume-weighted average price (VWAP), bar timestamp, and trade count for a single option contract. Useful for change-vs-yesterday comparisons, daily charts, and volatility/volume baselines.
|
|
1035
|
+
|
|
1036
|
+
If set, this operation will use `client_id` from the global security.
|
|
1037
|
+
|
|
1038
|
+
:param ticker: Option contract identifier in OCC/OSI format. The 21-character form is `ROOT + YYMMDD + C/P + strike-in-cents` (e.g. `AAPL251219C00150000` = AAPL Dec-19-2025 $150 Call). The optional `O:` prefix is accepted and stripped (so `O:AAPL251219C00150000` works too).
|
|
1039
|
+
:param retries: Override the default retry configuration for this method
|
|
1040
|
+
:param server_url: Override the default server URL for this method
|
|
1041
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1042
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1043
|
+
"""
|
|
1044
|
+
base_url = None
|
|
1045
|
+
url_variables = None
|
|
1046
|
+
if timeout_ms is None:
|
|
1047
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1048
|
+
|
|
1049
|
+
if timeout_ms is None:
|
|
1050
|
+
timeout_ms = 30000
|
|
1051
|
+
|
|
1052
|
+
if server_url is not None:
|
|
1053
|
+
base_url = server_url
|
|
1054
|
+
else:
|
|
1055
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1056
|
+
|
|
1057
|
+
request = models.GetOptionPreviousDayRequest(
|
|
1058
|
+
ticker=ticker,
|
|
1059
|
+
)
|
|
1060
|
+
|
|
1061
|
+
req = self._build_request_async(
|
|
1062
|
+
method="GET",
|
|
1063
|
+
path="/v1/options/previous-day",
|
|
1064
|
+
base_url=base_url,
|
|
1065
|
+
url_variables=url_variables,
|
|
1066
|
+
request=request,
|
|
1067
|
+
request_body_required=False,
|
|
1068
|
+
request_has_path_params=False,
|
|
1069
|
+
request_has_query_params=True,
|
|
1070
|
+
user_agent_header="user-agent",
|
|
1071
|
+
accept_header_value="application/json",
|
|
1072
|
+
http_headers=http_headers,
|
|
1073
|
+
security=self.sdk_configuration.security,
|
|
1074
|
+
allow_empty_value=None,
|
|
1075
|
+
allowed_fields=["client_id"],
|
|
1076
|
+
timeout_ms=timeout_ms,
|
|
1077
|
+
)
|
|
1078
|
+
|
|
1079
|
+
if retries == UNSET:
|
|
1080
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1081
|
+
retries = self.sdk_configuration.retry_config
|
|
1082
|
+
else:
|
|
1083
|
+
retries = utils.RetryConfig(
|
|
1084
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
1085
|
+
)
|
|
1086
|
+
|
|
1087
|
+
retry_config = None
|
|
1088
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1089
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1090
|
+
|
|
1091
|
+
http_res = await self.do_request_async(
|
|
1092
|
+
hook_ctx=HookContext(
|
|
1093
|
+
config=self.sdk_configuration,
|
|
1094
|
+
base_url=base_url or "",
|
|
1095
|
+
operation_id="getOptionPreviousDay",
|
|
1096
|
+
oauth2_scopes=["market:supplemental"],
|
|
1097
|
+
security_source=self.sdk_configuration.security,
|
|
1098
|
+
tags=["Options"],
|
|
1099
|
+
extensions=None,
|
|
1100
|
+
),
|
|
1101
|
+
request=req,
|
|
1102
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
1103
|
+
retry_config=retry_config,
|
|
1104
|
+
)
|
|
1105
|
+
|
|
1106
|
+
response_data: Any = None
|
|
1107
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1108
|
+
return models.GetOptionPreviousDayResponse(
|
|
1109
|
+
option_previous_day_response=unmarshal_json_response(
|
|
1110
|
+
Optional[models.OptionPreviousDayResponse], http_res
|
|
1111
|
+
),
|
|
1112
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
1113
|
+
)
|
|
1114
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
1115
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
1116
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1117
|
+
request=req, response=http_res
|
|
1118
|
+
)
|
|
1119
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1120
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
1121
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
1122
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1123
|
+
request=req, response=http_res
|
|
1124
|
+
)
|
|
1125
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1126
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
1127
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
1128
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1129
|
+
request=req, response=http_res
|
|
1130
|
+
)
|
|
1131
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1132
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
1133
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
1134
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1135
|
+
request=req, response=http_res
|
|
1136
|
+
)
|
|
1137
|
+
raise errors.NotFound(response_data, http_res)
|
|
1138
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
1139
|
+
response_data = unmarshal_json_response(
|
|
1140
|
+
errors.InternalServerErrorUnion, http_res
|
|
1141
|
+
)
|
|
1142
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1143
|
+
request=req, response=http_res
|
|
1144
|
+
)
|
|
1145
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1146
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1147
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1148
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1149
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1150
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1151
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1152
|
+
|
|
1153
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1154
|
+
|
|
1155
|
+
def get_option_quotes(
|
|
1156
|
+
self,
|
|
1157
|
+
*,
|
|
1158
|
+
ticker: str,
|
|
1159
|
+
timestamp: Optional[str] = None,
|
|
1160
|
+
timestamp_from: Optional[str] = None,
|
|
1161
|
+
timestamp_after: Optional[str] = None,
|
|
1162
|
+
timestamp_to: Optional[str] = None,
|
|
1163
|
+
timestamp_before: Optional[str] = None,
|
|
1164
|
+
order: Optional[models.GetOptionQuotesOrder] = models.GetOptionQuotesOrder.DESC,
|
|
1165
|
+
limit: Optional[int] = None,
|
|
1166
|
+
sort: Optional[str] = None,
|
|
1167
|
+
next: Optional[str] = None,
|
|
1168
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1169
|
+
server_url: Optional[str] = None,
|
|
1170
|
+
url_override: Optional[str] = None,
|
|
1171
|
+
timeout_ms: Optional[int] = None,
|
|
1172
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1173
|
+
) -> Optional[models.GetOptionQuotesResponse]:
|
|
1174
|
+
r"""Get Options Quotes
|
|
1175
|
+
|
|
1176
|
+
Get quote data for options contracts including bid, ask, and Greeks.
|
|
1177
|
+
|
|
1178
|
+
If set, this operation will use `client_id` from the global security.
|
|
1179
|
+
|
|
1180
|
+
:param ticker: Options contract ticker symbol. Enter the exact option symbol returned by option search or chain endpoints.
|
|
1181
|
+
:param timestamp: Query by timestamp (YYYY-MM-DD or nanoseconds)
|
|
1182
|
+
:param timestamp_from: Timestamp start filter. Returns records at or after this timestamp.
|
|
1183
|
+
:param timestamp_after: Timestamp lower-bound filter. Returns records after this timestamp, excluding the timestamp itself.
|
|
1184
|
+
:param timestamp_to: Timestamp end filter. Returns records at or before this timestamp.
|
|
1185
|
+
:param timestamp_before: Timestamp upper-bound filter. Returns records before this timestamp, excluding the timestamp itself.
|
|
1186
|
+
:param order: Sort order for returned records. Use asc for oldest first or desc for newest first when supported.
|
|
1187
|
+
:param limit: Maximum number of results to return. Use smaller values for UI pages and larger values for exports within API limits.
|
|
1188
|
+
:param sort: Sort field used for ordering. Massive documents this separately from `order`, so enter the provider-supported field name in the text box, for example `timestamp`.
|
|
1189
|
+
:param next: Pagination cursor from the previous response. Omit it on the first request, then send the returned cursor to fetch the next page.
|
|
1190
|
+
:param retries: Override the default retry configuration for this method
|
|
1191
|
+
:param server_url: Override the default server URL for this method
|
|
1192
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1193
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1194
|
+
"""
|
|
1195
|
+
base_url = None
|
|
1196
|
+
url_variables = None
|
|
1197
|
+
if timeout_ms is None:
|
|
1198
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1199
|
+
|
|
1200
|
+
if timeout_ms is None:
|
|
1201
|
+
timeout_ms = 30000
|
|
1202
|
+
|
|
1203
|
+
if server_url is not None:
|
|
1204
|
+
base_url = server_url
|
|
1205
|
+
else:
|
|
1206
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1207
|
+
|
|
1208
|
+
request = models.GetOptionQuotesRequest(
|
|
1209
|
+
ticker=ticker,
|
|
1210
|
+
timestamp=timestamp,
|
|
1211
|
+
timestamp_from=timestamp_from,
|
|
1212
|
+
timestamp_after=timestamp_after,
|
|
1213
|
+
timestamp_to=timestamp_to,
|
|
1214
|
+
timestamp_before=timestamp_before,
|
|
1215
|
+
order=order,
|
|
1216
|
+
limit=limit,
|
|
1217
|
+
sort=sort,
|
|
1218
|
+
next=next,
|
|
1219
|
+
)
|
|
1220
|
+
|
|
1221
|
+
req = self._build_request(
|
|
1222
|
+
method="GET",
|
|
1223
|
+
path="/v1/options/quotes",
|
|
1224
|
+
base_url=base_url,
|
|
1225
|
+
url_variables=url_variables,
|
|
1226
|
+
url_override=url_override,
|
|
1227
|
+
request=request,
|
|
1228
|
+
request_body_required=False,
|
|
1229
|
+
request_has_path_params=False,
|
|
1230
|
+
request_has_query_params=True,
|
|
1231
|
+
user_agent_header="user-agent",
|
|
1232
|
+
accept_header_value="application/json",
|
|
1233
|
+
http_headers=http_headers,
|
|
1234
|
+
security=self.sdk_configuration.security,
|
|
1235
|
+
allow_empty_value=None,
|
|
1236
|
+
allowed_fields=["client_id"],
|
|
1237
|
+
timeout_ms=timeout_ms,
|
|
1238
|
+
)
|
|
1239
|
+
|
|
1240
|
+
if retries == UNSET:
|
|
1241
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1242
|
+
retries = self.sdk_configuration.retry_config
|
|
1243
|
+
else:
|
|
1244
|
+
retries = utils.RetryConfig(
|
|
1245
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
1246
|
+
)
|
|
1247
|
+
|
|
1248
|
+
retry_config = None
|
|
1249
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1250
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1251
|
+
|
|
1252
|
+
http_res = self.do_request(
|
|
1253
|
+
hook_ctx=HookContext(
|
|
1254
|
+
config=self.sdk_configuration,
|
|
1255
|
+
base_url=base_url or "",
|
|
1256
|
+
operation_id="getOptionQuotes",
|
|
1257
|
+
oauth2_scopes=["market:supplemental"],
|
|
1258
|
+
security_source=self.sdk_configuration.security,
|
|
1259
|
+
tags=["Options"],
|
|
1260
|
+
extensions=None,
|
|
1261
|
+
),
|
|
1262
|
+
request=req,
|
|
1263
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
1264
|
+
retry_config=retry_config,
|
|
1265
|
+
)
|
|
1266
|
+
|
|
1267
|
+
def next_func() -> Optional[models.GetOptionQuotesResponse]:
|
|
1268
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
1269
|
+
next_url_match = JSONPath("$.nextUrl").parse(body)
|
|
1270
|
+
if len(next_url_match) == 0:
|
|
1271
|
+
return None
|
|
1272
|
+
|
|
1273
|
+
next_url = next_url_match[0]
|
|
1274
|
+
if not next_url:
|
|
1275
|
+
return None
|
|
1276
|
+
|
|
1277
|
+
if next_url[0] == "/":
|
|
1278
|
+
url = self._get_url(base_url, url_variables)
|
|
1279
|
+
next_url = url + next_url
|
|
1280
|
+
|
|
1281
|
+
return self.get_option_quotes(
|
|
1282
|
+
ticker=ticker,
|
|
1283
|
+
timestamp=timestamp,
|
|
1284
|
+
timestamp_from=timestamp_from,
|
|
1285
|
+
timestamp_after=timestamp_after,
|
|
1286
|
+
timestamp_to=timestamp_to,
|
|
1287
|
+
timestamp_before=timestamp_before,
|
|
1288
|
+
order=order,
|
|
1289
|
+
limit=limit,
|
|
1290
|
+
sort=sort,
|
|
1291
|
+
next=next,
|
|
1292
|
+
retries=retries,
|
|
1293
|
+
server_url=server_url,
|
|
1294
|
+
timeout_ms=timeout_ms,
|
|
1295
|
+
http_headers=http_headers,
|
|
1296
|
+
url_override=next_url,
|
|
1297
|
+
)
|
|
1298
|
+
|
|
1299
|
+
response_data: Any = None
|
|
1300
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1301
|
+
return models.GetOptionQuotesResponse(
|
|
1302
|
+
option_quotes_response=unmarshal_json_response(
|
|
1303
|
+
Optional[models.OptionQuotesResponse], http_res
|
|
1304
|
+
),
|
|
1305
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
1306
|
+
next=next_func,
|
|
1307
|
+
)
|
|
1308
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
1309
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
1310
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1311
|
+
request=req, response=http_res
|
|
1312
|
+
)
|
|
1313
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1314
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
1315
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
1316
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1317
|
+
request=req, response=http_res
|
|
1318
|
+
)
|
|
1319
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1320
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
1321
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
1322
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1323
|
+
request=req, response=http_res
|
|
1324
|
+
)
|
|
1325
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1326
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
1327
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
1328
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1329
|
+
request=req, response=http_res
|
|
1330
|
+
)
|
|
1331
|
+
raise errors.NotFound(response_data, http_res)
|
|
1332
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
1333
|
+
response_data = unmarshal_json_response(
|
|
1334
|
+
errors.InternalServerErrorUnion, http_res
|
|
1335
|
+
)
|
|
1336
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1337
|
+
request=req, response=http_res
|
|
1338
|
+
)
|
|
1339
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1340
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1341
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1342
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1343
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1344
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1345
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1346
|
+
|
|
1347
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1348
|
+
|
|
1349
|
+
async def get_option_quotes_async(
|
|
1350
|
+
self,
|
|
1351
|
+
*,
|
|
1352
|
+
ticker: str,
|
|
1353
|
+
timestamp: Optional[str] = None,
|
|
1354
|
+
timestamp_from: Optional[str] = None,
|
|
1355
|
+
timestamp_after: Optional[str] = None,
|
|
1356
|
+
timestamp_to: Optional[str] = None,
|
|
1357
|
+
timestamp_before: Optional[str] = None,
|
|
1358
|
+
order: Optional[models.GetOptionQuotesOrder] = models.GetOptionQuotesOrder.DESC,
|
|
1359
|
+
limit: Optional[int] = None,
|
|
1360
|
+
sort: Optional[str] = None,
|
|
1361
|
+
next: Optional[str] = None,
|
|
1362
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1363
|
+
server_url: Optional[str] = None,
|
|
1364
|
+
url_override: Optional[str] = None,
|
|
1365
|
+
timeout_ms: Optional[int] = None,
|
|
1366
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1367
|
+
) -> Optional[models.GetOptionQuotesResponse]:
|
|
1368
|
+
r"""Get Options Quotes
|
|
1369
|
+
|
|
1370
|
+
Get quote data for options contracts including bid, ask, and Greeks.
|
|
1371
|
+
|
|
1372
|
+
If set, this operation will use `client_id` from the global security.
|
|
1373
|
+
|
|
1374
|
+
:param ticker: Options contract ticker symbol. Enter the exact option symbol returned by option search or chain endpoints.
|
|
1375
|
+
:param timestamp: Query by timestamp (YYYY-MM-DD or nanoseconds)
|
|
1376
|
+
:param timestamp_from: Timestamp start filter. Returns records at or after this timestamp.
|
|
1377
|
+
:param timestamp_after: Timestamp lower-bound filter. Returns records after this timestamp, excluding the timestamp itself.
|
|
1378
|
+
:param timestamp_to: Timestamp end filter. Returns records at or before this timestamp.
|
|
1379
|
+
:param timestamp_before: Timestamp upper-bound filter. Returns records before this timestamp, excluding the timestamp itself.
|
|
1380
|
+
:param order: Sort order for returned records. Use asc for oldest first or desc for newest first when supported.
|
|
1381
|
+
:param limit: Maximum number of results to return. Use smaller values for UI pages and larger values for exports within API limits.
|
|
1382
|
+
:param sort: Sort field used for ordering. Massive documents this separately from `order`, so enter the provider-supported field name in the text box, for example `timestamp`.
|
|
1383
|
+
:param next: Pagination cursor from the previous response. Omit it on the first request, then send the returned cursor to fetch the next page.
|
|
1384
|
+
:param retries: Override the default retry configuration for this method
|
|
1385
|
+
:param server_url: Override the default server URL for this method
|
|
1386
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1387
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1388
|
+
"""
|
|
1389
|
+
base_url = None
|
|
1390
|
+
url_variables = None
|
|
1391
|
+
if timeout_ms is None:
|
|
1392
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1393
|
+
|
|
1394
|
+
if timeout_ms is None:
|
|
1395
|
+
timeout_ms = 30000
|
|
1396
|
+
|
|
1397
|
+
if server_url is not None:
|
|
1398
|
+
base_url = server_url
|
|
1399
|
+
else:
|
|
1400
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1401
|
+
|
|
1402
|
+
request = models.GetOptionQuotesRequest(
|
|
1403
|
+
ticker=ticker,
|
|
1404
|
+
timestamp=timestamp,
|
|
1405
|
+
timestamp_from=timestamp_from,
|
|
1406
|
+
timestamp_after=timestamp_after,
|
|
1407
|
+
timestamp_to=timestamp_to,
|
|
1408
|
+
timestamp_before=timestamp_before,
|
|
1409
|
+
order=order,
|
|
1410
|
+
limit=limit,
|
|
1411
|
+
sort=sort,
|
|
1412
|
+
next=next,
|
|
1413
|
+
)
|
|
1414
|
+
|
|
1415
|
+
req = self._build_request_async(
|
|
1416
|
+
method="GET",
|
|
1417
|
+
path="/v1/options/quotes",
|
|
1418
|
+
base_url=base_url,
|
|
1419
|
+
url_variables=url_variables,
|
|
1420
|
+
url_override=url_override,
|
|
1421
|
+
request=request,
|
|
1422
|
+
request_body_required=False,
|
|
1423
|
+
request_has_path_params=False,
|
|
1424
|
+
request_has_query_params=True,
|
|
1425
|
+
user_agent_header="user-agent",
|
|
1426
|
+
accept_header_value="application/json",
|
|
1427
|
+
http_headers=http_headers,
|
|
1428
|
+
security=self.sdk_configuration.security,
|
|
1429
|
+
allow_empty_value=None,
|
|
1430
|
+
allowed_fields=["client_id"],
|
|
1431
|
+
timeout_ms=timeout_ms,
|
|
1432
|
+
)
|
|
1433
|
+
|
|
1434
|
+
if retries == UNSET:
|
|
1435
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1436
|
+
retries = self.sdk_configuration.retry_config
|
|
1437
|
+
else:
|
|
1438
|
+
retries = utils.RetryConfig(
|
|
1439
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
1440
|
+
)
|
|
1441
|
+
|
|
1442
|
+
retry_config = None
|
|
1443
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1444
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1445
|
+
|
|
1446
|
+
http_res = await self.do_request_async(
|
|
1447
|
+
hook_ctx=HookContext(
|
|
1448
|
+
config=self.sdk_configuration,
|
|
1449
|
+
base_url=base_url or "",
|
|
1450
|
+
operation_id="getOptionQuotes",
|
|
1451
|
+
oauth2_scopes=["market:supplemental"],
|
|
1452
|
+
security_source=self.sdk_configuration.security,
|
|
1453
|
+
tags=["Options"],
|
|
1454
|
+
extensions=None,
|
|
1455
|
+
),
|
|
1456
|
+
request=req,
|
|
1457
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
1458
|
+
retry_config=retry_config,
|
|
1459
|
+
)
|
|
1460
|
+
|
|
1461
|
+
def next_func() -> Optional[models.GetOptionQuotesResponse]:
|
|
1462
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
1463
|
+
next_url_match = JSONPath("$.nextUrl").parse(body)
|
|
1464
|
+
if len(next_url_match) == 0:
|
|
1465
|
+
return None
|
|
1466
|
+
|
|
1467
|
+
next_url = next_url_match[0]
|
|
1468
|
+
if not next_url:
|
|
1469
|
+
return None
|
|
1470
|
+
|
|
1471
|
+
if next_url[0] == "/":
|
|
1472
|
+
url = self._get_url(base_url, url_variables)
|
|
1473
|
+
next_url = url + next_url
|
|
1474
|
+
|
|
1475
|
+
return self.get_option_quotes(
|
|
1476
|
+
ticker=ticker,
|
|
1477
|
+
timestamp=timestamp,
|
|
1478
|
+
timestamp_from=timestamp_from,
|
|
1479
|
+
timestamp_after=timestamp_after,
|
|
1480
|
+
timestamp_to=timestamp_to,
|
|
1481
|
+
timestamp_before=timestamp_before,
|
|
1482
|
+
order=order,
|
|
1483
|
+
limit=limit,
|
|
1484
|
+
sort=sort,
|
|
1485
|
+
next=next,
|
|
1486
|
+
retries=retries,
|
|
1487
|
+
server_url=server_url,
|
|
1488
|
+
timeout_ms=timeout_ms,
|
|
1489
|
+
http_headers=http_headers,
|
|
1490
|
+
url_override=next_url,
|
|
1491
|
+
)
|
|
1492
|
+
|
|
1493
|
+
response_data: Any = None
|
|
1494
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1495
|
+
return models.GetOptionQuotesResponse(
|
|
1496
|
+
option_quotes_response=unmarshal_json_response(
|
|
1497
|
+
Optional[models.OptionQuotesResponse], http_res
|
|
1498
|
+
),
|
|
1499
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
1500
|
+
next=next_func,
|
|
1501
|
+
)
|
|
1502
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
1503
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
1504
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1505
|
+
request=req, response=http_res
|
|
1506
|
+
)
|
|
1507
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1508
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
1509
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
1510
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1511
|
+
request=req, response=http_res
|
|
1512
|
+
)
|
|
1513
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1514
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
1515
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
1516
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1517
|
+
request=req, response=http_res
|
|
1518
|
+
)
|
|
1519
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1520
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
1521
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
1522
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1523
|
+
request=req, response=http_res
|
|
1524
|
+
)
|
|
1525
|
+
raise errors.NotFound(response_data, http_res)
|
|
1526
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
1527
|
+
response_data = unmarshal_json_response(
|
|
1528
|
+
errors.InternalServerErrorUnion, http_res
|
|
1529
|
+
)
|
|
1530
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1531
|
+
request=req, response=http_res
|
|
1532
|
+
)
|
|
1533
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1534
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1535
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1536
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1537
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1538
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1539
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1540
|
+
|
|
1541
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1542
|
+
|
|
1543
|
+
def get_option_chain_snapshot(
|
|
1544
|
+
self,
|
|
1545
|
+
*,
|
|
1546
|
+
underlying_asset: str,
|
|
1547
|
+
strike_price: Optional[str] = None,
|
|
1548
|
+
expiration_date: Optional[date] = None,
|
|
1549
|
+
contract_type: Optional[str] = None,
|
|
1550
|
+
strike_price_gte: Optional[str] = None,
|
|
1551
|
+
strike_price_gt: Optional[str] = None,
|
|
1552
|
+
strike_price_lte: Optional[str] = None,
|
|
1553
|
+
strike_price_lt: Optional[str] = None,
|
|
1554
|
+
expiration_date_gte: Optional[str] = None,
|
|
1555
|
+
expiration_date_gt: Optional[str] = None,
|
|
1556
|
+
expiration_date_lte: Optional[str] = None,
|
|
1557
|
+
expiration_date_lt: Optional[str] = None,
|
|
1558
|
+
order: Optional[
|
|
1559
|
+
models.GetOptionChainSnapshotOrder
|
|
1560
|
+
] = models.GetOptionChainSnapshotOrder.ASC,
|
|
1561
|
+
limit: Optional[int] = None,
|
|
1562
|
+
sort: Optional[str] = None,
|
|
1563
|
+
next: Optional[str] = None,
|
|
1564
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1565
|
+
server_url: Optional[str] = None,
|
|
1566
|
+
url_override: Optional[str] = None,
|
|
1567
|
+
timeout_ms: Optional[int] = None,
|
|
1568
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1569
|
+
) -> Optional[models.GetOptionChainSnapshotResponse]:
|
|
1570
|
+
r"""Get option chain snapshot
|
|
1571
|
+
|
|
1572
|
+
Returns a paginated snapshot of option contracts for an underlying equity. Supports optional filters on strike, expiration, and contract type. Query parameters use camelCase; pagination uses `nextUrl` in the response body. Uses the upstream chain snapshot data source.
|
|
1573
|
+
|
|
1574
|
+
If set, this operation will use `client_id` from the global security.
|
|
1575
|
+
|
|
1576
|
+
:param underlying_asset: Underlying equity symbol (for example AAPL).
|
|
1577
|
+
:param strike_price: Filter by exact strike price (numeric string).
|
|
1578
|
+
:param expiration_date: Filter by expiration date (typically YYYY-MM-DD).
|
|
1579
|
+
:param contract_type: Filter by contract type (for example call or put).
|
|
1580
|
+
:param strike_price_gte: Strike price greater than or equal to this value.
|
|
1581
|
+
:param strike_price_gt: Strike price strictly greater than this value.
|
|
1582
|
+
:param strike_price_lte: Strike price less than or equal to this value.
|
|
1583
|
+
:param strike_price_lt: Strike price strictly less than this value.
|
|
1584
|
+
:param expiration_date_gte: Expiration date greater than or equal to this value.
|
|
1585
|
+
:param expiration_date_gt: Expiration date strictly greater than this value.
|
|
1586
|
+
:param expiration_date_lte: Expiration date less than or equal to this value.
|
|
1587
|
+
:param expiration_date_lt: Expiration date strictly less than this value.
|
|
1588
|
+
:param order: Sort order for returned records. Use asc for oldest first or desc for newest first when supported. for results.
|
|
1589
|
+
:param limit: Maximum number of contracts per page (1–250).
|
|
1590
|
+
:param sort: Sort field used for ordering. Massive documents this separately from `order`, so enter the provider-supported field name in the text box.
|
|
1591
|
+
:param next: Pagination cursor from the previous response. Omit it on the first request, then send the returned cursor to fetch the next page. You can also follow the absolute `nextUrl` from the previous response.
|
|
1592
|
+
:param retries: Override the default retry configuration for this method
|
|
1593
|
+
:param server_url: Override the default server URL for this method
|
|
1594
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1595
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1596
|
+
"""
|
|
1597
|
+
base_url = None
|
|
1598
|
+
url_variables = None
|
|
1599
|
+
if timeout_ms is None:
|
|
1600
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1601
|
+
|
|
1602
|
+
if timeout_ms is None:
|
|
1603
|
+
timeout_ms = 30000
|
|
1604
|
+
|
|
1605
|
+
if server_url is not None:
|
|
1606
|
+
base_url = server_url
|
|
1607
|
+
else:
|
|
1608
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1609
|
+
|
|
1610
|
+
request = models.GetOptionChainSnapshotRequest(
|
|
1611
|
+
underlying_asset=underlying_asset,
|
|
1612
|
+
strike_price=strike_price,
|
|
1613
|
+
expiration_date=expiration_date,
|
|
1614
|
+
contract_type=contract_type,
|
|
1615
|
+
strike_price_gte=strike_price_gte,
|
|
1616
|
+
strike_price_gt=strike_price_gt,
|
|
1617
|
+
strike_price_lte=strike_price_lte,
|
|
1618
|
+
strike_price_lt=strike_price_lt,
|
|
1619
|
+
expiration_date_gte=expiration_date_gte,
|
|
1620
|
+
expiration_date_gt=expiration_date_gt,
|
|
1621
|
+
expiration_date_lte=expiration_date_lte,
|
|
1622
|
+
expiration_date_lt=expiration_date_lt,
|
|
1623
|
+
order=order,
|
|
1624
|
+
limit=limit,
|
|
1625
|
+
sort=sort,
|
|
1626
|
+
next=next,
|
|
1627
|
+
)
|
|
1628
|
+
|
|
1629
|
+
req = self._build_request(
|
|
1630
|
+
method="GET",
|
|
1631
|
+
path="/v1/options/snapshot/chain/{underlyingAsset}",
|
|
1632
|
+
base_url=base_url,
|
|
1633
|
+
url_variables=url_variables,
|
|
1634
|
+
url_override=url_override,
|
|
1635
|
+
request=request,
|
|
1636
|
+
request_body_required=False,
|
|
1637
|
+
request_has_path_params=True,
|
|
1638
|
+
request_has_query_params=True,
|
|
1639
|
+
user_agent_header="user-agent",
|
|
1640
|
+
accept_header_value="application/json",
|
|
1641
|
+
http_headers=http_headers,
|
|
1642
|
+
security=self.sdk_configuration.security,
|
|
1643
|
+
allow_empty_value=None,
|
|
1644
|
+
allowed_fields=["client_id"],
|
|
1645
|
+
timeout_ms=timeout_ms,
|
|
1646
|
+
)
|
|
1647
|
+
|
|
1648
|
+
if retries == UNSET:
|
|
1649
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1650
|
+
retries = self.sdk_configuration.retry_config
|
|
1651
|
+
else:
|
|
1652
|
+
retries = utils.RetryConfig(
|
|
1653
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
1654
|
+
)
|
|
1655
|
+
|
|
1656
|
+
retry_config = None
|
|
1657
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1658
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1659
|
+
|
|
1660
|
+
http_res = self.do_request(
|
|
1661
|
+
hook_ctx=HookContext(
|
|
1662
|
+
config=self.sdk_configuration,
|
|
1663
|
+
base_url=base_url or "",
|
|
1664
|
+
operation_id="getOptionChainSnapshot",
|
|
1665
|
+
oauth2_scopes=["market:supplemental"],
|
|
1666
|
+
security_source=self.sdk_configuration.security,
|
|
1667
|
+
tags=["Options"],
|
|
1668
|
+
extensions=None,
|
|
1669
|
+
),
|
|
1670
|
+
request=req,
|
|
1671
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
1672
|
+
retry_config=retry_config,
|
|
1673
|
+
)
|
|
1674
|
+
|
|
1675
|
+
def next_func() -> Optional[models.GetOptionChainSnapshotResponse]:
|
|
1676
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
1677
|
+
next_url_match = JSONPath("$.nextUrl").parse(body)
|
|
1678
|
+
if len(next_url_match) == 0:
|
|
1679
|
+
return None
|
|
1680
|
+
|
|
1681
|
+
next_url = next_url_match[0]
|
|
1682
|
+
if not next_url:
|
|
1683
|
+
return None
|
|
1684
|
+
|
|
1685
|
+
if next_url[0] == "/":
|
|
1686
|
+
url = self._get_url(base_url, url_variables)
|
|
1687
|
+
next_url = url + next_url
|
|
1688
|
+
|
|
1689
|
+
return self.get_option_chain_snapshot(
|
|
1690
|
+
underlying_asset=underlying_asset,
|
|
1691
|
+
strike_price=strike_price,
|
|
1692
|
+
expiration_date=expiration_date,
|
|
1693
|
+
contract_type=contract_type,
|
|
1694
|
+
strike_price_gte=strike_price_gte,
|
|
1695
|
+
strike_price_gt=strike_price_gt,
|
|
1696
|
+
strike_price_lte=strike_price_lte,
|
|
1697
|
+
strike_price_lt=strike_price_lt,
|
|
1698
|
+
expiration_date_gte=expiration_date_gte,
|
|
1699
|
+
expiration_date_gt=expiration_date_gt,
|
|
1700
|
+
expiration_date_lte=expiration_date_lte,
|
|
1701
|
+
expiration_date_lt=expiration_date_lt,
|
|
1702
|
+
order=order,
|
|
1703
|
+
limit=limit,
|
|
1704
|
+
sort=sort,
|
|
1705
|
+
next=next,
|
|
1706
|
+
retries=retries,
|
|
1707
|
+
server_url=server_url,
|
|
1708
|
+
timeout_ms=timeout_ms,
|
|
1709
|
+
http_headers=http_headers,
|
|
1710
|
+
url_override=next_url,
|
|
1711
|
+
)
|
|
1712
|
+
|
|
1713
|
+
response_data: Any = None
|
|
1714
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1715
|
+
return models.GetOptionChainSnapshotResponse(
|
|
1716
|
+
option_chain_snapshot_response=unmarshal_json_response(
|
|
1717
|
+
Optional[models.OptionChainSnapshotResponse], http_res
|
|
1718
|
+
),
|
|
1719
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
1720
|
+
next=next_func,
|
|
1721
|
+
)
|
|
1722
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
1723
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
1724
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1725
|
+
request=req, response=http_res
|
|
1726
|
+
)
|
|
1727
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1728
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
1729
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
1730
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1731
|
+
request=req, response=http_res
|
|
1732
|
+
)
|
|
1733
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1734
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
1735
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
1736
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1737
|
+
request=req, response=http_res
|
|
1738
|
+
)
|
|
1739
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1740
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
1741
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
1742
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1743
|
+
request=req, response=http_res
|
|
1744
|
+
)
|
|
1745
|
+
raise errors.NotFound(response_data, http_res)
|
|
1746
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
1747
|
+
response_data = unmarshal_json_response(
|
|
1748
|
+
errors.InternalServerErrorUnion, http_res
|
|
1749
|
+
)
|
|
1750
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1751
|
+
request=req, response=http_res
|
|
1752
|
+
)
|
|
1753
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1754
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1755
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1756
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1757
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1758
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
1759
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1760
|
+
|
|
1761
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1762
|
+
|
|
1763
|
+
async def get_option_chain_snapshot_async(
|
|
1764
|
+
self,
|
|
1765
|
+
*,
|
|
1766
|
+
underlying_asset: str,
|
|
1767
|
+
strike_price: Optional[str] = None,
|
|
1768
|
+
expiration_date: Optional[date] = None,
|
|
1769
|
+
contract_type: Optional[str] = None,
|
|
1770
|
+
strike_price_gte: Optional[str] = None,
|
|
1771
|
+
strike_price_gt: Optional[str] = None,
|
|
1772
|
+
strike_price_lte: Optional[str] = None,
|
|
1773
|
+
strike_price_lt: Optional[str] = None,
|
|
1774
|
+
expiration_date_gte: Optional[str] = None,
|
|
1775
|
+
expiration_date_gt: Optional[str] = None,
|
|
1776
|
+
expiration_date_lte: Optional[str] = None,
|
|
1777
|
+
expiration_date_lt: Optional[str] = None,
|
|
1778
|
+
order: Optional[
|
|
1779
|
+
models.GetOptionChainSnapshotOrder
|
|
1780
|
+
] = models.GetOptionChainSnapshotOrder.ASC,
|
|
1781
|
+
limit: Optional[int] = None,
|
|
1782
|
+
sort: Optional[str] = None,
|
|
1783
|
+
next: Optional[str] = None,
|
|
1784
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1785
|
+
server_url: Optional[str] = None,
|
|
1786
|
+
url_override: Optional[str] = None,
|
|
1787
|
+
timeout_ms: Optional[int] = None,
|
|
1788
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1789
|
+
) -> Optional[models.GetOptionChainSnapshotResponse]:
|
|
1790
|
+
r"""Get option chain snapshot
|
|
1791
|
+
|
|
1792
|
+
Returns a paginated snapshot of option contracts for an underlying equity. Supports optional filters on strike, expiration, and contract type. Query parameters use camelCase; pagination uses `nextUrl` in the response body. Uses the upstream chain snapshot data source.
|
|
1793
|
+
|
|
1794
|
+
If set, this operation will use `client_id` from the global security.
|
|
1795
|
+
|
|
1796
|
+
:param underlying_asset: Underlying equity symbol (for example AAPL).
|
|
1797
|
+
:param strike_price: Filter by exact strike price (numeric string).
|
|
1798
|
+
:param expiration_date: Filter by expiration date (typically YYYY-MM-DD).
|
|
1799
|
+
:param contract_type: Filter by contract type (for example call or put).
|
|
1800
|
+
:param strike_price_gte: Strike price greater than or equal to this value.
|
|
1801
|
+
:param strike_price_gt: Strike price strictly greater than this value.
|
|
1802
|
+
:param strike_price_lte: Strike price less than or equal to this value.
|
|
1803
|
+
:param strike_price_lt: Strike price strictly less than this value.
|
|
1804
|
+
:param expiration_date_gte: Expiration date greater than or equal to this value.
|
|
1805
|
+
:param expiration_date_gt: Expiration date strictly greater than this value.
|
|
1806
|
+
:param expiration_date_lte: Expiration date less than or equal to this value.
|
|
1807
|
+
:param expiration_date_lt: Expiration date strictly less than this value.
|
|
1808
|
+
:param order: Sort order for returned records. Use asc for oldest first or desc for newest first when supported. for results.
|
|
1809
|
+
:param limit: Maximum number of contracts per page (1–250).
|
|
1810
|
+
:param sort: Sort field used for ordering. Massive documents this separately from `order`, so enter the provider-supported field name in the text box.
|
|
1811
|
+
:param next: Pagination cursor from the previous response. Omit it on the first request, then send the returned cursor to fetch the next page. You can also follow the absolute `nextUrl` from the previous response.
|
|
1812
|
+
:param retries: Override the default retry configuration for this method
|
|
1813
|
+
:param server_url: Override the default server URL for this method
|
|
1814
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
1815
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
1816
|
+
"""
|
|
1817
|
+
base_url = None
|
|
1818
|
+
url_variables = None
|
|
1819
|
+
if timeout_ms is None:
|
|
1820
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
1821
|
+
|
|
1822
|
+
if timeout_ms is None:
|
|
1823
|
+
timeout_ms = 30000
|
|
1824
|
+
|
|
1825
|
+
if server_url is not None:
|
|
1826
|
+
base_url = server_url
|
|
1827
|
+
else:
|
|
1828
|
+
base_url = self._get_url(base_url, url_variables)
|
|
1829
|
+
|
|
1830
|
+
request = models.GetOptionChainSnapshotRequest(
|
|
1831
|
+
underlying_asset=underlying_asset,
|
|
1832
|
+
strike_price=strike_price,
|
|
1833
|
+
expiration_date=expiration_date,
|
|
1834
|
+
contract_type=contract_type,
|
|
1835
|
+
strike_price_gte=strike_price_gte,
|
|
1836
|
+
strike_price_gt=strike_price_gt,
|
|
1837
|
+
strike_price_lte=strike_price_lte,
|
|
1838
|
+
strike_price_lt=strike_price_lt,
|
|
1839
|
+
expiration_date_gte=expiration_date_gte,
|
|
1840
|
+
expiration_date_gt=expiration_date_gt,
|
|
1841
|
+
expiration_date_lte=expiration_date_lte,
|
|
1842
|
+
expiration_date_lt=expiration_date_lt,
|
|
1843
|
+
order=order,
|
|
1844
|
+
limit=limit,
|
|
1845
|
+
sort=sort,
|
|
1846
|
+
next=next,
|
|
1847
|
+
)
|
|
1848
|
+
|
|
1849
|
+
req = self._build_request_async(
|
|
1850
|
+
method="GET",
|
|
1851
|
+
path="/v1/options/snapshot/chain/{underlyingAsset}",
|
|
1852
|
+
base_url=base_url,
|
|
1853
|
+
url_variables=url_variables,
|
|
1854
|
+
url_override=url_override,
|
|
1855
|
+
request=request,
|
|
1856
|
+
request_body_required=False,
|
|
1857
|
+
request_has_path_params=True,
|
|
1858
|
+
request_has_query_params=True,
|
|
1859
|
+
user_agent_header="user-agent",
|
|
1860
|
+
accept_header_value="application/json",
|
|
1861
|
+
http_headers=http_headers,
|
|
1862
|
+
security=self.sdk_configuration.security,
|
|
1863
|
+
allow_empty_value=None,
|
|
1864
|
+
allowed_fields=["client_id"],
|
|
1865
|
+
timeout_ms=timeout_ms,
|
|
1866
|
+
)
|
|
1867
|
+
|
|
1868
|
+
if retries == UNSET:
|
|
1869
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
1870
|
+
retries = self.sdk_configuration.retry_config
|
|
1871
|
+
else:
|
|
1872
|
+
retries = utils.RetryConfig(
|
|
1873
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
1874
|
+
)
|
|
1875
|
+
|
|
1876
|
+
retry_config = None
|
|
1877
|
+
if isinstance(retries, utils.RetryConfig):
|
|
1878
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
1879
|
+
|
|
1880
|
+
http_res = await self.do_request_async(
|
|
1881
|
+
hook_ctx=HookContext(
|
|
1882
|
+
config=self.sdk_configuration,
|
|
1883
|
+
base_url=base_url or "",
|
|
1884
|
+
operation_id="getOptionChainSnapshot",
|
|
1885
|
+
oauth2_scopes=["market:supplemental"],
|
|
1886
|
+
security_source=self.sdk_configuration.security,
|
|
1887
|
+
tags=["Options"],
|
|
1888
|
+
extensions=None,
|
|
1889
|
+
),
|
|
1890
|
+
request=req,
|
|
1891
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
1892
|
+
retry_config=retry_config,
|
|
1893
|
+
)
|
|
1894
|
+
|
|
1895
|
+
def next_func() -> Optional[models.GetOptionChainSnapshotResponse]:
|
|
1896
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
1897
|
+
next_url_match = JSONPath("$.nextUrl").parse(body)
|
|
1898
|
+
if len(next_url_match) == 0:
|
|
1899
|
+
return None
|
|
1900
|
+
|
|
1901
|
+
next_url = next_url_match[0]
|
|
1902
|
+
if not next_url:
|
|
1903
|
+
return None
|
|
1904
|
+
|
|
1905
|
+
if next_url[0] == "/":
|
|
1906
|
+
url = self._get_url(base_url, url_variables)
|
|
1907
|
+
next_url = url + next_url
|
|
1908
|
+
|
|
1909
|
+
return self.get_option_chain_snapshot(
|
|
1910
|
+
underlying_asset=underlying_asset,
|
|
1911
|
+
strike_price=strike_price,
|
|
1912
|
+
expiration_date=expiration_date,
|
|
1913
|
+
contract_type=contract_type,
|
|
1914
|
+
strike_price_gte=strike_price_gte,
|
|
1915
|
+
strike_price_gt=strike_price_gt,
|
|
1916
|
+
strike_price_lte=strike_price_lte,
|
|
1917
|
+
strike_price_lt=strike_price_lt,
|
|
1918
|
+
expiration_date_gte=expiration_date_gte,
|
|
1919
|
+
expiration_date_gt=expiration_date_gt,
|
|
1920
|
+
expiration_date_lte=expiration_date_lte,
|
|
1921
|
+
expiration_date_lt=expiration_date_lt,
|
|
1922
|
+
order=order,
|
|
1923
|
+
limit=limit,
|
|
1924
|
+
sort=sort,
|
|
1925
|
+
next=next,
|
|
1926
|
+
retries=retries,
|
|
1927
|
+
server_url=server_url,
|
|
1928
|
+
timeout_ms=timeout_ms,
|
|
1929
|
+
http_headers=http_headers,
|
|
1930
|
+
url_override=next_url,
|
|
1931
|
+
)
|
|
1932
|
+
|
|
1933
|
+
response_data: Any = None
|
|
1934
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
1935
|
+
return models.GetOptionChainSnapshotResponse(
|
|
1936
|
+
option_chain_snapshot_response=unmarshal_json_response(
|
|
1937
|
+
Optional[models.OptionChainSnapshotResponse], http_res
|
|
1938
|
+
),
|
|
1939
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
1940
|
+
next=next_func,
|
|
1941
|
+
)
|
|
1942
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
1943
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
1944
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1945
|
+
request=req, response=http_res
|
|
1946
|
+
)
|
|
1947
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1948
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
1949
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
1950
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1951
|
+
request=req, response=http_res
|
|
1952
|
+
)
|
|
1953
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1954
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
1955
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
1956
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1957
|
+
request=req, response=http_res
|
|
1958
|
+
)
|
|
1959
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1960
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
1961
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
1962
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1963
|
+
request=req, response=http_res
|
|
1964
|
+
)
|
|
1965
|
+
raise errors.NotFound(response_data, http_res)
|
|
1966
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
1967
|
+
response_data = unmarshal_json_response(
|
|
1968
|
+
errors.InternalServerErrorUnion, http_res
|
|
1969
|
+
)
|
|
1970
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
1971
|
+
request=req, response=http_res
|
|
1972
|
+
)
|
|
1973
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1974
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
1975
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1976
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1977
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
1978
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1979
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
1980
|
+
|
|
1981
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
1982
|
+
|
|
1983
|
+
def get_option_contract_snapshot(
|
|
1984
|
+
self,
|
|
1985
|
+
*,
|
|
1986
|
+
underlying_asset: str,
|
|
1987
|
+
option_contract: str,
|
|
1988
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1989
|
+
server_url: Optional[str] = None,
|
|
1990
|
+
timeout_ms: Optional[int] = None,
|
|
1991
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
1992
|
+
) -> models.GetOptionContractSnapshotResponse:
|
|
1993
|
+
r"""Get option contract snapshot
|
|
1994
|
+
|
|
1995
|
+
Returns a point-in-time snapshot for a single option contract: details, day bar, last quote, last trade, Greeks, implied volatility, and underlying context when available. Responses may be cached for approximately five minutes. Uses the upstream contract snapshot data source.
|
|
1996
|
+
|
|
1997
|
+
If set, this operation will use `client_id` from the global security.
|
|
1998
|
+
|
|
1999
|
+
:param underlying_asset: Underlying equity symbol (for example AAPL).
|
|
2000
|
+
:param option_contract: OCC-format options contract identifier (for example O:AAPL240119C00190000).
|
|
2001
|
+
:param retries: Override the default retry configuration for this method
|
|
2002
|
+
:param server_url: Override the default server URL for this method
|
|
2003
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2004
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2005
|
+
"""
|
|
2006
|
+
base_url = None
|
|
2007
|
+
url_variables = None
|
|
2008
|
+
if timeout_ms is None:
|
|
2009
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2010
|
+
|
|
2011
|
+
if timeout_ms is None:
|
|
2012
|
+
timeout_ms = 30000
|
|
2013
|
+
|
|
2014
|
+
if server_url is not None:
|
|
2015
|
+
base_url = server_url
|
|
2016
|
+
else:
|
|
2017
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2018
|
+
|
|
2019
|
+
request = models.GetOptionContractSnapshotRequest(
|
|
2020
|
+
underlying_asset=underlying_asset,
|
|
2021
|
+
option_contract=option_contract,
|
|
2022
|
+
)
|
|
2023
|
+
|
|
2024
|
+
req = self._build_request(
|
|
2025
|
+
method="GET",
|
|
2026
|
+
path="/v1/options/snapshot/{underlyingAsset}/{optionContract}",
|
|
2027
|
+
base_url=base_url,
|
|
2028
|
+
url_variables=url_variables,
|
|
2029
|
+
request=request,
|
|
2030
|
+
request_body_required=False,
|
|
2031
|
+
request_has_path_params=True,
|
|
2032
|
+
request_has_query_params=True,
|
|
2033
|
+
user_agent_header="user-agent",
|
|
2034
|
+
accept_header_value="application/json",
|
|
2035
|
+
http_headers=http_headers,
|
|
2036
|
+
security=self.sdk_configuration.security,
|
|
2037
|
+
allow_empty_value=None,
|
|
2038
|
+
allowed_fields=["client_id"],
|
|
2039
|
+
timeout_ms=timeout_ms,
|
|
2040
|
+
)
|
|
2041
|
+
|
|
2042
|
+
if retries == UNSET:
|
|
2043
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2044
|
+
retries = self.sdk_configuration.retry_config
|
|
2045
|
+
else:
|
|
2046
|
+
retries = utils.RetryConfig(
|
|
2047
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
2048
|
+
)
|
|
2049
|
+
|
|
2050
|
+
retry_config = None
|
|
2051
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2052
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2053
|
+
|
|
2054
|
+
http_res = self.do_request(
|
|
2055
|
+
hook_ctx=HookContext(
|
|
2056
|
+
config=self.sdk_configuration,
|
|
2057
|
+
base_url=base_url or "",
|
|
2058
|
+
operation_id="getOptionContractSnapshot",
|
|
2059
|
+
oauth2_scopes=["market:supplemental"],
|
|
2060
|
+
security_source=self.sdk_configuration.security,
|
|
2061
|
+
tags=["Options"],
|
|
2062
|
+
extensions=None,
|
|
2063
|
+
),
|
|
2064
|
+
request=req,
|
|
2065
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
2066
|
+
retry_config=retry_config,
|
|
2067
|
+
)
|
|
2068
|
+
|
|
2069
|
+
response_data: Any = None
|
|
2070
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2071
|
+
return models.GetOptionContractSnapshotResponse(
|
|
2072
|
+
option_contract_snapshot_response=unmarshal_json_response(
|
|
2073
|
+
Optional[models.OptionContractSnapshotResponse], http_res
|
|
2074
|
+
),
|
|
2075
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
2076
|
+
)
|
|
2077
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
2078
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
2079
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2080
|
+
request=req, response=http_res
|
|
2081
|
+
)
|
|
2082
|
+
raise errors.BadRequest(response_data, http_res)
|
|
2083
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
2084
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
2085
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2086
|
+
request=req, response=http_res
|
|
2087
|
+
)
|
|
2088
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
2089
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
2090
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
2091
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2092
|
+
request=req, response=http_res
|
|
2093
|
+
)
|
|
2094
|
+
raise errors.Forbidden(response_data, http_res)
|
|
2095
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
2096
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
2097
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2098
|
+
request=req, response=http_res
|
|
2099
|
+
)
|
|
2100
|
+
raise errors.NotFound(response_data, http_res)
|
|
2101
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
2102
|
+
response_data = unmarshal_json_response(
|
|
2103
|
+
errors.InternalServerErrorUnion, http_res
|
|
2104
|
+
)
|
|
2105
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2106
|
+
request=req, response=http_res
|
|
2107
|
+
)
|
|
2108
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
2109
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2110
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2111
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2112
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2113
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2114
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2115
|
+
|
|
2116
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
2117
|
+
|
|
2118
|
+
async def get_option_contract_snapshot_async(
|
|
2119
|
+
self,
|
|
2120
|
+
*,
|
|
2121
|
+
underlying_asset: str,
|
|
2122
|
+
option_contract: str,
|
|
2123
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2124
|
+
server_url: Optional[str] = None,
|
|
2125
|
+
timeout_ms: Optional[int] = None,
|
|
2126
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2127
|
+
) -> models.GetOptionContractSnapshotResponse:
|
|
2128
|
+
r"""Get option contract snapshot
|
|
2129
|
+
|
|
2130
|
+
Returns a point-in-time snapshot for a single option contract: details, day bar, last quote, last trade, Greeks, implied volatility, and underlying context when available. Responses may be cached for approximately five minutes. Uses the upstream contract snapshot data source.
|
|
2131
|
+
|
|
2132
|
+
If set, this operation will use `client_id` from the global security.
|
|
2133
|
+
|
|
2134
|
+
:param underlying_asset: Underlying equity symbol (for example AAPL).
|
|
2135
|
+
:param option_contract: OCC-format options contract identifier (for example O:AAPL240119C00190000).
|
|
2136
|
+
:param retries: Override the default retry configuration for this method
|
|
2137
|
+
:param server_url: Override the default server URL for this method
|
|
2138
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2139
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2140
|
+
"""
|
|
2141
|
+
base_url = None
|
|
2142
|
+
url_variables = None
|
|
2143
|
+
if timeout_ms is None:
|
|
2144
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2145
|
+
|
|
2146
|
+
if timeout_ms is None:
|
|
2147
|
+
timeout_ms = 30000
|
|
2148
|
+
|
|
2149
|
+
if server_url is not None:
|
|
2150
|
+
base_url = server_url
|
|
2151
|
+
else:
|
|
2152
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2153
|
+
|
|
2154
|
+
request = models.GetOptionContractSnapshotRequest(
|
|
2155
|
+
underlying_asset=underlying_asset,
|
|
2156
|
+
option_contract=option_contract,
|
|
2157
|
+
)
|
|
2158
|
+
|
|
2159
|
+
req = self._build_request_async(
|
|
2160
|
+
method="GET",
|
|
2161
|
+
path="/v1/options/snapshot/{underlyingAsset}/{optionContract}",
|
|
2162
|
+
base_url=base_url,
|
|
2163
|
+
url_variables=url_variables,
|
|
2164
|
+
request=request,
|
|
2165
|
+
request_body_required=False,
|
|
2166
|
+
request_has_path_params=True,
|
|
2167
|
+
request_has_query_params=True,
|
|
2168
|
+
user_agent_header="user-agent",
|
|
2169
|
+
accept_header_value="application/json",
|
|
2170
|
+
http_headers=http_headers,
|
|
2171
|
+
security=self.sdk_configuration.security,
|
|
2172
|
+
allow_empty_value=None,
|
|
2173
|
+
allowed_fields=["client_id"],
|
|
2174
|
+
timeout_ms=timeout_ms,
|
|
2175
|
+
)
|
|
2176
|
+
|
|
2177
|
+
if retries == UNSET:
|
|
2178
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2179
|
+
retries = self.sdk_configuration.retry_config
|
|
2180
|
+
else:
|
|
2181
|
+
retries = utils.RetryConfig(
|
|
2182
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
2183
|
+
)
|
|
2184
|
+
|
|
2185
|
+
retry_config = None
|
|
2186
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2187
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2188
|
+
|
|
2189
|
+
http_res = await self.do_request_async(
|
|
2190
|
+
hook_ctx=HookContext(
|
|
2191
|
+
config=self.sdk_configuration,
|
|
2192
|
+
base_url=base_url or "",
|
|
2193
|
+
operation_id="getOptionContractSnapshot",
|
|
2194
|
+
oauth2_scopes=["market:supplemental"],
|
|
2195
|
+
security_source=self.sdk_configuration.security,
|
|
2196
|
+
tags=["Options"],
|
|
2197
|
+
extensions=None,
|
|
2198
|
+
),
|
|
2199
|
+
request=req,
|
|
2200
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
2201
|
+
retry_config=retry_config,
|
|
2202
|
+
)
|
|
2203
|
+
|
|
2204
|
+
response_data: Any = None
|
|
2205
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2206
|
+
return models.GetOptionContractSnapshotResponse(
|
|
2207
|
+
option_contract_snapshot_response=unmarshal_json_response(
|
|
2208
|
+
Optional[models.OptionContractSnapshotResponse], http_res
|
|
2209
|
+
),
|
|
2210
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
2211
|
+
)
|
|
2212
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
2213
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
2214
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2215
|
+
request=req, response=http_res
|
|
2216
|
+
)
|
|
2217
|
+
raise errors.BadRequest(response_data, http_res)
|
|
2218
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
2219
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
2220
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2221
|
+
request=req, response=http_res
|
|
2222
|
+
)
|
|
2223
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
2224
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
2225
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
2226
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2227
|
+
request=req, response=http_res
|
|
2228
|
+
)
|
|
2229
|
+
raise errors.Forbidden(response_data, http_res)
|
|
2230
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
2231
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
2232
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2233
|
+
request=req, response=http_res
|
|
2234
|
+
)
|
|
2235
|
+
raise errors.NotFound(response_data, http_res)
|
|
2236
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
2237
|
+
response_data = unmarshal_json_response(
|
|
2238
|
+
errors.InternalServerErrorUnion, http_res
|
|
2239
|
+
)
|
|
2240
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2241
|
+
request=req, response=http_res
|
|
2242
|
+
)
|
|
2243
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
2244
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2245
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2246
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2247
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2248
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2249
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2250
|
+
|
|
2251
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
2252
|
+
|
|
2253
|
+
def get_option_trades(
|
|
2254
|
+
self,
|
|
2255
|
+
*,
|
|
2256
|
+
ticker: str,
|
|
2257
|
+
timestamp: Optional[str] = None,
|
|
2258
|
+
timestamp_from: Optional[str] = None,
|
|
2259
|
+
timestamp_after: Optional[str] = None,
|
|
2260
|
+
timestamp_to: Optional[str] = None,
|
|
2261
|
+
timestamp_before: Optional[str] = None,
|
|
2262
|
+
order: Optional[models.GetOptionTradesOrder] = models.GetOptionTradesOrder.DESC,
|
|
2263
|
+
limit: Optional[int] = None,
|
|
2264
|
+
sort: Optional[str] = None,
|
|
2265
|
+
next: Optional[str] = None,
|
|
2266
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2267
|
+
server_url: Optional[str] = None,
|
|
2268
|
+
url_override: Optional[str] = None,
|
|
2269
|
+
timeout_ms: Optional[int] = None,
|
|
2270
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2271
|
+
) -> Optional[models.GetOptionTradesResponse]:
|
|
2272
|
+
r"""Get Options Trades
|
|
2273
|
+
|
|
2274
|
+
Get tick-level trade data for options contracts with precise timestamps.
|
|
2275
|
+
|
|
2276
|
+
If set, this operation will use `client_id` from the global security.
|
|
2277
|
+
|
|
2278
|
+
:param ticker: Options contract ticker symbol. Enter the exact option symbol returned by option search or chain endpoints.
|
|
2279
|
+
:param timestamp: Query by timestamp (YYYY-MM-DD or nanoseconds)
|
|
2280
|
+
:param timestamp_from: Timestamp start filter. Returns records at or after this timestamp.
|
|
2281
|
+
:param timestamp_after: Timestamp lower-bound filter. Returns records after this timestamp, excluding the timestamp itself.
|
|
2282
|
+
:param timestamp_to: Timestamp end filter. Returns records at or before this timestamp.
|
|
2283
|
+
:param timestamp_before: Timestamp upper-bound filter. Returns records before this timestamp, excluding the timestamp itself.
|
|
2284
|
+
:param order: Sort order for returned records. Use asc for oldest first or desc for newest first when supported.
|
|
2285
|
+
:param limit: Maximum number of results to return. Use smaller values for UI pages and larger values for exports within API limits.
|
|
2286
|
+
:param sort: Sort field used for ordering. Massive documents this separately from `order`, so enter the provider-supported field name in the text box, for example `timestamp`.
|
|
2287
|
+
:param next: Pagination cursor from the previous response. Omit it on the first request, then send the returned cursor to fetch the next page.
|
|
2288
|
+
:param retries: Override the default retry configuration for this method
|
|
2289
|
+
:param server_url: Override the default server URL for this method
|
|
2290
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2291
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2292
|
+
"""
|
|
2293
|
+
base_url = None
|
|
2294
|
+
url_variables = None
|
|
2295
|
+
if timeout_ms is None:
|
|
2296
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2297
|
+
|
|
2298
|
+
if timeout_ms is None:
|
|
2299
|
+
timeout_ms = 30000
|
|
2300
|
+
|
|
2301
|
+
if server_url is not None:
|
|
2302
|
+
base_url = server_url
|
|
2303
|
+
else:
|
|
2304
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2305
|
+
|
|
2306
|
+
request = models.GetOptionTradesRequest(
|
|
2307
|
+
ticker=ticker,
|
|
2308
|
+
timestamp=timestamp,
|
|
2309
|
+
timestamp_from=timestamp_from,
|
|
2310
|
+
timestamp_after=timestamp_after,
|
|
2311
|
+
timestamp_to=timestamp_to,
|
|
2312
|
+
timestamp_before=timestamp_before,
|
|
2313
|
+
order=order,
|
|
2314
|
+
limit=limit,
|
|
2315
|
+
sort=sort,
|
|
2316
|
+
next=next,
|
|
2317
|
+
)
|
|
2318
|
+
|
|
2319
|
+
req = self._build_request(
|
|
2320
|
+
method="GET",
|
|
2321
|
+
path="/v1/options/trades",
|
|
2322
|
+
base_url=base_url,
|
|
2323
|
+
url_variables=url_variables,
|
|
2324
|
+
url_override=url_override,
|
|
2325
|
+
request=request,
|
|
2326
|
+
request_body_required=False,
|
|
2327
|
+
request_has_path_params=False,
|
|
2328
|
+
request_has_query_params=True,
|
|
2329
|
+
user_agent_header="user-agent",
|
|
2330
|
+
accept_header_value="application/json",
|
|
2331
|
+
http_headers=http_headers,
|
|
2332
|
+
security=self.sdk_configuration.security,
|
|
2333
|
+
allow_empty_value=None,
|
|
2334
|
+
allowed_fields=["client_id"],
|
|
2335
|
+
timeout_ms=timeout_ms,
|
|
2336
|
+
)
|
|
2337
|
+
|
|
2338
|
+
if retries == UNSET:
|
|
2339
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2340
|
+
retries = self.sdk_configuration.retry_config
|
|
2341
|
+
else:
|
|
2342
|
+
retries = utils.RetryConfig(
|
|
2343
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
2344
|
+
)
|
|
2345
|
+
|
|
2346
|
+
retry_config = None
|
|
2347
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2348
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2349
|
+
|
|
2350
|
+
http_res = self.do_request(
|
|
2351
|
+
hook_ctx=HookContext(
|
|
2352
|
+
config=self.sdk_configuration,
|
|
2353
|
+
base_url=base_url or "",
|
|
2354
|
+
operation_id="getOptionTrades",
|
|
2355
|
+
oauth2_scopes=["market:supplemental"],
|
|
2356
|
+
security_source=self.sdk_configuration.security,
|
|
2357
|
+
tags=["Options"],
|
|
2358
|
+
extensions=None,
|
|
2359
|
+
),
|
|
2360
|
+
request=req,
|
|
2361
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
2362
|
+
retry_config=retry_config,
|
|
2363
|
+
)
|
|
2364
|
+
|
|
2365
|
+
def next_func() -> Optional[models.GetOptionTradesResponse]:
|
|
2366
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
2367
|
+
next_url_match = JSONPath("$.nextUrl").parse(body)
|
|
2368
|
+
if len(next_url_match) == 0:
|
|
2369
|
+
return None
|
|
2370
|
+
|
|
2371
|
+
next_url = next_url_match[0]
|
|
2372
|
+
if not next_url:
|
|
2373
|
+
return None
|
|
2374
|
+
|
|
2375
|
+
if next_url[0] == "/":
|
|
2376
|
+
url = self._get_url(base_url, url_variables)
|
|
2377
|
+
next_url = url + next_url
|
|
2378
|
+
|
|
2379
|
+
return self.get_option_trades(
|
|
2380
|
+
ticker=ticker,
|
|
2381
|
+
timestamp=timestamp,
|
|
2382
|
+
timestamp_from=timestamp_from,
|
|
2383
|
+
timestamp_after=timestamp_after,
|
|
2384
|
+
timestamp_to=timestamp_to,
|
|
2385
|
+
timestamp_before=timestamp_before,
|
|
2386
|
+
order=order,
|
|
2387
|
+
limit=limit,
|
|
2388
|
+
sort=sort,
|
|
2389
|
+
next=next,
|
|
2390
|
+
retries=retries,
|
|
2391
|
+
server_url=server_url,
|
|
2392
|
+
timeout_ms=timeout_ms,
|
|
2393
|
+
http_headers=http_headers,
|
|
2394
|
+
url_override=next_url,
|
|
2395
|
+
)
|
|
2396
|
+
|
|
2397
|
+
response_data: Any = None
|
|
2398
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2399
|
+
return models.GetOptionTradesResponse(
|
|
2400
|
+
option_trades_response=unmarshal_json_response(
|
|
2401
|
+
Optional[models.OptionTradesResponse], http_res
|
|
2402
|
+
),
|
|
2403
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
2404
|
+
next=next_func,
|
|
2405
|
+
)
|
|
2406
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
2407
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
2408
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2409
|
+
request=req, response=http_res
|
|
2410
|
+
)
|
|
2411
|
+
raise errors.BadRequest(response_data, http_res)
|
|
2412
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
2413
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
2414
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2415
|
+
request=req, response=http_res
|
|
2416
|
+
)
|
|
2417
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
2418
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
2419
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
2420
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2421
|
+
request=req, response=http_res
|
|
2422
|
+
)
|
|
2423
|
+
raise errors.Forbidden(response_data, http_res)
|
|
2424
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
2425
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
2426
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2427
|
+
request=req, response=http_res
|
|
2428
|
+
)
|
|
2429
|
+
raise errors.NotFound(response_data, http_res)
|
|
2430
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
2431
|
+
response_data = unmarshal_json_response(
|
|
2432
|
+
errors.InternalServerErrorUnion, http_res
|
|
2433
|
+
)
|
|
2434
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2435
|
+
request=req, response=http_res
|
|
2436
|
+
)
|
|
2437
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
2438
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2439
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2440
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2441
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2442
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2443
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2444
|
+
|
|
2445
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
2446
|
+
|
|
2447
|
+
async def get_option_trades_async(
|
|
2448
|
+
self,
|
|
2449
|
+
*,
|
|
2450
|
+
ticker: str,
|
|
2451
|
+
timestamp: Optional[str] = None,
|
|
2452
|
+
timestamp_from: Optional[str] = None,
|
|
2453
|
+
timestamp_after: Optional[str] = None,
|
|
2454
|
+
timestamp_to: Optional[str] = None,
|
|
2455
|
+
timestamp_before: Optional[str] = None,
|
|
2456
|
+
order: Optional[models.GetOptionTradesOrder] = models.GetOptionTradesOrder.DESC,
|
|
2457
|
+
limit: Optional[int] = None,
|
|
2458
|
+
sort: Optional[str] = None,
|
|
2459
|
+
next: Optional[str] = None,
|
|
2460
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2461
|
+
server_url: Optional[str] = None,
|
|
2462
|
+
url_override: Optional[str] = None,
|
|
2463
|
+
timeout_ms: Optional[int] = None,
|
|
2464
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2465
|
+
) -> Optional[models.GetOptionTradesResponse]:
|
|
2466
|
+
r"""Get Options Trades
|
|
2467
|
+
|
|
2468
|
+
Get tick-level trade data for options contracts with precise timestamps.
|
|
2469
|
+
|
|
2470
|
+
If set, this operation will use `client_id` from the global security.
|
|
2471
|
+
|
|
2472
|
+
:param ticker: Options contract ticker symbol. Enter the exact option symbol returned by option search or chain endpoints.
|
|
2473
|
+
:param timestamp: Query by timestamp (YYYY-MM-DD or nanoseconds)
|
|
2474
|
+
:param timestamp_from: Timestamp start filter. Returns records at or after this timestamp.
|
|
2475
|
+
:param timestamp_after: Timestamp lower-bound filter. Returns records after this timestamp, excluding the timestamp itself.
|
|
2476
|
+
:param timestamp_to: Timestamp end filter. Returns records at or before this timestamp.
|
|
2477
|
+
:param timestamp_before: Timestamp upper-bound filter. Returns records before this timestamp, excluding the timestamp itself.
|
|
2478
|
+
:param order: Sort order for returned records. Use asc for oldest first or desc for newest first when supported.
|
|
2479
|
+
:param limit: Maximum number of results to return. Use smaller values for UI pages and larger values for exports within API limits.
|
|
2480
|
+
:param sort: Sort field used for ordering. Massive documents this separately from `order`, so enter the provider-supported field name in the text box, for example `timestamp`.
|
|
2481
|
+
:param next: Pagination cursor from the previous response. Omit it on the first request, then send the returned cursor to fetch the next page.
|
|
2482
|
+
:param retries: Override the default retry configuration for this method
|
|
2483
|
+
:param server_url: Override the default server URL for this method
|
|
2484
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2485
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2486
|
+
"""
|
|
2487
|
+
base_url = None
|
|
2488
|
+
url_variables = None
|
|
2489
|
+
if timeout_ms is None:
|
|
2490
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2491
|
+
|
|
2492
|
+
if timeout_ms is None:
|
|
2493
|
+
timeout_ms = 30000
|
|
2494
|
+
|
|
2495
|
+
if server_url is not None:
|
|
2496
|
+
base_url = server_url
|
|
2497
|
+
else:
|
|
2498
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2499
|
+
|
|
2500
|
+
request = models.GetOptionTradesRequest(
|
|
2501
|
+
ticker=ticker,
|
|
2502
|
+
timestamp=timestamp,
|
|
2503
|
+
timestamp_from=timestamp_from,
|
|
2504
|
+
timestamp_after=timestamp_after,
|
|
2505
|
+
timestamp_to=timestamp_to,
|
|
2506
|
+
timestamp_before=timestamp_before,
|
|
2507
|
+
order=order,
|
|
2508
|
+
limit=limit,
|
|
2509
|
+
sort=sort,
|
|
2510
|
+
next=next,
|
|
2511
|
+
)
|
|
2512
|
+
|
|
2513
|
+
req = self._build_request_async(
|
|
2514
|
+
method="GET",
|
|
2515
|
+
path="/v1/options/trades",
|
|
2516
|
+
base_url=base_url,
|
|
2517
|
+
url_variables=url_variables,
|
|
2518
|
+
url_override=url_override,
|
|
2519
|
+
request=request,
|
|
2520
|
+
request_body_required=False,
|
|
2521
|
+
request_has_path_params=False,
|
|
2522
|
+
request_has_query_params=True,
|
|
2523
|
+
user_agent_header="user-agent",
|
|
2524
|
+
accept_header_value="application/json",
|
|
2525
|
+
http_headers=http_headers,
|
|
2526
|
+
security=self.sdk_configuration.security,
|
|
2527
|
+
allow_empty_value=None,
|
|
2528
|
+
allowed_fields=["client_id"],
|
|
2529
|
+
timeout_ms=timeout_ms,
|
|
2530
|
+
)
|
|
2531
|
+
|
|
2532
|
+
if retries == UNSET:
|
|
2533
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2534
|
+
retries = self.sdk_configuration.retry_config
|
|
2535
|
+
else:
|
|
2536
|
+
retries = utils.RetryConfig(
|
|
2537
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
2538
|
+
)
|
|
2539
|
+
|
|
2540
|
+
retry_config = None
|
|
2541
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2542
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2543
|
+
|
|
2544
|
+
http_res = await self.do_request_async(
|
|
2545
|
+
hook_ctx=HookContext(
|
|
2546
|
+
config=self.sdk_configuration,
|
|
2547
|
+
base_url=base_url or "",
|
|
2548
|
+
operation_id="getOptionTrades",
|
|
2549
|
+
oauth2_scopes=["market:supplemental"],
|
|
2550
|
+
security_source=self.sdk_configuration.security,
|
|
2551
|
+
tags=["Options"],
|
|
2552
|
+
extensions=None,
|
|
2553
|
+
),
|
|
2554
|
+
request=req,
|
|
2555
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
2556
|
+
retry_config=retry_config,
|
|
2557
|
+
)
|
|
2558
|
+
|
|
2559
|
+
def next_func() -> Optional[models.GetOptionTradesResponse]:
|
|
2560
|
+
body = utils.unmarshal_json(http_res.text, Union[Dict[Any, Any], List[Any]])
|
|
2561
|
+
next_url_match = JSONPath("$.nextUrl").parse(body)
|
|
2562
|
+
if len(next_url_match) == 0:
|
|
2563
|
+
return None
|
|
2564
|
+
|
|
2565
|
+
next_url = next_url_match[0]
|
|
2566
|
+
if not next_url:
|
|
2567
|
+
return None
|
|
2568
|
+
|
|
2569
|
+
if next_url[0] == "/":
|
|
2570
|
+
url = self._get_url(base_url, url_variables)
|
|
2571
|
+
next_url = url + next_url
|
|
2572
|
+
|
|
2573
|
+
return self.get_option_trades(
|
|
2574
|
+
ticker=ticker,
|
|
2575
|
+
timestamp=timestamp,
|
|
2576
|
+
timestamp_from=timestamp_from,
|
|
2577
|
+
timestamp_after=timestamp_after,
|
|
2578
|
+
timestamp_to=timestamp_to,
|
|
2579
|
+
timestamp_before=timestamp_before,
|
|
2580
|
+
order=order,
|
|
2581
|
+
limit=limit,
|
|
2582
|
+
sort=sort,
|
|
2583
|
+
next=next,
|
|
2584
|
+
retries=retries,
|
|
2585
|
+
server_url=server_url,
|
|
2586
|
+
timeout_ms=timeout_ms,
|
|
2587
|
+
http_headers=http_headers,
|
|
2588
|
+
url_override=next_url,
|
|
2589
|
+
)
|
|
2590
|
+
|
|
2591
|
+
response_data: Any = None
|
|
2592
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2593
|
+
return models.GetOptionTradesResponse(
|
|
2594
|
+
option_trades_response=unmarshal_json_response(
|
|
2595
|
+
Optional[models.OptionTradesResponse], http_res
|
|
2596
|
+
),
|
|
2597
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
2598
|
+
next=next_func,
|
|
2599
|
+
)
|
|
2600
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
2601
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
2602
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2603
|
+
request=req, response=http_res
|
|
2604
|
+
)
|
|
2605
|
+
raise errors.BadRequest(response_data, http_res)
|
|
2606
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
2607
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
2608
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2609
|
+
request=req, response=http_res
|
|
2610
|
+
)
|
|
2611
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
2612
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
2613
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
2614
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2615
|
+
request=req, response=http_res
|
|
2616
|
+
)
|
|
2617
|
+
raise errors.Forbidden(response_data, http_res)
|
|
2618
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
2619
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
2620
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2621
|
+
request=req, response=http_res
|
|
2622
|
+
)
|
|
2623
|
+
raise errors.NotFound(response_data, http_res)
|
|
2624
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
2625
|
+
response_data = unmarshal_json_response(
|
|
2626
|
+
errors.InternalServerErrorUnion, http_res
|
|
2627
|
+
)
|
|
2628
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2629
|
+
request=req, response=http_res
|
|
2630
|
+
)
|
|
2631
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
2632
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2633
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2634
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2635
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2636
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2637
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2638
|
+
|
|
2639
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
2640
|
+
|
|
2641
|
+
def get_options_unusual_activity(
|
|
2642
|
+
self,
|
|
2643
|
+
*,
|
|
2644
|
+
symbol: str,
|
|
2645
|
+
source: Optional[models.Source] = models.Source.DELAYED,
|
|
2646
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2647
|
+
server_url: Optional[str] = None,
|
|
2648
|
+
timeout_ms: Optional[int] = None,
|
|
2649
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2650
|
+
) -> models.GetOptionsUnusualActivityResponse:
|
|
2651
|
+
r"""Get Options Unusual Activity by Symbol
|
|
2652
|
+
|
|
2653
|
+
Retrieve options unusual activity for a specific underlying symbol (e.g. AAPL, TSLA). Returns options unusual activity data such as unusual volume and block trades. **Required scope:** options:information
|
|
2654
|
+
|
|
2655
|
+
If set, this operation will use `client_id` from the global security.
|
|
2656
|
+
|
|
2657
|
+
:param symbol: Underlying stock symbol (e.g. AAPL, TSLA).
|
|
2658
|
+
:param source: Data source. Values are case-insensitive.
|
|
2659
|
+
:param retries: Override the default retry configuration for this method
|
|
2660
|
+
:param server_url: Override the default server URL for this method
|
|
2661
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2662
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2663
|
+
"""
|
|
2664
|
+
base_url = None
|
|
2665
|
+
url_variables = None
|
|
2666
|
+
if timeout_ms is None:
|
|
2667
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2668
|
+
|
|
2669
|
+
if timeout_ms is None:
|
|
2670
|
+
timeout_ms = 30000
|
|
2671
|
+
|
|
2672
|
+
if server_url is not None:
|
|
2673
|
+
base_url = server_url
|
|
2674
|
+
else:
|
|
2675
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2676
|
+
|
|
2677
|
+
request = models.GetOptionsUnusualActivityRequest(
|
|
2678
|
+
symbol=symbol,
|
|
2679
|
+
source=source,
|
|
2680
|
+
)
|
|
2681
|
+
|
|
2682
|
+
req = self._build_request(
|
|
2683
|
+
method="GET",
|
|
2684
|
+
path="/v1/options/unusual_activity/{symbol}",
|
|
2685
|
+
base_url=base_url,
|
|
2686
|
+
url_variables=url_variables,
|
|
2687
|
+
request=request,
|
|
2688
|
+
request_body_required=False,
|
|
2689
|
+
request_has_path_params=True,
|
|
2690
|
+
request_has_query_params=True,
|
|
2691
|
+
user_agent_header="user-agent",
|
|
2692
|
+
accept_header_value="application/json",
|
|
2693
|
+
http_headers=http_headers,
|
|
2694
|
+
security=self.sdk_configuration.security,
|
|
2695
|
+
allow_empty_value=None,
|
|
2696
|
+
allowed_fields=["client_id"],
|
|
2697
|
+
timeout_ms=timeout_ms,
|
|
2698
|
+
)
|
|
2699
|
+
|
|
2700
|
+
if retries == UNSET:
|
|
2701
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2702
|
+
retries = self.sdk_configuration.retry_config
|
|
2703
|
+
else:
|
|
2704
|
+
retries = utils.RetryConfig(
|
|
2705
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
2706
|
+
)
|
|
2707
|
+
|
|
2708
|
+
retry_config = None
|
|
2709
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2710
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2711
|
+
|
|
2712
|
+
http_res = self.do_request(
|
|
2713
|
+
hook_ctx=HookContext(
|
|
2714
|
+
config=self.sdk_configuration,
|
|
2715
|
+
base_url=base_url or "",
|
|
2716
|
+
operation_id="getOptionsUnusualActivity",
|
|
2717
|
+
oauth2_scopes=["options:information"],
|
|
2718
|
+
security_source=self.sdk_configuration.security,
|
|
2719
|
+
tags=["Options"],
|
|
2720
|
+
extensions=None,
|
|
2721
|
+
),
|
|
2722
|
+
request=req,
|
|
2723
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
2724
|
+
retry_config=retry_config,
|
|
2725
|
+
)
|
|
2726
|
+
|
|
2727
|
+
response_data: Any = None
|
|
2728
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2729
|
+
return models.GetOptionsUnusualActivityResponse(
|
|
2730
|
+
options_unusual_activity_response=unmarshal_json_response(
|
|
2731
|
+
Optional[models.OptionsUnusualActivityResponse], http_res
|
|
2732
|
+
),
|
|
2733
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
2734
|
+
)
|
|
2735
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
2736
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
2737
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2738
|
+
request=req, response=http_res
|
|
2739
|
+
)
|
|
2740
|
+
raise errors.BadRequest(response_data, http_res)
|
|
2741
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
2742
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
2743
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2744
|
+
request=req, response=http_res
|
|
2745
|
+
)
|
|
2746
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
2747
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
2748
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
2749
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2750
|
+
request=req, response=http_res
|
|
2751
|
+
)
|
|
2752
|
+
raise errors.Forbidden(response_data, http_res)
|
|
2753
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
2754
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
2755
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2756
|
+
request=req, response=http_res
|
|
2757
|
+
)
|
|
2758
|
+
raise errors.NotFound(response_data, http_res)
|
|
2759
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
2760
|
+
response_data = unmarshal_json_response(
|
|
2761
|
+
errors.InternalServerErrorUnion, http_res
|
|
2762
|
+
)
|
|
2763
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2764
|
+
request=req, response=http_res
|
|
2765
|
+
)
|
|
2766
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
2767
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2768
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2769
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2770
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2771
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
2772
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2773
|
+
|
|
2774
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
2775
|
+
|
|
2776
|
+
async def get_options_unusual_activity_async(
|
|
2777
|
+
self,
|
|
2778
|
+
*,
|
|
2779
|
+
symbol: str,
|
|
2780
|
+
source: Optional[models.Source] = models.Source.DELAYED,
|
|
2781
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2782
|
+
server_url: Optional[str] = None,
|
|
2783
|
+
timeout_ms: Optional[int] = None,
|
|
2784
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2785
|
+
) -> models.GetOptionsUnusualActivityResponse:
|
|
2786
|
+
r"""Get Options Unusual Activity by Symbol
|
|
2787
|
+
|
|
2788
|
+
Retrieve options unusual activity for a specific underlying symbol (e.g. AAPL, TSLA). Returns options unusual activity data such as unusual volume and block trades. **Required scope:** options:information
|
|
2789
|
+
|
|
2790
|
+
If set, this operation will use `client_id` from the global security.
|
|
2791
|
+
|
|
2792
|
+
:param symbol: Underlying stock symbol (e.g. AAPL, TSLA).
|
|
2793
|
+
:param source: Data source. Values are case-insensitive.
|
|
2794
|
+
:param retries: Override the default retry configuration for this method
|
|
2795
|
+
:param server_url: Override the default server URL for this method
|
|
2796
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2797
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2798
|
+
"""
|
|
2799
|
+
base_url = None
|
|
2800
|
+
url_variables = None
|
|
2801
|
+
if timeout_ms is None:
|
|
2802
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2803
|
+
|
|
2804
|
+
if timeout_ms is None:
|
|
2805
|
+
timeout_ms = 30000
|
|
2806
|
+
|
|
2807
|
+
if server_url is not None:
|
|
2808
|
+
base_url = server_url
|
|
2809
|
+
else:
|
|
2810
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2811
|
+
|
|
2812
|
+
request = models.GetOptionsUnusualActivityRequest(
|
|
2813
|
+
symbol=symbol,
|
|
2814
|
+
source=source,
|
|
2815
|
+
)
|
|
2816
|
+
|
|
2817
|
+
req = self._build_request_async(
|
|
2818
|
+
method="GET",
|
|
2819
|
+
path="/v1/options/unusual_activity/{symbol}",
|
|
2820
|
+
base_url=base_url,
|
|
2821
|
+
url_variables=url_variables,
|
|
2822
|
+
request=request,
|
|
2823
|
+
request_body_required=False,
|
|
2824
|
+
request_has_path_params=True,
|
|
2825
|
+
request_has_query_params=True,
|
|
2826
|
+
user_agent_header="user-agent",
|
|
2827
|
+
accept_header_value="application/json",
|
|
2828
|
+
http_headers=http_headers,
|
|
2829
|
+
security=self.sdk_configuration.security,
|
|
2830
|
+
allow_empty_value=None,
|
|
2831
|
+
allowed_fields=["client_id"],
|
|
2832
|
+
timeout_ms=timeout_ms,
|
|
2833
|
+
)
|
|
2834
|
+
|
|
2835
|
+
if retries == UNSET:
|
|
2836
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2837
|
+
retries = self.sdk_configuration.retry_config
|
|
2838
|
+
else:
|
|
2839
|
+
retries = utils.RetryConfig(
|
|
2840
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
2841
|
+
)
|
|
2842
|
+
|
|
2843
|
+
retry_config = None
|
|
2844
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2845
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2846
|
+
|
|
2847
|
+
http_res = await self.do_request_async(
|
|
2848
|
+
hook_ctx=HookContext(
|
|
2849
|
+
config=self.sdk_configuration,
|
|
2850
|
+
base_url=base_url or "",
|
|
2851
|
+
operation_id="getOptionsUnusualActivity",
|
|
2852
|
+
oauth2_scopes=["options:information"],
|
|
2853
|
+
security_source=self.sdk_configuration.security,
|
|
2854
|
+
tags=["Options"],
|
|
2855
|
+
extensions=None,
|
|
2856
|
+
),
|
|
2857
|
+
request=req,
|
|
2858
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
2859
|
+
retry_config=retry_config,
|
|
2860
|
+
)
|
|
2861
|
+
|
|
2862
|
+
response_data: Any = None
|
|
2863
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2864
|
+
return models.GetOptionsUnusualActivityResponse(
|
|
2865
|
+
options_unusual_activity_response=unmarshal_json_response(
|
|
2866
|
+
Optional[models.OptionsUnusualActivityResponse], http_res
|
|
2867
|
+
),
|
|
2868
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
2869
|
+
)
|
|
2870
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
2871
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
2872
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2873
|
+
request=req, response=http_res
|
|
2874
|
+
)
|
|
2875
|
+
raise errors.BadRequest(response_data, http_res)
|
|
2876
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
2877
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
2878
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2879
|
+
request=req, response=http_res
|
|
2880
|
+
)
|
|
2881
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
2882
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
2883
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
2884
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2885
|
+
request=req, response=http_res
|
|
2886
|
+
)
|
|
2887
|
+
raise errors.Forbidden(response_data, http_res)
|
|
2888
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
2889
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
2890
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2891
|
+
request=req, response=http_res
|
|
2892
|
+
)
|
|
2893
|
+
raise errors.NotFound(response_data, http_res)
|
|
2894
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
2895
|
+
response_data = unmarshal_json_response(
|
|
2896
|
+
errors.InternalServerErrorUnion, http_res
|
|
2897
|
+
)
|
|
2898
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
2899
|
+
request=req, response=http_res
|
|
2900
|
+
)
|
|
2901
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
2902
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
2903
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2904
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2905
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
2906
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
2907
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
2908
|
+
|
|
2909
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
2910
|
+
|
|
2911
|
+
def list_option_contracts(
|
|
2912
|
+
self,
|
|
2913
|
+
*,
|
|
2914
|
+
symbol: str,
|
|
2915
|
+
expiry_date: date,
|
|
2916
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
2917
|
+
server_url: Optional[str] = None,
|
|
2918
|
+
timeout_ms: Optional[int] = None,
|
|
2919
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
2920
|
+
) -> models.ListOptionContractsResponse:
|
|
2921
|
+
r"""Get Options Contract Symbols
|
|
2922
|
+
|
|
2923
|
+
Retrieve all option contract symbols (OCC symbols) for a specific underlying ticker and expiration date. Returns the complete list of available call and put contracts with their strike prices.
|
|
2924
|
+
|
|
2925
|
+
If set, this operation will use `client_id` from the global security.
|
|
2926
|
+
|
|
2927
|
+
:param symbol: The underlying stock symbol (e.g., AAPL, TSLA, SPY)
|
|
2928
|
+
:param expiry_date: The expiration date in YYYY-MM-DD format
|
|
2929
|
+
:param retries: Override the default retry configuration for this method
|
|
2930
|
+
:param server_url: Override the default server URL for this method
|
|
2931
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
2932
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
2933
|
+
"""
|
|
2934
|
+
base_url = None
|
|
2935
|
+
url_variables = None
|
|
2936
|
+
if timeout_ms is None:
|
|
2937
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
2938
|
+
|
|
2939
|
+
if timeout_ms is None:
|
|
2940
|
+
timeout_ms = 30000
|
|
2941
|
+
|
|
2942
|
+
if server_url is not None:
|
|
2943
|
+
base_url = server_url
|
|
2944
|
+
else:
|
|
2945
|
+
base_url = self._get_url(base_url, url_variables)
|
|
2946
|
+
|
|
2947
|
+
request = models.ListOptionContractsRequest(
|
|
2948
|
+
symbol=symbol,
|
|
2949
|
+
expiry_date=expiry_date,
|
|
2950
|
+
)
|
|
2951
|
+
|
|
2952
|
+
req = self._build_request(
|
|
2953
|
+
method="GET",
|
|
2954
|
+
path="/v1/options/{symbol}/contracts/{expiryDate}",
|
|
2955
|
+
base_url=base_url,
|
|
2956
|
+
url_variables=url_variables,
|
|
2957
|
+
request=request,
|
|
2958
|
+
request_body_required=False,
|
|
2959
|
+
request_has_path_params=True,
|
|
2960
|
+
request_has_query_params=True,
|
|
2961
|
+
user_agent_header="user-agent",
|
|
2962
|
+
accept_header_value="application/json",
|
|
2963
|
+
http_headers=http_headers,
|
|
2964
|
+
security=self.sdk_configuration.security,
|
|
2965
|
+
allow_empty_value=None,
|
|
2966
|
+
allowed_fields=["client_id"],
|
|
2967
|
+
timeout_ms=timeout_ms,
|
|
2968
|
+
)
|
|
2969
|
+
|
|
2970
|
+
if retries == UNSET:
|
|
2971
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
2972
|
+
retries = self.sdk_configuration.retry_config
|
|
2973
|
+
else:
|
|
2974
|
+
retries = utils.RetryConfig(
|
|
2975
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
2976
|
+
)
|
|
2977
|
+
|
|
2978
|
+
retry_config = None
|
|
2979
|
+
if isinstance(retries, utils.RetryConfig):
|
|
2980
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
2981
|
+
|
|
2982
|
+
http_res = self.do_request(
|
|
2983
|
+
hook_ctx=HookContext(
|
|
2984
|
+
config=self.sdk_configuration,
|
|
2985
|
+
base_url=base_url or "",
|
|
2986
|
+
operation_id="listOptionContracts",
|
|
2987
|
+
oauth2_scopes=["market:supplemental"],
|
|
2988
|
+
security_source=self.sdk_configuration.security,
|
|
2989
|
+
tags=["Options"],
|
|
2990
|
+
extensions=None,
|
|
2991
|
+
),
|
|
2992
|
+
request=req,
|
|
2993
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
2994
|
+
retry_config=retry_config,
|
|
2995
|
+
)
|
|
2996
|
+
|
|
2997
|
+
response_data: Any = None
|
|
2998
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
2999
|
+
return models.ListOptionContractsResponse(
|
|
3000
|
+
option_contracts_response=unmarshal_json_response(
|
|
3001
|
+
Optional[models.OptionContractsResponse], http_res
|
|
3002
|
+
),
|
|
3003
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
3004
|
+
)
|
|
3005
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
3006
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
3007
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3008
|
+
request=req, response=http_res
|
|
3009
|
+
)
|
|
3010
|
+
raise errors.BadRequest(response_data, http_res)
|
|
3011
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
3012
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
3013
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3014
|
+
request=req, response=http_res
|
|
3015
|
+
)
|
|
3016
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
3017
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
3018
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
3019
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3020
|
+
request=req, response=http_res
|
|
3021
|
+
)
|
|
3022
|
+
raise errors.Forbidden(response_data, http_res)
|
|
3023
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
3024
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
3025
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3026
|
+
request=req, response=http_res
|
|
3027
|
+
)
|
|
3028
|
+
raise errors.NotFound(response_data, http_res)
|
|
3029
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
3030
|
+
response_data = unmarshal_json_response(
|
|
3031
|
+
errors.InternalServerErrorUnion, http_res
|
|
3032
|
+
)
|
|
3033
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3034
|
+
request=req, response=http_res
|
|
3035
|
+
)
|
|
3036
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
3037
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3038
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3039
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
3040
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3041
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3042
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
3043
|
+
|
|
3044
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
3045
|
+
|
|
3046
|
+
async def list_option_contracts_async(
|
|
3047
|
+
self,
|
|
3048
|
+
*,
|
|
3049
|
+
symbol: str,
|
|
3050
|
+
expiry_date: date,
|
|
3051
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3052
|
+
server_url: Optional[str] = None,
|
|
3053
|
+
timeout_ms: Optional[int] = None,
|
|
3054
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3055
|
+
) -> models.ListOptionContractsResponse:
|
|
3056
|
+
r"""Get Options Contract Symbols
|
|
3057
|
+
|
|
3058
|
+
Retrieve all option contract symbols (OCC symbols) for a specific underlying ticker and expiration date. Returns the complete list of available call and put contracts with their strike prices.
|
|
3059
|
+
|
|
3060
|
+
If set, this operation will use `client_id` from the global security.
|
|
3061
|
+
|
|
3062
|
+
:param symbol: The underlying stock symbol (e.g., AAPL, TSLA, SPY)
|
|
3063
|
+
:param expiry_date: The expiration date in YYYY-MM-DD format
|
|
3064
|
+
:param retries: Override the default retry configuration for this method
|
|
3065
|
+
:param server_url: Override the default server URL for this method
|
|
3066
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3067
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3068
|
+
"""
|
|
3069
|
+
base_url = None
|
|
3070
|
+
url_variables = None
|
|
3071
|
+
if timeout_ms is None:
|
|
3072
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3073
|
+
|
|
3074
|
+
if timeout_ms is None:
|
|
3075
|
+
timeout_ms = 30000
|
|
3076
|
+
|
|
3077
|
+
if server_url is not None:
|
|
3078
|
+
base_url = server_url
|
|
3079
|
+
else:
|
|
3080
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3081
|
+
|
|
3082
|
+
request = models.ListOptionContractsRequest(
|
|
3083
|
+
symbol=symbol,
|
|
3084
|
+
expiry_date=expiry_date,
|
|
3085
|
+
)
|
|
3086
|
+
|
|
3087
|
+
req = self._build_request_async(
|
|
3088
|
+
method="GET",
|
|
3089
|
+
path="/v1/options/{symbol}/contracts/{expiryDate}",
|
|
3090
|
+
base_url=base_url,
|
|
3091
|
+
url_variables=url_variables,
|
|
3092
|
+
request=request,
|
|
3093
|
+
request_body_required=False,
|
|
3094
|
+
request_has_path_params=True,
|
|
3095
|
+
request_has_query_params=True,
|
|
3096
|
+
user_agent_header="user-agent",
|
|
3097
|
+
accept_header_value="application/json",
|
|
3098
|
+
http_headers=http_headers,
|
|
3099
|
+
security=self.sdk_configuration.security,
|
|
3100
|
+
allow_empty_value=None,
|
|
3101
|
+
allowed_fields=["client_id"],
|
|
3102
|
+
timeout_ms=timeout_ms,
|
|
3103
|
+
)
|
|
3104
|
+
|
|
3105
|
+
if retries == UNSET:
|
|
3106
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3107
|
+
retries = self.sdk_configuration.retry_config
|
|
3108
|
+
else:
|
|
3109
|
+
retries = utils.RetryConfig(
|
|
3110
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
3111
|
+
)
|
|
3112
|
+
|
|
3113
|
+
retry_config = None
|
|
3114
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3115
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3116
|
+
|
|
3117
|
+
http_res = await self.do_request_async(
|
|
3118
|
+
hook_ctx=HookContext(
|
|
3119
|
+
config=self.sdk_configuration,
|
|
3120
|
+
base_url=base_url or "",
|
|
3121
|
+
operation_id="listOptionContracts",
|
|
3122
|
+
oauth2_scopes=["market:supplemental"],
|
|
3123
|
+
security_source=self.sdk_configuration.security,
|
|
3124
|
+
tags=["Options"],
|
|
3125
|
+
extensions=None,
|
|
3126
|
+
),
|
|
3127
|
+
request=req,
|
|
3128
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
3129
|
+
retry_config=retry_config,
|
|
3130
|
+
)
|
|
3131
|
+
|
|
3132
|
+
response_data: Any = None
|
|
3133
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
3134
|
+
return models.ListOptionContractsResponse(
|
|
3135
|
+
option_contracts_response=unmarshal_json_response(
|
|
3136
|
+
Optional[models.OptionContractsResponse], http_res
|
|
3137
|
+
),
|
|
3138
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
3139
|
+
)
|
|
3140
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
3141
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
3142
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3143
|
+
request=req, response=http_res
|
|
3144
|
+
)
|
|
3145
|
+
raise errors.BadRequest(response_data, http_res)
|
|
3146
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
3147
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
3148
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3149
|
+
request=req, response=http_res
|
|
3150
|
+
)
|
|
3151
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
3152
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
3153
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
3154
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3155
|
+
request=req, response=http_res
|
|
3156
|
+
)
|
|
3157
|
+
raise errors.Forbidden(response_data, http_res)
|
|
3158
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
3159
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
3160
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3161
|
+
request=req, response=http_res
|
|
3162
|
+
)
|
|
3163
|
+
raise errors.NotFound(response_data, http_res)
|
|
3164
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
3165
|
+
response_data = unmarshal_json_response(
|
|
3166
|
+
errors.InternalServerErrorUnion, http_res
|
|
3167
|
+
)
|
|
3168
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3169
|
+
request=req, response=http_res
|
|
3170
|
+
)
|
|
3171
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
3172
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3173
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3174
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
3175
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3176
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3177
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
3178
|
+
|
|
3179
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
3180
|
+
|
|
3181
|
+
def list_option_expiry_dates(
|
|
3182
|
+
self,
|
|
3183
|
+
*,
|
|
3184
|
+
symbol: str,
|
|
3185
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3186
|
+
server_url: Optional[str] = None,
|
|
3187
|
+
timeout_ms: Optional[int] = None,
|
|
3188
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3189
|
+
) -> models.ListOptionExpiryDatesResponse:
|
|
3190
|
+
r"""Get Options Expiry Dates
|
|
3191
|
+
|
|
3192
|
+
Retrieve all available expiration dates for options contracts of a specific underlying symbol. Returns a list of dates when options for the specified ticker expire.
|
|
3193
|
+
|
|
3194
|
+
If set, this operation will use `client_id` from the global security.
|
|
3195
|
+
|
|
3196
|
+
:param symbol: The underlying stock symbol (e.g., AAPL, TSLA, SPY)
|
|
3197
|
+
:param retries: Override the default retry configuration for this method
|
|
3198
|
+
:param server_url: Override the default server URL for this method
|
|
3199
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3200
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3201
|
+
"""
|
|
3202
|
+
base_url = None
|
|
3203
|
+
url_variables = None
|
|
3204
|
+
if timeout_ms is None:
|
|
3205
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3206
|
+
|
|
3207
|
+
if timeout_ms is None:
|
|
3208
|
+
timeout_ms = 30000
|
|
3209
|
+
|
|
3210
|
+
if server_url is not None:
|
|
3211
|
+
base_url = server_url
|
|
3212
|
+
else:
|
|
3213
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3214
|
+
|
|
3215
|
+
request = models.ListOptionExpiryDatesRequest(
|
|
3216
|
+
symbol=symbol,
|
|
3217
|
+
)
|
|
3218
|
+
|
|
3219
|
+
req = self._build_request(
|
|
3220
|
+
method="GET",
|
|
3221
|
+
path="/v1/options/{symbol}/expiry-dates",
|
|
3222
|
+
base_url=base_url,
|
|
3223
|
+
url_variables=url_variables,
|
|
3224
|
+
request=request,
|
|
3225
|
+
request_body_required=False,
|
|
3226
|
+
request_has_path_params=True,
|
|
3227
|
+
request_has_query_params=True,
|
|
3228
|
+
user_agent_header="user-agent",
|
|
3229
|
+
accept_header_value="application/json",
|
|
3230
|
+
http_headers=http_headers,
|
|
3231
|
+
security=self.sdk_configuration.security,
|
|
3232
|
+
allow_empty_value=None,
|
|
3233
|
+
allowed_fields=["client_id"],
|
|
3234
|
+
timeout_ms=timeout_ms,
|
|
3235
|
+
)
|
|
3236
|
+
|
|
3237
|
+
if retries == UNSET:
|
|
3238
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3239
|
+
retries = self.sdk_configuration.retry_config
|
|
3240
|
+
else:
|
|
3241
|
+
retries = utils.RetryConfig(
|
|
3242
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
3243
|
+
)
|
|
3244
|
+
|
|
3245
|
+
retry_config = None
|
|
3246
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3247
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3248
|
+
|
|
3249
|
+
http_res = self.do_request(
|
|
3250
|
+
hook_ctx=HookContext(
|
|
3251
|
+
config=self.sdk_configuration,
|
|
3252
|
+
base_url=base_url or "",
|
|
3253
|
+
operation_id="listOptionExpiryDates",
|
|
3254
|
+
oauth2_scopes=["market:supplemental"],
|
|
3255
|
+
security_source=self.sdk_configuration.security,
|
|
3256
|
+
tags=["Options"],
|
|
3257
|
+
extensions=None,
|
|
3258
|
+
),
|
|
3259
|
+
request=req,
|
|
3260
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
3261
|
+
retry_config=retry_config,
|
|
3262
|
+
)
|
|
3263
|
+
|
|
3264
|
+
response_data: Any = None
|
|
3265
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
3266
|
+
return models.ListOptionExpiryDatesResponse(
|
|
3267
|
+
option_expiry_dates_response=unmarshal_json_response(
|
|
3268
|
+
Optional[models.OptionExpiryDatesResponse], http_res
|
|
3269
|
+
),
|
|
3270
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
3271
|
+
)
|
|
3272
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
3273
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
3274
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3275
|
+
request=req, response=http_res
|
|
3276
|
+
)
|
|
3277
|
+
raise errors.BadRequest(response_data, http_res)
|
|
3278
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
3279
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
3280
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3281
|
+
request=req, response=http_res
|
|
3282
|
+
)
|
|
3283
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
3284
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
3285
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
3286
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3287
|
+
request=req, response=http_res
|
|
3288
|
+
)
|
|
3289
|
+
raise errors.Forbidden(response_data, http_res)
|
|
3290
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
3291
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
3292
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3293
|
+
request=req, response=http_res
|
|
3294
|
+
)
|
|
3295
|
+
raise errors.NotFound(response_data, http_res)
|
|
3296
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
3297
|
+
response_data = unmarshal_json_response(
|
|
3298
|
+
errors.InternalServerErrorUnion, http_res
|
|
3299
|
+
)
|
|
3300
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3301
|
+
request=req, response=http_res
|
|
3302
|
+
)
|
|
3303
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
3304
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3305
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3306
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
3307
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3308
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
3309
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
3310
|
+
|
|
3311
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
3312
|
+
|
|
3313
|
+
async def list_option_expiry_dates_async(
|
|
3314
|
+
self,
|
|
3315
|
+
*,
|
|
3316
|
+
symbol: str,
|
|
3317
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
3318
|
+
server_url: Optional[str] = None,
|
|
3319
|
+
timeout_ms: Optional[int] = None,
|
|
3320
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
3321
|
+
) -> models.ListOptionExpiryDatesResponse:
|
|
3322
|
+
r"""Get Options Expiry Dates
|
|
3323
|
+
|
|
3324
|
+
Retrieve all available expiration dates for options contracts of a specific underlying symbol. Returns a list of dates when options for the specified ticker expire.
|
|
3325
|
+
|
|
3326
|
+
If set, this operation will use `client_id` from the global security.
|
|
3327
|
+
|
|
3328
|
+
:param symbol: The underlying stock symbol (e.g., AAPL, TSLA, SPY)
|
|
3329
|
+
:param retries: Override the default retry configuration for this method
|
|
3330
|
+
:param server_url: Override the default server URL for this method
|
|
3331
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
3332
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
3333
|
+
"""
|
|
3334
|
+
base_url = None
|
|
3335
|
+
url_variables = None
|
|
3336
|
+
if timeout_ms is None:
|
|
3337
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
3338
|
+
|
|
3339
|
+
if timeout_ms is None:
|
|
3340
|
+
timeout_ms = 30000
|
|
3341
|
+
|
|
3342
|
+
if server_url is not None:
|
|
3343
|
+
base_url = server_url
|
|
3344
|
+
else:
|
|
3345
|
+
base_url = self._get_url(base_url, url_variables)
|
|
3346
|
+
|
|
3347
|
+
request = models.ListOptionExpiryDatesRequest(
|
|
3348
|
+
symbol=symbol,
|
|
3349
|
+
)
|
|
3350
|
+
|
|
3351
|
+
req = self._build_request_async(
|
|
3352
|
+
method="GET",
|
|
3353
|
+
path="/v1/options/{symbol}/expiry-dates",
|
|
3354
|
+
base_url=base_url,
|
|
3355
|
+
url_variables=url_variables,
|
|
3356
|
+
request=request,
|
|
3357
|
+
request_body_required=False,
|
|
3358
|
+
request_has_path_params=True,
|
|
3359
|
+
request_has_query_params=True,
|
|
3360
|
+
user_agent_header="user-agent",
|
|
3361
|
+
accept_header_value="application/json",
|
|
3362
|
+
http_headers=http_headers,
|
|
3363
|
+
security=self.sdk_configuration.security,
|
|
3364
|
+
allow_empty_value=None,
|
|
3365
|
+
allowed_fields=["client_id"],
|
|
3366
|
+
timeout_ms=timeout_ms,
|
|
3367
|
+
)
|
|
3368
|
+
|
|
3369
|
+
if retries == UNSET:
|
|
3370
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
3371
|
+
retries = self.sdk_configuration.retry_config
|
|
3372
|
+
else:
|
|
3373
|
+
retries = utils.RetryConfig(
|
|
3374
|
+
"backoff", utils.BackoffStrategy(500, 8000, 1.5, 60000), True
|
|
3375
|
+
)
|
|
3376
|
+
|
|
3377
|
+
retry_config = None
|
|
3378
|
+
if isinstance(retries, utils.RetryConfig):
|
|
3379
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
3380
|
+
|
|
3381
|
+
http_res = await self.do_request_async(
|
|
3382
|
+
hook_ctx=HookContext(
|
|
3383
|
+
config=self.sdk_configuration,
|
|
3384
|
+
base_url=base_url or "",
|
|
3385
|
+
operation_id="listOptionExpiryDates",
|
|
3386
|
+
oauth2_scopes=["market:supplemental"],
|
|
3387
|
+
security_source=self.sdk_configuration.security,
|
|
3388
|
+
tags=["Options"],
|
|
3389
|
+
extensions=None,
|
|
3390
|
+
),
|
|
3391
|
+
request=req,
|
|
3392
|
+
is_error_status_code=lambda c: utils.match_status_codes(["4XX", "5XX"], c),
|
|
3393
|
+
retry_config=retry_config,
|
|
3394
|
+
)
|
|
3395
|
+
|
|
3396
|
+
response_data: Any = None
|
|
3397
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
3398
|
+
return models.ListOptionExpiryDatesResponse(
|
|
3399
|
+
option_expiry_dates_response=unmarshal_json_response(
|
|
3400
|
+
Optional[models.OptionExpiryDatesResponse], http_res
|
|
3401
|
+
),
|
|
3402
|
+
http_meta=models.HTTPMetadata(request=req, response=http_res),
|
|
3403
|
+
)
|
|
3404
|
+
if utils.match_response(http_res, "400", "application/json"):
|
|
3405
|
+
response_data = unmarshal_json_response(errors.BadRequestUnion, http_res)
|
|
3406
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3407
|
+
request=req, response=http_res
|
|
3408
|
+
)
|
|
3409
|
+
raise errors.BadRequest(response_data, http_res)
|
|
3410
|
+
if utils.match_response(http_res, "401", "application/json"):
|
|
3411
|
+
response_data = unmarshal_json_response(errors.UnauthorizedUnion, http_res)
|
|
3412
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3413
|
+
request=req, response=http_res
|
|
3414
|
+
)
|
|
3415
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
3416
|
+
if utils.match_response(http_res, "403", "application/json"):
|
|
3417
|
+
response_data = unmarshal_json_response(errors.ForbiddenUnion, http_res)
|
|
3418
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3419
|
+
request=req, response=http_res
|
|
3420
|
+
)
|
|
3421
|
+
raise errors.Forbidden(response_data, http_res)
|
|
3422
|
+
if utils.match_response(http_res, "404", "application/json"):
|
|
3423
|
+
response_data = unmarshal_json_response(errors.NotFoundUnion, http_res)
|
|
3424
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3425
|
+
request=req, response=http_res
|
|
3426
|
+
)
|
|
3427
|
+
raise errors.NotFound(response_data, http_res)
|
|
3428
|
+
if utils.match_response(http_res, "500", "application/json"):
|
|
3429
|
+
response_data = unmarshal_json_response(
|
|
3430
|
+
errors.InternalServerErrorUnion, http_res
|
|
3431
|
+
)
|
|
3432
|
+
response_data.http_meta = models.HTTPMetadata(
|
|
3433
|
+
request=req, response=http_res
|
|
3434
|
+
)
|
|
3435
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
3436
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
3437
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3438
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
3439
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
3440
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
3441
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
3442
|
+
|
|
3443
|
+
raise errors.APIError("Unexpected response received", http_res)
|