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