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::GetBondsResponse, 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::GetBondsResponse::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::GetBondsResponse`")))),
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::GetCommoditiesResponse, 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::GetCommoditiesResponse::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::GetCommoditiesResponse`")))),
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::GetCountriesResponse, 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::GetCountriesResponse`"))),
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::GetCountriesResponse`")))),
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::GetCrossListingsResponse, 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::GetCrossListingsResponse`"))),
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::GetCrossListingsResponse`")))),
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::GetCryptocurrenciesResponse, 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::GetCryptocurrenciesResponse::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::GetCryptocurrenciesResponse`")))),
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::GetCryptocurrencyExchangesResponse, Error<GetCryptocurrencyExchangesError>> {
2257    // Extract parameters from params struct
2258    let p_query_format = params.format;
2259    let p_query_delimiter = params.delimiter;
2260
2261    let uri_str = format!("{}/cryptocurrency_exchanges", configuration.base_path);
2262    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2263
2264    if let Some(ref param_value) = p_query_format {
2265        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2266    }
2267    if let Some(ref param_value) = p_query_delimiter {
2268        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2269    }
2270    if let Some(ref user_agent) = configuration.user_agent {
2271        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2272    }
2273    if let Some(ref apikey) = configuration.api_key {
2274        let key = apikey.key.clone();
2275        let value = match apikey.prefix {
2276            Some(ref prefix) => format!("{} {}", prefix, key),
2277            None => key,
2278        };
2279        req_builder = req_builder.header("Authorization", value);
2280    };
2281
2282    let req = req_builder.build()?;
2283    let resp = configuration.client.execute(req).await?;
2284
2285    let status = resp.status();
2286    let content_type = resp
2287        .headers()
2288        .get("content-type")
2289        .and_then(|v| v.to_str().ok())
2290        .unwrap_or("application/octet-stream");
2291    let content_type = super::ContentType::from(content_type);
2292
2293    if !status.is_client_error() && !status.is_server_error() {
2294        let content = resp.text().await?;
2295        match content_type {
2296            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2297            ContentType::Text => return Ok(models::GetCryptocurrencyExchangesResponse::Text(content)),
2298            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::GetCryptocurrencyExchangesResponse`")))),
2299        }
2300    } else {
2301        let content = resp.text().await?;
2302        let entity: Option<GetCryptocurrencyExchangesError> = serde_json::from_str(&content).ok();
2303        Err(Error::ResponseError(ResponseContent {
2304            status,
2305            content,
2306            entity,
2307        }))
2308    }
2309}
2310
2311/// 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.
2312pub async fn get_earliest_timestamp(
2313    configuration: &configuration::Configuration,
2314    params: GetEarliestTimestampParams,
2315) -> Result<models::GetEarliestTimestampResponse, Error<GetEarliestTimestampError>> {
2316    // Extract parameters from params struct
2317    let p_query_interval = params.interval;
2318    let p_query_symbol = params.symbol;
2319    let p_query_figi = params.figi;
2320    let p_query_isin = params.isin;
2321    let p_query_cusip = params.cusip;
2322    let p_query_exchange = params.exchange;
2323    let p_query_mic_code = params.mic_code;
2324    let p_query_timezone = params.timezone;
2325
2326    let uri_str = format!("{}/earliest_timestamp", configuration.base_path);
2327    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2328
2329    if let Some(ref param_value) = p_query_symbol {
2330        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2331    }
2332    if let Some(ref param_value) = p_query_figi {
2333        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
2334    }
2335    if let Some(ref param_value) = p_query_isin {
2336        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
2337    }
2338    if let Some(ref param_value) = p_query_cusip {
2339        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
2340    }
2341    req_builder = req_builder.query(&[("interval", &p_query_interval.to_string())]);
2342    if let Some(ref param_value) = p_query_exchange {
2343        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
2344    }
2345    if let Some(ref param_value) = p_query_mic_code {
2346        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
2347    }
2348    if let Some(ref param_value) = p_query_timezone {
2349        req_builder = req_builder.query(&[("timezone", &param_value.to_string())]);
2350    }
2351    if let Some(ref user_agent) = configuration.user_agent {
2352        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2353    }
2354    if let Some(ref apikey) = configuration.api_key {
2355        let key = apikey.key.clone();
2356        let value = match apikey.prefix {
2357            Some(ref prefix) => format!("{} {}", prefix, key),
2358            None => key,
2359        };
2360        req_builder = req_builder.header("Authorization", value);
2361    };
2362
2363    let req = req_builder.build()?;
2364    let resp = configuration.client.execute(req).await?;
2365
2366    let status = resp.status();
2367    let content_type = resp
2368        .headers()
2369        .get("content-type")
2370        .and_then(|v| v.to_str().ok())
2371        .unwrap_or("application/octet-stream");
2372    let content_type = super::ContentType::from(content_type);
2373
2374    if !status.is_client_error() && !status.is_server_error() {
2375        let content = resp.text().await?;
2376        match content_type {
2377            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2378            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEarliestTimestampResponse`"))),
2379            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::GetEarliestTimestampResponse`")))),
2380        }
2381    } else {
2382        let content = resp.text().await?;
2383        let entity: Option<GetEarliestTimestampError> = serde_json::from_str(&content).ok();
2384        Err(Error::ResponseError(ResponseContent {
2385            status,
2386            content,
2387            entity,
2388        }))
2389    }
2390}
2391
2392/// 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.
2393pub async fn get_etf(
2394    configuration: &configuration::Configuration,
2395    params: GetEtfParams,
2396) -> Result<models::GetEtfResponse, Error<GetEtfError>> {
2397    // Extract parameters from params struct
2398    let p_query_symbol = params.symbol;
2399    let p_query_figi = params.figi;
2400    let p_query_isin = params.isin;
2401    let p_query_cusip = params.cusip;
2402    let p_query_cik = params.cik;
2403    let p_query_exchange = params.exchange;
2404    let p_query_mic_code = params.mic_code;
2405    let p_query_country = params.country;
2406    let p_query_format = params.format;
2407    let p_query_delimiter = params.delimiter;
2408    let p_query_show_plan = params.show_plan;
2409    let p_query_include_delisted = params.include_delisted;
2410
2411    let uri_str = format!("{}/etfs", configuration.base_path);
2412    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2413
2414    if let Some(ref param_value) = p_query_symbol {
2415        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2416    }
2417    if let Some(ref param_value) = p_query_figi {
2418        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
2419    }
2420    if let Some(ref param_value) = p_query_isin {
2421        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
2422    }
2423    if let Some(ref param_value) = p_query_cusip {
2424        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
2425    }
2426    if let Some(ref param_value) = p_query_cik {
2427        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
2428    }
2429    if let Some(ref param_value) = p_query_exchange {
2430        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
2431    }
2432    if let Some(ref param_value) = p_query_mic_code {
2433        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
2434    }
2435    if let Some(ref param_value) = p_query_country {
2436        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2437    }
2438    if let Some(ref param_value) = p_query_format {
2439        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2440    }
2441    if let Some(ref param_value) = p_query_delimiter {
2442        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2443    }
2444    if let Some(ref param_value) = p_query_show_plan {
2445        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
2446    }
2447    if let Some(ref param_value) = p_query_include_delisted {
2448        req_builder = req_builder.query(&[("include_delisted", &param_value.to_string())]);
2449    }
2450    if let Some(ref user_agent) = configuration.user_agent {
2451        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2452    }
2453    if let Some(ref apikey) = configuration.api_key {
2454        let key = apikey.key.clone();
2455        let value = match apikey.prefix {
2456            Some(ref prefix) => format!("{} {}", prefix, key),
2457            None => key,
2458        };
2459        req_builder = req_builder.header("Authorization", value);
2460    };
2461
2462    let req = req_builder.build()?;
2463    let resp = configuration.client.execute(req).await?;
2464
2465    let status = resp.status();
2466    let content_type = resp
2467        .headers()
2468        .get("content-type")
2469        .and_then(|v| v.to_str().ok())
2470        .unwrap_or("application/octet-stream");
2471    let content_type = super::ContentType::from(content_type);
2472
2473    if !status.is_client_error() && !status.is_server_error() {
2474        let content = resp.text().await?;
2475        match content_type {
2476            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2477            ContentType::Text => return Ok(models::GetEtfResponse::Text(content)),
2478            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::GetEtfResponse`")))),
2479        }
2480    } else {
2481        let content = resp.text().await?;
2482        let entity: Option<GetEtfError> = serde_json::from_str(&content).ok();
2483        Err(Error::ResponseError(ResponseContent {
2484            status,
2485            content,
2486            entity,
2487        }))
2488    }
2489}
2490
2491/// 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.
2492pub async fn get_etfs_family(
2493    configuration: &configuration::Configuration,
2494    params: GetEtfsFamilyParams,
2495) -> Result<models::GetEtfsFamilyResponse, Error<GetEtfsFamilyError>> {
2496    // Extract parameters from params struct
2497    let p_query_country = params.country;
2498    let p_query_fund_family = params.fund_family;
2499
2500    let uri_str = format!("{}/etfs/family", configuration.base_path);
2501    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2502
2503    if let Some(ref param_value) = p_query_country {
2504        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2505    }
2506    if let Some(ref param_value) = p_query_fund_family {
2507        req_builder = req_builder.query(&[("fund_family", &param_value.to_string())]);
2508    }
2509    if let Some(ref user_agent) = configuration.user_agent {
2510        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2511    }
2512    if let Some(ref apikey) = configuration.api_key {
2513        let key = apikey.key.clone();
2514        let value = match apikey.prefix {
2515            Some(ref prefix) => format!("{} {}", prefix, key),
2516            None => key,
2517        };
2518        req_builder = req_builder.header("Authorization", value);
2519    };
2520
2521    let req = req_builder.build()?;
2522    let resp = configuration.client.execute(req).await?;
2523
2524    let status = resp.status();
2525    let content_type = resp
2526        .headers()
2527        .get("content-type")
2528        .and_then(|v| v.to_str().ok())
2529        .unwrap_or("application/octet-stream");
2530    let content_type = super::ContentType::from(content_type);
2531
2532    if !status.is_client_error() && !status.is_server_error() {
2533        let content = resp.text().await?;
2534        match content_type {
2535            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2536            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsFamilyResponse`"))),
2537            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::GetEtfsFamilyResponse`")))),
2538        }
2539    } else {
2540        let content = resp.text().await?;
2541        let entity: Option<GetEtfsFamilyError> = serde_json::from_str(&content).ok();
2542        Err(Error::ResponseError(ResponseContent {
2543            status,
2544            content,
2545            entity,
2546        }))
2547    }
2548}
2549
2550/// 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.
2551pub async fn get_etfs_list(
2552    configuration: &configuration::Configuration,
2553    params: GetEtfsListParams,
2554) -> Result<models::GetEtfsListResponse, Error<GetEtfsListError>> {
2555    // Extract parameters from params struct
2556    let p_query_symbol = params.symbol;
2557    let p_query_figi = params.figi;
2558    let p_query_isin = params.isin;
2559    let p_query_cusip = params.cusip;
2560    let p_query_cik = params.cik;
2561    let p_query_country = params.country;
2562    let p_query_fund_family = params.fund_family;
2563    let p_query_fund_type = params.fund_type;
2564    let p_query_page = params.page;
2565    let p_query_outputsize = params.outputsize;
2566
2567    let uri_str = format!("{}/etfs/list", configuration.base_path);
2568    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2569
2570    if let Some(ref param_value) = p_query_symbol {
2571        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2572    }
2573    if let Some(ref param_value) = p_query_figi {
2574        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
2575    }
2576    if let Some(ref param_value) = p_query_isin {
2577        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
2578    }
2579    if let Some(ref param_value) = p_query_cusip {
2580        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
2581    }
2582    if let Some(ref param_value) = p_query_cik {
2583        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
2584    }
2585    if let Some(ref param_value) = p_query_country {
2586        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2587    }
2588    if let Some(ref param_value) = p_query_fund_family {
2589        req_builder = req_builder.query(&[("fund_family", &param_value.to_string())]);
2590    }
2591    if let Some(ref param_value) = p_query_fund_type {
2592        req_builder = req_builder.query(&[("fund_type", &param_value.to_string())]);
2593    }
2594    if let Some(ref param_value) = p_query_page {
2595        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2596    }
2597    if let Some(ref param_value) = p_query_outputsize {
2598        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
2599    }
2600    if let Some(ref user_agent) = configuration.user_agent {
2601        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2602    }
2603    if let Some(ref apikey) = configuration.api_key {
2604        let key = apikey.key.clone();
2605        let value = match apikey.prefix {
2606            Some(ref prefix) => format!("{} {}", prefix, key),
2607            None => key,
2608        };
2609        req_builder = req_builder.header("Authorization", value);
2610    };
2611
2612    let req = req_builder.build()?;
2613    let resp = configuration.client.execute(req).await?;
2614
2615    let status = resp.status();
2616    let content_type = resp
2617        .headers()
2618        .get("content-type")
2619        .and_then(|v| v.to_str().ok())
2620        .unwrap_or("application/octet-stream");
2621    let content_type = super::ContentType::from(content_type);
2622
2623    if !status.is_client_error() && !status.is_server_error() {
2624        let content = resp.text().await?;
2625        match content_type {
2626            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2627            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsListResponse`"))),
2628            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::GetEtfsListResponse`")))),
2629        }
2630    } else {
2631        let content = resp.text().await?;
2632        let entity: Option<GetEtfsListError> = serde_json::from_str(&content).ok();
2633        Err(Error::ResponseError(ResponseContent {
2634            status,
2635            content,
2636            entity,
2637        }))
2638    }
2639}
2640
2641/// 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.
2642pub async fn get_etfs_type(
2643    configuration: &configuration::Configuration,
2644    params: GetEtfsTypeParams,
2645) -> Result<models::GetEtfsTypeResponse, Error<GetEtfsTypeError>> {
2646    // Extract parameters from params struct
2647    let p_query_country = params.country;
2648    let p_query_fund_type = params.fund_type;
2649
2650    let uri_str = format!("{}/etfs/type", configuration.base_path);
2651    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2652
2653    if let Some(ref param_value) = p_query_country {
2654        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2655    }
2656    if let Some(ref param_value) = p_query_fund_type {
2657        req_builder = req_builder.query(&[("fund_type", &param_value.to_string())]);
2658    }
2659    if let Some(ref user_agent) = configuration.user_agent {
2660        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2661    }
2662    if let Some(ref apikey) = configuration.api_key {
2663        let key = apikey.key.clone();
2664        let value = match apikey.prefix {
2665            Some(ref prefix) => format!("{} {}", prefix, key),
2666            None => key,
2667        };
2668        req_builder = req_builder.header("Authorization", value);
2669    };
2670
2671    let req = req_builder.build()?;
2672    let resp = configuration.client.execute(req).await?;
2673
2674    let status = resp.status();
2675    let content_type = resp
2676        .headers()
2677        .get("content-type")
2678        .and_then(|v| v.to_str().ok())
2679        .unwrap_or("application/octet-stream");
2680    let content_type = super::ContentType::from(content_type);
2681
2682    if !status.is_client_error() && !status.is_server_error() {
2683        let content = resp.text().await?;
2684        match content_type {
2685            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2686            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetEtfsTypeResponse`"))),
2687            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::GetEtfsTypeResponse`")))),
2688        }
2689    } else {
2690        let content = resp.text().await?;
2691        let entity: Option<GetEtfsTypeError> = serde_json::from_str(&content).ok();
2692        Err(Error::ResponseError(ResponseContent {
2693            status,
2694            content,
2695            entity,
2696        }))
2697    }
2698}
2699
2700/// 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.
2701pub async fn get_exchange_schedule(
2702    configuration: &configuration::Configuration,
2703    params: GetExchangeScheduleParams,
2704) -> Result<models::GetExchangeScheduleResponse, Error<GetExchangeScheduleError>> {
2705    // Extract parameters from params struct
2706    let p_query_mic_name = params.mic_name;
2707    let p_query_mic_code = params.mic_code;
2708    let p_query_country = params.country;
2709    let p_query_date = params.date;
2710
2711    let uri_str = format!("{}/exchange_schedule", configuration.base_path);
2712    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2713
2714    if let Some(ref param_value) = p_query_mic_name {
2715        req_builder = req_builder.query(&[("mic_name", &param_value.to_string())]);
2716    }
2717    if let Some(ref param_value) = p_query_mic_code {
2718        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
2719    }
2720    if let Some(ref param_value) = p_query_country {
2721        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2722    }
2723    if let Some(ref param_value) = p_query_date {
2724        req_builder = req_builder.query(&[("date", &param_value.to_string())]);
2725    }
2726    if let Some(ref user_agent) = configuration.user_agent {
2727        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2728    }
2729    if let Some(ref apikey) = configuration.api_key {
2730        let key = apikey.key.clone();
2731        let value = match apikey.prefix {
2732            Some(ref prefix) => format!("{} {}", prefix, key),
2733            None => key,
2734        };
2735        req_builder = req_builder.header("Authorization", value);
2736    };
2737
2738    let req = req_builder.build()?;
2739    let resp = configuration.client.execute(req).await?;
2740
2741    let status = resp.status();
2742    let content_type = resp
2743        .headers()
2744        .get("content-type")
2745        .and_then(|v| v.to_str().ok())
2746        .unwrap_or("application/octet-stream");
2747    let content_type = super::ContentType::from(content_type);
2748
2749    if !status.is_client_error() && !status.is_server_error() {
2750        let content = resp.text().await?;
2751        match content_type {
2752            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2753            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetExchangeScheduleResponse`"))),
2754            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::GetExchangeScheduleResponse`")))),
2755        }
2756    } else {
2757        let content = resp.text().await?;
2758        let entity: Option<GetExchangeScheduleError> = serde_json::from_str(&content).ok();
2759        Err(Error::ResponseError(ResponseContent {
2760            status,
2761            content,
2762            entity,
2763        }))
2764    }
2765}
2766
2767/// 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.
2768pub async fn get_exchanges(
2769    configuration: &configuration::Configuration,
2770    params: GetExchangesParams,
2771) -> Result<models::GetExchangesResponse, Error<GetExchangesError>> {
2772    // Extract parameters from params struct
2773    let p_query_type = params.r#type;
2774    let p_query_name = params.name;
2775    let p_query_code = params.code;
2776    let p_query_country = params.country;
2777    let p_query_format = params.format;
2778    let p_query_delimiter = params.delimiter;
2779    let p_query_show_plan = params.show_plan;
2780
2781    let uri_str = format!("{}/exchanges", configuration.base_path);
2782    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2783
2784    if let Some(ref param_value) = p_query_type {
2785        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
2786    }
2787    if let Some(ref param_value) = p_query_name {
2788        req_builder = req_builder.query(&[("name", &param_value.to_string())]);
2789    }
2790    if let Some(ref param_value) = p_query_code {
2791        req_builder = req_builder.query(&[("code", &param_value.to_string())]);
2792    }
2793    if let Some(ref param_value) = p_query_country {
2794        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2795    }
2796    if let Some(ref param_value) = p_query_format {
2797        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2798    }
2799    if let Some(ref param_value) = p_query_delimiter {
2800        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2801    }
2802    if let Some(ref param_value) = p_query_show_plan {
2803        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
2804    }
2805    if let Some(ref user_agent) = configuration.user_agent {
2806        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2807    }
2808    if let Some(ref apikey) = configuration.api_key {
2809        let key = apikey.key.clone();
2810        let value = match apikey.prefix {
2811            Some(ref prefix) => format!("{} {}", prefix, key),
2812            None => key,
2813        };
2814        req_builder = req_builder.header("Authorization", value);
2815    };
2816
2817    let req = req_builder.build()?;
2818    let resp = configuration.client.execute(req).await?;
2819
2820    let status = resp.status();
2821    let content_type = resp
2822        .headers()
2823        .get("content-type")
2824        .and_then(|v| v.to_str().ok())
2825        .unwrap_or("application/octet-stream");
2826    let content_type = super::ContentType::from(content_type);
2827
2828    if !status.is_client_error() && !status.is_server_error() {
2829        let content = resp.text().await?;
2830        match content_type {
2831            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2832            ContentType::Text => return Ok(models::GetExchangesResponse::Text(content)),
2833            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::GetExchangesResponse`")))),
2834        }
2835    } else {
2836        let content = resp.text().await?;
2837        let entity: Option<GetExchangesError> = serde_json::from_str(&content).ok();
2838        Err(Error::ResponseError(ResponseContent {
2839            status,
2840            content,
2841            entity,
2842        }))
2843    }
2844}
2845
2846/// 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.
2847pub async fn get_forex_pairs(
2848    configuration: &configuration::Configuration,
2849    params: GetForexPairsParams,
2850) -> Result<models::GetForexPairsResponse, Error<GetForexPairsError>> {
2851    // Extract parameters from params struct
2852    let p_query_symbol = params.symbol;
2853    let p_query_currency_base = params.currency_base;
2854    let p_query_currency_quote = params.currency_quote;
2855    let p_query_format = params.format;
2856    let p_query_delimiter = params.delimiter;
2857
2858    let uri_str = format!("{}/forex_pairs", configuration.base_path);
2859    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2860
2861    if let Some(ref param_value) = p_query_symbol {
2862        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2863    }
2864    if let Some(ref param_value) = p_query_currency_base {
2865        req_builder = req_builder.query(&[("currency_base", &param_value.to_string())]);
2866    }
2867    if let Some(ref param_value) = p_query_currency_quote {
2868        req_builder = req_builder.query(&[("currency_quote", &param_value.to_string())]);
2869    }
2870    if let Some(ref param_value) = p_query_format {
2871        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2872    }
2873    if let Some(ref param_value) = p_query_delimiter {
2874        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2875    }
2876    if let Some(ref user_agent) = configuration.user_agent {
2877        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2878    }
2879    if let Some(ref apikey) = configuration.api_key {
2880        let key = apikey.key.clone();
2881        let value = match apikey.prefix {
2882            Some(ref prefix) => format!("{} {}", prefix, key),
2883            None => key,
2884        };
2885        req_builder = req_builder.header("Authorization", value);
2886    };
2887
2888    let req = req_builder.build()?;
2889    let resp = configuration.client.execute(req).await?;
2890
2891    let status = resp.status();
2892    let content_type = resp
2893        .headers()
2894        .get("content-type")
2895        .and_then(|v| v.to_str().ok())
2896        .unwrap_or("application/octet-stream");
2897    let content_type = super::ContentType::from(content_type);
2898
2899    if !status.is_client_error() && !status.is_server_error() {
2900        let content = resp.text().await?;
2901        match content_type {
2902            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2903            ContentType::Text => return Ok(models::GetForexPairsResponse::Text(content)),
2904            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::GetForexPairsResponse`")))),
2905        }
2906    } else {
2907        let content = resp.text().await?;
2908        let entity: Option<GetForexPairsError> = serde_json::from_str(&content).ok();
2909        Err(Error::ResponseError(ResponseContent {
2910            status,
2911            content,
2912            entity,
2913        }))
2914    }
2915}
2916
2917/// 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.
2918pub async fn get_funds(
2919    configuration: &configuration::Configuration,
2920    params: GetFundsParams,
2921) -> Result<models::GetFundsResponse, Error<GetFundsError>> {
2922    // Extract parameters from params struct
2923    let p_query_symbol = params.symbol;
2924    let p_query_figi = params.figi;
2925    let p_query_isin = params.isin;
2926    let p_query_cusip = params.cusip;
2927    let p_query_cik = params.cik;
2928    let p_query_exchange = params.exchange;
2929    let p_query_country = params.country;
2930    let p_query_format = params.format;
2931    let p_query_delimiter = params.delimiter;
2932    let p_query_show_plan = params.show_plan;
2933    let p_query_page = params.page;
2934    let p_query_outputsize = params.outputsize;
2935
2936    let uri_str = format!("{}/funds", configuration.base_path);
2937    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2938
2939    if let Some(ref param_value) = p_query_symbol {
2940        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
2941    }
2942    if let Some(ref param_value) = p_query_figi {
2943        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
2944    }
2945    if let Some(ref param_value) = p_query_isin {
2946        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
2947    }
2948    if let Some(ref param_value) = p_query_cusip {
2949        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
2950    }
2951    if let Some(ref param_value) = p_query_cik {
2952        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
2953    }
2954    if let Some(ref param_value) = p_query_exchange {
2955        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
2956    }
2957    if let Some(ref param_value) = p_query_country {
2958        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
2959    }
2960    if let Some(ref param_value) = p_query_format {
2961        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
2962    }
2963    if let Some(ref param_value) = p_query_delimiter {
2964        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2965    }
2966    if let Some(ref param_value) = p_query_show_plan {
2967        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
2968    }
2969    if let Some(ref param_value) = p_query_page {
2970        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
2971    }
2972    if let Some(ref param_value) = p_query_outputsize {
2973        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
2974    }
2975    if let Some(ref user_agent) = configuration.user_agent {
2976        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2977    }
2978    if let Some(ref apikey) = configuration.api_key {
2979        let key = apikey.key.clone();
2980        let value = match apikey.prefix {
2981            Some(ref prefix) => format!("{} {}", prefix, key),
2982            None => key,
2983        };
2984        req_builder = req_builder.header("Authorization", value);
2985    };
2986
2987    let req = req_builder.build()?;
2988    let resp = configuration.client.execute(req).await?;
2989
2990    let status = resp.status();
2991    let content_type = resp
2992        .headers()
2993        .get("content-type")
2994        .and_then(|v| v.to_str().ok())
2995        .unwrap_or("application/octet-stream");
2996    let content_type = super::ContentType::from(content_type);
2997
2998    if !status.is_client_error() && !status.is_server_error() {
2999        let content = resp.text().await?;
3000        match content_type {
3001            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3002            ContentType::Text => return Ok(models::GetFundsResponse::Text(content)),
3003            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::GetFundsResponse`")))),
3004        }
3005    } else {
3006        let content = resp.text().await?;
3007        let entity: Option<GetFundsError> = serde_json::from_str(&content).ok();
3008        Err(Error::ResponseError(ResponseContent {
3009            status,
3010            content,
3011            entity,
3012        }))
3013    }
3014}
3015
3016/// 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.
3017pub async fn get_instrument_type(
3018    configuration: &configuration::Configuration,
3019) -> Result<models::GetInstrumentTypeResponse, Error<GetInstrumentTypeError>> {
3020    let uri_str = format!("{}/instrument_type", configuration.base_path);
3021    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3022
3023    if let Some(ref user_agent) = configuration.user_agent {
3024        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3025    }
3026    if let Some(ref apikey) = configuration.api_key {
3027        let key = apikey.key.clone();
3028        let value = match apikey.prefix {
3029            Some(ref prefix) => format!("{} {}", prefix, key),
3030            None => key,
3031        };
3032        req_builder = req_builder.header("Authorization", value);
3033    };
3034
3035    let req = req_builder.build()?;
3036    let resp = configuration.client.execute(req).await?;
3037
3038    let status = resp.status();
3039    let content_type = resp
3040        .headers()
3041        .get("content-type")
3042        .and_then(|v| v.to_str().ok())
3043        .unwrap_or("application/octet-stream");
3044    let content_type = super::ContentType::from(content_type);
3045
3046    if !status.is_client_error() && !status.is_server_error() {
3047        let content = resp.text().await?;
3048        match content_type {
3049            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3050            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetInstrumentTypeResponse`"))),
3051            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::GetInstrumentTypeResponse`")))),
3052        }
3053    } else {
3054        let content = resp.text().await?;
3055        let entity: Option<GetInstrumentTypeError> = serde_json::from_str(&content).ok();
3056        Err(Error::ResponseError(ResponseContent {
3057            status,
3058            content,
3059            entity,
3060        }))
3061    }
3062}
3063
3064/// The intervals endpoint provides a list of supported time intervals that can be used for querying financial data.
3065pub async fn get_intervals(
3066    configuration: &configuration::Configuration,
3067) -> Result<models::GetIntervalsResponse, Error<GetIntervalsError>> {
3068    let uri_str = format!("{}/intervals", configuration.base_path);
3069    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3070
3071    if let Some(ref user_agent) = configuration.user_agent {
3072        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3073    }
3074    if let Some(ref apikey) = configuration.api_key {
3075        let key = apikey.key.clone();
3076        let value = match apikey.prefix {
3077            Some(ref prefix) => format!("{} {}", prefix, key),
3078            None => key,
3079        };
3080        req_builder = req_builder.header("Authorization", value);
3081    };
3082
3083    let req = req_builder.build()?;
3084    let resp = configuration.client.execute(req).await?;
3085
3086    let status = resp.status();
3087    let content_type = resp
3088        .headers()
3089        .get("content-type")
3090        .and_then(|v| v.to_str().ok())
3091        .unwrap_or("application/octet-stream");
3092    let content_type = super::ContentType::from(content_type);
3093
3094    if !status.is_client_error() && !status.is_server_error() {
3095        let content = resp.text().await?;
3096        match content_type {
3097            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3098            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetIntervalsResponse`"))),
3099            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::GetIntervalsResponse`")))),
3100        }
3101    } else {
3102        let content = resp.text().await?;
3103        let entity: Option<GetIntervalsError> = serde_json::from_str(&content).ok();
3104        Err(Error::ResponseError(ResponseContent {
3105            status,
3106            content,
3107            entity,
3108        }))
3109    }
3110}
3111
3112/// 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.
3113pub async fn get_market_state(
3114    configuration: &configuration::Configuration,
3115    params: GetMarketStateParams,
3116) -> Result<models::GetMarketStateResponse, Error<GetMarketStateError>> {
3117    // Extract parameters from params struct
3118    let p_query_exchange = params.exchange;
3119    let p_query_code = params.code;
3120    let p_query_country = params.country;
3121
3122    let uri_str = format!("{}/market_state", configuration.base_path);
3123    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3124
3125    if let Some(ref param_value) = p_query_exchange {
3126        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
3127    }
3128    if let Some(ref param_value) = p_query_code {
3129        req_builder = req_builder.query(&[("code", &param_value.to_string())]);
3130    }
3131    if let Some(ref param_value) = p_query_country {
3132        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3133    }
3134    if let Some(ref user_agent) = configuration.user_agent {
3135        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3136    }
3137    if let Some(ref apikey) = configuration.api_key {
3138        let key = apikey.key.clone();
3139        let value = match apikey.prefix {
3140            Some(ref prefix) => format!("{} {}", prefix, key),
3141            None => key,
3142        };
3143        req_builder = req_builder.header("Authorization", value);
3144    };
3145
3146    let req = req_builder.build()?;
3147    let resp = configuration.client.execute(req).await?;
3148
3149    let status = resp.status();
3150    let content_type = resp
3151        .headers()
3152        .get("content-type")
3153        .and_then(|v| v.to_str().ok())
3154        .unwrap_or("application/octet-stream");
3155    let content_type = super::ContentType::from(content_type);
3156
3157    if !status.is_client_error() && !status.is_server_error() {
3158        let content = resp.text().await?;
3159        match content_type {
3160            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3161            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetMarketStateResponse`"))),
3162            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::GetMarketStateResponse`")))),
3163        }
3164    } else {
3165        let content = resp.text().await?;
3166        let entity: Option<GetMarketStateError> = serde_json::from_str(&content).ok();
3167        Err(Error::ResponseError(ResponseContent {
3168            status,
3169            content,
3170            entity,
3171        }))
3172    }
3173}
3174
3175/// 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.
3176pub async fn get_mutual_funds_family(
3177    configuration: &configuration::Configuration,
3178    params: GetMutualFundsFamilyParams,
3179) -> Result<models::GetMutualFundsFamilyResponse, Error<GetMutualFundsFamilyError>> {
3180    // Extract parameters from params struct
3181    let p_query_fund_family = params.fund_family;
3182    let p_query_country = params.country;
3183
3184    let uri_str = format!("{}/mutual_funds/family", configuration.base_path);
3185    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3186
3187    if let Some(ref param_value) = p_query_fund_family {
3188        req_builder = req_builder.query(&[("fund_family", &param_value.to_string())]);
3189    }
3190    if let Some(ref param_value) = p_query_country {
3191        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3192    }
3193    if let Some(ref user_agent) = configuration.user_agent {
3194        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3195    }
3196    if let Some(ref apikey) = configuration.api_key {
3197        let key = apikey.key.clone();
3198        let value = match apikey.prefix {
3199            Some(ref prefix) => format!("{} {}", prefix, key),
3200            None => key,
3201        };
3202        req_builder = req_builder.header("Authorization", value);
3203    };
3204
3205    let req = req_builder.build()?;
3206    let resp = configuration.client.execute(req).await?;
3207
3208    let status = resp.status();
3209    let content_type = resp
3210        .headers()
3211        .get("content-type")
3212        .and_then(|v| v.to_str().ok())
3213        .unwrap_or("application/octet-stream");
3214    let content_type = super::ContentType::from(content_type);
3215
3216    if !status.is_client_error() && !status.is_server_error() {
3217        let content = resp.text().await?;
3218        match content_type {
3219            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3220            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetMutualFundsFamilyResponse`"))),
3221            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::GetMutualFundsFamilyResponse`")))),
3222        }
3223    } else {
3224        let content = resp.text().await?;
3225        let entity: Option<GetMutualFundsFamilyError> = serde_json::from_str(&content).ok();
3226        Err(Error::ResponseError(ResponseContent {
3227            status,
3228            content,
3229            entity,
3230        }))
3231    }
3232}
3233
3234/// 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.
3235pub async fn get_mutual_funds_list(
3236    configuration: &configuration::Configuration,
3237    params: GetMutualFundsListParams,
3238) -> Result<models::GetMutualFundsListResponse, Error<GetMutualFundsListError>> {
3239    // Extract parameters from params struct
3240    let p_query_symbol = params.symbol;
3241    let p_query_figi = params.figi;
3242    let p_query_isin = params.isin;
3243    let p_query_cusip = params.cusip;
3244    let p_query_cik = params.cik;
3245    let p_query_country = params.country;
3246    let p_query_fund_family = params.fund_family;
3247    let p_query_fund_type = params.fund_type;
3248    let p_query_performance_rating = params.performance_rating;
3249    let p_query_risk_rating = params.risk_rating;
3250    let p_query_page = params.page;
3251    let p_query_outputsize = params.outputsize;
3252
3253    let uri_str = format!("{}/mutual_funds/list", configuration.base_path);
3254    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3255
3256    if let Some(ref param_value) = p_query_symbol {
3257        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
3258    }
3259    if let Some(ref param_value) = p_query_figi {
3260        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
3261    }
3262    if let Some(ref param_value) = p_query_isin {
3263        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
3264    }
3265    if let Some(ref param_value) = p_query_cusip {
3266        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
3267    }
3268    if let Some(ref param_value) = p_query_cik {
3269        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
3270    }
3271    if let Some(ref param_value) = p_query_country {
3272        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3273    }
3274    if let Some(ref param_value) = p_query_fund_family {
3275        req_builder = req_builder.query(&[("fund_family", &param_value.to_string())]);
3276    }
3277    if let Some(ref param_value) = p_query_fund_type {
3278        req_builder = req_builder.query(&[("fund_type", &param_value.to_string())]);
3279    }
3280    if let Some(ref param_value) = p_query_performance_rating {
3281        req_builder = req_builder.query(&[("performance_rating", &param_value.to_string())]);
3282    }
3283    if let Some(ref param_value) = p_query_risk_rating {
3284        req_builder = req_builder.query(&[("risk_rating", &param_value.to_string())]);
3285    }
3286    if let Some(ref param_value) = p_query_page {
3287        req_builder = req_builder.query(&[("page", &param_value.to_string())]);
3288    }
3289    if let Some(ref param_value) = p_query_outputsize {
3290        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
3291    }
3292    if let Some(ref user_agent) = configuration.user_agent {
3293        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3294    }
3295    if let Some(ref apikey) = configuration.api_key {
3296        let key = apikey.key.clone();
3297        let value = match apikey.prefix {
3298            Some(ref prefix) => format!("{} {}", prefix, key),
3299            None => key,
3300        };
3301        req_builder = req_builder.header("Authorization", value);
3302    };
3303
3304    let req = req_builder.build()?;
3305    let resp = configuration.client.execute(req).await?;
3306
3307    let status = resp.status();
3308    let content_type = resp
3309        .headers()
3310        .get("content-type")
3311        .and_then(|v| v.to_str().ok())
3312        .unwrap_or("application/octet-stream");
3313    let content_type = super::ContentType::from(content_type);
3314
3315    if !status.is_client_error() && !status.is_server_error() {
3316        let content = resp.text().await?;
3317        match content_type {
3318            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3319            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetMutualFundsListResponse`"))),
3320            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::GetMutualFundsListResponse`")))),
3321        }
3322    } else {
3323        let content = resp.text().await?;
3324        let entity: Option<GetMutualFundsListError> = serde_json::from_str(&content).ok();
3325        Err(Error::ResponseError(ResponseContent {
3326            status,
3327            content,
3328            entity,
3329        }))
3330    }
3331}
3332
3333/// 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.
3334pub async fn get_mutual_funds_type(
3335    configuration: &configuration::Configuration,
3336    params: GetMutualFundsTypeParams,
3337) -> Result<models::GetMutualFundsTypeResponse, Error<GetMutualFundsTypeError>> {
3338    // Extract parameters from params struct
3339    let p_query_fund_type = params.fund_type;
3340    let p_query_country = params.country;
3341
3342    let uri_str = format!("{}/mutual_funds/type", configuration.base_path);
3343    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3344
3345    if let Some(ref param_value) = p_query_fund_type {
3346        req_builder = req_builder.query(&[("fund_type", &param_value.to_string())]);
3347    }
3348    if let Some(ref param_value) = p_query_country {
3349        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3350    }
3351    if let Some(ref user_agent) = configuration.user_agent {
3352        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3353    }
3354    if let Some(ref apikey) = configuration.api_key {
3355        let key = apikey.key.clone();
3356        let value = match apikey.prefix {
3357            Some(ref prefix) => format!("{} {}", prefix, key),
3358            None => key,
3359        };
3360        req_builder = req_builder.header("Authorization", value);
3361    };
3362
3363    let req = req_builder.build()?;
3364    let resp = configuration.client.execute(req).await?;
3365
3366    let status = resp.status();
3367    let content_type = resp
3368        .headers()
3369        .get("content-type")
3370        .and_then(|v| v.to_str().ok())
3371        .unwrap_or("application/octet-stream");
3372    let content_type = super::ContentType::from(content_type);
3373
3374    if !status.is_client_error() && !status.is_server_error() {
3375        let content = resp.text().await?;
3376        match content_type {
3377            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3378            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetMutualFundsTypeResponse`"))),
3379            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::GetMutualFundsTypeResponse`")))),
3380        }
3381    } else {
3382        let content = resp.text().await?;
3383        let entity: Option<GetMutualFundsTypeError> = serde_json::from_str(&content).ok();
3384        Err(Error::ResponseError(ResponseContent {
3385            status,
3386            content,
3387            entity,
3388        }))
3389    }
3390}
3391
3392/// 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.
3393pub async fn get_stocks(
3394    configuration: &configuration::Configuration,
3395    params: GetStocksParams,
3396) -> Result<models::GetStocksResponse, Error<GetStocksError>> {
3397    // Extract parameters from params struct
3398    let p_query_symbol = params.symbol;
3399    let p_query_figi = params.figi;
3400    let p_query_isin = params.isin;
3401    let p_query_cusip = params.cusip;
3402    let p_query_cik = params.cik;
3403    let p_query_exchange = params.exchange;
3404    let p_query_mic_code = params.mic_code;
3405    let p_query_country = params.country;
3406    let p_query_type = params.r#type;
3407    let p_query_format = params.format;
3408    let p_query_delimiter = params.delimiter;
3409    let p_query_show_plan = params.show_plan;
3410    let p_query_include_delisted = params.include_delisted;
3411
3412    let uri_str = format!("{}/stocks", configuration.base_path);
3413    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3414
3415    if let Some(ref param_value) = p_query_symbol {
3416        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
3417    }
3418    if let Some(ref param_value) = p_query_figi {
3419        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
3420    }
3421    if let Some(ref param_value) = p_query_isin {
3422        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
3423    }
3424    if let Some(ref param_value) = p_query_cusip {
3425        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
3426    }
3427    if let Some(ref param_value) = p_query_cik {
3428        req_builder = req_builder.query(&[("cik", &param_value.to_string())]);
3429    }
3430    if let Some(ref param_value) = p_query_exchange {
3431        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
3432    }
3433    if let Some(ref param_value) = p_query_mic_code {
3434        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
3435    }
3436    if let Some(ref param_value) = p_query_country {
3437        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
3438    }
3439    if let Some(ref param_value) = p_query_type {
3440        req_builder = req_builder.query(&[("type", &param_value.to_string())]);
3441    }
3442    if let Some(ref param_value) = p_query_format {
3443        req_builder = req_builder.query(&[("format", &param_value.to_string())]);
3444    }
3445    if let Some(ref param_value) = p_query_delimiter {
3446        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
3447    }
3448    if let Some(ref param_value) = p_query_show_plan {
3449        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
3450    }
3451    if let Some(ref param_value) = p_query_include_delisted {
3452        req_builder = req_builder.query(&[("include_delisted", &param_value.to_string())]);
3453    }
3454    if let Some(ref user_agent) = configuration.user_agent {
3455        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3456    }
3457    if let Some(ref apikey) = configuration.api_key {
3458        let key = apikey.key.clone();
3459        let value = match apikey.prefix {
3460            Some(ref prefix) => format!("{} {}", prefix, key),
3461            None => key,
3462        };
3463        req_builder = req_builder.header("Authorization", value);
3464    };
3465
3466    let req = req_builder.build()?;
3467    let resp = configuration.client.execute(req).await?;
3468
3469    let status = resp.status();
3470    let content_type = resp
3471        .headers()
3472        .get("content-type")
3473        .and_then(|v| v.to_str().ok())
3474        .unwrap_or("application/octet-stream");
3475    let content_type = super::ContentType::from(content_type);
3476
3477    if !status.is_client_error() && !status.is_server_error() {
3478        let content = resp.text().await?;
3479        match content_type {
3480            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3481            ContentType::Text => return Ok(models::GetStocksResponse::Text(content)),
3482            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::GetStocksResponse`")))),
3483        }
3484    } else {
3485        let content = resp.text().await?;
3486        let entity: Option<GetStocksError> = serde_json::from_str(&content).ok();
3487        Err(Error::ResponseError(ResponseContent {
3488            status,
3489            content,
3490            entity,
3491        }))
3492    }
3493}
3494
3495/// 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.
3496pub async fn get_symbol_search(
3497    configuration: &configuration::Configuration,
3498    params: GetSymbolSearchParams,
3499) -> Result<models::GetSymbolSearchResponse, Error<GetSymbolSearchError>> {
3500    // Extract parameters from params struct
3501    let p_query_symbol = params.symbol;
3502    let p_query_outputsize = params.outputsize;
3503    let p_query_show_plan = params.show_plan;
3504
3505    let uri_str = format!("{}/symbol_search", configuration.base_path);
3506    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3507
3508    req_builder = req_builder.query(&[("symbol", &p_query_symbol.to_string())]);
3509    if let Some(ref param_value) = p_query_outputsize {
3510        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
3511    }
3512    if let Some(ref param_value) = p_query_show_plan {
3513        req_builder = req_builder.query(&[("show_plan", &param_value.to_string())]);
3514    }
3515    if let Some(ref user_agent) = configuration.user_agent {
3516        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3517    }
3518    if let Some(ref apikey) = configuration.api_key {
3519        let key = apikey.key.clone();
3520        let value = match apikey.prefix {
3521            Some(ref prefix) => format!("{} {}", prefix, key),
3522            None => key,
3523        };
3524        req_builder = req_builder.header("Authorization", value);
3525    };
3526
3527    let req = req_builder.build()?;
3528    let resp = configuration.client.execute(req).await?;
3529
3530    let status = resp.status();
3531    let content_type = resp
3532        .headers()
3533        .get("content-type")
3534        .and_then(|v| v.to_str().ok())
3535        .unwrap_or("application/octet-stream");
3536    let content_type = super::ContentType::from(content_type);
3537
3538    if !status.is_client_error() && !status.is_server_error() {
3539        let content = resp.text().await?;
3540        match content_type {
3541            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3542            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetSymbolSearchResponse`"))),
3543            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::GetSymbolSearchResponse`")))),
3544        }
3545    } else {
3546        let content = resp.text().await?;
3547        let entity: Option<GetSymbolSearchError> = serde_json::from_str(&content).ok();
3548        Err(Error::ResponseError(ResponseContent {
3549            status,
3550            content,
3551            entity,
3552        }))
3553    }
3554}
3555
3556/// 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.
3557pub async fn get_technical_indicators(
3558    configuration: &configuration::Configuration,
3559) -> Result<models::GetTechnicalIndicatorsResponse, Error<GetTechnicalIndicatorsError>> {
3560    let uri_str = format!("{}/technical_indicators", configuration.base_path);
3561    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
3562
3563    if let Some(ref user_agent) = configuration.user_agent {
3564        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3565    }
3566    if let Some(ref apikey) = configuration.api_key {
3567        let key = apikey.key.clone();
3568        let value = match apikey.prefix {
3569            Some(ref prefix) => format!("{} {}", prefix, key),
3570            None => key,
3571        };
3572        req_builder = req_builder.header("Authorization", value);
3573    };
3574
3575    let req = req_builder.build()?;
3576    let resp = configuration.client.execute(req).await?;
3577
3578    let status = resp.status();
3579    let content_type = resp
3580        .headers()
3581        .get("content-type")
3582        .and_then(|v| v.to_str().ok())
3583        .unwrap_or("application/octet-stream");
3584    let content_type = super::ContentType::from(content_type);
3585
3586    if !status.is_client_error() && !status.is_server_error() {
3587        let content = resp.text().await?;
3588        match content_type {
3589            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3590            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/*` content type response that cannot be converted to `models::GetTechnicalIndicatorsResponse`"))),
3591            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::GetTechnicalIndicatorsResponse`")))),
3592        }
3593    } else {
3594        let content = resp.text().await?;
3595        let entity: Option<GetTechnicalIndicatorsError> = serde_json::from_str(&content).ok();
3596        Err(Error::ResponseError(ResponseContent {
3597            status,
3598            content,
3599            entity,
3600        }))
3601    }
3602}