twelve_data_client/apis/
reference_data_api.rs

1/*
2 * Twelve Data API
3 *
4 * ## Overview  Welcome to Twelve Data developer docs — your gateway to comprehensive financial market data through a powerful and easy-to-use API. Twelve Data provides access to financial markets across over 50 global countries, covering more than 1 million public instruments, including stocks, forex, ETFs, mutual funds, commodities, and cryptocurrencies.  ## Quickstart  To get started, you'll need to sign up for an API key. Once you have your API key, you can start making requests to the API.  ### Step 1: Create Twelve Data account  Sign up on the Twelve Data website to create your account [here](https://twelvedata.com/register). This gives you access to the API dashboard and your API key.  ### Step 2: Get your API key  After signing in, navigate to your [dashboard](https://twelvedata.com/account/api-keys) to find your unique API key. This key is required to authenticate all API and WebSocket requests.  ### Step 3: Make your first request  Try a simple API call with cURL to fetch the latest price for Apple (AAPL):  ``` curl \"https://api.twelvedata.com/price?symbol=AAPL&apikey=your_api_key\" ```  ### Step 4: Make a request from Python or Javascript  Use our client libraries or standard HTTP clients to make API calls programmatically. Here’s an example in [Python](https://github.com/twelvedata/twelvedata-python) and JavaScript:  #### Python (using official Twelve Data SDK):  ```python from twelvedata import TDClient  # Initialize client with your API key td = TDClient(apikey=\"your_api_key\")  # Get latest price for Apple price = td.price(symbol=\"AAPL\").as_json()  print(price) ```  #### JavaScript (Node.js):  ```javascript const fetch = require('node-fetch');  fetch('https://api.twelvedata.com/price?symbol=AAPL&apikey=your_api_key') &nbsp;&nbsp;.then(response => response.json()) &nbsp;&nbsp;.then(data => console.log(data)); ```  ### Step 5: Perform correlation analysis between Tesla and Microsoft prices  Fetch historical price data for Tesla (TSLA) and Microsoft (MSFT) and calculate the correlation of their closing prices:  ```python from twelvedata import TDClient import pandas as pd  # Initialize client with your API key td = TDClient(apikey=\"your_api_key\")  # Fetch historical price data for Tesla tsla_ts = td.time_series( &nbsp;&nbsp;&nbsp;&nbsp;symbol=\"TSLA\", &nbsp;&nbsp;&nbsp;&nbsp;interval=\"1day\", &nbsp;&nbsp;&nbsp;&nbsp;outputsize=100 ).as_pandas()  # Fetch historical price data for Microsoft msft_ts = td.time_series( &nbsp;&nbsp;&nbsp;&nbsp;symbol=\"MSFT\", &nbsp;&nbsp;&nbsp;&nbsp;interval=\"1day\", &nbsp;&nbsp;&nbsp;&nbsp;outputsize=100 ).as_pandas()  # Align data on datetime index combined = pd.concat( &nbsp;&nbsp;&nbsp;&nbsp;[tsla_ts['close'].astype(float), msft_ts['close'].astype(float)], &nbsp;&nbsp;&nbsp;&nbsp;axis=1, &nbsp;&nbsp;&nbsp;&nbsp;keys=[\"TSLA\", \"MSFT\"] ).dropna()  # Calculate correlation correlation = combined[\"TSLA\"].corr(combined[\"MSFT\"]) print(f\"Correlation of closing prices between TSLA and MSFT: {correlation:.2f}\") ```  ### Authentication  Authenticate your requests using one of these methods:  #### Query parameter method ``` GET https://api.twelvedata.com/endpoint?symbol=AAPL&apikey=your_api_key ```  #### HTTP header method (recommended) ``` Authorization: apikey your_api_key ```  ##### API key useful information <ul> <li> Demo API key (<code>apikey=demo</code>) available for demo requests</li> <li> Personal API key required for full access</li> <li> Premium endpoints and data require higher-tier plans (testable with <a href=\"https://twelvedata.com/exchanges\">trial symbols</a>)</li> </ul>  ### API endpoints   Service | Base URL | ---------|----------|  REST API | `https://api.twelvedata.com` |  WebSocket | `wss://ws.twelvedata.com` |  ### Parameter guidelines <ul> <li><b>Separator:</b> Use <code>&</code> to separate multiple parameters</li> <li><b>Case sensitivity:</b> Parameter names are case-insensitive</li>  <ul><li><code>symbol=AAPL</code> = <code>symbol=aapl</code></li></ul>  <li><b>Multiple values:</b> Separate with commas where supported</li> </ul>  ### Response handling  #### Default format All responses return JSON format by default unless otherwise specified.  #### Null values <b>Important:</b> Some response fields may contain `null` values when data is unavailable for specific metrics. This is expected behavior, not an error.  ##### Best Practices: <ul> <li>Always implement <code>null</code> value handling in your application</li> <li>Use defensive programming techniques for data processing</li> <li>Consider fallback values or error handling for critical metrics</li> </ul>  #### Error handling Structure your code to gracefully handle: <ul> <li>Network timeouts</li> <li>Rate limiting responses</li> <li>Invalid parameter errors</li> <li>Data unavailability periods</li> </ul>  ##### Best practices <ul> <li><b>Rate limits:</b> Adhere to your plan’s rate limits to avoid throttling. Check your dashboard for details.</li> <li><b>Error handling:</b> Implement retry logic for transient errors (e.g., <code>429 Too Many Requests</code>).</li> <li><b>Caching:</b> Cache responses for frequently accessed data to reduce API calls and improve performance.</li> <li><b>Secure storage:</b> Store your API key securely and never expose it in client-side code or public repositories.</li> </ul>  ## Errors  Twelve Data API employs a standardized error response format, delivering a JSON object with `code`, `message`, and `status` keys for clear and consistent error communication.  ### Codes  Below is a table of possible error codes, their HTTP status, meanings, and resolution steps:   Code | status | Meaning | Resolution |  --- | --- | --- | --- |  **400** | Bad Request | Invalid or incorrect parameter(s) provided. | Check the `message` in the response for details. Refer to the API Documenta­tion to correct the input. |  **401** | Unauthor­ized | Invalid or incorrect API key. | Verify your API key is correct. Sign up for a key <a href=\"https://twelvedata.com/account/api-keys\">here</a>. |  **403** | Forbidden | API key lacks permissions for the requested resource (upgrade required). | Upgrade your plan <a href=\"https://twelvedata.com/pricing\">here</a>. |  **404** | Not Found | Requested data could not be found. | Adjust parameters to be less strict as they may be too restrictive. |  **414** | Parameter Too Long | Input parameter array exceeds the allowed length. | Follow the `message` guidance to adjust the parameter length. |  **429** | Too Many Requests | API request limit reached for your key. | Wait briefly or upgrade your plan <a href=\"https://twelvedata.com/pricing\">here</a>. |  **500** | Internal Server Error | Server-side issue occurred; retry later. | Contact support <a href=\"https://twelvedata.com/contact\">here</a> for assistance. |  ### Example error response  Consider the following invalid request:  ``` https://api.twelvedata.com/time_series?symbol=AAPL&interval=0.99min&apikey=your_api_key ```  Due to the incorrect `interval` value, the API returns:  ```json { &nbsp;&nbsp;\"code\": 400, &nbsp;&nbsp;\"message\": \"Invalid **interval** provided: 0.99min. Supported intervals: 1min, 5min, 15min, 30min, 45min, 1h, 2h, 4h, 8h, 1day, 1week, 1month\", &nbsp;&nbsp;\"status\": \"error\" } ```  Refer to the API Documentation for valid parameter values to resolve such errors.  ## Libraries  Twelve Data provides a growing ecosystem of libraries and integrations to help you build faster and smarter in your preferred environment. Official libraries are actively maintained by the Twelve Data team, while selected community-built libraries offer additional flexibility.  A full list is available on our [GitHub profile](https://github.com/search?q=twelvedata).  ### Official SDKs <ul> <li><b>Python:</b> <a href=\"https://github.com/twelvedata/twelvedata-python\">twelvedata-python</a></li> <li><b>R:</b> <a href=\"https://github.com/twelvedata/twelvedata-r-sdk\">twelvedata-r-sdk</a></li> </ul>  ### AI integrations <ul> <li><b>Twelve Data MCP Server:</b> <a href=\"https://github.com/twelvedata/mcp\">Repository</a> — Model Context Protocol (MCP) server that provides seamless integration with AI assistants and language models, enabling direct access to Twelve Data's financial market data within conversational interfaces and AI workflows.</li> </ul>  ### Spreadsheet add-ons <ul> <li><b>Excel:</b> <a href=\"https://twelvedata.com/excel\">Excel Add-in</a></li> <li><b>Google Sheets:</b> <a href=\"https://twelvedata.com/google-sheets\">Google Sheets Add-on</a></li> </ul>  ### Community libraries  The community has developed libraries in several popular languages. You can explore more community libraries on [GitHub](https://github.com/search?q=twelvedata). <ul> <li><b>C#:</b> <a href=\"https://github.com/pseudomarkets/TwelveDataSharp\">TwelveDataSharp</a></li> <li><b>JavaScript:</b> <a href=\"https://github.com/evzaboun/twelvedata\">twelvedata</a></li> <li><b>PHP:</b> <a href=\"https://github.com/ingelby/twelvedata\">twelvedata</a></li> <li><b>Go:</b> <a href=\"https://github.com/soulgarden/twelvedata\">twelvedata</a></li> <li><b>TypeScript:</b> <a href=\"https://github.com/Clyde-Goodall/twelve-data-wrapper\">twelve-data-wrapper</a></li> </ul>  ### Other Twelve Data repositories <ul> <li><b>searchindex</b> <i>(Go)</i>: <a href=\"https://github.com/twelvedata/searchindex\">Repository</a> — In-memory search index by strings</li> <li><b>ws-tools</b> <i>(Python)</i>: <a href=\"https://github.com/twelvedata/ws-tools\">Repository</a> — Utility tools for WebSocket stream handling</li> </ul>  ### API specification <ul> <li><b>OpenAPI / Swagger:</b> Access the <a href=\"https://api.twelvedata.com/doc/swagger/openapi.json\">complete API specification</a> in OpenAPI format. You can use this file to automatically generate client libraries in your preferred programming language, explore the API interactively via Swagger tools, or integrate Twelve Data seamlessly into your AI and LLM workflows.</li> </ul>
5 *
6 * The version of the OpenAPI document: 0.0.1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16/// struct for passing parameters to the method [`get_bonds`]
17#[derive(Clone, Debug, Default, Serialize, Deserialize)]
18pub struct GetBondsParams {
19    /// The ticker symbol of an instrument for which data is requested
20    pub symbol: Option<String>,
21    /// Filter by exchange name
22    pub exchange: Option<String>,
23    /// Filter by country name or alpha code, e.g., `United States` or `US`
24    pub country: Option<String>,
25    /// The format of the response data
26    pub format: Option<String>,
27    /// The separator used in the CSV response data
28    pub delimiter: Option<String>,
29    /// Adds info on which plan symbol is available
30    pub show_plan: Option<bool>,
31    /// Page number of the results to fetch
32    pub page: Option<i64>,
33    /// Determines the number of data points returned in the output
34    pub outputsize: Option<i64>,
35}
36
37impl GetBondsParams {
38    /// Create a new builder for this parameter struct
39    pub fn builder() -> GetBondsParamsBuilder {
40        GetBondsParamsBuilder::default()
41    }
42}
43
44/// Builder for [`GetBondsParams`]
45#[derive(Clone, Debug, Default)]
46pub struct GetBondsParamsBuilder {
47    /// The ticker symbol of an instrument for which data is requested
48    symbol: Option<String>,
49    /// Filter by exchange name
50    exchange: Option<String>,
51    /// Filter by country name or alpha code, e.g., `United States` or `US`
52    country: Option<String>,
53    /// The format of the response data
54    format: Option<String>,
55    /// The separator used in the CSV response data
56    delimiter: Option<String>,
57    /// Adds info on which plan symbol is available
58    show_plan: Option<bool>,
59    /// Page number of the results to fetch
60    page: Option<i64>,
61    /// Determines the number of data points returned in the output
62    outputsize: Option<i64>,
63}
64
65impl GetBondsParamsBuilder {
66    /// The ticker symbol of an instrument for which data is requested
67    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
68        self.symbol = Some(symbol.into());
69        self
70    }
71    /// Filter by exchange name
72    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
73        self.exchange = Some(exchange.into());
74        self
75    }
76    /// Filter by country name or alpha code, e.g., `United States` or `US`
77    pub fn country(mut self, country: impl Into<String>) -> Self {
78        self.country = Some(country.into());
79        self
80    }
81    /// The format of the response data
82    pub fn format(mut self, format: impl Into<String>) -> Self {
83        self.format = Some(format.into());
84        self
85    }
86    /// The separator used in the CSV response data
87    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
88        self.delimiter = Some(delimiter.into());
89        self
90    }
91    /// Adds info on which plan symbol is available
92    pub fn show_plan(mut self, show_plan: bool) -> Self {
93        self.show_plan = Some(show_plan);
94        self
95    }
96    /// Page number of the results to fetch
97    pub fn page(mut self, page: i64) -> Self {
98        self.page = Some(page);
99        self
100    }
101    /// Determines the number of data points returned in the output
102    pub fn outputsize(mut self, outputsize: i64) -> Self {
103        self.outputsize = Some(outputsize);
104        self
105    }
106
107    /// Build the parameter struct
108    pub fn build(self) -> GetBondsParams {
109        GetBondsParams {
110            symbol: self.symbol,
111            exchange: self.exchange,
112            country: self.country,
113            format: self.format,
114            delimiter: self.delimiter,
115            show_plan: self.show_plan,
116            page: self.page,
117            outputsize: self.outputsize,
118        }
119    }
120}
121
122/// struct for passing parameters to the method [`get_commodities`]
123#[derive(Clone, Debug, Default, Serialize, Deserialize)]
124pub struct GetCommoditiesParams {
125    /// The ticker symbol of an instrument for which data is requested
126    pub symbol: Option<String>,
127    /// Filter by category of commodity
128    pub category: Option<String>,
129    /// The format of the response data
130    pub format: Option<String>,
131    /// The separator used in the CSV response data
132    pub delimiter: Option<String>,
133}
134
135impl GetCommoditiesParams {
136    /// Create a new builder for this parameter struct
137    pub fn builder() -> GetCommoditiesParamsBuilder {
138        GetCommoditiesParamsBuilder::default()
139    }
140}
141
142/// Builder for [`GetCommoditiesParams`]
143#[derive(Clone, Debug, Default)]
144pub struct GetCommoditiesParamsBuilder {
145    /// The ticker symbol of an instrument for which data is requested
146    symbol: Option<String>,
147    /// Filter by category of commodity
148    category: Option<String>,
149    /// The format of the response data
150    format: Option<String>,
151    /// The separator used in the CSV response data
152    delimiter: Option<String>,
153}
154
155impl GetCommoditiesParamsBuilder {
156    /// The ticker symbol of an instrument for which data is requested
157    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
158        self.symbol = Some(symbol.into());
159        self
160    }
161    /// Filter by category of commodity
162    pub fn category(mut self, category: impl Into<String>) -> Self {
163        self.category = Some(category.into());
164        self
165    }
166    /// The format of the response data
167    pub fn format(mut self, format: impl Into<String>) -> Self {
168        self.format = Some(format.into());
169        self
170    }
171    /// The separator used in the CSV response data
172    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
173        self.delimiter = Some(delimiter.into());
174        self
175    }
176
177    /// Build the parameter struct
178    pub fn build(self) -> GetCommoditiesParams {
179        GetCommoditiesParams {
180            symbol: self.symbol,
181            category: self.category,
182            format: self.format,
183            delimiter: self.delimiter,
184        }
185    }
186}
187
188/// struct for passing parameters to the method [`get_cross_listings`]
189#[derive(Clone, Debug, Default, Serialize, Deserialize)]
190pub struct GetCrossListingsParams {
191    /// The ticker symbol of an instrument for which data is requested
192    pub symbol: String,
193    /// Exchange where instrument is traded
194    pub exchange: Option<String>,
195    /// Market identifier code (MIC) under ISO 10383 standard
196    pub mic_code: Option<String>,
197    /// Country to which stock exchange belongs to
198    pub country: Option<String>,
199}
200
201impl GetCrossListingsParams {
202    /// Create a new builder for this parameter struct
203    pub fn builder() -> GetCrossListingsParamsBuilder {
204        GetCrossListingsParamsBuilder::default()
205    }
206}
207
208/// Builder for [`GetCrossListingsParams`]
209#[derive(Clone, Debug, Default)]
210pub struct GetCrossListingsParamsBuilder {
211    /// The ticker symbol of an instrument for which data is requested
212    symbol: String,
213    /// Exchange where instrument is traded
214    exchange: Option<String>,
215    /// Market identifier code (MIC) under ISO 10383 standard
216    mic_code: Option<String>,
217    /// Country to which stock exchange belongs to
218    country: Option<String>,
219}
220
221impl GetCrossListingsParamsBuilder {
222    /// The ticker symbol of an instrument for which data is requested
223    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
224        self.symbol = symbol.into();
225        self
226    }
227    /// Exchange where instrument is traded
228    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
229        self.exchange = Some(exchange.into());
230        self
231    }
232    /// Market identifier code (MIC) under ISO 10383 standard
233    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
234        self.mic_code = Some(mic_code.into());
235        self
236    }
237    /// Country to which stock exchange belongs to
238    pub fn country(mut self, country: impl Into<String>) -> Self {
239        self.country = Some(country.into());
240        self
241    }
242
243    /// Build the parameter struct
244    pub fn build(self) -> GetCrossListingsParams {
245        GetCrossListingsParams {
246            symbol: self.symbol,
247            exchange: self.exchange,
248            mic_code: self.mic_code,
249            country: self.country,
250        }
251    }
252}
253
254/// struct for passing parameters to the method [`get_cryptocurrencies`]
255#[derive(Clone, Debug, Default, Serialize, Deserialize)]
256pub struct GetCryptocurrenciesParams {
257    /// The ticker symbol of an instrument for which data is requested
258    pub symbol: Option<String>,
259    /// Filter by exchange name. E.g. `Binance`, `Coinbase`, etc.
260    pub exchange: Option<String>,
261    /// Filter by currency base
262    pub currency_base: Option<String>,
263    /// Filter by currency quote
264    pub currency_quote: Option<String>,
265    /// The format of the response data
266    pub format: Option<String>,
267    /// The separator used in the CSV response data
268    pub delimiter: Option<String>,
269}
270
271impl GetCryptocurrenciesParams {
272    /// Create a new builder for this parameter struct
273    pub fn builder() -> GetCryptocurrenciesParamsBuilder {
274        GetCryptocurrenciesParamsBuilder::default()
275    }
276}
277
278/// Builder for [`GetCryptocurrenciesParams`]
279#[derive(Clone, Debug, Default)]
280pub struct GetCryptocurrenciesParamsBuilder {
281    /// The ticker symbol of an instrument for which data is requested
282    symbol: Option<String>,
283    /// Filter by exchange name. E.g. `Binance`, `Coinbase`, etc.
284    exchange: Option<String>,
285    /// Filter by currency base
286    currency_base: Option<String>,
287    /// Filter by currency quote
288    currency_quote: Option<String>,
289    /// The format of the response data
290    format: Option<String>,
291    /// The separator used in the CSV response data
292    delimiter: Option<String>,
293}
294
295impl GetCryptocurrenciesParamsBuilder {
296    /// The ticker symbol of an instrument for which data is requested
297    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
298        self.symbol = Some(symbol.into());
299        self
300    }
301    /// Filter by exchange name. E.g. `Binance`, `Coinbase`, etc.
302    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
303        self.exchange = Some(exchange.into());
304        self
305    }
306    /// Filter by currency base
307    pub fn currency_base(mut self, currency_base: impl Into<String>) -> Self {
308        self.currency_base = Some(currency_base.into());
309        self
310    }
311    /// Filter by currency quote
312    pub fn currency_quote(mut self, currency_quote: impl Into<String>) -> Self {
313        self.currency_quote = Some(currency_quote.into());
314        self
315    }
316    /// The format of the response data
317    pub fn format(mut self, format: impl Into<String>) -> Self {
318        self.format = Some(format.into());
319        self
320    }
321    /// The separator used in the CSV response data
322    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
323        self.delimiter = Some(delimiter.into());
324        self
325    }
326
327    /// Build the parameter struct
328    pub fn build(self) -> GetCryptocurrenciesParams {
329        GetCryptocurrenciesParams {
330            symbol: self.symbol,
331            exchange: self.exchange,
332            currency_base: self.currency_base,
333            currency_quote: self.currency_quote,
334            format: self.format,
335            delimiter: self.delimiter,
336        }
337    }
338}
339
340/// struct for passing parameters to the method [`get_cryptocurrency_exchanges`]
341#[derive(Clone, Debug, Default, Serialize, Deserialize)]
342pub struct GetCryptocurrencyExchangesParams {
343    /// The format of the response data
344    pub format: Option<String>,
345    /// Specify the delimiter used when downloading the CSV file
346    pub delimiter: Option<String>,
347}
348
349impl GetCryptocurrencyExchangesParams {
350    /// Create a new builder for this parameter struct
351    pub fn builder() -> GetCryptocurrencyExchangesParamsBuilder {
352        GetCryptocurrencyExchangesParamsBuilder::default()
353    }
354}
355
356/// Builder for [`GetCryptocurrencyExchangesParams`]
357#[derive(Clone, Debug, Default)]
358pub struct GetCryptocurrencyExchangesParamsBuilder {
359    /// The format of the response data
360    format: Option<String>,
361    /// Specify the delimiter used when downloading the CSV file
362    delimiter: Option<String>,
363}
364
365impl GetCryptocurrencyExchangesParamsBuilder {
366    /// The format of the response data
367    pub fn format(mut self, format: impl Into<String>) -> Self {
368        self.format = Some(format.into());
369        self
370    }
371    /// Specify the delimiter used when downloading the CSV file
372    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
373        self.delimiter = Some(delimiter.into());
374        self
375    }
376
377    /// Build the parameter struct
378    pub fn build(self) -> GetCryptocurrencyExchangesParams {
379        GetCryptocurrencyExchangesParams {
380            format: self.format,
381            delimiter: self.delimiter,
382        }
383    }
384}
385
386/// struct for passing parameters to the method [`get_earliest_timestamp`]
387#[derive(Clone, Debug, Default, Serialize, Deserialize)]
388pub struct GetEarliestTimestampParams {
389    /// Interval between two consecutive points in time series.
390    pub interval: String,
391    /// Symbol ticker of the instrument.
392    pub symbol: Option<String>,
393    /// Filter by financial instrument global identifier (FIGI).
394    pub figi: Option<String>,
395    /// Filter by international securities identification number (ISIN)
396    pub isin: Option<String>,
397    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
398    pub cusip: Option<String>,
399    /// Exchange where instrument is traded.
400    pub exchange: Option<String>,
401    /// Market Identifier Code (MIC) under ISO 10383 standard.
402    pub mic_code: Option<String>,
403    /// Timezone at which output datetime will be displayed. Supports: <ul> <li>1. <code>Exchange</code> for local exchange time</li> <li>2. <code>UTC</code> for datetime at universal UTC standard</li> <li>3. Timezone name according to the IANA Time Zone Database. E.g. <code>America/New_York</code>, <code>Asia/Singapore</code>. Full list of timezones can be found <a href=\"https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\" target=\"blank\">here</a>.</li> </ul> <i>Take note that the IANA Timezone name is case-sensitive</i>
404    pub timezone: Option<String>,
405}
406
407impl GetEarliestTimestampParams {
408    /// Create a new builder for this parameter struct
409    pub fn builder() -> GetEarliestTimestampParamsBuilder {
410        GetEarliestTimestampParamsBuilder::default()
411    }
412}
413
414/// Builder for [`GetEarliestTimestampParams`]
415#[derive(Clone, Debug, Default)]
416pub struct GetEarliestTimestampParamsBuilder {
417    /// Interval between two consecutive points in time series.
418    interval: String,
419    /// Symbol ticker of the instrument.
420    symbol: Option<String>,
421    /// Filter by financial instrument global identifier (FIGI).
422    figi: Option<String>,
423    /// Filter by international securities identification number (ISIN)
424    isin: Option<String>,
425    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
426    cusip: Option<String>,
427    /// Exchange where instrument is traded.
428    exchange: Option<String>,
429    /// Market Identifier Code (MIC) under ISO 10383 standard.
430    mic_code: Option<String>,
431    /// Timezone at which output datetime will be displayed. Supports: <ul> <li>1. <code>Exchange</code> for local exchange time</li> <li>2. <code>UTC</code> for datetime at universal UTC standard</li> <li>3. Timezone name according to the IANA Time Zone Database. E.g. <code>America/New_York</code>, <code>Asia/Singapore</code>. Full list of timezones can be found <a href=\"https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\" target=\"blank\">here</a>.</li> </ul> <i>Take note that the IANA Timezone name is case-sensitive</i>
432    timezone: Option<String>,
433}
434
435impl GetEarliestTimestampParamsBuilder {
436    /// Interval between two consecutive points in time series.
437    pub fn interval(mut self, interval: impl Into<String>) -> Self {
438        self.interval = interval.into();
439        self
440    }
441    /// Symbol ticker of the instrument.
442    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
443        self.symbol = Some(symbol.into());
444        self
445    }
446    /// Filter by financial instrument global identifier (FIGI).
447    pub fn figi(mut self, figi: impl Into<String>) -> Self {
448        self.figi = Some(figi.into());
449        self
450    }
451    /// Filter by international securities identification number (ISIN)
452    pub fn isin(mut self, isin: impl Into<String>) -> Self {
453        self.isin = Some(isin.into());
454        self
455    }
456    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
457    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
458        self.cusip = Some(cusip.into());
459        self
460    }
461    /// Exchange where instrument is traded.
462    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
463        self.exchange = Some(exchange.into());
464        self
465    }
466    /// Market Identifier Code (MIC) under ISO 10383 standard.
467    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
468        self.mic_code = Some(mic_code.into());
469        self
470    }
471    /// Timezone at which output datetime will be displayed. Supports: <ul> <li>1. <code>Exchange</code> for local exchange time</li> <li>2. <code>UTC</code> for datetime at universal UTC standard</li> <li>3. Timezone name according to the IANA Time Zone Database. E.g. <code>America/New_York</code>, <code>Asia/Singapore</code>. Full list of timezones can be found <a href=\"https://en.wikipedia.org/wiki/List_of_tz_database_time_zones\" target=\"blank\">here</a>.</li> </ul> <i>Take note that the IANA Timezone name is case-sensitive</i>
472    pub fn timezone(mut self, timezone: impl Into<String>) -> Self {
473        self.timezone = Some(timezone.into());
474        self
475    }
476
477    /// Build the parameter struct
478    pub fn build(self) -> GetEarliestTimestampParams {
479        GetEarliestTimestampParams {
480            interval: self.interval,
481            symbol: self.symbol,
482            figi: self.figi,
483            isin: self.isin,
484            cusip: self.cusip,
485            exchange: self.exchange,
486            mic_code: self.mic_code,
487            timezone: self.timezone,
488        }
489    }
490}
491
492/// struct for passing parameters to the method [`get_etf`]
493#[derive(Clone, Debug, Default, Serialize, Deserialize)]
494pub struct GetEtfParams {
495    /// The ticker symbol of an instrument for which data is requested
496    pub symbol: Option<String>,
497    /// Filter by financial instrument global identifier (FIGI)
498    pub figi: Option<String>,
499    /// Filter by international securities identification number (ISIN)
500    pub isin: Option<String>,
501    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
502    pub cusip: Option<String>,
503    /// The CIK of an instrument for which data is requested
504    pub cik: Option<String>,
505    /// Filter by exchange name
506    pub exchange: Option<String>,
507    /// Filter by market identifier code (MIC) under ISO 10383 standard
508    pub mic_code: Option<String>,
509    /// Filter by country name or alpha code, e.g., `United States` or `US`
510    pub country: Option<String>,
511    /// The format of the response data
512    pub format: Option<String>,
513    /// The separator used in the CSV response data
514    pub delimiter: Option<String>,
515    /// Adds info on which plan symbol is available
516    pub show_plan: Option<bool>,
517    /// Include delisted identifiers
518    pub include_delisted: Option<bool>,
519}
520
521impl GetEtfParams {
522    /// Create a new builder for this parameter struct
523    pub fn builder() -> GetEtfParamsBuilder {
524        GetEtfParamsBuilder::default()
525    }
526}
527
528/// Builder for [`GetEtfParams`]
529#[derive(Clone, Debug, Default)]
530pub struct GetEtfParamsBuilder {
531    /// The ticker symbol of an instrument for which data is requested
532    symbol: Option<String>,
533    /// Filter by financial instrument global identifier (FIGI)
534    figi: Option<String>,
535    /// Filter by international securities identification number (ISIN)
536    isin: Option<String>,
537    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
538    cusip: Option<String>,
539    /// The CIK of an instrument for which data is requested
540    cik: Option<String>,
541    /// Filter by exchange name
542    exchange: Option<String>,
543    /// Filter by market identifier code (MIC) under ISO 10383 standard
544    mic_code: Option<String>,
545    /// Filter by country name or alpha code, e.g., `United States` or `US`
546    country: Option<String>,
547    /// The format of the response data
548    format: Option<String>,
549    /// The separator used in the CSV response data
550    delimiter: Option<String>,
551    /// Adds info on which plan symbol is available
552    show_plan: Option<bool>,
553    /// Include delisted identifiers
554    include_delisted: Option<bool>,
555}
556
557impl GetEtfParamsBuilder {
558    /// The ticker symbol of an instrument for which data is requested
559    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
560        self.symbol = Some(symbol.into());
561        self
562    }
563    /// Filter by financial instrument global identifier (FIGI)
564    pub fn figi(mut self, figi: impl Into<String>) -> Self {
565        self.figi = Some(figi.into());
566        self
567    }
568    /// Filter by international securities identification number (ISIN)
569    pub fn isin(mut self, isin: impl Into<String>) -> Self {
570        self.isin = Some(isin.into());
571        self
572    }
573    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
574    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
575        self.cusip = Some(cusip.into());
576        self
577    }
578    /// The CIK of an instrument for which data is requested
579    pub fn cik(mut self, cik: impl Into<String>) -> Self {
580        self.cik = Some(cik.into());
581        self
582    }
583    /// Filter by exchange name
584    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
585        self.exchange = Some(exchange.into());
586        self
587    }
588    /// Filter by market identifier code (MIC) under ISO 10383 standard
589    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
590        self.mic_code = Some(mic_code.into());
591        self
592    }
593    /// Filter by country name or alpha code, e.g., `United States` or `US`
594    pub fn country(mut self, country: impl Into<String>) -> Self {
595        self.country = Some(country.into());
596        self
597    }
598    /// The format of the response data
599    pub fn format(mut self, format: impl Into<String>) -> Self {
600        self.format = Some(format.into());
601        self
602    }
603    /// The separator used in the CSV response data
604    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
605        self.delimiter = Some(delimiter.into());
606        self
607    }
608    /// Adds info on which plan symbol is available
609    pub fn show_plan(mut self, show_plan: bool) -> Self {
610        self.show_plan = Some(show_plan);
611        self
612    }
613    /// Include delisted identifiers
614    pub fn include_delisted(mut self, include_delisted: bool) -> Self {
615        self.include_delisted = Some(include_delisted);
616        self
617    }
618
619    /// Build the parameter struct
620    pub fn build(self) -> GetEtfParams {
621        GetEtfParams {
622            symbol: self.symbol,
623            figi: self.figi,
624            isin: self.isin,
625            cusip: self.cusip,
626            cik: self.cik,
627            exchange: self.exchange,
628            mic_code: self.mic_code,
629            country: self.country,
630            format: self.format,
631            delimiter: self.delimiter,
632            show_plan: self.show_plan,
633            include_delisted: self.include_delisted,
634        }
635    }
636}
637
638/// struct for passing parameters to the method [`get_etfs_family`]
639#[derive(Clone, Debug, Default, Serialize, Deserialize)]
640pub struct GetEtfsFamilyParams {
641    /// Filter by country name or alpha code, e.g., `United States` or `US`
642    pub country: Option<String>,
643    /// Filter by investment company that manages the fund
644    pub fund_family: Option<String>,
645}
646
647impl GetEtfsFamilyParams {
648    /// Create a new builder for this parameter struct
649    pub fn builder() -> GetEtfsFamilyParamsBuilder {
650        GetEtfsFamilyParamsBuilder::default()
651    }
652}
653
654/// Builder for [`GetEtfsFamilyParams`]
655#[derive(Clone, Debug, Default)]
656pub struct GetEtfsFamilyParamsBuilder {
657    /// Filter by country name or alpha code, e.g., `United States` or `US`
658    country: Option<String>,
659    /// Filter by investment company that manages the fund
660    fund_family: Option<String>,
661}
662
663impl GetEtfsFamilyParamsBuilder {
664    /// Filter by country name or alpha code, e.g., `United States` or `US`
665    pub fn country(mut self, country: impl Into<String>) -> Self {
666        self.country = Some(country.into());
667        self
668    }
669    /// Filter by investment company that manages the fund
670    pub fn fund_family(mut self, fund_family: impl Into<String>) -> Self {
671        self.fund_family = Some(fund_family.into());
672        self
673    }
674
675    /// Build the parameter struct
676    pub fn build(self) -> GetEtfsFamilyParams {
677        GetEtfsFamilyParams {
678            country: self.country,
679            fund_family: self.fund_family,
680        }
681    }
682}
683
684/// struct for passing parameters to the method [`get_etfs_list`]
685#[derive(Clone, Debug, Default, Serialize, Deserialize)]
686pub struct GetEtfsListParams {
687    /// Filter by symbol
688    pub symbol: Option<String>,
689    /// Filter by financial instrument global identifier (FIGI)
690    pub figi: Option<String>,
691    /// Filter by international securities identification number (ISIN)
692    pub isin: Option<String>,
693    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
694    pub cusip: Option<String>,
695    /// The CIK of an instrument for which data is requested
696    pub cik: Option<String>,
697    /// Filter by country name or alpha code, e.g., `United States` or `US`
698    pub country: Option<String>,
699    /// Filter by investment company that manages the fund
700    pub fund_family: Option<String>,
701    /// Filter by the type of fund
702    pub fund_type: Option<String>,
703    /// Page number
704    pub page: Option<i64>,
705    /// Number of records in response
706    pub outputsize: Option<i64>,
707}
708
709impl GetEtfsListParams {
710    /// Create a new builder for this parameter struct
711    pub fn builder() -> GetEtfsListParamsBuilder {
712        GetEtfsListParamsBuilder::default()
713    }
714}
715
716/// Builder for [`GetEtfsListParams`]
717#[derive(Clone, Debug, Default)]
718pub struct GetEtfsListParamsBuilder {
719    /// Filter by symbol
720    symbol: Option<String>,
721    /// Filter by financial instrument global identifier (FIGI)
722    figi: Option<String>,
723    /// Filter by international securities identification number (ISIN)
724    isin: Option<String>,
725    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
726    cusip: Option<String>,
727    /// The CIK of an instrument for which data is requested
728    cik: Option<String>,
729    /// Filter by country name or alpha code, e.g., `United States` or `US`
730    country: Option<String>,
731    /// Filter by investment company that manages the fund
732    fund_family: Option<String>,
733    /// Filter by the type of fund
734    fund_type: Option<String>,
735    /// Page number
736    page: Option<i64>,
737    /// Number of records in response
738    outputsize: Option<i64>,
739}
740
741impl GetEtfsListParamsBuilder {
742    /// Filter by symbol
743    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
744        self.symbol = Some(symbol.into());
745        self
746    }
747    /// Filter by financial instrument global identifier (FIGI)
748    pub fn figi(mut self, figi: impl Into<String>) -> Self {
749        self.figi = Some(figi.into());
750        self
751    }
752    /// Filter by international securities identification number (ISIN)
753    pub fn isin(mut self, isin: impl Into<String>) -> Self {
754        self.isin = Some(isin.into());
755        self
756    }
757    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
758    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
759        self.cusip = Some(cusip.into());
760        self
761    }
762    /// The CIK of an instrument for which data is requested
763    pub fn cik(mut self, cik: impl Into<String>) -> Self {
764        self.cik = Some(cik.into());
765        self
766    }
767    /// Filter by country name or alpha code, e.g., `United States` or `US`
768    pub fn country(mut self, country: impl Into<String>) -> Self {
769        self.country = Some(country.into());
770        self
771    }
772    /// Filter by investment company that manages the fund
773    pub fn fund_family(mut self, fund_family: impl Into<String>) -> Self {
774        self.fund_family = Some(fund_family.into());
775        self
776    }
777    /// Filter by the type of fund
778    pub fn fund_type(mut self, fund_type: impl Into<String>) -> Self {
779        self.fund_type = Some(fund_type.into());
780        self
781    }
782    /// Page number
783    pub fn page(mut self, page: i64) -> Self {
784        self.page = Some(page);
785        self
786    }
787    /// Number of records in response
788    pub fn outputsize(mut self, outputsize: i64) -> Self {
789        self.outputsize = Some(outputsize);
790        self
791    }
792
793    /// Build the parameter struct
794    pub fn build(self) -> GetEtfsListParams {
795        GetEtfsListParams {
796            symbol: self.symbol,
797            figi: self.figi,
798            isin: self.isin,
799            cusip: self.cusip,
800            cik: self.cik,
801            country: self.country,
802            fund_family: self.fund_family,
803            fund_type: self.fund_type,
804            page: self.page,
805            outputsize: self.outputsize,
806        }
807    }
808}
809
810/// struct for passing parameters to the method [`get_etfs_type`]
811#[derive(Clone, Debug, Default, Serialize, Deserialize)]
812pub struct GetEtfsTypeParams {
813    /// Filter by country name or alpha code, e.g., `United States` or `US`
814    pub country: Option<String>,
815    /// Filter by the type of fund
816    pub fund_type: Option<String>,
817}
818
819impl GetEtfsTypeParams {
820    /// Create a new builder for this parameter struct
821    pub fn builder() -> GetEtfsTypeParamsBuilder {
822        GetEtfsTypeParamsBuilder::default()
823    }
824}
825
826/// Builder for [`GetEtfsTypeParams`]
827#[derive(Clone, Debug, Default)]
828pub struct GetEtfsTypeParamsBuilder {
829    /// Filter by country name or alpha code, e.g., `United States` or `US`
830    country: Option<String>,
831    /// Filter by the type of fund
832    fund_type: Option<String>,
833}
834
835impl GetEtfsTypeParamsBuilder {
836    /// Filter by country name or alpha code, e.g., `United States` or `US`
837    pub fn country(mut self, country: impl Into<String>) -> Self {
838        self.country = Some(country.into());
839        self
840    }
841    /// Filter by the type of fund
842    pub fn fund_type(mut self, fund_type: impl Into<String>) -> Self {
843        self.fund_type = Some(fund_type.into());
844        self
845    }
846
847    /// Build the parameter struct
848    pub fn build(self) -> GetEtfsTypeParams {
849        GetEtfsTypeParams {
850            country: self.country,
851            fund_type: self.fund_type,
852        }
853    }
854}
855
856/// struct for passing parameters to the method [`get_exchange_schedule`]
857#[derive(Clone, Debug, Default, Serialize, Deserialize)]
858pub struct GetExchangeScheduleParams {
859    /// Filter by exchange name
860    pub mic_name: Option<String>,
861    /// Filter by market identifier code (MIC) under ISO 10383 standard
862    pub mic_code: Option<String>,
863    /// Filter by country name or alpha code, e.g., `United States` or `US`
864    pub country: Option<String>,
865    /// <p> If a date is provided, the API returns the schedule for the specified date; otherwise, it returns the default (common) schedule. </p> The date can be specified in one of the following formats: <ul> <li>An exact date (e.g., <code>2021-10-27</code>)</li> <li>A human-readable keyword: <code>today</code> or <code>yesterday</code></li> <li>A full datetime string in UTC (e.g., <code>2025-04-11T20:00:00</code>) to retrieve the schedule corresponding to the day in the specified time.</li> </ul> When using a datetime value, the resulting schedule will correspond to the local calendar day at the specified time. For example, <code>2025-04-11T20:00:00 UTC</code> corresponds to: <ul> <li><code>2025-04-11</code> in the <code>America/New_York</code> timezone</li> <li><code>2025-04-12</code> in the <code>Australia/Sydney</code> timezone</li> </ul>
866    pub date: Option<String>,
867}
868
869impl GetExchangeScheduleParams {
870    /// Create a new builder for this parameter struct
871    pub fn builder() -> GetExchangeScheduleParamsBuilder {
872        GetExchangeScheduleParamsBuilder::default()
873    }
874}
875
876/// Builder for [`GetExchangeScheduleParams`]
877#[derive(Clone, Debug, Default)]
878pub struct GetExchangeScheduleParamsBuilder {
879    /// Filter by exchange name
880    mic_name: Option<String>,
881    /// Filter by market identifier code (MIC) under ISO 10383 standard
882    mic_code: Option<String>,
883    /// Filter by country name or alpha code, e.g., `United States` or `US`
884    country: Option<String>,
885    /// <p> If a date is provided, the API returns the schedule for the specified date; otherwise, it returns the default (common) schedule. </p> The date can be specified in one of the following formats: <ul> <li>An exact date (e.g., <code>2021-10-27</code>)</li> <li>A human-readable keyword: <code>today</code> or <code>yesterday</code></li> <li>A full datetime string in UTC (e.g., <code>2025-04-11T20:00:00</code>) to retrieve the schedule corresponding to the day in the specified time.</li> </ul> When using a datetime value, the resulting schedule will correspond to the local calendar day at the specified time. For example, <code>2025-04-11T20:00:00 UTC</code> corresponds to: <ul> <li><code>2025-04-11</code> in the <code>America/New_York</code> timezone</li> <li><code>2025-04-12</code> in the <code>Australia/Sydney</code> timezone</li> </ul>
886    date: Option<String>,
887}
888
889impl GetExchangeScheduleParamsBuilder {
890    /// Filter by exchange name
891    pub fn mic_name(mut self, mic_name: impl Into<String>) -> Self {
892        self.mic_name = Some(mic_name.into());
893        self
894    }
895    /// Filter by market identifier code (MIC) under ISO 10383 standard
896    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
897        self.mic_code = Some(mic_code.into());
898        self
899    }
900    /// Filter by country name or alpha code, e.g., `United States` or `US`
901    pub fn country(mut self, country: impl Into<String>) -> Self {
902        self.country = Some(country.into());
903        self
904    }
905    /// <p> If a date is provided, the API returns the schedule for the specified date; otherwise, it returns the default (common) schedule. </p> The date can be specified in one of the following formats: <ul> <li>An exact date (e.g., <code>2021-10-27</code>)</li> <li>A human-readable keyword: <code>today</code> or <code>yesterday</code></li> <li>A full datetime string in UTC (e.g., <code>2025-04-11T20:00:00</code>) to retrieve the schedule corresponding to the day in the specified time.</li> </ul> When using a datetime value, the resulting schedule will correspond to the local calendar day at the specified time. For example, <code>2025-04-11T20:00:00 UTC</code> corresponds to: <ul> <li><code>2025-04-11</code> in the <code>America/New_York</code> timezone</li> <li><code>2025-04-12</code> in the <code>Australia/Sydney</code> timezone</li> </ul>
906    pub fn date(mut self, date: impl Into<String>) -> Self {
907        self.date = Some(date.into());
908        self
909    }
910
911    /// Build the parameter struct
912    pub fn build(self) -> GetExchangeScheduleParams {
913        GetExchangeScheduleParams {
914            mic_name: self.mic_name,
915            mic_code: self.mic_code,
916            country: self.country,
917            date: self.date,
918        }
919    }
920}
921
922/// struct for passing parameters to the method [`get_exchanges`]
923#[derive(Clone, Debug, Default, Serialize, Deserialize)]
924pub struct GetExchangesParams {
925    /// The asset class to which the instrument belongs
926    pub r#type: Option<String>,
927    /// Filter by exchange name
928    pub name: Option<String>,
929    /// Filter by market identifier code (MIC) under ISO 10383 standard
930    pub code: Option<String>,
931    /// Filter by country name or alpha code, e.g., `United States` or `US`
932    pub country: Option<String>,
933    /// The format of the response data
934    pub format: Option<String>,
935    /// The separator used in the CSV response data
936    pub delimiter: Option<String>,
937    /// Adds info on which plan symbol is available
938    pub show_plan: Option<bool>,
939}
940
941impl GetExchangesParams {
942    /// Create a new builder for this parameter struct
943    pub fn builder() -> GetExchangesParamsBuilder {
944        GetExchangesParamsBuilder::default()
945    }
946}
947
948/// Builder for [`GetExchangesParams`]
949#[derive(Clone, Debug, Default)]
950pub struct GetExchangesParamsBuilder {
951    /// The asset class to which the instrument belongs
952    r#type: Option<String>,
953    /// Filter by exchange name
954    name: Option<String>,
955    /// Filter by market identifier code (MIC) under ISO 10383 standard
956    code: Option<String>,
957    /// Filter by country name or alpha code, e.g., `United States` or `US`
958    country: Option<String>,
959    /// The format of the response data
960    format: Option<String>,
961    /// The separator used in the CSV response data
962    delimiter: Option<String>,
963    /// Adds info on which plan symbol is available
964    show_plan: Option<bool>,
965}
966
967impl GetExchangesParamsBuilder {
968    /// The asset class to which the instrument belongs
969    pub fn r#type(mut self, r#type: impl Into<String>) -> Self {
970        self.r#type = Some(r#type.into());
971        self
972    }
973    /// Filter by exchange name
974    pub fn name(mut self, name: impl Into<String>) -> Self {
975        self.name = Some(name.into());
976        self
977    }
978    /// Filter by market identifier code (MIC) under ISO 10383 standard
979    pub fn code(mut self, code: impl Into<String>) -> Self {
980        self.code = Some(code.into());
981        self
982    }
983    /// Filter by country name or alpha code, e.g., `United States` or `US`
984    pub fn country(mut self, country: impl Into<String>) -> Self {
985        self.country = Some(country.into());
986        self
987    }
988    /// The format of the response data
989    pub fn format(mut self, format: impl Into<String>) -> Self {
990        self.format = Some(format.into());
991        self
992    }
993    /// The separator used in the CSV response data
994    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
995        self.delimiter = Some(delimiter.into());
996        self
997    }
998    /// Adds info on which plan symbol is available
999    pub fn show_plan(mut self, show_plan: bool) -> Self {
1000        self.show_plan = Some(show_plan);
1001        self
1002    }
1003
1004    /// Build the parameter struct
1005    pub fn build(self) -> GetExchangesParams {
1006        GetExchangesParams {
1007            r#type: self.r#type,
1008            name: self.name,
1009            code: self.code,
1010            country: self.country,
1011            format: self.format,
1012            delimiter: self.delimiter,
1013            show_plan: self.show_plan,
1014        }
1015    }
1016}
1017
1018/// struct for passing parameters to the method [`get_forex_pairs`]
1019#[derive(Clone, Debug, Default, Serialize, Deserialize)]
1020pub struct GetForexPairsParams {
1021    /// The ticker symbol of an instrument for which data is requested
1022    pub symbol: Option<String>,
1023    /// Filter by currency base
1024    pub currency_base: Option<String>,
1025    /// Filter by currency quote
1026    pub currency_quote: Option<String>,
1027    /// The format of the response data
1028    pub format: Option<String>,
1029    /// The separator used in the CSV response data
1030    pub delimiter: Option<String>,
1031}
1032
1033impl GetForexPairsParams {
1034    /// Create a new builder for this parameter struct
1035    pub fn builder() -> GetForexPairsParamsBuilder {
1036        GetForexPairsParamsBuilder::default()
1037    }
1038}
1039
1040/// Builder for [`GetForexPairsParams`]
1041#[derive(Clone, Debug, Default)]
1042pub struct GetForexPairsParamsBuilder {
1043    /// The ticker symbol of an instrument for which data is requested
1044    symbol: Option<String>,
1045    /// Filter by currency base
1046    currency_base: Option<String>,
1047    /// Filter by currency quote
1048    currency_quote: Option<String>,
1049    /// The format of the response data
1050    format: Option<String>,
1051    /// The separator used in the CSV response data
1052    delimiter: Option<String>,
1053}
1054
1055impl GetForexPairsParamsBuilder {
1056    /// The ticker symbol of an instrument for which data is requested
1057    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
1058        self.symbol = Some(symbol.into());
1059        self
1060    }
1061    /// Filter by currency base
1062    pub fn currency_base(mut self, currency_base: impl Into<String>) -> Self {
1063        self.currency_base = Some(currency_base.into());
1064        self
1065    }
1066    /// Filter by currency quote
1067    pub fn currency_quote(mut self, currency_quote: impl Into<String>) -> Self {
1068        self.currency_quote = Some(currency_quote.into());
1069        self
1070    }
1071    /// The format of the response data
1072    pub fn format(mut self, format: impl Into<String>) -> Self {
1073        self.format = Some(format.into());
1074        self
1075    }
1076    /// The separator used in the CSV response data
1077    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
1078        self.delimiter = Some(delimiter.into());
1079        self
1080    }
1081
1082    /// Build the parameter struct
1083    pub fn build(self) -> GetForexPairsParams {
1084        GetForexPairsParams {
1085            symbol: self.symbol,
1086            currency_base: self.currency_base,
1087            currency_quote: self.currency_quote,
1088            format: self.format,
1089            delimiter: self.delimiter,
1090        }
1091    }
1092}
1093
1094/// struct for passing parameters to the method [`get_funds`]
1095#[derive(Clone, Debug, Default, Serialize, Deserialize)]
1096pub struct GetFundsParams {
1097    /// The ticker symbol of an instrument for which data is requested
1098    pub symbol: Option<String>,
1099    /// Filter by financial instrument global identifier (FIGI)
1100    pub figi: Option<String>,
1101    /// Filter by international securities identification number (ISIN)
1102    pub isin: Option<String>,
1103    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1104    pub cusip: Option<String>,
1105    /// The CIK of an instrument for which data is requested
1106    pub cik: Option<String>,
1107    /// Filter by exchange name
1108    pub exchange: Option<String>,
1109    /// Filter by country name or alpha code, e.g., `United States` or `US`
1110    pub country: Option<String>,
1111    /// The format of the response data
1112    pub format: Option<String>,
1113    /// The separator used in the CSV response data
1114    pub delimiter: Option<String>,
1115    /// Adds info on which plan symbol is available
1116    pub show_plan: Option<bool>,
1117    /// Page number of the results to fetch
1118    pub page: Option<i64>,
1119    /// Determines the number of data points returned in the output
1120    pub outputsize: Option<i64>,
1121}
1122
1123impl GetFundsParams {
1124    /// Create a new builder for this parameter struct
1125    pub fn builder() -> GetFundsParamsBuilder {
1126        GetFundsParamsBuilder::default()
1127    }
1128}
1129
1130/// Builder for [`GetFundsParams`]
1131#[derive(Clone, Debug, Default)]
1132pub struct GetFundsParamsBuilder {
1133    /// The ticker symbol of an instrument for which data is requested
1134    symbol: Option<String>,
1135    /// Filter by financial instrument global identifier (FIGI)
1136    figi: Option<String>,
1137    /// Filter by international securities identification number (ISIN)
1138    isin: Option<String>,
1139    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1140    cusip: Option<String>,
1141    /// The CIK of an instrument for which data is requested
1142    cik: Option<String>,
1143    /// Filter by exchange name
1144    exchange: Option<String>,
1145    /// Filter by country name or alpha code, e.g., `United States` or `US`
1146    country: Option<String>,
1147    /// The format of the response data
1148    format: Option<String>,
1149    /// The separator used in the CSV response data
1150    delimiter: Option<String>,
1151    /// Adds info on which plan symbol is available
1152    show_plan: Option<bool>,
1153    /// Page number of the results to fetch
1154    page: Option<i64>,
1155    /// Determines the number of data points returned in the output
1156    outputsize: Option<i64>,
1157}
1158
1159impl GetFundsParamsBuilder {
1160    /// The ticker symbol of an instrument for which data is requested
1161    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
1162        self.symbol = Some(symbol.into());
1163        self
1164    }
1165    /// Filter by financial instrument global identifier (FIGI)
1166    pub fn figi(mut self, figi: impl Into<String>) -> Self {
1167        self.figi = Some(figi.into());
1168        self
1169    }
1170    /// Filter by international securities identification number (ISIN)
1171    pub fn isin(mut self, isin: impl Into<String>) -> Self {
1172        self.isin = Some(isin.into());
1173        self
1174    }
1175    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1176    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
1177        self.cusip = Some(cusip.into());
1178        self
1179    }
1180    /// The CIK of an instrument for which data is requested
1181    pub fn cik(mut self, cik: impl Into<String>) -> Self {
1182        self.cik = Some(cik.into());
1183        self
1184    }
1185    /// Filter by exchange name
1186    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
1187        self.exchange = Some(exchange.into());
1188        self
1189    }
1190    /// Filter by country name or alpha code, e.g., `United States` or `US`
1191    pub fn country(mut self, country: impl Into<String>) -> Self {
1192        self.country = Some(country.into());
1193        self
1194    }
1195    /// The format of the response data
1196    pub fn format(mut self, format: impl Into<String>) -> Self {
1197        self.format = Some(format.into());
1198        self
1199    }
1200    /// The separator used in the CSV response data
1201    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
1202        self.delimiter = Some(delimiter.into());
1203        self
1204    }
1205    /// Adds info on which plan symbol is available
1206    pub fn show_plan(mut self, show_plan: bool) -> Self {
1207        self.show_plan = Some(show_plan);
1208        self
1209    }
1210    /// Page number of the results to fetch
1211    pub fn page(mut self, page: i64) -> Self {
1212        self.page = Some(page);
1213        self
1214    }
1215    /// Determines the number of data points returned in the output
1216    pub fn outputsize(mut self, outputsize: i64) -> Self {
1217        self.outputsize = Some(outputsize);
1218        self
1219    }
1220
1221    /// Build the parameter struct
1222    pub fn build(self) -> GetFundsParams {
1223        GetFundsParams {
1224            symbol: self.symbol,
1225            figi: self.figi,
1226            isin: self.isin,
1227            cusip: self.cusip,
1228            cik: self.cik,
1229            exchange: self.exchange,
1230            country: self.country,
1231            format: self.format,
1232            delimiter: self.delimiter,
1233            show_plan: self.show_plan,
1234            page: self.page,
1235            outputsize: self.outputsize,
1236        }
1237    }
1238}
1239
1240/// struct for passing parameters to the method [`get_market_state`]
1241#[derive(Clone, Debug, Default, Serialize, Deserialize)]
1242pub struct GetMarketStateParams {
1243    /// The exchange name where the instrument is traded.
1244    pub exchange: Option<String>,
1245    /// The Market Identifier Code (MIC) of the exchange where the instrument is traded.
1246    pub code: Option<String>,
1247    /// The country where the exchange is located. Takes country name or alpha code.
1248    pub country: Option<String>,
1249}
1250
1251impl GetMarketStateParams {
1252    /// Create a new builder for this parameter struct
1253    pub fn builder() -> GetMarketStateParamsBuilder {
1254        GetMarketStateParamsBuilder::default()
1255    }
1256}
1257
1258/// Builder for [`GetMarketStateParams`]
1259#[derive(Clone, Debug, Default)]
1260pub struct GetMarketStateParamsBuilder {
1261    /// The exchange name where the instrument is traded.
1262    exchange: Option<String>,
1263    /// The Market Identifier Code (MIC) of the exchange where the instrument is traded.
1264    code: Option<String>,
1265    /// The country where the exchange is located. Takes country name or alpha code.
1266    country: Option<String>,
1267}
1268
1269impl GetMarketStateParamsBuilder {
1270    /// The exchange name where the instrument is traded.
1271    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
1272        self.exchange = Some(exchange.into());
1273        self
1274    }
1275    /// The Market Identifier Code (MIC) of the exchange where the instrument is traded.
1276    pub fn code(mut self, code: impl Into<String>) -> Self {
1277        self.code = Some(code.into());
1278        self
1279    }
1280    /// The country where the exchange is located. Takes country name or alpha code.
1281    pub fn country(mut self, country: impl Into<String>) -> Self {
1282        self.country = Some(country.into());
1283        self
1284    }
1285
1286    /// Build the parameter struct
1287    pub fn build(self) -> GetMarketStateParams {
1288        GetMarketStateParams {
1289            exchange: self.exchange,
1290            code: self.code,
1291            country: self.country,
1292        }
1293    }
1294}
1295
1296/// struct for passing parameters to the method [`get_mutual_funds_family`]
1297#[derive(Clone, Debug, Default, Serialize, Deserialize)]
1298pub struct GetMutualFundsFamilyParams {
1299    /// Filter by investment company that manages the fund
1300    pub fund_family: Option<String>,
1301    /// Filter by country name or alpha code, e.g., `United States` or `US`
1302    pub country: Option<String>,
1303}
1304
1305impl GetMutualFundsFamilyParams {
1306    /// Create a new builder for this parameter struct
1307    pub fn builder() -> GetMutualFundsFamilyParamsBuilder {
1308        GetMutualFundsFamilyParamsBuilder::default()
1309    }
1310}
1311
1312/// Builder for [`GetMutualFundsFamilyParams`]
1313#[derive(Clone, Debug, Default)]
1314pub struct GetMutualFundsFamilyParamsBuilder {
1315    /// Filter by investment company that manages the fund
1316    fund_family: Option<String>,
1317    /// Filter by country name or alpha code, e.g., `United States` or `US`
1318    country: Option<String>,
1319}
1320
1321impl GetMutualFundsFamilyParamsBuilder {
1322    /// Filter by investment company that manages the fund
1323    pub fn fund_family(mut self, fund_family: impl Into<String>) -> Self {
1324        self.fund_family = Some(fund_family.into());
1325        self
1326    }
1327    /// Filter by country name or alpha code, e.g., `United States` or `US`
1328    pub fn country(mut self, country: impl Into<String>) -> Self {
1329        self.country = Some(country.into());
1330        self
1331    }
1332
1333    /// Build the parameter struct
1334    pub fn build(self) -> GetMutualFundsFamilyParams {
1335        GetMutualFundsFamilyParams {
1336            fund_family: self.fund_family,
1337            country: self.country,
1338        }
1339    }
1340}
1341
1342/// struct for passing parameters to the method [`get_mutual_funds_list`]
1343#[derive(Clone, Debug, Default, Serialize, Deserialize)]
1344pub struct GetMutualFundsListParams {
1345    /// Filter by symbol
1346    pub symbol: Option<String>,
1347    /// Filter by financial instrument global identifier (FIGI)
1348    pub figi: Option<String>,
1349    /// Filter by international securities identification number (ISIN)
1350    pub isin: Option<String>,
1351    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1352    pub cusip: Option<String>,
1353    /// The CIK of an instrument for which data is requested
1354    pub cik: Option<String>,
1355    /// Filter by country name or alpha code, e.g., `United States` or `US`
1356    pub country: Option<String>,
1357    /// Filter by investment company that manages the fund
1358    pub fund_family: Option<String>,
1359    /// Filter by the type of fund
1360    pub fund_type: Option<String>,
1361    /// Filter by performance rating from `0` to `5`
1362    pub performance_rating: Option<i64>,
1363    /// Filter by risk rating from `0` to `5`
1364    pub risk_rating: Option<i64>,
1365    /// Page number
1366    pub page: Option<i64>,
1367    /// Number of records in response
1368    pub outputsize: Option<i64>,
1369}
1370
1371impl GetMutualFundsListParams {
1372    /// Create a new builder for this parameter struct
1373    pub fn builder() -> GetMutualFundsListParamsBuilder {
1374        GetMutualFundsListParamsBuilder::default()
1375    }
1376}
1377
1378/// Builder for [`GetMutualFundsListParams`]
1379#[derive(Clone, Debug, Default)]
1380pub struct GetMutualFundsListParamsBuilder {
1381    /// Filter by symbol
1382    symbol: Option<String>,
1383    /// Filter by financial instrument global identifier (FIGI)
1384    figi: Option<String>,
1385    /// Filter by international securities identification number (ISIN)
1386    isin: Option<String>,
1387    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1388    cusip: Option<String>,
1389    /// The CIK of an instrument for which data is requested
1390    cik: Option<String>,
1391    /// Filter by country name or alpha code, e.g., `United States` or `US`
1392    country: Option<String>,
1393    /// Filter by investment company that manages the fund
1394    fund_family: Option<String>,
1395    /// Filter by the type of fund
1396    fund_type: Option<String>,
1397    /// Filter by performance rating from `0` to `5`
1398    performance_rating: Option<i64>,
1399    /// Filter by risk rating from `0` to `5`
1400    risk_rating: Option<i64>,
1401    /// Page number
1402    page: Option<i64>,
1403    /// Number of records in response
1404    outputsize: Option<i64>,
1405}
1406
1407impl GetMutualFundsListParamsBuilder {
1408    /// Filter by symbol
1409    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
1410        self.symbol = Some(symbol.into());
1411        self
1412    }
1413    /// Filter by financial instrument global identifier (FIGI)
1414    pub fn figi(mut self, figi: impl Into<String>) -> Self {
1415        self.figi = Some(figi.into());
1416        self
1417    }
1418    /// Filter by international securities identification number (ISIN)
1419    pub fn isin(mut self, isin: impl Into<String>) -> Self {
1420        self.isin = Some(isin.into());
1421        self
1422    }
1423    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1424    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
1425        self.cusip = Some(cusip.into());
1426        self
1427    }
1428    /// The CIK of an instrument for which data is requested
1429    pub fn cik(mut self, cik: impl Into<String>) -> Self {
1430        self.cik = Some(cik.into());
1431        self
1432    }
1433    /// Filter by country name or alpha code, e.g., `United States` or `US`
1434    pub fn country(mut self, country: impl Into<String>) -> Self {
1435        self.country = Some(country.into());
1436        self
1437    }
1438    /// Filter by investment company that manages the fund
1439    pub fn fund_family(mut self, fund_family: impl Into<String>) -> Self {
1440        self.fund_family = Some(fund_family.into());
1441        self
1442    }
1443    /// Filter by the type of fund
1444    pub fn fund_type(mut self, fund_type: impl Into<String>) -> Self {
1445        self.fund_type = Some(fund_type.into());
1446        self
1447    }
1448    /// Filter by performance rating from `0` to `5`
1449    pub fn performance_rating(mut self, performance_rating: i64) -> Self {
1450        self.performance_rating = Some(performance_rating);
1451        self
1452    }
1453    /// Filter by risk rating from `0` to `5`
1454    pub fn risk_rating(mut self, risk_rating: i64) -> Self {
1455        self.risk_rating = Some(risk_rating);
1456        self
1457    }
1458    /// Page number
1459    pub fn page(mut self, page: i64) -> Self {
1460        self.page = Some(page);
1461        self
1462    }
1463    /// Number of records in response
1464    pub fn outputsize(mut self, outputsize: i64) -> Self {
1465        self.outputsize = Some(outputsize);
1466        self
1467    }
1468
1469    /// Build the parameter struct
1470    pub fn build(self) -> GetMutualFundsListParams {
1471        GetMutualFundsListParams {
1472            symbol: self.symbol,
1473            figi: self.figi,
1474            isin: self.isin,
1475            cusip: self.cusip,
1476            cik: self.cik,
1477            country: self.country,
1478            fund_family: self.fund_family,
1479            fund_type: self.fund_type,
1480            performance_rating: self.performance_rating,
1481            risk_rating: self.risk_rating,
1482            page: self.page,
1483            outputsize: self.outputsize,
1484        }
1485    }
1486}
1487
1488/// struct for passing parameters to the method [`get_mutual_funds_type`]
1489#[derive(Clone, Debug, Default, Serialize, Deserialize)]
1490pub struct GetMutualFundsTypeParams {
1491    /// Filter by the type of fund
1492    pub fund_type: Option<String>,
1493    /// Filter by country name or alpha code, e.g., `United States` or `US`
1494    pub country: Option<String>,
1495}
1496
1497impl GetMutualFundsTypeParams {
1498    /// Create a new builder for this parameter struct
1499    pub fn builder() -> GetMutualFundsTypeParamsBuilder {
1500        GetMutualFundsTypeParamsBuilder::default()
1501    }
1502}
1503
1504/// Builder for [`GetMutualFundsTypeParams`]
1505#[derive(Clone, Debug, Default)]
1506pub struct GetMutualFundsTypeParamsBuilder {
1507    /// Filter by the type of fund
1508    fund_type: Option<String>,
1509    /// Filter by country name or alpha code, e.g., `United States` or `US`
1510    country: Option<String>,
1511}
1512
1513impl GetMutualFundsTypeParamsBuilder {
1514    /// Filter by the type of fund
1515    pub fn fund_type(mut self, fund_type: impl Into<String>) -> Self {
1516        self.fund_type = Some(fund_type.into());
1517        self
1518    }
1519    /// Filter by country name or alpha code, e.g., `United States` or `US`
1520    pub fn country(mut self, country: impl Into<String>) -> Self {
1521        self.country = Some(country.into());
1522        self
1523    }
1524
1525    /// Build the parameter struct
1526    pub fn build(self) -> GetMutualFundsTypeParams {
1527        GetMutualFundsTypeParams {
1528            fund_type: self.fund_type,
1529            country: self.country,
1530        }
1531    }
1532}
1533
1534/// struct for passing parameters to the method [`get_stocks`]
1535#[derive(Clone, Debug, Default, Serialize, Deserialize)]
1536pub struct GetStocksParams {
1537    /// The ticker symbol of an instrument for which data is requested
1538    pub symbol: Option<String>,
1539    /// Filter by financial instrument global identifier (FIGI)
1540    pub figi: Option<String>,
1541    /// Filter by international securities identification number (ISIN)
1542    pub isin: Option<String>,
1543    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1544    pub cusip: Option<String>,
1545    /// The CIK of an instrument for which data is requested
1546    pub cik: Option<String>,
1547    /// Filter by exchange name
1548    pub exchange: Option<String>,
1549    /// Filter by market identifier code (MIC) under ISO 10383 standard
1550    pub mic_code: Option<String>,
1551    /// Filter by country name or alpha code, e.g., `United States` or `US`
1552    pub country: Option<String>,
1553    /// The asset class to which the instrument belongs
1554    pub r#type: Option<String>,
1555    /// The format of the response data
1556    pub format: Option<String>,
1557    /// The separator used in the CSV response data
1558    pub delimiter: Option<String>,
1559    /// Adds info on which plan symbol is available
1560    pub show_plan: Option<bool>,
1561    /// Include delisted identifiers
1562    pub include_delisted: Option<bool>,
1563}
1564
1565impl GetStocksParams {
1566    /// Create a new builder for this parameter struct
1567    pub fn builder() -> GetStocksParamsBuilder {
1568        GetStocksParamsBuilder::default()
1569    }
1570}
1571
1572/// Builder for [`GetStocksParams`]
1573#[derive(Clone, Debug, Default)]
1574pub struct GetStocksParamsBuilder {
1575    /// The ticker symbol of an instrument for which data is requested
1576    symbol: Option<String>,
1577    /// Filter by financial instrument global identifier (FIGI)
1578    figi: Option<String>,
1579    /// Filter by international securities identification number (ISIN)
1580    isin: Option<String>,
1581    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1582    cusip: Option<String>,
1583    /// The CIK of an instrument for which data is requested
1584    cik: Option<String>,
1585    /// Filter by exchange name
1586    exchange: Option<String>,
1587    /// Filter by market identifier code (MIC) under ISO 10383 standard
1588    mic_code: Option<String>,
1589    /// Filter by country name or alpha code, e.g., `United States` or `US`
1590    country: Option<String>,
1591    /// The asset class to which the instrument belongs
1592    r#type: Option<String>,
1593    /// The format of the response data
1594    format: Option<String>,
1595    /// The separator used in the CSV response data
1596    delimiter: Option<String>,
1597    /// Adds info on which plan symbol is available
1598    show_plan: Option<bool>,
1599    /// Include delisted identifiers
1600    include_delisted: Option<bool>,
1601}
1602
1603impl GetStocksParamsBuilder {
1604    /// The ticker symbol of an instrument for which data is requested
1605    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
1606        self.symbol = Some(symbol.into());
1607        self
1608    }
1609    /// Filter by financial instrument global identifier (FIGI)
1610    pub fn figi(mut self, figi: impl Into<String>) -> Self {
1611        self.figi = Some(figi.into());
1612        self
1613    }
1614    /// Filter by international securities identification number (ISIN)
1615    pub fn isin(mut self, isin: impl Into<String>) -> Self {
1616        self.isin = Some(isin.into());
1617        self
1618    }
1619    /// The CUSIP of an instrument for which data is requested. CUSIP access is activating in the <a href=\"https://twelvedata.com/account/add-ons\">Add-ons</a> section
1620    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
1621        self.cusip = Some(cusip.into());
1622        self
1623    }
1624    /// The CIK of an instrument for which data is requested
1625    pub fn cik(mut self, cik: impl Into<String>) -> Self {
1626        self.cik = Some(cik.into());
1627        self
1628    }
1629    /// Filter by exchange name
1630    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
1631        self.exchange = Some(exchange.into());
1632        self
1633    }
1634    /// Filter by market identifier code (MIC) under ISO 10383 standard
1635    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
1636        self.mic_code = Some(mic_code.into());
1637        self
1638    }
1639    /// Filter by country name or alpha code, e.g., `United States` or `US`
1640    pub fn country(mut self, country: impl Into<String>) -> Self {
1641        self.country = Some(country.into());
1642        self
1643    }
1644    /// The asset class to which the instrument belongs
1645    pub fn r#type(mut self, r#type: impl Into<String>) -> Self {
1646        self.r#type = Some(r#type.into());
1647        self
1648    }
1649    /// The format of the response data
1650    pub fn format(mut self, format: impl Into<String>) -> Self {
1651        self.format = Some(format.into());
1652        self
1653    }
1654    /// The separator used in the CSV response data
1655    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
1656        self.delimiter = Some(delimiter.into());
1657        self
1658    }
1659    /// Adds info on which plan symbol is available
1660    pub fn show_plan(mut self, show_plan: bool) -> Self {
1661        self.show_plan = Some(show_plan);
1662        self
1663    }
1664    /// Include delisted identifiers
1665    pub fn include_delisted(mut self, include_delisted: bool) -> Self {
1666        self.include_delisted = Some(include_delisted);
1667        self
1668    }
1669
1670    /// Build the parameter struct
1671    pub fn build(self) -> GetStocksParams {
1672        GetStocksParams {
1673            symbol: self.symbol,
1674            figi: self.figi,
1675            isin: self.isin,
1676            cusip: self.cusip,
1677            cik: self.cik,
1678            exchange: self.exchange,
1679            mic_code: self.mic_code,
1680            country: self.country,
1681            r#type: self.r#type,
1682            format: self.format,
1683            delimiter: self.delimiter,
1684            show_plan: self.show_plan,
1685            include_delisted: self.include_delisted,
1686        }
1687    }
1688}
1689
1690/// struct for passing parameters to the method [`get_symbol_search`]
1691#[derive(Clone, Debug, Default, Serialize, Deserialize)]
1692pub struct GetSymbolSearchParams {
1693    /// Symbol to search. Supports: <ul> <li>Ticker symbol of instrument.</li> <li>International securities identification number (ISIN). <li>Financial instrument global identifier (FIGI). <li>Composite FIGI.</li> <li>Share Class FIGI.</li> </ul>
1694    pub symbol: String,
1695    /// Number of matches in response. Max <code>120</code>
1696    pub outputsize: Option<i64>,
1697    /// Adds info on which plan symbol is available.
1698    pub show_plan: Option<bool>,
1699}
1700
1701impl GetSymbolSearchParams {
1702    /// Create a new builder for this parameter struct
1703    pub fn builder() -> GetSymbolSearchParamsBuilder {
1704        GetSymbolSearchParamsBuilder::default()
1705    }
1706}
1707
1708/// Builder for [`GetSymbolSearchParams`]
1709#[derive(Clone, Debug, Default)]
1710pub struct GetSymbolSearchParamsBuilder {
1711    /// Symbol to search. Supports: <ul> <li>Ticker symbol of instrument.</li> <li>International securities identification number (ISIN). <li>Financial instrument global identifier (FIGI). <li>Composite FIGI.</li> <li>Share Class FIGI.</li> </ul>
1712    symbol: String,
1713    /// Number of matches in response. Max <code>120</code>
1714    outputsize: Option<i64>,
1715    /// Adds info on which plan symbol is available.
1716    show_plan: Option<bool>,
1717}
1718
1719impl GetSymbolSearchParamsBuilder {
1720    /// Symbol to search. Supports: <ul> <li>Ticker symbol of instrument.</li> <li>International securities identification number (ISIN). <li>Financial instrument global identifier (FIGI). <li>Composite FIGI.</li> <li>Share Class FIGI.</li> </ul>
1721    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
1722        self.symbol = symbol.into();
1723        self
1724    }
1725    /// Number of matches in response. Max <code>120</code>
1726    pub fn outputsize(mut self, outputsize: i64) -> Self {
1727        self.outputsize = Some(outputsize);
1728        self
1729    }
1730    /// Adds info on which plan symbol is available.
1731    pub fn show_plan(mut self, show_plan: bool) -> Self {
1732        self.show_plan = Some(show_plan);
1733        self
1734    }
1735
1736    /// Build the parameter struct
1737    pub fn build(self) -> GetSymbolSearchParams {
1738        GetSymbolSearchParams {
1739            symbol: self.symbol,
1740            outputsize: self.outputsize,
1741            show_plan: self.show_plan,
1742        }
1743    }
1744}
1745
1746/// struct for typed errors of method [`get_bonds`]
1747#[derive(Debug, Clone, Serialize, Deserialize)]
1748#[serde(untagged)]
1749pub enum GetBondsError {
1750    UnknownValue(serde_json::Value),
1751}
1752
1753/// struct for typed errors of method [`get_commodities`]
1754#[derive(Debug, Clone, Serialize, Deserialize)]
1755#[serde(untagged)]
1756pub enum GetCommoditiesError {
1757    UnknownValue(serde_json::Value),
1758}
1759
1760/// struct for typed errors of method [`get_countries`]
1761#[derive(Debug, Clone, Serialize, Deserialize)]
1762#[serde(untagged)]
1763pub enum GetCountriesError {
1764    UnknownValue(serde_json::Value),
1765}
1766
1767/// struct for typed errors of method [`get_cross_listings`]
1768#[derive(Debug, Clone, Serialize, Deserialize)]
1769#[serde(untagged)]
1770pub enum GetCrossListingsError {
1771    UnknownValue(serde_json::Value),
1772}
1773
1774/// struct for typed errors of method [`get_cryptocurrencies`]
1775#[derive(Debug, Clone, Serialize, Deserialize)]
1776#[serde(untagged)]
1777pub enum GetCryptocurrenciesError {
1778    UnknownValue(serde_json::Value),
1779}
1780
1781/// struct for typed errors of method [`get_cryptocurrency_exchanges`]
1782#[derive(Debug, Clone, Serialize, Deserialize)]
1783#[serde(untagged)]
1784pub enum GetCryptocurrencyExchangesError {
1785    UnknownValue(serde_json::Value),
1786}
1787
1788/// struct for typed errors of method [`get_earliest_timestamp`]
1789#[derive(Debug, Clone, Serialize, Deserialize)]
1790#[serde(untagged)]
1791pub enum GetEarliestTimestampError {
1792    UnknownValue(serde_json::Value),
1793}
1794
1795/// struct for typed errors of method [`get_etf`]
1796#[derive(Debug, Clone, Serialize, Deserialize)]
1797#[serde(untagged)]
1798pub enum GetEtfError {
1799    UnknownValue(serde_json::Value),
1800}
1801
1802/// struct for typed errors of method [`get_etfs_family`]
1803#[derive(Debug, Clone, Serialize, Deserialize)]
1804#[serde(untagged)]
1805pub enum GetEtfsFamilyError {
1806    UnknownValue(serde_json::Value),
1807}
1808
1809/// struct for typed errors of method [`get_etfs_list`]
1810#[derive(Debug, Clone, Serialize, Deserialize)]
1811#[serde(untagged)]
1812pub enum GetEtfsListError {
1813    UnknownValue(serde_json::Value),
1814}
1815
1816/// struct for typed errors of method [`get_etfs_type`]
1817#[derive(Debug, Clone, Serialize, Deserialize)]
1818#[serde(untagged)]
1819pub enum GetEtfsTypeError {
1820    UnknownValue(serde_json::Value),
1821}
1822
1823/// struct for typed errors of method [`get_exchange_schedule`]
1824#[derive(Debug, Clone, Serialize, Deserialize)]
1825#[serde(untagged)]
1826pub enum GetExchangeScheduleError {
1827    UnknownValue(serde_json::Value),
1828}
1829
1830/// struct for typed errors of method [`get_exchanges`]
1831#[derive(Debug, Clone, Serialize, Deserialize)]
1832#[serde(untagged)]
1833pub enum GetExchangesError {
1834    UnknownValue(serde_json::Value),
1835}
1836
1837/// struct for typed errors of method [`get_forex_pairs`]
1838#[derive(Debug, Clone, Serialize, Deserialize)]
1839#[serde(untagged)]
1840pub enum GetForexPairsError {
1841    UnknownValue(serde_json::Value),
1842}
1843
1844/// struct for typed errors of method [`get_funds`]
1845#[derive(Debug, Clone, Serialize, Deserialize)]
1846#[serde(untagged)]
1847pub enum GetFundsError {
1848    UnknownValue(serde_json::Value),
1849}
1850
1851/// struct for typed errors of method [`get_instrument_type`]
1852#[derive(Debug, Clone, Serialize, Deserialize)]
1853#[serde(untagged)]
1854pub enum GetInstrumentTypeError {
1855    UnknownValue(serde_json::Value),
1856}
1857
1858/// struct for typed errors of method [`get_intervals`]
1859#[derive(Debug, Clone, Serialize, Deserialize)]
1860#[serde(untagged)]
1861pub enum GetIntervalsError {
1862    UnknownValue(serde_json::Value),
1863}
1864
1865/// struct for typed errors of method [`get_market_state`]
1866#[derive(Debug, Clone, Serialize, Deserialize)]
1867#[serde(untagged)]
1868pub enum GetMarketStateError {
1869    UnknownValue(serde_json::Value),
1870}
1871
1872/// struct for typed errors of method [`get_mutual_funds_family`]
1873#[derive(Debug, Clone, Serialize, Deserialize)]
1874#[serde(untagged)]
1875pub enum GetMutualFundsFamilyError {
1876    UnknownValue(serde_json::Value),
1877}
1878
1879/// struct for typed errors of method [`get_mutual_funds_list`]
1880#[derive(Debug, Clone, Serialize, Deserialize)]
1881#[serde(untagged)]
1882pub enum GetMutualFundsListError {
1883    UnknownValue(serde_json::Value),
1884}
1885
1886/// struct for typed errors of method [`get_mutual_funds_type`]
1887#[derive(Debug, Clone, Serialize, Deserialize)]
1888#[serde(untagged)]
1889pub enum GetMutualFundsTypeError {
1890    UnknownValue(serde_json::Value),
1891}
1892
1893/// struct for typed errors of method [`get_stocks`]
1894#[derive(Debug, Clone, Serialize, Deserialize)]
1895#[serde(untagged)]
1896pub enum GetStocksError {
1897    UnknownValue(serde_json::Value),
1898}
1899
1900/// struct for typed errors of method [`get_symbol_search`]
1901#[derive(Debug, Clone, Serialize, Deserialize)]
1902#[serde(untagged)]
1903pub enum GetSymbolSearchError {
1904    UnknownValue(serde_json::Value),
1905}
1906
1907/// struct for typed errors of method [`get_technical_indicators`]
1908#[derive(Debug, Clone, Serialize, Deserialize)]
1909#[serde(untagged)]
1910pub enum GetTechnicalIndicatorsError {
1911    UnknownValue(serde_json::Value),
1912}
1913
1914/// The fixed income endpoint provides a daily updated list of available bonds. It returns an array containing detailed information about each bond, including identifiers, names, and other relevant attributes.
1915pub async fn get_bonds(
1916    configuration: &configuration::Configuration,
1917    params: GetBondsParams,
1918) -> Result<models::GetBonds200ResponseEnum, Error<GetBondsError>> {
1919    // Extract parameters from params struct
1920    let p_query_symbol = params.symbol;
1921    let p_query_exchange = params.exchange;
1922    let p_query_country = params.country;
1923    let p_query_format = params.format;
1924    let p_query_delimiter = params.delimiter;
1925    let p_query_show_plan = params.show_plan;
1926    let p_query_page = params.page;
1927    let p_query_outputsize = params.outputsize;
1928
1929    let uri_str = format!("{}/bonds", configuration.base_path);
1930    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1931
1932    if let Some(ref param_value) = p_query_symbol {
1933        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1934    }
1935    if let Some(ref param_value) = p_query_exchange {
1936        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1937    }
1938    if let Some(ref param_value) = p_query_country {
1939        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1940    }
1941    if let Some(ref param_value) = p_query_format {
1942        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
1943    }
1944    if let Some(ref param_value) = p_query_delimiter {
1945        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
1946    }
1947    if let Some(ref param_value) = p_query_show_plan {
1948        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
1949    }
1950    if let Some(ref param_value) = p_query_page {
1951        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
1952    }
1953    if let Some(ref param_value) = p_query_outputsize {
1954        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
1955    }
1956    if let Some(ref user_agent) = configuration.user_agent {
1957        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1958    }
1959    if let Some(ref apikey) = configuration.api_key {
1960        let key = apikey.key.clone();
1961        let value = match apikey.prefix {
1962            Some(ref prefix) => format!("{} {}", prefix, key),
1963            None => key,
1964        };
1965        req_builder = req_builder.header("Authorization", value);
1966    };
1967
1968    let req = req_builder.build()?;
1969    let resp = configuration.client.execute(req).await?;
1970
1971    let status = resp.status();
1972    let content_type = resp
1973        .headers()
1974        .get("content-type")
1975        .and_then(|v| v.to_str().ok())
1976        .unwrap_or("application/octet-stream");
1977    let content_type = super::ContentType::from(content_type);
1978
1979    if !status.is_client_error() && !status.is_server_error() {
1980        let content = resp.text().await?;
1981        match content_type {
1982            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1983            ContentType::Text => return Ok(models::GetBonds200ResponseEnum::Text(content)),
1984            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetBonds200ResponseEnum`")))),
1985        }
1986    } else {
1987        let content = resp.text().await?;
1988        let entity: Option<GetBondsError> = serde_json::from_str(&content).ok();
1989        Err(Error::ResponseError(ResponseContent {
1990            status,
1991            content,
1992            entity,
1993        }))
1994    }
1995}
1996
1997/// The commodities endpoint provides a daily updated list of available commodity pairs, across precious metals, livestock, softs, grains, etc.
1998pub async fn get_commodities(
1999    configuration: &configuration::Configuration,
2000    params: GetCommoditiesParams,
2001) -> Result<models::GetCommodities200ResponseEnum, Error<GetCommoditiesError>> {
2002    // Extract parameters from params struct
2003    let p_query_symbol = params.symbol;
2004    let p_query_category = params.category;
2005    let p_query_format = params.format;
2006    let p_query_delimiter = params.delimiter;
2007
2008    let uri_str = format!("{}/commodities", configuration.base_path);
2009    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2010
2011    if let Some(ref param_value) = p_query_symbol {
2012        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2013    }
2014    if let Some(ref param_value) = p_query_category {
2015        req_builder = req_builder.query(&[("category", &param_value.to_string())]);
2016    }
2017    if let Some(ref param_value) = p_query_format {
2018        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2019    }
2020    if let Some(ref param_value) = p_query_delimiter {
2021        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2022    }
2023    if let Some(ref user_agent) = configuration.user_agent {
2024        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2025    }
2026    if let Some(ref apikey) = configuration.api_key {
2027        let key = apikey.key.clone();
2028        let value = match apikey.prefix {
2029            Some(ref prefix) => format!("{} {}", prefix, key),
2030            None => key,
2031        };
2032        req_builder = req_builder.header("Authorization", value);
2033    };
2034
2035    let req = req_builder.build()?;
2036    let resp = configuration.client.execute(req).await?;
2037
2038    let status = resp.status();
2039    let content_type = resp
2040        .headers()
2041        .get("content-type")
2042        .and_then(|v| v.to_str().ok())
2043        .unwrap_or("application/octet-stream");
2044    let content_type = super::ContentType::from(content_type);
2045
2046    if !status.is_client_error() && !status.is_server_error() {
2047        let content = resp.text().await?;
2048        match content_type {
2049            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2050            ContentType::Text => return Ok(models::GetCommodities200ResponseEnum::Text(content)),
2051            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCommodities200ResponseEnum`")))),
2052        }
2053    } else {
2054        let content = resp.text().await?;
2055        let entity: Option<GetCommoditiesError> = serde_json::from_str(&content).ok();
2056        Err(Error::ResponseError(ResponseContent {
2057            status,
2058            content,
2059            entity,
2060        }))
2061    }
2062}
2063
2064/// The countries endpoint provides a comprehensive list of countries, including their ISO codes, official names, capitals, and currencies. This data is essential for applications requiring accurate country information for tasks such as localization, currency conversion, or geographic analysis.
2065pub async fn get_countries(
2066    configuration: &configuration::Configuration,
2067) -> Result<models::GetCountries200ResponseEnum, Error<GetCountriesError>> {
2068    let uri_str = format!("{}/countries", configuration.base_path);
2069    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2070
2071    if let Some(ref user_agent) = configuration.user_agent {
2072        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2073    }
2074    if let Some(ref apikey) = configuration.api_key {
2075        let key = apikey.key.clone();
2076        let value = match apikey.prefix {
2077            Some(ref prefix) => format!("{} {}", prefix, key),
2078            None => key,
2079        };
2080        req_builder = req_builder.header("Authorization", value);
2081    };
2082
2083    let req = req_builder.build()?;
2084    let resp = configuration.client.execute(req).await?;
2085
2086    let status = resp.status();
2087    let content_type = resp
2088        .headers()
2089        .get("content-type")
2090        .and_then(|v| v.to_str().ok())
2091        .unwrap_or("application/octet-stream");
2092    let content_type = super::ContentType::from(content_type);
2093
2094    if !status.is_client_error() && !status.is_server_error() {
2095        let content = resp.text().await?;
2096        match content_type {
2097            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2098            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetCountries200ResponseEnum`"))),
2099            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCountries200ResponseEnum`")))),
2100        }
2101    } else {
2102        let content = resp.text().await?;
2103        let entity: Option<GetCountriesError> = serde_json::from_str(&content).ok();
2104        Err(Error::ResponseError(ResponseContent {
2105            status,
2106            content,
2107            entity,
2108        }))
2109    }
2110}
2111
2112/// The cross_listings endpoint provides a daily updated list of cross-listed symbols for a specified financial instrument. Cross-listed symbols represent the same security available on multiple exchanges. This endpoint is useful for identifying all the exchanges where a particular security is traded, allowing users to access comprehensive trading information across different markets.
2113pub async fn get_cross_listings(
2114    configuration: &configuration::Configuration,
2115    params: GetCrossListingsParams,
2116) -> Result<models::GetCrossListings200ResponseEnum, Error<GetCrossListingsError>> {
2117    // Extract parameters from params struct
2118    let p_query_symbol = params.symbol;
2119    let p_query_exchange = params.exchange;
2120    let p_query_mic_code = params.mic_code;
2121    let p_query_country = params.country;
2122
2123    let uri_str = format!("{}/cross_listings", configuration.base_path);
2124    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2125
2126    req_builder = req_builder.query(&[("symbol", &p_query_symbol.to_string())]);
2127    if let Some(ref param_value) = p_query_exchange {
2128        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
2129    }
2130    if let Some(ref param_value) = p_query_mic_code {
2131        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
2132    }
2133    if let Some(ref param_value) = p_query_country {
2134        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2135    }
2136    if let Some(ref user_agent) = configuration.user_agent {
2137        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2138    }
2139    if let Some(ref apikey) = configuration.api_key {
2140        let key = apikey.key.clone();
2141        let value = match apikey.prefix {
2142            Some(ref prefix) => format!("{} {}", prefix, key),
2143            None => key,
2144        };
2145        req_builder = req_builder.header("Authorization", value);
2146    };
2147
2148    let req = req_builder.build()?;
2149    let resp = configuration.client.execute(req).await?;
2150
2151    let status = resp.status();
2152    let content_type = resp
2153        .headers()
2154        .get("content-type")
2155        .and_then(|v| v.to_str().ok())
2156        .unwrap_or("application/octet-stream");
2157    let content_type = super::ContentType::from(content_type);
2158
2159    if !status.is_client_error() && !status.is_server_error() {
2160        let content = resp.text().await?;
2161        match content_type {
2162            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2163            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetCrossListings200ResponseEnum`"))),
2164            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCrossListings200ResponseEnum`")))),
2165        }
2166    } else {
2167        let content = resp.text().await?;
2168        let entity: Option<GetCrossListingsError> = serde_json::from_str(&content).ok();
2169        Err(Error::ResponseError(ResponseContent {
2170            status,
2171            content,
2172            entity,
2173        }))
2174    }
2175}
2176
2177/// The cryptocurrencies endpoint provides a daily updated list of all available cryptos. It returns an array containing detailed information about each cryptocurrency, including its symbol, name, and other relevant identifiers. This endpoint is useful for retrieving a comprehensive catalog of cryptocurrencies for applications that require up-to-date market listings or need to display available crypto assets to users.
2178pub async fn get_cryptocurrencies(
2179    configuration: &configuration::Configuration,
2180    params: GetCryptocurrenciesParams,
2181) -> Result<models::GetCryptocurrencies200ResponseEnum, Error<GetCryptocurrenciesError>> {
2182    // Extract parameters from params struct
2183    let p_query_symbol = params.symbol;
2184    let p_query_exchange = params.exchange;
2185    let p_query_currency_base = params.currency_base;
2186    let p_query_currency_quote = params.currency_quote;
2187    let p_query_format = params.format;
2188    let p_query_delimiter = params.delimiter;
2189
2190    let uri_str = format!("{}/cryptocurrencies", configuration.base_path);
2191    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2192
2193    if let Some(ref param_value) = p_query_symbol {
2194        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2195    }
2196    if let Some(ref param_value) = p_query_exchange {
2197        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
2198    }
2199    if let Some(ref param_value) = p_query_currency_base {
2200        req_builder = req_builder.query(&[("currency_base", &param_value.to_string())]);
2201    }
2202    if let Some(ref param_value) = p_query_currency_quote {
2203        req_builder = req_builder.query(&[("currency_quote", &param_value.to_string())]);
2204    }
2205    if let Some(ref param_value) = p_query_format {
2206        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2207    }
2208    if let Some(ref param_value) = p_query_delimiter {
2209        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2210    }
2211    if let Some(ref user_agent) = configuration.user_agent {
2212        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2213    }
2214    if let Some(ref apikey) = configuration.api_key {
2215        let key = apikey.key.clone();
2216        let value = match apikey.prefix {
2217            Some(ref prefix) => format!("{} {}", prefix, key),
2218            None => key,
2219        };
2220        req_builder = req_builder.header("Authorization", value);
2221    };
2222
2223    let req = req_builder.build()?;
2224    let resp = configuration.client.execute(req).await?;
2225
2226    let status = resp.status();
2227    let content_type = resp
2228        .headers()
2229        .get("content-type")
2230        .and_then(|v| v.to_str().ok())
2231        .unwrap_or("application/octet-stream");
2232    let content_type = super::ContentType::from(content_type);
2233
2234    if !status.is_client_error() && !status.is_server_error() {
2235        let content = resp.text().await?;
2236        match content_type {
2237            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2238            ContentType::Text => return Ok(models::GetCryptocurrencies200ResponseEnum::Text(content)),
2239            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCryptocurrencies200ResponseEnum`")))),
2240        }
2241    } else {
2242        let content = resp.text().await?;
2243        let entity: Option<GetCryptocurrenciesError> = serde_json::from_str(&content).ok();
2244        Err(Error::ResponseError(ResponseContent {
2245            status,
2246            content,
2247            entity,
2248        }))
2249    }
2250}
2251
2252/// The cryptocurrency exchanges endpoint provides a daily updated list of available cryptocurrency exchanges. It returns an array containing details about each exchange, such as exchange names and identifiers.
2253pub async fn get_cryptocurrency_exchanges(
2254    configuration: &configuration::Configuration,
2255    params: GetCryptocurrencyExchangesParams,
2256) -> Result<models::GetCryptocurrencyExchanges200ResponseEnum, Error<GetCryptocurrencyExchangesError>>
2257{
2258    // Extract parameters from params struct
2259    let p_query_format = params.format;
2260    let p_query_delimiter = params.delimiter;
2261
2262    let uri_str = format!("{}/cryptocurrency_exchanges", configuration.base_path);
2263    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2264
2265    if let Some(ref param_value) = p_query_format {
2266        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2267    }
2268    if let Some(ref param_value) = p_query_delimiter {
2269        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2270    }
2271    if let Some(ref user_agent) = configuration.user_agent {
2272        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2273    }
2274    if let Some(ref apikey) = configuration.api_key {
2275        let key = apikey.key.clone();
2276        let value = match apikey.prefix {
2277            Some(ref prefix) => format!("{} {}", prefix, key),
2278            None => key,
2279        };
2280        req_builder = req_builder.header("Authorization", value);
2281    };
2282
2283    let req = req_builder.build()?;
2284    let resp = configuration.client.execute(req).await?;
2285
2286    let status = resp.status();
2287    let content_type = resp
2288        .headers()
2289        .get("content-type")
2290        .and_then(|v| v.to_str().ok())
2291        .unwrap_or("application/octet-stream");
2292    let content_type = super::ContentType::from(content_type);
2293
2294    if !status.is_client_error() && !status.is_server_error() {
2295        let content = resp.text().await?;
2296        match content_type {
2297            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2298            ContentType::Text => return Ok(models::GetCryptocurrencyExchanges200ResponseEnum::Text(content)),
2299            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetCryptocurrencyExchanges200ResponseEnum`")))),
2300        }
2301    } else {
2302        let content = resp.text().await?;
2303        let entity: Option<GetCryptocurrencyExchangesError> = serde_json::from_str(&content).ok();
2304        Err(Error::ResponseError(ResponseContent {
2305            status,
2306            content,
2307            entity,
2308        }))
2309    }
2310}
2311
2312/// The earliest_timestamp endpoint provides the earliest available date and time for a specified financial instrument at a given data interval. This endpoint is useful for determining the starting point of historical data availability for various assets, such as stocks or currencies, allowing users to understand the time range covered by the data.
2313pub async fn get_earliest_timestamp(
2314    configuration: &configuration::Configuration,
2315    params: GetEarliestTimestampParams,
2316) -> Result<models::GetEarliestTimestamp200ResponseEnum, Error<GetEarliestTimestampError>> {
2317    // Extract parameters from params struct
2318    let p_query_interval = params.interval;
2319    let p_query_symbol = params.symbol;
2320    let p_query_figi = params.figi;
2321    let p_query_isin = params.isin;
2322    let p_query_cusip = params.cusip;
2323    let p_query_exchange = params.exchange;
2324    let p_query_mic_code = params.mic_code;
2325    let p_query_timezone = params.timezone;
2326
2327    let uri_str = format!("{}/earliest_timestamp", configuration.base_path);
2328    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2329
2330    if let Some(ref param_value) = p_query_symbol {
2331        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2332    }
2333    if let Some(ref param_value) = p_query_figi {
2334        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
2335    }
2336    if let Some(ref param_value) = p_query_isin {
2337        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
2338    }
2339    if let Some(ref param_value) = p_query_cusip {
2340        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
2341    }
2342    req_builder = req_builder.query(&[("interval", &p_query_interval.to_string())]);
2343    if let Some(ref param_value) = p_query_exchange {
2344        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
2345    }
2346    if let Some(ref param_value) = p_query_mic_code {
2347        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
2348    }
2349    if let Some(ref param_value) = p_query_timezone {
2350        req_builder = req_builder.query(&[("timezone", &param_value.to_string())]);
2351    }
2352    if let Some(ref user_agent) = configuration.user_agent {
2353        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2354    }
2355    if let Some(ref apikey) = configuration.api_key {
2356        let key = apikey.key.clone();
2357        let value = match apikey.prefix {
2358            Some(ref prefix) => format!("{} {}", prefix, key),
2359            None => key,
2360        };
2361        req_builder = req_builder.header("Authorization", value);
2362    };
2363
2364    let req = req_builder.build()?;
2365    let resp = configuration.client.execute(req).await?;
2366
2367    let status = resp.status();
2368    let content_type = resp
2369        .headers()
2370        .get("content-type")
2371        .and_then(|v| v.to_str().ok())
2372        .unwrap_or("application/octet-stream");
2373    let content_type = super::ContentType::from(content_type);
2374
2375    if !status.is_client_error() && !status.is_server_error() {
2376        let content = resp.text().await?;
2377        match content_type {
2378            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2379            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEarliestTimestamp200ResponseEnum`"))),
2380            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEarliestTimestamp200ResponseEnum`")))),
2381        }
2382    } else {
2383        let content = resp.text().await?;
2384        let entity: Option<GetEarliestTimestampError> = serde_json::from_str(&content).ok();
2385        Err(Error::ResponseError(ResponseContent {
2386            status,
2387            content,
2388            entity,
2389        }))
2390    }
2391}
2392
2393/// The ETFs endpoint provides a daily updated list of all available Exchange-Traded Funds. It returns an array containing detailed information about each ETF, including its symbol, name, and other relevant identifiers. This endpoint is useful for retrieving a comprehensive catalog of ETFs for portfolio management, investment tracking, or financial analysis.
2394pub async fn get_etf(
2395    configuration: &configuration::Configuration,
2396    params: GetEtfParams,
2397) -> Result<models::GetEtf200ResponseEnum, Error<GetEtfError>> {
2398    // Extract parameters from params struct
2399    let p_query_symbol = params.symbol;
2400    let p_query_figi = params.figi;
2401    let p_query_isin = params.isin;
2402    let p_query_cusip = params.cusip;
2403    let p_query_cik = params.cik;
2404    let p_query_exchange = params.exchange;
2405    let p_query_mic_code = params.mic_code;
2406    let p_query_country = params.country;
2407    let p_query_format = params.format;
2408    let p_query_delimiter = params.delimiter;
2409    let p_query_show_plan = params.show_plan;
2410    let p_query_include_delisted = params.include_delisted;
2411
2412    let uri_str = format!("{}/etfs", configuration.base_path);
2413    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2414
2415    if let Some(ref param_value) = p_query_symbol {
2416        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2417    }
2418    if let Some(ref param_value) = p_query_figi {
2419        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
2420    }
2421    if let Some(ref param_value) = p_query_isin {
2422        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
2423    }
2424    if let Some(ref param_value) = p_query_cusip {
2425        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
2426    }
2427    if let Some(ref param_value) = p_query_cik {
2428        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
2429    }
2430    if let Some(ref param_value) = p_query_exchange {
2431        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
2432    }
2433    if let Some(ref param_value) = p_query_mic_code {
2434        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
2435    }
2436    if let Some(ref param_value) = p_query_country {
2437        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2438    }
2439    if let Some(ref param_value) = p_query_format {
2440        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2441    }
2442    if let Some(ref param_value) = p_query_delimiter {
2443        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2444    }
2445    if let Some(ref param_value) = p_query_show_plan {
2446        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
2447    }
2448    if let Some(ref param_value) = p_query_include_delisted {
2449        req_builder = req_builder.query(&[("include_delisted", &param_value.to_string())]);
2450    }
2451    if let Some(ref user_agent) = configuration.user_agent {
2452        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2453    }
2454    if let Some(ref apikey) = configuration.api_key {
2455        let key = apikey.key.clone();
2456        let value = match apikey.prefix {
2457            Some(ref prefix) => format!("{} {}", prefix, key),
2458            None => key,
2459        };
2460        req_builder = req_builder.header("Authorization", value);
2461    };
2462
2463    let req = req_builder.build()?;
2464    let resp = configuration.client.execute(req).await?;
2465
2466    let status = resp.status();
2467    let content_type = resp
2468        .headers()
2469        .get("content-type")
2470        .and_then(|v| v.to_str().ok())
2471        .unwrap_or("application/octet-stream");
2472    let content_type = super::ContentType::from(content_type);
2473
2474    if !status.is_client_error() && !status.is_server_error() {
2475        let content = resp.text().await?;
2476        match content_type {
2477            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2478            ContentType::Text => return Ok(models::GetEtf200ResponseEnum::Text(content)),
2479            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtf200ResponseEnum`")))),
2480        }
2481    } else {
2482        let content = resp.text().await?;
2483        let entity: Option<GetEtfError> = serde_json::from_str(&content).ok();
2484        Err(Error::ResponseError(ResponseContent {
2485            status,
2486            content,
2487            entity,
2488        }))
2489    }
2490}
2491
2492/// Retrieve a comprehensive list of exchange-traded fund (ETF) families, providing users with detailed information on various ETF groups available in the market. This endpoint is ideal for users looking to explore different ETF categories, compare offerings, or integrate ETF family data into their financial applications.
2493pub async fn get_etfs_family(
2494    configuration: &configuration::Configuration,
2495    params: GetEtfsFamilyParams,
2496) -> Result<models::GetEtfsFamily200ResponseEnum, Error<GetEtfsFamilyError>> {
2497    // Extract parameters from params struct
2498    let p_query_country = params.country;
2499    let p_query_fund_family = params.fund_family;
2500
2501    let uri_str = format!("{}/etfs/family", configuration.base_path);
2502    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2503
2504    if let Some(ref param_value) = p_query_country {
2505        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2506    }
2507    if let Some(ref param_value) = p_query_fund_family {
2508        req_builder = req_builder.query(&[("fund_family", &param_value.to_string())]);
2509    }
2510    if let Some(ref user_agent) = configuration.user_agent {
2511        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2512    }
2513    if let Some(ref apikey) = configuration.api_key {
2514        let key = apikey.key.clone();
2515        let value = match apikey.prefix {
2516            Some(ref prefix) => format!("{} {}", prefix, key),
2517            None => key,
2518        };
2519        req_builder = req_builder.header("Authorization", value);
2520    };
2521
2522    let req = req_builder.build()?;
2523    let resp = configuration.client.execute(req).await?;
2524
2525    let status = resp.status();
2526    let content_type = resp
2527        .headers()
2528        .get("content-type")
2529        .and_then(|v| v.to_str().ok())
2530        .unwrap_or("application/octet-stream");
2531    let content_type = super::ContentType::from(content_type);
2532
2533    if !status.is_client_error() && !status.is_server_error() {
2534        let content = resp.text().await?;
2535        match content_type {
2536            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2537            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsFamily200ResponseEnum`"))),
2538            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtfsFamily200ResponseEnum`")))),
2539        }
2540    } else {
2541        let content = resp.text().await?;
2542        let entity: Option<GetEtfsFamilyError> = serde_json::from_str(&content).ok();
2543        Err(Error::ResponseError(ResponseContent {
2544            status,
2545            content,
2546            entity,
2547        }))
2548    }
2549}
2550
2551/// The ETFs directory endpoint provides a daily updated list of exchange-traded funds, sorted by total assets in descending order. This endpoint is useful for retrieving comprehensive ETF data, including fund names and asset values, to assist users in quickly identifying the ETFs available.
2552pub async fn get_etfs_list(
2553    configuration: &configuration::Configuration,
2554    params: GetEtfsListParams,
2555) -> Result<models::GetEtfsList200ResponseEnum, Error<GetEtfsListError>> {
2556    // Extract parameters from params struct
2557    let p_query_symbol = params.symbol;
2558    let p_query_figi = params.figi;
2559    let p_query_isin = params.isin;
2560    let p_query_cusip = params.cusip;
2561    let p_query_cik = params.cik;
2562    let p_query_country = params.country;
2563    let p_query_fund_family = params.fund_family;
2564    let p_query_fund_type = params.fund_type;
2565    let p_query_page = params.page;
2566    let p_query_outputsize = params.outputsize;
2567
2568    let uri_str = format!("{}/etfs/list", configuration.base_path);
2569    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2570
2571    if let Some(ref param_value) = p_query_symbol {
2572        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2573    }
2574    if let Some(ref param_value) = p_query_figi {
2575        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
2576    }
2577    if let Some(ref param_value) = p_query_isin {
2578        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
2579    }
2580    if let Some(ref param_value) = p_query_cusip {
2581        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
2582    }
2583    if let Some(ref param_value) = p_query_cik {
2584        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
2585    }
2586    if let Some(ref param_value) = p_query_country {
2587        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2588    }
2589    if let Some(ref param_value) = p_query_fund_family {
2590        req_builder = req_builder.query(&[("fund_family", &param_value.to_string())]);
2591    }
2592    if let Some(ref param_value) = p_query_fund_type {
2593        req_builder = req_builder.query(&[("fund_type", &param_value.to_string())]);
2594    }
2595    if let Some(ref param_value) = p_query_page {
2596        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2597    }
2598    if let Some(ref param_value) = p_query_outputsize {
2599        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
2600    }
2601    if let Some(ref user_agent) = configuration.user_agent {
2602        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2603    }
2604    if let Some(ref apikey) = configuration.api_key {
2605        let key = apikey.key.clone();
2606        let value = match apikey.prefix {
2607            Some(ref prefix) => format!("{} {}", prefix, key),
2608            None => key,
2609        };
2610        req_builder = req_builder.header("Authorization", value);
2611    };
2612
2613    let req = req_builder.build()?;
2614    let resp = configuration.client.execute(req).await?;
2615
2616    let status = resp.status();
2617    let content_type = resp
2618        .headers()
2619        .get("content-type")
2620        .and_then(|v| v.to_str().ok())
2621        .unwrap_or("application/octet-stream");
2622    let content_type = super::ContentType::from(content_type);
2623
2624    if !status.is_client_error() && !status.is_server_error() {
2625        let content = resp.text().await?;
2626        match content_type {
2627            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2628            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsList200ResponseEnum`"))),
2629            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtfsList200ResponseEnum`")))),
2630        }
2631    } else {
2632        let content = resp.text().await?;
2633        let entity: Option<GetEtfsListError> = serde_json::from_str(&content).ok();
2634        Err(Error::ResponseError(ResponseContent {
2635            status,
2636            content,
2637            entity,
2638        }))
2639    }
2640}
2641
2642/// The ETFs Types endpoint provides a concise list of ETF categories by market (e.g., Singapore, United States), including types like \"Equity Precious Metals\" and \"Large Blend.\" It supports targeted investment research and portfolio diversification.
2643pub async fn get_etfs_type(
2644    configuration: &configuration::Configuration,
2645    params: GetEtfsTypeParams,
2646) -> Result<models::GetEtfsType200ResponseEnum, Error<GetEtfsTypeError>> {
2647    // Extract parameters from params struct
2648    let p_query_country = params.country;
2649    let p_query_fund_type = params.fund_type;
2650
2651    let uri_str = format!("{}/etfs/type", configuration.base_path);
2652    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2653
2654    if let Some(ref param_value) = p_query_country {
2655        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2656    }
2657    if let Some(ref param_value) = p_query_fund_type {
2658        req_builder = req_builder.query(&[("fund_type", &param_value.to_string())]);
2659    }
2660    if let Some(ref user_agent) = configuration.user_agent {
2661        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2662    }
2663    if let Some(ref apikey) = configuration.api_key {
2664        let key = apikey.key.clone();
2665        let value = match apikey.prefix {
2666            Some(ref prefix) => format!("{} {}", prefix, key),
2667            None => key,
2668        };
2669        req_builder = req_builder.header("Authorization", value);
2670    };
2671
2672    let req = req_builder.build()?;
2673    let resp = configuration.client.execute(req).await?;
2674
2675    let status = resp.status();
2676    let content_type = resp
2677        .headers()
2678        .get("content-type")
2679        .and_then(|v| v.to_str().ok())
2680        .unwrap_or("application/octet-stream");
2681    let content_type = super::ContentType::from(content_type);
2682
2683    if !status.is_client_error() && !status.is_server_error() {
2684        let content = resp.text().await?;
2685        match content_type {
2686            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2687            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsType200ResponseEnum`"))),
2688            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetEtfsType200ResponseEnum`")))),
2689        }
2690    } else {
2691        let content = resp.text().await?;
2692        let entity: Option<GetEtfsTypeError> = serde_json::from_str(&content).ok();
2693        Err(Error::ResponseError(ResponseContent {
2694            status,
2695            content,
2696            entity,
2697        }))
2698    }
2699}
2700
2701/// The exchanges schedule endpoint provides detailed information about various stock exchanges, including their trading hours and operational days. This data is essential for users who need to know when specific exchanges are open for trading, allowing them to plan their activities around the availability of these markets.
2702pub async fn get_exchange_schedule(
2703    configuration: &configuration::Configuration,
2704    params: GetExchangeScheduleParams,
2705) -> Result<models::GetExchangeSchedule200ResponseEnum, Error<GetExchangeScheduleError>> {
2706    // Extract parameters from params struct
2707    let p_query_mic_name = params.mic_name;
2708    let p_query_mic_code = params.mic_code;
2709    let p_query_country = params.country;
2710    let p_query_date = params.date;
2711
2712    let uri_str = format!("{}/exchange_schedule", configuration.base_path);
2713    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2714
2715    if let Some(ref param_value) = p_query_mic_name {
2716        req_builder = req_builder.query(&[("mic_name", &param_value.to_string())]);
2717    }
2718    if let Some(ref param_value) = p_query_mic_code {
2719        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
2720    }
2721    if let Some(ref param_value) = p_query_country {
2722        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2723    }
2724    if let Some(ref param_value) = p_query_date {
2725        req_builder = req_builder.query(&[("date", &param_value.to_string())]);
2726    }
2727    if let Some(ref user_agent) = configuration.user_agent {
2728        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2729    }
2730    if let Some(ref apikey) = configuration.api_key {
2731        let key = apikey.key.clone();
2732        let value = match apikey.prefix {
2733            Some(ref prefix) => format!("{} {}", prefix, key),
2734            None => key,
2735        };
2736        req_builder = req_builder.header("Authorization", value);
2737    };
2738
2739    let req = req_builder.build()?;
2740    let resp = configuration.client.execute(req).await?;
2741
2742    let status = resp.status();
2743    let content_type = resp
2744        .headers()
2745        .get("content-type")
2746        .and_then(|v| v.to_str().ok())
2747        .unwrap_or("application/octet-stream");
2748    let content_type = super::ContentType::from(content_type);
2749
2750    if !status.is_client_error() && !status.is_server_error() {
2751        let content = resp.text().await?;
2752        match content_type {
2753            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2754            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetExchangeSchedule200ResponseEnum`"))),
2755            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetExchangeSchedule200ResponseEnum`")))),
2756        }
2757    } else {
2758        let content = resp.text().await?;
2759        let entity: Option<GetExchangeScheduleError> = serde_json::from_str(&content).ok();
2760        Err(Error::ResponseError(ResponseContent {
2761            status,
2762            content,
2763            entity,
2764        }))
2765    }
2766}
2767
2768/// The exchanges endpoint provides a comprehensive list of all available equity exchanges. It returns an array containing detailed information about each exchange, such as exchange code, name, country, and timezone. This data is updated daily.
2769pub async fn get_exchanges(
2770    configuration: &configuration::Configuration,
2771    params: GetExchangesParams,
2772) -> Result<models::GetExchanges200ResponseEnum, Error<GetExchangesError>> {
2773    // Extract parameters from params struct
2774    let p_query_type = params.r#type;
2775    let p_query_name = params.name;
2776    let p_query_code = params.code;
2777    let p_query_country = params.country;
2778    let p_query_format = params.format;
2779    let p_query_delimiter = params.delimiter;
2780    let p_query_show_plan = params.show_plan;
2781
2782    let uri_str = format!("{}/exchanges", configuration.base_path);
2783    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2784
2785    if let Some(ref param_value) = p_query_type {
2786        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
2787    }
2788    if let Some(ref param_value) = p_query_name {
2789        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
2790    }
2791    if let Some(ref param_value) = p_query_code {
2792        req_builder = req_builder.query(&[("code", &param_value.to_string())]);
2793    }
2794    if let Some(ref param_value) = p_query_country {
2795        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2796    }
2797    if let Some(ref param_value) = p_query_format {
2798        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2799    }
2800    if let Some(ref param_value) = p_query_delimiter {
2801        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2802    }
2803    if let Some(ref param_value) = p_query_show_plan {
2804        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
2805    }
2806    if let Some(ref user_agent) = configuration.user_agent {
2807        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2808    }
2809    if let Some(ref apikey) = configuration.api_key {
2810        let key = apikey.key.clone();
2811        let value = match apikey.prefix {
2812            Some(ref prefix) => format!("{} {}", prefix, key),
2813            None => key,
2814        };
2815        req_builder = req_builder.header("Authorization", value);
2816    };
2817
2818    let req = req_builder.build()?;
2819    let resp = configuration.client.execute(req).await?;
2820
2821    let status = resp.status();
2822    let content_type = resp
2823        .headers()
2824        .get("content-type")
2825        .and_then(|v| v.to_str().ok())
2826        .unwrap_or("application/octet-stream");
2827    let content_type = super::ContentType::from(content_type);
2828
2829    if !status.is_client_error() && !status.is_server_error() {
2830        let content = resp.text().await?;
2831        match content_type {
2832            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2833            ContentType::Text => return Ok(models::GetExchanges200ResponseEnum::Text(content)),
2834            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetExchanges200ResponseEnum`")))),
2835        }
2836    } else {
2837        let content = resp.text().await?;
2838        let entity: Option<GetExchangesError> = serde_json::from_str(&content).ok();
2839        Err(Error::ResponseError(ResponseContent {
2840            status,
2841            content,
2842            entity,
2843        }))
2844    }
2845}
2846
2847/// The forex pairs endpoint provides a comprehensive list of all available foreign exchange currency pairs. It returns an array of forex pairs, which is updated daily.
2848pub async fn get_forex_pairs(
2849    configuration: &configuration::Configuration,
2850    params: GetForexPairsParams,
2851) -> Result<models::GetForexPairs200ResponseEnum, Error<GetForexPairsError>> {
2852    // Extract parameters from params struct
2853    let p_query_symbol = params.symbol;
2854    let p_query_currency_base = params.currency_base;
2855    let p_query_currency_quote = params.currency_quote;
2856    let p_query_format = params.format;
2857    let p_query_delimiter = params.delimiter;
2858
2859    let uri_str = format!("{}/forex_pairs", configuration.base_path);
2860    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2861
2862    if let Some(ref param_value) = p_query_symbol {
2863        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2864    }
2865    if let Some(ref param_value) = p_query_currency_base {
2866        req_builder = req_builder.query(&[("currency_base", &param_value.to_string())]);
2867    }
2868    if let Some(ref param_value) = p_query_currency_quote {
2869        req_builder = req_builder.query(&[("currency_quote", &param_value.to_string())]);
2870    }
2871    if let Some(ref param_value) = p_query_format {
2872        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2873    }
2874    if let Some(ref param_value) = p_query_delimiter {
2875        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2876    }
2877    if let Some(ref user_agent) = configuration.user_agent {
2878        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2879    }
2880    if let Some(ref apikey) = configuration.api_key {
2881        let key = apikey.key.clone();
2882        let value = match apikey.prefix {
2883            Some(ref prefix) => format!("{} {}", prefix, key),
2884            None => key,
2885        };
2886        req_builder = req_builder.header("Authorization", value);
2887    };
2888
2889    let req = req_builder.build()?;
2890    let resp = configuration.client.execute(req).await?;
2891
2892    let status = resp.status();
2893    let content_type = resp
2894        .headers()
2895        .get("content-type")
2896        .and_then(|v| v.to_str().ok())
2897        .unwrap_or("application/octet-stream");
2898    let content_type = super::ContentType::from(content_type);
2899
2900    if !status.is_client_error() && !status.is_server_error() {
2901        let content = resp.text().await?;
2902        match content_type {
2903            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2904            ContentType::Text => return Ok(models::GetForexPairs200ResponseEnum::Text(content)),
2905            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetForexPairs200ResponseEnum`")))),
2906        }
2907    } else {
2908        let content = resp.text().await?;
2909        let entity: Option<GetForexPairsError> = serde_json::from_str(&content).ok();
2910        Err(Error::ResponseError(ResponseContent {
2911            status,
2912            content,
2913            entity,
2914        }))
2915    }
2916}
2917
2918/// The funds endpoint provides a daily updated list of available investment funds. It returns an array containing detailed information about each fund, including identifiers, names, and other relevant attributes.
2919pub async fn get_funds(
2920    configuration: &configuration::Configuration,
2921    params: GetFundsParams,
2922) -> Result<models::GetFunds200ResponseEnum, Error<GetFundsError>> {
2923    // Extract parameters from params struct
2924    let p_query_symbol = params.symbol;
2925    let p_query_figi = params.figi;
2926    let p_query_isin = params.isin;
2927    let p_query_cusip = params.cusip;
2928    let p_query_cik = params.cik;
2929    let p_query_exchange = params.exchange;
2930    let p_query_country = params.country;
2931    let p_query_format = params.format;
2932    let p_query_delimiter = params.delimiter;
2933    let p_query_show_plan = params.show_plan;
2934    let p_query_page = params.page;
2935    let p_query_outputsize = params.outputsize;
2936
2937    let uri_str = format!("{}/funds", configuration.base_path);
2938    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2939
2940    if let Some(ref param_value) = p_query_symbol {
2941        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2942    }
2943    if let Some(ref param_value) = p_query_figi {
2944        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
2945    }
2946    if let Some(ref param_value) = p_query_isin {
2947        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
2948    }
2949    if let Some(ref param_value) = p_query_cusip {
2950        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
2951    }
2952    if let Some(ref param_value) = p_query_cik {
2953        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
2954    }
2955    if let Some(ref param_value) = p_query_exchange {
2956        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
2957    }
2958    if let Some(ref param_value) = p_query_country {
2959        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2960    }
2961    if let Some(ref param_value) = p_query_format {
2962        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2963    }
2964    if let Some(ref param_value) = p_query_delimiter {
2965        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2966    }
2967    if let Some(ref param_value) = p_query_show_plan {
2968        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
2969    }
2970    if let Some(ref param_value) = p_query_page {
2971        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2972    }
2973    if let Some(ref param_value) = p_query_outputsize {
2974        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
2975    }
2976    if let Some(ref user_agent) = configuration.user_agent {
2977        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2978    }
2979    if let Some(ref apikey) = configuration.api_key {
2980        let key = apikey.key.clone();
2981        let value = match apikey.prefix {
2982            Some(ref prefix) => format!("{} {}", prefix, key),
2983            None => key,
2984        };
2985        req_builder = req_builder.header("Authorization", value);
2986    };
2987
2988    let req = req_builder.build()?;
2989    let resp = configuration.client.execute(req).await?;
2990
2991    let status = resp.status();
2992    let content_type = resp
2993        .headers()
2994        .get("content-type")
2995        .and_then(|v| v.to_str().ok())
2996        .unwrap_or("application/octet-stream");
2997    let content_type = super::ContentType::from(content_type);
2998
2999    if !status.is_client_error() && !status.is_server_error() {
3000        let content = resp.text().await?;
3001        match content_type {
3002            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3003            ContentType::Text => return Ok(models::GetFunds200ResponseEnum::Text(content)),
3004            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetFunds200ResponseEnum`")))),
3005        }
3006    } else {
3007        let content = resp.text().await?;
3008        let entity: Option<GetFundsError> = serde_json::from_str(&content).ok();
3009        Err(Error::ResponseError(ResponseContent {
3010            status,
3011            content,
3012            entity,
3013        }))
3014    }
3015}
3016
3017/// The instrument type endpoint lists all available financial instrument types, such as stocks, ETFs, and cryptos. This information is essential for users to identify and categorize different financial instruments when accessing or analyzing market data.
3018pub async fn get_instrument_type(
3019    configuration: &configuration::Configuration,
3020) -> Result<models::GetInstrumentType200ResponseEnum, Error<GetInstrumentTypeError>> {
3021    let uri_str = format!("{}/instrument_type", configuration.base_path);
3022    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3023
3024    if let Some(ref user_agent) = configuration.user_agent {
3025        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3026    }
3027    if let Some(ref apikey) = configuration.api_key {
3028        let key = apikey.key.clone();
3029        let value = match apikey.prefix {
3030            Some(ref prefix) => format!("{} {}", prefix, key),
3031            None => key,
3032        };
3033        req_builder = req_builder.header("Authorization", value);
3034    };
3035
3036    let req = req_builder.build()?;
3037    let resp = configuration.client.execute(req).await?;
3038
3039    let status = resp.status();
3040    let content_type = resp
3041        .headers()
3042        .get("content-type")
3043        .and_then(|v| v.to_str().ok())
3044        .unwrap_or("application/octet-stream");
3045    let content_type = super::ContentType::from(content_type);
3046
3047    if !status.is_client_error() && !status.is_server_error() {
3048        let content = resp.text().await?;
3049        match content_type {
3050            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3051            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetInstrumentType200ResponseEnum`"))),
3052            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetInstrumentType200ResponseEnum`")))),
3053        }
3054    } else {
3055        let content = resp.text().await?;
3056        let entity: Option<GetInstrumentTypeError> = serde_json::from_str(&content).ok();
3057        Err(Error::ResponseError(ResponseContent {
3058            status,
3059            content,
3060            entity,
3061        }))
3062    }
3063}
3064
3065/// The intervals endpoint provides a list of supported time intervals that can be used for querying financial data.
3066pub async fn get_intervals(
3067    configuration: &configuration::Configuration,
3068) -> Result<models::GetIntervals200ResponseEnum, Error<GetIntervalsError>> {
3069    let uri_str = format!("{}/intervals", configuration.base_path);
3070    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3071
3072    if let Some(ref user_agent) = configuration.user_agent {
3073        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3074    }
3075    if let Some(ref apikey) = configuration.api_key {
3076        let key = apikey.key.clone();
3077        let value = match apikey.prefix {
3078            Some(ref prefix) => format!("{} {}", prefix, key),
3079            None => key,
3080        };
3081        req_builder = req_builder.header("Authorization", value);
3082    };
3083
3084    let req = req_builder.build()?;
3085    let resp = configuration.client.execute(req).await?;
3086
3087    let status = resp.status();
3088    let content_type = resp
3089        .headers()
3090        .get("content-type")
3091        .and_then(|v| v.to_str().ok())
3092        .unwrap_or("application/octet-stream");
3093    let content_type = super::ContentType::from(content_type);
3094
3095    if !status.is_client_error() && !status.is_server_error() {
3096        let content = resp.text().await?;
3097        match content_type {
3098            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3099            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetIntervals200ResponseEnum`"))),
3100            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetIntervals200ResponseEnum`")))),
3101        }
3102    } else {
3103        let content = resp.text().await?;
3104        let entity: Option<GetIntervalsError> = serde_json::from_str(&content).ok();
3105        Err(Error::ResponseError(ResponseContent {
3106            status,
3107            content,
3108            entity,
3109        }))
3110    }
3111}
3112
3113/// The market state endpoint provides real-time information on the operational status of all available stock exchanges. It returns data on whether each exchange is currently open or closed, along with the time remaining until the next opening or closing. This endpoint is useful for users who need to monitor exchange hours and plan their trading activities accordingly.
3114pub async fn get_market_state(
3115    configuration: &configuration::Configuration,
3116    params: GetMarketStateParams,
3117) -> Result<models::GetMarketState200ResponseEnum, Error<GetMarketStateError>> {
3118    // Extract parameters from params struct
3119    let p_query_exchange = params.exchange;
3120    let p_query_code = params.code;
3121    let p_query_country = params.country;
3122
3123    let uri_str = format!("{}/market_state", configuration.base_path);
3124    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3125
3126    if let Some(ref param_value) = p_query_exchange {
3127        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
3128    }
3129    if let Some(ref param_value) = p_query_code {
3130        req_builder = req_builder.query(&[("code", &param_value.to_string())]);
3131    }
3132    if let Some(ref param_value) = p_query_country {
3133        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3134    }
3135    if let Some(ref user_agent) = configuration.user_agent {
3136        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3137    }
3138    if let Some(ref apikey) = configuration.api_key {
3139        let key = apikey.key.clone();
3140        let value = match apikey.prefix {
3141            Some(ref prefix) => format!("{} {}", prefix, key),
3142            None => key,
3143        };
3144        req_builder = req_builder.header("Authorization", value);
3145    };
3146
3147    let req = req_builder.build()?;
3148    let resp = configuration.client.execute(req).await?;
3149
3150    let status = resp.status();
3151    let content_type = resp
3152        .headers()
3153        .get("content-type")
3154        .and_then(|v| v.to_str().ok())
3155        .unwrap_or("application/octet-stream");
3156    let content_type = super::ContentType::from(content_type);
3157
3158    if !status.is_client_error() && !status.is_server_error() {
3159        let content = resp.text().await?;
3160        match content_type {
3161            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3162            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetMarketState200ResponseEnum`"))),
3163            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetMarketState200ResponseEnum`")))),
3164        }
3165    } else {
3166        let content = resp.text().await?;
3167        let entity: Option<GetMarketStateError> = serde_json::from_str(&content).ok();
3168        Err(Error::ResponseError(ResponseContent {
3169            status,
3170            content,
3171            entity,
3172        }))
3173    }
3174}
3175
3176/// The mutual funds family endpoint provides a comprehensive list of MF families, which are groups of mutual funds managed by the same investment company. This data is useful for users looking to explore or compare different fund families, understand the range of investment options offered by each, and identify potential investment opportunities within specific fund families.
3177pub async fn get_mutual_funds_family(
3178    configuration: &configuration::Configuration,
3179    params: GetMutualFundsFamilyParams,
3180) -> Result<models::GetMutualFundsFamily200ResponseEnum, Error<GetMutualFundsFamilyError>> {
3181    // Extract parameters from params struct
3182    let p_query_fund_family = params.fund_family;
3183    let p_query_country = params.country;
3184
3185    let uri_str = format!("{}/mutual_funds/family", configuration.base_path);
3186    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3187
3188    if let Some(ref param_value) = p_query_fund_family {
3189        req_builder = req_builder.query(&[("fund_family", &param_value.to_string())]);
3190    }
3191    if let Some(ref param_value) = p_query_country {
3192        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3193    }
3194    if let Some(ref user_agent) = configuration.user_agent {
3195        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3196    }
3197    if let Some(ref apikey) = configuration.api_key {
3198        let key = apikey.key.clone();
3199        let value = match apikey.prefix {
3200            Some(ref prefix) => format!("{} {}", prefix, key),
3201            None => key,
3202        };
3203        req_builder = req_builder.header("Authorization", value);
3204    };
3205
3206    let req = req_builder.build()?;
3207    let resp = configuration.client.execute(req).await?;
3208
3209    let status = resp.status();
3210    let content_type = resp
3211        .headers()
3212        .get("content-type")
3213        .and_then(|v| v.to_str().ok())
3214        .unwrap_or("application/octet-stream");
3215    let content_type = super::ContentType::from(content_type);
3216
3217    if !status.is_client_error() && !status.is_server_error() {
3218        let content = resp.text().await?;
3219        match content_type {
3220            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3221            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetMutualFundsFamily200ResponseEnum`"))),
3222            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetMutualFundsFamily200ResponseEnum`")))),
3223        }
3224    } else {
3225        let content = resp.text().await?;
3226        let entity: Option<GetMutualFundsFamilyError> = serde_json::from_str(&content).ok();
3227        Err(Error::ResponseError(ResponseContent {
3228            status,
3229            content,
3230            entity,
3231        }))
3232    }
3233}
3234
3235/// The mutual funds directory endpoint provides a daily updated list of mutual funds, sorted in descending order by their total assets value. This endpoint is useful for retrieving an organized overview of available mutual funds.
3236pub async fn get_mutual_funds_list(
3237    configuration: &configuration::Configuration,
3238    params: GetMutualFundsListParams,
3239) -> Result<models::GetMutualFundsList200ResponseEnum, Error<GetMutualFundsListError>> {
3240    // Extract parameters from params struct
3241    let p_query_symbol = params.symbol;
3242    let p_query_figi = params.figi;
3243    let p_query_isin = params.isin;
3244    let p_query_cusip = params.cusip;
3245    let p_query_cik = params.cik;
3246    let p_query_country = params.country;
3247    let p_query_fund_family = params.fund_family;
3248    let p_query_fund_type = params.fund_type;
3249    let p_query_performance_rating = params.performance_rating;
3250    let p_query_risk_rating = params.risk_rating;
3251    let p_query_page = params.page;
3252    let p_query_outputsize = params.outputsize;
3253
3254    let uri_str = format!("{}/mutual_funds/list", configuration.base_path);
3255    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3256
3257    if let Some(ref param_value) = p_query_symbol {
3258        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
3259    }
3260    if let Some(ref param_value) = p_query_figi {
3261        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
3262    }
3263    if let Some(ref param_value) = p_query_isin {
3264        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
3265    }
3266    if let Some(ref param_value) = p_query_cusip {
3267        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
3268    }
3269    if let Some(ref param_value) = p_query_cik {
3270        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
3271    }
3272    if let Some(ref param_value) = p_query_country {
3273        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3274    }
3275    if let Some(ref param_value) = p_query_fund_family {
3276        req_builder = req_builder.query(&[("fund_family", &param_value.to_string())]);
3277    }
3278    if let Some(ref param_value) = p_query_fund_type {
3279        req_builder = req_builder.query(&[("fund_type", &param_value.to_string())]);
3280    }
3281    if let Some(ref param_value) = p_query_performance_rating {
3282        req_builder = req_builder.query(&[("performance_rating", &param_value.to_string())]);
3283    }
3284    if let Some(ref param_value) = p_query_risk_rating {
3285        req_builder = req_builder.query(&[("risk_rating", &param_value.to_string())]);
3286    }
3287    if let Some(ref param_value) = p_query_page {
3288        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3289    }
3290    if let Some(ref param_value) = p_query_outputsize {
3291        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
3292    }
3293    if let Some(ref user_agent) = configuration.user_agent {
3294        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3295    }
3296    if let Some(ref apikey) = configuration.api_key {
3297        let key = apikey.key.clone();
3298        let value = match apikey.prefix {
3299            Some(ref prefix) => format!("{} {}", prefix, key),
3300            None => key,
3301        };
3302        req_builder = req_builder.header("Authorization", value);
3303    };
3304
3305    let req = req_builder.build()?;
3306    let resp = configuration.client.execute(req).await?;
3307
3308    let status = resp.status();
3309    let content_type = resp
3310        .headers()
3311        .get("content-type")
3312        .and_then(|v| v.to_str().ok())
3313        .unwrap_or("application/octet-stream");
3314    let content_type = super::ContentType::from(content_type);
3315
3316    if !status.is_client_error() && !status.is_server_error() {
3317        let content = resp.text().await?;
3318        match content_type {
3319            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3320            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetMutualFundsList200ResponseEnum`"))),
3321            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetMutualFundsList200ResponseEnum`")))),
3322        }
3323    } else {
3324        let content = resp.text().await?;
3325        let entity: Option<GetMutualFundsListError> = serde_json::from_str(&content).ok();
3326        Err(Error::ResponseError(ResponseContent {
3327            status,
3328            content,
3329            entity,
3330        }))
3331    }
3332}
3333
3334/// This endpoint provides detailed information on various types of mutual funds, such as equity, bond, and balanced funds, allowing users to understand the different investment options available.
3335pub async fn get_mutual_funds_type(
3336    configuration: &configuration::Configuration,
3337    params: GetMutualFundsTypeParams,
3338) -> Result<models::GetMutualFundsType200ResponseEnum, Error<GetMutualFundsTypeError>> {
3339    // Extract parameters from params struct
3340    let p_query_fund_type = params.fund_type;
3341    let p_query_country = params.country;
3342
3343    let uri_str = format!("{}/mutual_funds/type", configuration.base_path);
3344    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3345
3346    if let Some(ref param_value) = p_query_fund_type {
3347        req_builder = req_builder.query(&[("fund_type", &param_value.to_string())]);
3348    }
3349    if let Some(ref param_value) = p_query_country {
3350        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3351    }
3352    if let Some(ref user_agent) = configuration.user_agent {
3353        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3354    }
3355    if let Some(ref apikey) = configuration.api_key {
3356        let key = apikey.key.clone();
3357        let value = match apikey.prefix {
3358            Some(ref prefix) => format!("{} {}", prefix, key),
3359            None => key,
3360        };
3361        req_builder = req_builder.header("Authorization", value);
3362    };
3363
3364    let req = req_builder.build()?;
3365    let resp = configuration.client.execute(req).await?;
3366
3367    let status = resp.status();
3368    let content_type = resp
3369        .headers()
3370        .get("content-type")
3371        .and_then(|v| v.to_str().ok())
3372        .unwrap_or("application/octet-stream");
3373    let content_type = super::ContentType::from(content_type);
3374
3375    if !status.is_client_error() && !status.is_server_error() {
3376        let content = resp.text().await?;
3377        match content_type {
3378            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3379            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetMutualFundsType200ResponseEnum`"))),
3380            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetMutualFundsType200ResponseEnum`")))),
3381        }
3382    } else {
3383        let content = resp.text().await?;
3384        let entity: Option<GetMutualFundsTypeError> = serde_json::from_str(&content).ok();
3385        Err(Error::ResponseError(ResponseContent {
3386            status,
3387            content,
3388            entity,
3389        }))
3390    }
3391}
3392
3393/// The stocks endpoint provides a daily updated list of all available stock symbols. It returns an array containing the symbols, which can be used to identify and access specific stock data across various services. This endpoint is essential for users needing to retrieve the latest stock symbol information for further data requests or integration into financial applications.
3394pub async fn get_stocks(
3395    configuration: &configuration::Configuration,
3396    params: GetStocksParams,
3397) -> Result<models::GetStocks200ResponseEnum, Error<GetStocksError>> {
3398    // Extract parameters from params struct
3399    let p_query_symbol = params.symbol;
3400    let p_query_figi = params.figi;
3401    let p_query_isin = params.isin;
3402    let p_query_cusip = params.cusip;
3403    let p_query_cik = params.cik;
3404    let p_query_exchange = params.exchange;
3405    let p_query_mic_code = params.mic_code;
3406    let p_query_country = params.country;
3407    let p_query_type = params.r#type;
3408    let p_query_format = params.format;
3409    let p_query_delimiter = params.delimiter;
3410    let p_query_show_plan = params.show_plan;
3411    let p_query_include_delisted = params.include_delisted;
3412
3413    let uri_str = format!("{}/stocks", configuration.base_path);
3414    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3415
3416    if let Some(ref param_value) = p_query_symbol {
3417        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
3418    }
3419    if let Some(ref param_value) = p_query_figi {
3420        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
3421    }
3422    if let Some(ref param_value) = p_query_isin {
3423        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
3424    }
3425    if let Some(ref param_value) = p_query_cusip {
3426        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
3427    }
3428    if let Some(ref param_value) = p_query_cik {
3429        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
3430    }
3431    if let Some(ref param_value) = p_query_exchange {
3432        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
3433    }
3434    if let Some(ref param_value) = p_query_mic_code {
3435        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
3436    }
3437    if let Some(ref param_value) = p_query_country {
3438        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3439    }
3440    if let Some(ref param_value) = p_query_type {
3441        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
3442    }
3443    if let Some(ref param_value) = p_query_format {
3444        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
3445    }
3446    if let Some(ref param_value) = p_query_delimiter {
3447        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
3448    }
3449    if let Some(ref param_value) = p_query_show_plan {
3450        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
3451    }
3452    if let Some(ref param_value) = p_query_include_delisted {
3453        req_builder = req_builder.query(&[("include_delisted", &param_value.to_string())]);
3454    }
3455    if let Some(ref user_agent) = configuration.user_agent {
3456        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3457    }
3458    if let Some(ref apikey) = configuration.api_key {
3459        let key = apikey.key.clone();
3460        let value = match apikey.prefix {
3461            Some(ref prefix) => format!("{} {}", prefix, key),
3462            None => key,
3463        };
3464        req_builder = req_builder.header("Authorization", value);
3465    };
3466
3467    let req = req_builder.build()?;
3468    let resp = configuration.client.execute(req).await?;
3469
3470    let status = resp.status();
3471    let content_type = resp
3472        .headers()
3473        .get("content-type")
3474        .and_then(|v| v.to_str().ok())
3475        .unwrap_or("application/octet-stream");
3476    let content_type = super::ContentType::from(content_type);
3477
3478    if !status.is_client_error() && !status.is_server_error() {
3479        let content = resp.text().await?;
3480        match content_type {
3481            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3482            ContentType::Text => return Ok(models::GetStocks200ResponseEnum::Text(content)),
3483            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetStocks200ResponseEnum`")))),
3484        }
3485    } else {
3486        let content = resp.text().await?;
3487        let entity: Option<GetStocksError> = serde_json::from_str(&content).ok();
3488        Err(Error::ResponseError(ResponseContent {
3489            status,
3490            content,
3491            entity,
3492        }))
3493    }
3494}
3495
3496/// The symbol search endpoint allows users to find financial instruments by name or symbol. It returns a list of matching symbols, ordered by relevance, with the most relevant instrument first. This is useful for quickly locating specific stocks, ETFs, or other financial instruments when only partial information is available.
3497pub async fn get_symbol_search(
3498    configuration: &configuration::Configuration,
3499    params: GetSymbolSearchParams,
3500) -> Result<models::GetSymbolSearch200ResponseEnum, Error<GetSymbolSearchError>> {
3501    // Extract parameters from params struct
3502    let p_query_symbol = params.symbol;
3503    let p_query_outputsize = params.outputsize;
3504    let p_query_show_plan = params.show_plan;
3505
3506    let uri_str = format!("{}/symbol_search", configuration.base_path);
3507    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3508
3509    req_builder = req_builder.query(&[("symbol", &p_query_symbol.to_string())]);
3510    if let Some(ref param_value) = p_query_outputsize {
3511        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
3512    }
3513    if let Some(ref param_value) = p_query_show_plan {
3514        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
3515    }
3516    if let Some(ref user_agent) = configuration.user_agent {
3517        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3518    }
3519    if let Some(ref apikey) = configuration.api_key {
3520        let key = apikey.key.clone();
3521        let value = match apikey.prefix {
3522            Some(ref prefix) => format!("{} {}", prefix, key),
3523            None => key,
3524        };
3525        req_builder = req_builder.header("Authorization", value);
3526    };
3527
3528    let req = req_builder.build()?;
3529    let resp = configuration.client.execute(req).await?;
3530
3531    let status = resp.status();
3532    let content_type = resp
3533        .headers()
3534        .get("content-type")
3535        .and_then(|v| v.to_str().ok())
3536        .unwrap_or("application/octet-stream");
3537    let content_type = super::ContentType::from(content_type);
3538
3539    if !status.is_client_error() && !status.is_server_error() {
3540        let content = resp.text().await?;
3541        match content_type {
3542            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3543            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetSymbolSearch200ResponseEnum`"))),
3544            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetSymbolSearch200ResponseEnum`")))),
3545        }
3546    } else {
3547        let content = resp.text().await?;
3548        let entity: Option<GetSymbolSearchError> = serde_json::from_str(&content).ok();
3549        Err(Error::ResponseError(ResponseContent {
3550            status,
3551            content,
3552            entity,
3553        }))
3554    }
3555}
3556
3557/// The technical indicators endpoint provides a comprehensive list of available technical indicators, each represented as an object. This endpoint is useful for developers looking to integrate a variety of technical analysis tools into their applications, allowing for streamlined access to indicator data without needing to manually configure each one.
3558pub async fn get_technical_indicators(
3559    configuration: &configuration::Configuration,
3560) -> Result<models::GetTechnicalIndicators200ResponseEnum, Error<GetTechnicalIndicatorsError>> {
3561    let uri_str = format!("{}/technical_indicators", configuration.base_path);
3562    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3563
3564    if let Some(ref user_agent) = configuration.user_agent {
3565        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3566    }
3567    if let Some(ref apikey) = configuration.api_key {
3568        let key = apikey.key.clone();
3569        let value = match apikey.prefix {
3570            Some(ref prefix) => format!("{} {}", prefix, key),
3571            None => key,
3572        };
3573        req_builder = req_builder.header("Authorization", value);
3574    };
3575
3576    let req = req_builder.build()?;
3577    let resp = configuration.client.execute(req).await?;
3578
3579    let status = resp.status();
3580    let content_type = resp
3581        .headers()
3582        .get("content-type")
3583        .and_then(|v| v.to_str().ok())
3584        .unwrap_or("application/octet-stream");
3585    let content_type = super::ContentType::from(content_type);
3586
3587    if !status.is_client_error() && !status.is_server_error() {
3588        let content = resp.text().await?;
3589        match content_type {
3590            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3591            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetTechnicalIndicators200ResponseEnum`"))),
3592            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GetTechnicalIndicators200ResponseEnum`")))),
3593        }
3594    } else {
3595        let content = resp.text().await?;
3596        let entity: Option<GetTechnicalIndicatorsError> = serde_json::from_str(&content).ok();
3597        Err(Error::ResponseError(ResponseContent {
3598            status,
3599            content,
3600            entity,
3601        }))
3602    }
3603}