twelve_data_client/apis/
market_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
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17/// struct for passing parameters to the method [`get_currency_conversion`]
18#[derive(Clone, Debug, Default)]
19pub struct GetCurrencyConversionParams {
20    /// The currency pair you want to request can be either forex or cryptocurrency. Slash(`/`) delimiter is used. E.g. `EUR/USD` or `BTC/ETH` will be correct
21    pub symbol: String,
22    /// Amount of base currency to be converted into quote currency. Supports values in the range from `0` and above
23    pub amount: f64,
24    /// If not null, will use exchange rate from a specific date or time. Format `2006-01-02` or `2006-01-02T15:04:05`. Is set in the local exchange time zone, use timezone parameter to specify a specific time zone
25    pub date: Option<String>,
26    /// Value can be `JSON` or `CSV`. Default `JSON`
27    pub format: Option<String>,
28    /// Specify the delimiter used when downloading the `CSV` file. Default semicolon `;`
29    pub delimiter: Option<String>,
30    /// The number of decimal places for the data
31    pub dp: Option<i64>,
32    /// 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>
33    pub timezone: Option<String>
34}
35
36impl GetCurrencyConversionParams {
37    /// Create a new builder for this parameter struct
38    pub fn builder() -> GetCurrencyConversionParamsBuilder {
39        GetCurrencyConversionParamsBuilder::default()
40    }
41}
42
43/// Builder for [`GetCurrencyConversionParams`]
44#[derive(Clone, Debug, Default)]
45pub struct GetCurrencyConversionParamsBuilder {
46    /// The currency pair you want to request can be either forex or cryptocurrency. Slash(`/`) delimiter is used. E.g. `EUR/USD` or `BTC/ETH` will be correct
47    symbol: String,
48    /// Amount of base currency to be converted into quote currency. Supports values in the range from `0` and above
49    amount: f64,
50    /// If not null, will use exchange rate from a specific date or time. Format `2006-01-02` or `2006-01-02T15:04:05`. Is set in the local exchange time zone, use timezone parameter to specify a specific time zone
51    date: Option<String>,
52    /// Value can be `JSON` or `CSV`. Default `JSON`
53    format: Option<String>,
54    /// Specify the delimiter used when downloading the `CSV` file. Default semicolon `;`
55    delimiter: Option<String>,
56    /// The number of decimal places for the data
57    dp: Option<i64>,
58    /// 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>
59    timezone: Option<String>
60}
61
62impl GetCurrencyConversionParamsBuilder {
63    /// The currency pair you want to request can be either forex or cryptocurrency. Slash(`/`) delimiter is used. E.g. `EUR/USD` or `BTC/ETH` will be correct
64    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
65        self.symbol = symbol.into();
66        
67        self
68    }
69    /// Amount of base currency to be converted into quote currency. Supports values in the range from `0` and above
70    pub fn amount(mut self, amount: f64) -> Self {
71        
72        self.amount = amount;
73        
74        self
75    }
76    /// If not null, will use exchange rate from a specific date or time. Format `2006-01-02` or `2006-01-02T15:04:05`. Is set in the local exchange time zone, use timezone parameter to specify a specific time zone
77    pub fn date(mut self, date: impl Into<String>) -> Self {
78        self.date = Some(date.into());
79        
80        self
81    }
82    /// Value can be `JSON` or `CSV`. Default `JSON`
83    pub fn format(mut self, format: impl Into<String>) -> Self {
84        self.format = Some(format.into());
85        
86        self
87    }
88    /// Specify the delimiter used when downloading the `CSV` file. Default semicolon `;`
89    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
90        self.delimiter = Some(delimiter.into());
91        
92        self
93    }
94    /// The number of decimal places for the data
95    pub fn dp(mut self, dp: i64) -> Self {
96        
97        self.dp = Some(dp);
98        
99        self
100    }
101    /// 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>
102    pub fn timezone(mut self, timezone: impl Into<String>) -> Self {
103        self.timezone = Some(timezone.into());
104        
105        self
106    }
107
108    /// Build the parameter struct
109    pub fn build(self) -> GetCurrencyConversionParams {
110        GetCurrencyConversionParams {
111            symbol: self.symbol,
112            amount: self.amount,
113            date: self.date,
114            format: self.format,
115            delimiter: self.delimiter,
116            dp: self.dp,
117            timezone: self.timezone
118        }
119    }
120}
121
122/// struct for passing parameters to the method [`get_eod`]
123#[derive(Clone, Debug, Default)]
124pub struct GetEodParams {
125    /// Symbol ticker of the instrument
126    pub symbol: Option<String>,
127    /// Filter by financial instrument global identifier (FIGI)
128    pub figi: Option<String>,
129    /// Filter by international securities identification number (ISIN)
130    pub isin: Option<String>,
131    /// 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
132    pub cusip: Option<String>,
133    /// Exchange where instrument is traded
134    pub exchange: Option<String>,
135    /// Market Identifier Code (MIC) under ISO 10383 standard
136    pub mic_code: Option<String>,
137    /// Country where instrument is traded, e.g., `United States` or `US`
138    pub country: Option<String>,
139    /// The asset class to which the instrument belongs
140    pub r#type: Option<String>,
141    /// If not null, then return data from a specific date
142    pub date: Option<String>,
143    /// Parameter is optional. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume
144    pub prepost: Option<bool>,
145    /// Specifies the number of decimal places for floating values Should be in range [0,11] inclusive
146    pub dp: Option<i64>
147}
148
149impl GetEodParams {
150    /// Create a new builder for this parameter struct
151    pub fn builder() -> GetEodParamsBuilder {
152        GetEodParamsBuilder::default()
153    }
154}
155
156/// Builder for [`GetEodParams`]
157#[derive(Clone, Debug, Default)]
158pub struct GetEodParamsBuilder {
159    /// Symbol ticker of the instrument
160    symbol: Option<String>,
161    /// Filter by financial instrument global identifier (FIGI)
162    figi: Option<String>,
163    /// Filter by international securities identification number (ISIN)
164    isin: Option<String>,
165    /// 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
166    cusip: Option<String>,
167    /// Exchange where instrument is traded
168    exchange: Option<String>,
169    /// Market Identifier Code (MIC) under ISO 10383 standard
170    mic_code: Option<String>,
171    /// Country where instrument is traded, e.g., `United States` or `US`
172    country: Option<String>,
173    /// The asset class to which the instrument belongs
174    r#type: Option<String>,
175    /// If not null, then return data from a specific date
176    date: Option<String>,
177    /// Parameter is optional. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume
178    prepost: Option<bool>,
179    /// Specifies the number of decimal places for floating values Should be in range [0,11] inclusive
180    dp: Option<i64>
181}
182
183impl GetEodParamsBuilder {
184    /// Symbol ticker of the instrument
185    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
186        self.symbol = Some(symbol.into());
187        
188        self
189    }
190    /// Filter by financial instrument global identifier (FIGI)
191    pub fn figi(mut self, figi: impl Into<String>) -> Self {
192        self.figi = Some(figi.into());
193        
194        self
195    }
196    /// Filter by international securities identification number (ISIN)
197    pub fn isin(mut self, isin: impl Into<String>) -> Self {
198        self.isin = Some(isin.into());
199        
200        self
201    }
202    /// 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
203    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
204        self.cusip = Some(cusip.into());
205        
206        self
207    }
208    /// Exchange where instrument is traded
209    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
210        self.exchange = Some(exchange.into());
211        
212        self
213    }
214    /// Market Identifier Code (MIC) under ISO 10383 standard
215    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
216        self.mic_code = Some(mic_code.into());
217        
218        self
219    }
220    /// Country where instrument is traded, e.g., `United States` or `US`
221    pub fn country(mut self, country: impl Into<String>) -> Self {
222        self.country = Some(country.into());
223        
224        self
225    }
226    /// The asset class to which the instrument belongs
227    pub fn r#type(mut self, r#type: impl Into<String>) -> Self {
228        self.r#type = Some(r#type.into());
229        
230        self
231    }
232    /// If not null, then return data from a specific date
233    pub fn date(mut self, date: impl Into<String>) -> Self {
234        self.date = Some(date.into());
235        
236        self
237    }
238    /// Parameter is optional. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume
239    pub fn prepost(mut self, prepost: bool) -> Self {
240        
241        self.prepost = Some(prepost);
242        
243        self
244    }
245    /// Specifies the number of decimal places for floating values Should be in range [0,11] inclusive
246    pub fn dp(mut self, dp: i64) -> Self {
247        
248        self.dp = Some(dp);
249        
250        self
251    }
252
253    /// Build the parameter struct
254    pub fn build(self) -> GetEodParams {
255        GetEodParams {
256            symbol: self.symbol,
257            figi: self.figi,
258            isin: self.isin,
259            cusip: self.cusip,
260            exchange: self.exchange,
261            mic_code: self.mic_code,
262            country: self.country,
263            r#type: self.r#type,
264            date: self.date,
265            prepost: self.prepost,
266            dp: self.dp
267        }
268    }
269}
270
271/// struct for passing parameters to the method [`get_exchange_rate`]
272#[derive(Clone, Debug, Default)]
273pub struct GetExchangeRateParams {
274    /// The currency pair you want to request can be either forex or cryptocurrency. Slash(`/`) delimiter is used. E.g. `EUR/USD` or `BTC/ETH` will be correct
275    pub symbol: String,
276    /// If not null, will use exchange rate from a specific date or time. Format `2006-01-02` or `2006-01-02T15:04:05`. Is set in the local exchange time zone, use timezone parameter to specify a specific time zone
277    pub date: Option<String>,
278    /// Value can be `JSON` or `CSV`. Default `JSON`
279    pub format: Option<String>,
280    /// Specify the delimiter used when downloading the `CSV` file. Default semicolon `;`
281    pub delimiter: Option<String>,
282    /// The number of decimal places for the data
283    pub dp: Option<i64>,
284    /// 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>
285    pub timezone: Option<String>
286}
287
288impl GetExchangeRateParams {
289    /// Create a new builder for this parameter struct
290    pub fn builder() -> GetExchangeRateParamsBuilder {
291        GetExchangeRateParamsBuilder::default()
292    }
293}
294
295/// Builder for [`GetExchangeRateParams`]
296#[derive(Clone, Debug, Default)]
297pub struct GetExchangeRateParamsBuilder {
298    /// The currency pair you want to request can be either forex or cryptocurrency. Slash(`/`) delimiter is used. E.g. `EUR/USD` or `BTC/ETH` will be correct
299    symbol: String,
300    /// If not null, will use exchange rate from a specific date or time. Format `2006-01-02` or `2006-01-02T15:04:05`. Is set in the local exchange time zone, use timezone parameter to specify a specific time zone
301    date: Option<String>,
302    /// Value can be `JSON` or `CSV`. Default `JSON`
303    format: Option<String>,
304    /// Specify the delimiter used when downloading the `CSV` file. Default semicolon `;`
305    delimiter: Option<String>,
306    /// The number of decimal places for the data
307    dp: Option<i64>,
308    /// 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>
309    timezone: Option<String>
310}
311
312impl GetExchangeRateParamsBuilder {
313    /// The currency pair you want to request can be either forex or cryptocurrency. Slash(`/`) delimiter is used. E.g. `EUR/USD` or `BTC/ETH` will be correct
314    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
315        self.symbol = symbol.into();
316        
317        self
318    }
319    /// If not null, will use exchange rate from a specific date or time. Format `2006-01-02` or `2006-01-02T15:04:05`. Is set in the local exchange time zone, use timezone parameter to specify a specific time zone
320    pub fn date(mut self, date: impl Into<String>) -> Self {
321        self.date = Some(date.into());
322        
323        self
324    }
325    /// Value can be `JSON` or `CSV`. Default `JSON`
326    pub fn format(mut self, format: impl Into<String>) -> Self {
327        self.format = Some(format.into());
328        
329        self
330    }
331    /// Specify the delimiter used when downloading the `CSV` file. Default semicolon `;`
332    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
333        self.delimiter = Some(delimiter.into());
334        
335        self
336    }
337    /// The number of decimal places for the data
338    pub fn dp(mut self, dp: i64) -> Self {
339        
340        self.dp = Some(dp);
341        
342        self
343    }
344    /// 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>
345    pub fn timezone(mut self, timezone: impl Into<String>) -> Self {
346        self.timezone = Some(timezone.into());
347        
348        self
349    }
350
351    /// Build the parameter struct
352    pub fn build(self) -> GetExchangeRateParams {
353        GetExchangeRateParams {
354            symbol: self.symbol,
355            date: self.date,
356            format: self.format,
357            delimiter: self.delimiter,
358            dp: self.dp,
359            timezone: self.timezone
360        }
361    }
362}
363
364/// struct for passing parameters to the method [`get_market_movers`]
365#[derive(Clone, Debug, Default)]
366pub struct GetMarketMoversParams {
367    /// Maket type
368    pub market: String,
369    /// Specifies direction of the snapshot gainers or losers
370    pub direction: Option<String>,
371    /// Specifies the size of the snapshot. Can be in a range from `1` to `50`
372    pub outputsize: Option<i64>,
373    /// Country of the snapshot, applicable to non-currencies only. Takes country name or alpha code
374    pub country: Option<String>,
375    /// Takes values with price grater than specified value
376    pub price_greater_than: Option<String>,
377    /// Specifies the number of decimal places for floating values. Should be in range [0,11] inclusive
378    pub dp: Option<String>
379}
380
381impl GetMarketMoversParams {
382    /// Create a new builder for this parameter struct
383    pub fn builder() -> GetMarketMoversParamsBuilder {
384        GetMarketMoversParamsBuilder::default()
385    }
386}
387
388/// Builder for [`GetMarketMoversParams`]
389#[derive(Clone, Debug, Default)]
390pub struct GetMarketMoversParamsBuilder {
391    /// Maket type
392    market: String,
393    /// Specifies direction of the snapshot gainers or losers
394    direction: Option<String>,
395    /// Specifies the size of the snapshot. Can be in a range from `1` to `50`
396    outputsize: Option<i64>,
397    /// Country of the snapshot, applicable to non-currencies only. Takes country name or alpha code
398    country: Option<String>,
399    /// Takes values with price grater than specified value
400    price_greater_than: Option<String>,
401    /// Specifies the number of decimal places for floating values. Should be in range [0,11] inclusive
402    dp: Option<String>
403}
404
405impl GetMarketMoversParamsBuilder {
406    /// Maket type
407    pub fn market(mut self, market: impl Into<String>) -> Self {
408        self.market = market.into();
409        
410        self
411    }
412    /// Specifies direction of the snapshot gainers or losers
413    pub fn direction(mut self, direction: impl Into<String>) -> Self {
414        self.direction = Some(direction.into());
415        
416        self
417    }
418    /// Specifies the size of the snapshot. Can be in a range from `1` to `50`
419    pub fn outputsize(mut self, outputsize: i64) -> Self {
420        
421        self.outputsize = Some(outputsize);
422        
423        self
424    }
425    /// Country of the snapshot, applicable to non-currencies only. Takes country name or alpha code
426    pub fn country(mut self, country: impl Into<String>) -> Self {
427        self.country = Some(country.into());
428        
429        self
430    }
431    /// Takes values with price grater than specified value
432    pub fn price_greater_than(mut self, price_greater_than: impl Into<String>) -> Self {
433        self.price_greater_than = Some(price_greater_than.into());
434        
435        self
436    }
437    /// Specifies the number of decimal places for floating values. Should be in range [0,11] inclusive
438    pub fn dp(mut self, dp: impl Into<String>) -> Self {
439        self.dp = Some(dp.into());
440        
441        self
442    }
443
444    /// Build the parameter struct
445    pub fn build(self) -> GetMarketMoversParams {
446        GetMarketMoversParams {
447            market: self.market,
448            direction: self.direction,
449            outputsize: self.outputsize,
450            country: self.country,
451            price_greater_than: self.price_greater_than,
452            dp: self.dp
453        }
454    }
455}
456
457/// struct for passing parameters to the method [`get_price`]
458#[derive(Clone, Debug, Default)]
459pub struct GetPriceParams {
460    /// Symbol ticker of the instrument
461    pub symbol: Option<String>,
462    /// Filter by financial instrument global identifier (FIGI)
463    pub figi: Option<String>,
464    /// Filter by international securities identification number (ISIN)
465    pub isin: Option<String>,
466    /// 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
467    pub cusip: Option<String>,
468    /// Exchange where instrument is traded
469    pub exchange: Option<String>,
470    /// Market Identifier Code (MIC) under ISO 10383 standard
471    pub mic_code: Option<String>,
472    /// Country where instrument is traded, e.g., `United States` or `US`
473    pub country: Option<String>,
474    /// The asset class to which the instrument belongs
475    pub r#type: Option<String>,
476    /// Value can be JSON or CSV
477    pub format: Option<String>,
478    /// Specify the delimiter used when downloading the CSV file
479    pub delimiter: Option<String>,
480    /// Parameter is optional. Only for Pro and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
481    pub prepost: Option<bool>,
482    /// Specifies the number of decimal places for floating values. Should be in range [0,11] inclusive
483    pub dp: Option<i64>
484}
485
486impl GetPriceParams {
487    /// Create a new builder for this parameter struct
488    pub fn builder() -> GetPriceParamsBuilder {
489        GetPriceParamsBuilder::default()
490    }
491}
492
493/// Builder for [`GetPriceParams`]
494#[derive(Clone, Debug, Default)]
495pub struct GetPriceParamsBuilder {
496    /// Symbol ticker of the instrument
497    symbol: Option<String>,
498    /// Filter by financial instrument global identifier (FIGI)
499    figi: Option<String>,
500    /// Filter by international securities identification number (ISIN)
501    isin: Option<String>,
502    /// 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
503    cusip: Option<String>,
504    /// Exchange where instrument is traded
505    exchange: Option<String>,
506    /// Market Identifier Code (MIC) under ISO 10383 standard
507    mic_code: Option<String>,
508    /// Country where instrument is traded, e.g., `United States` or `US`
509    country: Option<String>,
510    /// The asset class to which the instrument belongs
511    r#type: Option<String>,
512    /// Value can be JSON or CSV
513    format: Option<String>,
514    /// Specify the delimiter used when downloading the CSV file
515    delimiter: Option<String>,
516    /// Parameter is optional. Only for Pro and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
517    prepost: Option<bool>,
518    /// Specifies the number of decimal places for floating values. Should be in range [0,11] inclusive
519    dp: Option<i64>
520}
521
522impl GetPriceParamsBuilder {
523    /// Symbol ticker of the instrument
524    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
525        self.symbol = Some(symbol.into());
526        
527        self
528    }
529    /// Filter by financial instrument global identifier (FIGI)
530    pub fn figi(mut self, figi: impl Into<String>) -> Self {
531        self.figi = Some(figi.into());
532        
533        self
534    }
535    /// Filter by international securities identification number (ISIN)
536    pub fn isin(mut self, isin: impl Into<String>) -> Self {
537        self.isin = Some(isin.into());
538        
539        self
540    }
541    /// 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
542    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
543        self.cusip = Some(cusip.into());
544        
545        self
546    }
547    /// Exchange where instrument is traded
548    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
549        self.exchange = Some(exchange.into());
550        
551        self
552    }
553    /// Market Identifier Code (MIC) under ISO 10383 standard
554    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
555        self.mic_code = Some(mic_code.into());
556        
557        self
558    }
559    /// Country where instrument is traded, e.g., `United States` or `US`
560    pub fn country(mut self, country: impl Into<String>) -> Self {
561        self.country = Some(country.into());
562        
563        self
564    }
565    /// The asset class to which the instrument belongs
566    pub fn r#type(mut self, r#type: impl Into<String>) -> Self {
567        self.r#type = Some(r#type.into());
568        
569        self
570    }
571    /// Value can be JSON or CSV
572    pub fn format(mut self, format: impl Into<String>) -> Self {
573        self.format = Some(format.into());
574        
575        self
576    }
577    /// Specify the delimiter used when downloading the CSV file
578    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
579        self.delimiter = Some(delimiter.into());
580        
581        self
582    }
583    /// Parameter is optional. Only for Pro and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
584    pub fn prepost(mut self, prepost: bool) -> Self {
585        
586        self.prepost = Some(prepost);
587        
588        self
589    }
590    /// Specifies the number of decimal places for floating values. Should be in range [0,11] inclusive
591    pub fn dp(mut self, dp: i64) -> Self {
592        
593        self.dp = Some(dp);
594        
595        self
596    }
597
598    /// Build the parameter struct
599    pub fn build(self) -> GetPriceParams {
600        GetPriceParams {
601            symbol: self.symbol,
602            figi: self.figi,
603            isin: self.isin,
604            cusip: self.cusip,
605            exchange: self.exchange,
606            mic_code: self.mic_code,
607            country: self.country,
608            r#type: self.r#type,
609            format: self.format,
610            delimiter: self.delimiter,
611            prepost: self.prepost,
612            dp: self.dp
613        }
614    }
615}
616
617/// struct for passing parameters to the method [`get_quote`]
618#[derive(Clone, Debug, Default)]
619pub struct GetQuoteParams {
620    /// Symbol ticker of the instrument
621    pub symbol: Option<String>,
622    /// Filter by financial instrument global identifier (FIGI)
623    pub figi: Option<String>,
624    /// Filter by international securities identification number (ISIN)
625    pub isin: Option<String>,
626    /// 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
627    pub cusip: Option<String>,
628    /// Interval of the quote
629    pub interval: Option<String>,
630    /// Exchange where instrument is traded
631    pub exchange: Option<String>,
632    /// Market Identifier Code (MIC) under ISO 10383 standard
633    pub mic_code: Option<String>,
634    /// Country where instrument is traded, e.g., `United States` or `US`
635    pub country: Option<String>,
636    /// Number of periods for Average Volume
637    pub volume_time_period: Option<i64>,
638    /// The asset class to which the instrument belongs
639    pub r#type: Option<String>,
640    /// Value can be JSON or CSV Default JSON
641    pub format: Option<String>,
642    /// Specify the delimiter used when downloading the CSV file
643    pub delimiter: Option<String>,
644    /// Parameter is optional. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
645    pub prepost: Option<bool>,
646    /// If true, then return data for closed day
647    pub eod: Option<bool>,
648    /// Number of hours for calculate rolling change at period. By default set to 24, it can be in range [1, 168].
649    pub rolling_period: Option<i64>,
650    /// Specifies the number of decimal places for floating values Should be in range [0,11] inclusive
651    pub dp: Option<i64>,
652    /// 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>
653    pub timezone: Option<String>
654}
655
656impl GetQuoteParams {
657    /// Create a new builder for this parameter struct
658    pub fn builder() -> GetQuoteParamsBuilder {
659        GetQuoteParamsBuilder::default()
660    }
661}
662
663/// Builder for [`GetQuoteParams`]
664#[derive(Clone, Debug, Default)]
665pub struct GetQuoteParamsBuilder {
666    /// Symbol ticker of the instrument
667    symbol: Option<String>,
668    /// Filter by financial instrument global identifier (FIGI)
669    figi: Option<String>,
670    /// Filter by international securities identification number (ISIN)
671    isin: Option<String>,
672    /// 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
673    cusip: Option<String>,
674    /// Interval of the quote
675    interval: Option<String>,
676    /// Exchange where instrument is traded
677    exchange: Option<String>,
678    /// Market Identifier Code (MIC) under ISO 10383 standard
679    mic_code: Option<String>,
680    /// Country where instrument is traded, e.g., `United States` or `US`
681    country: Option<String>,
682    /// Number of periods for Average Volume
683    volume_time_period: Option<i64>,
684    /// The asset class to which the instrument belongs
685    r#type: Option<String>,
686    /// Value can be JSON or CSV Default JSON
687    format: Option<String>,
688    /// Specify the delimiter used when downloading the CSV file
689    delimiter: Option<String>,
690    /// Parameter is optional. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
691    prepost: Option<bool>,
692    /// If true, then return data for closed day
693    eod: Option<bool>,
694    /// Number of hours for calculate rolling change at period. By default set to 24, it can be in range [1, 168].
695    rolling_period: Option<i64>,
696    /// Specifies the number of decimal places for floating values Should be in range [0,11] inclusive
697    dp: Option<i64>,
698    /// 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>
699    timezone: Option<String>
700}
701
702impl GetQuoteParamsBuilder {
703    /// Symbol ticker of the instrument
704    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
705        self.symbol = Some(symbol.into());
706        
707        self
708    }
709    /// Filter by financial instrument global identifier (FIGI)
710    pub fn figi(mut self, figi: impl Into<String>) -> Self {
711        self.figi = Some(figi.into());
712        
713        self
714    }
715    /// Filter by international securities identification number (ISIN)
716    pub fn isin(mut self, isin: impl Into<String>) -> Self {
717        self.isin = Some(isin.into());
718        
719        self
720    }
721    /// 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
722    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
723        self.cusip = Some(cusip.into());
724        
725        self
726    }
727    /// Interval of the quote
728    pub fn interval(mut self, interval: impl Into<String>) -> Self {
729        self.interval = Some(interval.into());
730        
731        self
732    }
733    /// Exchange where instrument is traded
734    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
735        self.exchange = Some(exchange.into());
736        
737        self
738    }
739    /// Market Identifier Code (MIC) under ISO 10383 standard
740    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
741        self.mic_code = Some(mic_code.into());
742        
743        self
744    }
745    /// Country where instrument is traded, e.g., `United States` or `US`
746    pub fn country(mut self, country: impl Into<String>) -> Self {
747        self.country = Some(country.into());
748        
749        self
750    }
751    /// Number of periods for Average Volume
752    pub fn volume_time_period(mut self, volume_time_period: i64) -> Self {
753        
754        self.volume_time_period = Some(volume_time_period);
755        
756        self
757    }
758    /// The asset class to which the instrument belongs
759    pub fn r#type(mut self, r#type: impl Into<String>) -> Self {
760        self.r#type = Some(r#type.into());
761        
762        self
763    }
764    /// Value can be JSON or CSV Default JSON
765    pub fn format(mut self, format: impl Into<String>) -> Self {
766        self.format = Some(format.into());
767        
768        self
769    }
770    /// Specify the delimiter used when downloading the CSV file
771    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
772        self.delimiter = Some(delimiter.into());
773        
774        self
775    }
776    /// Parameter is optional. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
777    pub fn prepost(mut self, prepost: bool) -> Self {
778        
779        self.prepost = Some(prepost);
780        
781        self
782    }
783    /// If true, then return data for closed day
784    pub fn eod(mut self, eod: bool) -> Self {
785        
786        self.eod = Some(eod);
787        
788        self
789    }
790    /// Number of hours for calculate rolling change at period. By default set to 24, it can be in range [1, 168].
791    pub fn rolling_period(mut self, rolling_period: i64) -> Self {
792        
793        self.rolling_period = Some(rolling_period);
794        
795        self
796    }
797    /// Specifies the number of decimal places for floating values Should be in range [0,11] inclusive
798    pub fn dp(mut self, dp: i64) -> Self {
799        
800        self.dp = Some(dp);
801        
802        self
803    }
804    /// 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>
805    pub fn timezone(mut self, timezone: impl Into<String>) -> Self {
806        self.timezone = Some(timezone.into());
807        
808        self
809    }
810
811    /// Build the parameter struct
812    pub fn build(self) -> GetQuoteParams {
813        GetQuoteParams {
814            symbol: self.symbol,
815            figi: self.figi,
816            isin: self.isin,
817            cusip: self.cusip,
818            interval: self.interval,
819            exchange: self.exchange,
820            mic_code: self.mic_code,
821            country: self.country,
822            volume_time_period: self.volume_time_period,
823            r#type: self.r#type,
824            format: self.format,
825            delimiter: self.delimiter,
826            prepost: self.prepost,
827            eod: self.eod,
828            rolling_period: self.rolling_period,
829            dp: self.dp,
830            timezone: self.timezone
831        }
832    }
833}
834
835/// struct for passing parameters to the method [`get_time_series`]
836#[derive(Clone, Debug, Default)]
837pub struct GetTimeSeriesParams {
838    /// Interval between two consecutive points in time series
839    pub interval: String,
840    /// Symbol ticker of the instrument. E.g. `AAPL`, `EUR/USD`, `ETH/BTC`, ...
841    pub symbol: Option<String>,
842    /// Filter by international securities identification number (ISIN)
843    pub isin: Option<String>,
844    /// The FIGI of an instrument for which data is requested
845    pub figi: Option<String>,
846    /// 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
847    pub cusip: Option<String>,
848    /// Number of data points to retrieve. Supports values in the range from `1` to `5000`. Default `30` when no date parameters are set, otherwise set to maximum
849    pub outputsize: Option<i64>,
850    /// Exchange where instrument is traded
851    pub exchange: Option<String>,
852    /// Market Identifier Code (MIC) under ISO 10383 standard
853    pub mic_code: Option<String>,
854    /// The country where the instrument is traded, e.g., `United States` or `US`
855    pub country: Option<String>,
856    /// The asset class to which the instrument belongs
857    pub r#type: Option<String>,
858    /// 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>
859    pub timezone: Option<String>,
860    /// Can be used separately and together with `end_date`. Format `2006-01-02` or `2006-01-02T15:04:05`  Default location: <ul> <li>Forex and Cryptocurrencies - <code>UTC</code></li> <li>Stocks - where exchange is located (e.g. for AAPL it will be <code>America/New_York</code>)</li> </ul> Both parameters take into account if <code>timezone</code> parameter is provided.<br/> If <code>timezone</code> is given then, <code>start_date</code> and <code>end_date</code> will be used in the specified location  Examples: <ul> <li>1. <code>&symbol=AAPL&start_date=2019-08-09T15:50:00&…</code><br/> Returns all records starting from 2019-08-09T15:50:00 New York time up to current date</li> <li>2. <code>&symbol=EUR/USD&timezone=Asia/Singapore&start_date=2019-08-09T15:50:00&…</code><br/> Returns all records starting from 2019-08-09T15:50:00 Singapore time up to current date</li> <li>3. <code>&symbol=ETH/BTC&timezone=Europe/Zurich&start_date=2019-08-09T15:50:00&end_date=2019-08-09T15:55:00&...</code><br/> Returns all records starting from 2019-08-09T15:50:00 Zurich time up to 2019-08-09T15:55:00</li> </ul>
861    pub start_date: Option<String>,
862    /// The ending date and time for data selection, see `start_date` description for details.
863    pub end_date: Option<String>,
864    /// Specifies the exact date to get the data for. Could be the exact date, e.g. `2021-10-27`, or in human language `today` or `yesterday`
865    pub date: Option<String>,
866    /// Sorting order of the output
867    pub order: Option<String>,
868    /// Returns quotes that include pre-market and post-market data. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume
869    pub prepost: Option<bool>,
870    /// The format of the response data
871    pub format: Option<String>,
872    /// The separator used in the CSV response data
873    pub delimiter: Option<String>,
874    /// Specifies the number of decimal places for floating values. Should be in range [0, 11] inclusive. By default, the number of decimal places is automatically determined based on the values provided
875    pub dp: Option<i64>,
876    /// A boolean parameter to include the previous closing price in the time_series data. If true, adds previous bar close price value to the current object
877    pub previous_close: Option<bool>,
878    /// Adjusting mode for prices
879    pub adjust: Option<String>
880}
881
882impl GetTimeSeriesParams {
883    /// Create a new builder for this parameter struct
884    pub fn builder() -> GetTimeSeriesParamsBuilder {
885        GetTimeSeriesParamsBuilder::default()
886    }
887}
888
889/// Builder for [`GetTimeSeriesParams`]
890#[derive(Clone, Debug, Default)]
891pub struct GetTimeSeriesParamsBuilder {
892    /// Interval between two consecutive points in time series
893    interval: String,
894    /// Symbol ticker of the instrument. E.g. `AAPL`, `EUR/USD`, `ETH/BTC`, ...
895    symbol: Option<String>,
896    /// Filter by international securities identification number (ISIN)
897    isin: Option<String>,
898    /// The FIGI of an instrument for which data is requested
899    figi: Option<String>,
900    /// 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
901    cusip: Option<String>,
902    /// Number of data points to retrieve. Supports values in the range from `1` to `5000`. Default `30` when no date parameters are set, otherwise set to maximum
903    outputsize: Option<i64>,
904    /// Exchange where instrument is traded
905    exchange: Option<String>,
906    /// Market Identifier Code (MIC) under ISO 10383 standard
907    mic_code: Option<String>,
908    /// The country where the instrument is traded, e.g., `United States` or `US`
909    country: Option<String>,
910    /// The asset class to which the instrument belongs
911    r#type: Option<String>,
912    /// 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>
913    timezone: Option<String>,
914    /// Can be used separately and together with `end_date`. Format `2006-01-02` or `2006-01-02T15:04:05`  Default location: <ul> <li>Forex and Cryptocurrencies - <code>UTC</code></li> <li>Stocks - where exchange is located (e.g. for AAPL it will be <code>America/New_York</code>)</li> </ul> Both parameters take into account if <code>timezone</code> parameter is provided.<br/> If <code>timezone</code> is given then, <code>start_date</code> and <code>end_date</code> will be used in the specified location  Examples: <ul> <li>1. <code>&symbol=AAPL&start_date=2019-08-09T15:50:00&…</code><br/> Returns all records starting from 2019-08-09T15:50:00 New York time up to current date</li> <li>2. <code>&symbol=EUR/USD&timezone=Asia/Singapore&start_date=2019-08-09T15:50:00&…</code><br/> Returns all records starting from 2019-08-09T15:50:00 Singapore time up to current date</li> <li>3. <code>&symbol=ETH/BTC&timezone=Europe/Zurich&start_date=2019-08-09T15:50:00&end_date=2019-08-09T15:55:00&...</code><br/> Returns all records starting from 2019-08-09T15:50:00 Zurich time up to 2019-08-09T15:55:00</li> </ul>
915    start_date: Option<String>,
916    /// The ending date and time for data selection, see `start_date` description for details.
917    end_date: Option<String>,
918    /// Specifies the exact date to get the data for. Could be the exact date, e.g. `2021-10-27`, or in human language `today` or `yesterday`
919    date: Option<String>,
920    /// Sorting order of the output
921    order: Option<String>,
922    /// Returns quotes that include pre-market and post-market data. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume
923    prepost: Option<bool>,
924    /// The format of the response data
925    format: Option<String>,
926    /// The separator used in the CSV response data
927    delimiter: Option<String>,
928    /// Specifies the number of decimal places for floating values. Should be in range [0, 11] inclusive. By default, the number of decimal places is automatically determined based on the values provided
929    dp: Option<i64>,
930    /// A boolean parameter to include the previous closing price in the time_series data. If true, adds previous bar close price value to the current object
931    previous_close: Option<bool>,
932    /// Adjusting mode for prices
933    adjust: Option<String>
934}
935
936impl GetTimeSeriesParamsBuilder {
937    /// Interval between two consecutive points in time series
938    pub fn interval(mut self, interval: impl Into<String>) -> Self {
939        self.interval = interval.into();
940        
941        self
942    }
943    /// Symbol ticker of the instrument. E.g. `AAPL`, `EUR/USD`, `ETH/BTC`, ...
944    pub fn symbol(mut self, symbol: impl Into<String>) -> Self {
945        self.symbol = Some(symbol.into());
946        
947        self
948    }
949    /// Filter by international securities identification number (ISIN)
950    pub fn isin(mut self, isin: impl Into<String>) -> Self {
951        self.isin = Some(isin.into());
952        
953        self
954    }
955    /// The FIGI of an instrument for which data is requested
956    pub fn figi(mut self, figi: impl Into<String>) -> Self {
957        self.figi = Some(figi.into());
958        
959        self
960    }
961    /// 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
962    pub fn cusip(mut self, cusip: impl Into<String>) -> Self {
963        self.cusip = Some(cusip.into());
964        
965        self
966    }
967    /// Number of data points to retrieve. Supports values in the range from `1` to `5000`. Default `30` when no date parameters are set, otherwise set to maximum
968    pub fn outputsize(mut self, outputsize: i64) -> Self {
969        
970        self.outputsize = Some(outputsize);
971        
972        self
973    }
974    /// Exchange where instrument is traded
975    pub fn exchange(mut self, exchange: impl Into<String>) -> Self {
976        self.exchange = Some(exchange.into());
977        
978        self
979    }
980    /// Market Identifier Code (MIC) under ISO 10383 standard
981    pub fn mic_code(mut self, mic_code: impl Into<String>) -> Self {
982        self.mic_code = Some(mic_code.into());
983        
984        self
985    }
986    /// The country where the instrument is traded, e.g., `United States` or `US`
987    pub fn country(mut self, country: impl Into<String>) -> Self {
988        self.country = Some(country.into());
989        
990        self
991    }
992    /// The asset class to which the instrument belongs
993    pub fn r#type(mut self, r#type: impl Into<String>) -> Self {
994        self.r#type = Some(r#type.into());
995        
996        self
997    }
998    /// 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>
999    pub fn timezone(mut self, timezone: impl Into<String>) -> Self {
1000        self.timezone = Some(timezone.into());
1001        
1002        self
1003    }
1004    /// Can be used separately and together with `end_date`. Format `2006-01-02` or `2006-01-02T15:04:05`  Default location: <ul> <li>Forex and Cryptocurrencies - <code>UTC</code></li> <li>Stocks - where exchange is located (e.g. for AAPL it will be <code>America/New_York</code>)</li> </ul> Both parameters take into account if <code>timezone</code> parameter is provided.<br/> If <code>timezone</code> is given then, <code>start_date</code> and <code>end_date</code> will be used in the specified location  Examples: <ul> <li>1. <code>&symbol=AAPL&start_date=2019-08-09T15:50:00&…</code><br/> Returns all records starting from 2019-08-09T15:50:00 New York time up to current date</li> <li>2. <code>&symbol=EUR/USD&timezone=Asia/Singapore&start_date=2019-08-09T15:50:00&…</code><br/> Returns all records starting from 2019-08-09T15:50:00 Singapore time up to current date</li> <li>3. <code>&symbol=ETH/BTC&timezone=Europe/Zurich&start_date=2019-08-09T15:50:00&end_date=2019-08-09T15:55:00&...</code><br/> Returns all records starting from 2019-08-09T15:50:00 Zurich time up to 2019-08-09T15:55:00</li> </ul>
1005    pub fn start_date(mut self, start_date: impl Into<String>) -> Self {
1006        self.start_date = Some(start_date.into());
1007        
1008        self
1009    }
1010    /// The ending date and time for data selection, see `start_date` description for details.
1011    pub fn end_date(mut self, end_date: impl Into<String>) -> Self {
1012        self.end_date = Some(end_date.into());
1013        
1014        self
1015    }
1016    /// Specifies the exact date to get the data for. Could be the exact date, e.g. `2021-10-27`, or in human language `today` or `yesterday`
1017    pub fn date(mut self, date: impl Into<String>) -> Self {
1018        self.date = Some(date.into());
1019        
1020        self
1021    }
1022    /// Sorting order of the output
1023    pub fn order(mut self, order: impl Into<String>) -> Self {
1024        self.order = Some(order.into());
1025        
1026        self
1027    }
1028    /// Returns quotes that include pre-market and post-market data. Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume
1029    pub fn prepost(mut self, prepost: bool) -> Self {
1030        
1031        self.prepost = Some(prepost);
1032        
1033        self
1034    }
1035    /// The format of the response data
1036    pub fn format(mut self, format: impl Into<String>) -> Self {
1037        self.format = Some(format.into());
1038        
1039        self
1040    }
1041    /// The separator used in the CSV response data
1042    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
1043        self.delimiter = Some(delimiter.into());
1044        
1045        self
1046    }
1047    /// Specifies the number of decimal places for floating values. Should be in range [0, 11] inclusive. By default, the number of decimal places is automatically determined based on the values provided
1048    pub fn dp(mut self, dp: i64) -> Self {
1049        
1050        self.dp = Some(dp);
1051        
1052        self
1053    }
1054    /// A boolean parameter to include the previous closing price in the time_series data. If true, adds previous bar close price value to the current object
1055    pub fn previous_close(mut self, previous_close: bool) -> Self {
1056        
1057        self.previous_close = Some(previous_close);
1058        
1059        self
1060    }
1061    /// Adjusting mode for prices
1062    pub fn adjust(mut self, adjust: impl Into<String>) -> Self {
1063        self.adjust = Some(adjust.into());
1064        
1065        self
1066    }
1067
1068    /// Build the parameter struct
1069    pub fn build(self) -> GetTimeSeriesParams {
1070        GetTimeSeriesParams {
1071            interval: self.interval,
1072            symbol: self.symbol,
1073            isin: self.isin,
1074            figi: self.figi,
1075            cusip: self.cusip,
1076            outputsize: self.outputsize,
1077            exchange: self.exchange,
1078            mic_code: self.mic_code,
1079            country: self.country,
1080            r#type: self.r#type,
1081            timezone: self.timezone,
1082            start_date: self.start_date,
1083            end_date: self.end_date,
1084            date: self.date,
1085            order: self.order,
1086            prepost: self.prepost,
1087            format: self.format,
1088            delimiter: self.delimiter,
1089            dp: self.dp,
1090            previous_close: self.previous_close,
1091            adjust: self.adjust
1092        }
1093    }
1094}
1095
1096/// struct for passing parameters to the method [`get_time_series_cross`]
1097#[derive(Clone, Debug, Default)]
1098pub struct GetTimeSeriesCrossParams {
1099    /// Base currency symbol
1100    pub base: String,
1101    /// Quote currency symbol
1102    pub quote: String,
1103    /// Interval between two consecutive points in time series
1104    pub interval: String,
1105    /// Base instrument type according to the `/instrument_type` endpoint
1106    pub base_type: Option<String>,
1107    /// Base exchange
1108    pub base_exchange: Option<String>,
1109    /// Base MIC code
1110    pub base_mic_code: Option<String>,
1111    /// Quote instrument type according to the `/instrument_type` endpoint
1112    pub quote_type: Option<String>,
1113    /// Quote exchange
1114    pub quote_exchange: Option<String>,
1115    /// Quote MIC code
1116    pub quote_mic_code: Option<String>,
1117    /// Number of data points to retrieve. Supports values in the range from `1` to `5000`. Default `30` when no date parameters are set, otherwise set to maximum
1118    pub outputsize: Option<i64>,
1119    /// Format of the response data
1120    pub format: Option<String>,
1121    /// Delimiter used in CSV file
1122    pub delimiter: Option<String>,
1123    /// Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
1124    pub prepost: Option<bool>,
1125    /// Start date for the time series data
1126    pub start_date: Option<String>,
1127    /// End date for the time series data
1128    pub end_date: Option<String>,
1129    /// Specifies if there should be an adjustment
1130    pub adjust: Option<bool>,
1131    /// Specifies the number of decimal places for floating values. Should be in range [0, 11] inclusive.
1132    pub dp: Option<i64>,
1133    /// 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>
1134    pub timezone: Option<String>
1135}
1136
1137impl GetTimeSeriesCrossParams {
1138    /// Create a new builder for this parameter struct
1139    pub fn builder() -> GetTimeSeriesCrossParamsBuilder {
1140        GetTimeSeriesCrossParamsBuilder::default()
1141    }
1142}
1143
1144/// Builder for [`GetTimeSeriesCrossParams`]
1145#[derive(Clone, Debug, Default)]
1146pub struct GetTimeSeriesCrossParamsBuilder {
1147    /// Base currency symbol
1148    base: String,
1149    /// Quote currency symbol
1150    quote: String,
1151    /// Interval between two consecutive points in time series
1152    interval: String,
1153    /// Base instrument type according to the `/instrument_type` endpoint
1154    base_type: Option<String>,
1155    /// Base exchange
1156    base_exchange: Option<String>,
1157    /// Base MIC code
1158    base_mic_code: Option<String>,
1159    /// Quote instrument type according to the `/instrument_type` endpoint
1160    quote_type: Option<String>,
1161    /// Quote exchange
1162    quote_exchange: Option<String>,
1163    /// Quote MIC code
1164    quote_mic_code: Option<String>,
1165    /// Number of data points to retrieve. Supports values in the range from `1` to `5000`. Default `30` when no date parameters are set, otherwise set to maximum
1166    outputsize: Option<i64>,
1167    /// Format of the response data
1168    format: Option<String>,
1169    /// Delimiter used in CSV file
1170    delimiter: Option<String>,
1171    /// Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
1172    prepost: Option<bool>,
1173    /// Start date for the time series data
1174    start_date: Option<String>,
1175    /// End date for the time series data
1176    end_date: Option<String>,
1177    /// Specifies if there should be an adjustment
1178    adjust: Option<bool>,
1179    /// Specifies the number of decimal places for floating values. Should be in range [0, 11] inclusive.
1180    dp: Option<i64>,
1181    /// 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>
1182    timezone: Option<String>
1183}
1184
1185impl GetTimeSeriesCrossParamsBuilder {
1186    /// Base currency symbol
1187    pub fn base(mut self, base: impl Into<String>) -> Self {
1188        self.base = base.into();
1189        
1190        self
1191    }
1192    /// Quote currency symbol
1193    pub fn quote(mut self, quote: impl Into<String>) -> Self {
1194        self.quote = quote.into();
1195        
1196        self
1197    }
1198    /// Interval between two consecutive points in time series
1199    pub fn interval(mut self, interval: impl Into<String>) -> Self {
1200        self.interval = interval.into();
1201        
1202        self
1203    }
1204    /// Base instrument type according to the `/instrument_type` endpoint
1205    pub fn base_type(mut self, base_type: impl Into<String>) -> Self {
1206        self.base_type = Some(base_type.into());
1207        
1208        self
1209    }
1210    /// Base exchange
1211    pub fn base_exchange(mut self, base_exchange: impl Into<String>) -> Self {
1212        self.base_exchange = Some(base_exchange.into());
1213        
1214        self
1215    }
1216    /// Base MIC code
1217    pub fn base_mic_code(mut self, base_mic_code: impl Into<String>) -> Self {
1218        self.base_mic_code = Some(base_mic_code.into());
1219        
1220        self
1221    }
1222    /// Quote instrument type according to the `/instrument_type` endpoint
1223    pub fn quote_type(mut self, quote_type: impl Into<String>) -> Self {
1224        self.quote_type = Some(quote_type.into());
1225        
1226        self
1227    }
1228    /// Quote exchange
1229    pub fn quote_exchange(mut self, quote_exchange: impl Into<String>) -> Self {
1230        self.quote_exchange = Some(quote_exchange.into());
1231        
1232        self
1233    }
1234    /// Quote MIC code
1235    pub fn quote_mic_code(mut self, quote_mic_code: impl Into<String>) -> Self {
1236        self.quote_mic_code = Some(quote_mic_code.into());
1237        
1238        self
1239    }
1240    /// Number of data points to retrieve. Supports values in the range from `1` to `5000`. Default `30` when no date parameters are set, otherwise set to maximum
1241    pub fn outputsize(mut self, outputsize: i64) -> Self {
1242        
1243        self.outputsize = Some(outputsize);
1244        
1245        self
1246    }
1247    /// Format of the response data
1248    pub fn format(mut self, format: impl Into<String>) -> Self {
1249        self.format = Some(format.into());
1250        
1251        self
1252    }
1253    /// Delimiter used in CSV file
1254    pub fn delimiter(mut self, delimiter: impl Into<String>) -> Self {
1255        self.delimiter = Some(delimiter.into());
1256        
1257        self
1258    }
1259    /// Only for `Pro` and above plans. Available at the `1min`, `5min`, `15min`, and `30min` intervals for US equities. Open, high, low, close values are supplied without volume.
1260    pub fn prepost(mut self, prepost: bool) -> Self {
1261        
1262        self.prepost = Some(prepost);
1263        
1264        self
1265    }
1266    /// Start date for the time series data
1267    pub fn start_date(mut self, start_date: impl Into<String>) -> Self {
1268        self.start_date = Some(start_date.into());
1269        
1270        self
1271    }
1272    /// End date for the time series data
1273    pub fn end_date(mut self, end_date: impl Into<String>) -> Self {
1274        self.end_date = Some(end_date.into());
1275        
1276        self
1277    }
1278    /// Specifies if there should be an adjustment
1279    pub fn adjust(mut self, adjust: bool) -> Self {
1280        
1281        self.adjust = Some(adjust);
1282        
1283        self
1284    }
1285    /// Specifies the number of decimal places for floating values. Should be in range [0, 11] inclusive.
1286    pub fn dp(mut self, dp: i64) -> Self {
1287        
1288        self.dp = Some(dp);
1289        
1290        self
1291    }
1292    /// 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>
1293    pub fn timezone(mut self, timezone: impl Into<String>) -> Self {
1294        self.timezone = Some(timezone.into());
1295        
1296        self
1297    }
1298
1299    /// Build the parameter struct
1300    pub fn build(self) -> GetTimeSeriesCrossParams {
1301        GetTimeSeriesCrossParams {
1302            base: self.base,
1303            quote: self.quote,
1304            interval: self.interval,
1305            base_type: self.base_type,
1306            base_exchange: self.base_exchange,
1307            base_mic_code: self.base_mic_code,
1308            quote_type: self.quote_type,
1309            quote_exchange: self.quote_exchange,
1310            quote_mic_code: self.quote_mic_code,
1311            outputsize: self.outputsize,
1312            format: self.format,
1313            delimiter: self.delimiter,
1314            prepost: self.prepost,
1315            start_date: self.start_date,
1316            end_date: self.end_date,
1317            adjust: self.adjust,
1318            dp: self.dp,
1319            timezone: self.timezone
1320        }
1321    }
1322}
1323
1324
1325/// struct for typed errors of method [`get_currency_conversion`]
1326#[derive(Debug, Clone, Serialize, Deserialize)]
1327#[serde(untagged)]
1328pub enum GetCurrencyConversionError {
1329    UnknownValue(serde_json::Value),
1330}
1331
1332/// struct for typed errors of method [`get_eod`]
1333#[derive(Debug, Clone, Serialize, Deserialize)]
1334#[serde(untagged)]
1335pub enum GetEodError {
1336    UnknownValue(serde_json::Value),
1337}
1338
1339/// struct for typed errors of method [`get_exchange_rate`]
1340#[derive(Debug, Clone, Serialize, Deserialize)]
1341#[serde(untagged)]
1342pub enum GetExchangeRateError {
1343    UnknownValue(serde_json::Value),
1344}
1345
1346/// struct for typed errors of method [`get_market_movers`]
1347#[derive(Debug, Clone, Serialize, Deserialize)]
1348#[serde(untagged)]
1349pub enum GetMarketMoversError {
1350    UnknownValue(serde_json::Value),
1351}
1352
1353/// struct for typed errors of method [`get_price`]
1354#[derive(Debug, Clone, Serialize, Deserialize)]
1355#[serde(untagged)]
1356pub enum GetPriceError {
1357    UnknownValue(serde_json::Value),
1358}
1359
1360/// struct for typed errors of method [`get_quote`]
1361#[derive(Debug, Clone, Serialize, Deserialize)]
1362#[serde(untagged)]
1363pub enum GetQuoteError {
1364    UnknownValue(serde_json::Value),
1365}
1366
1367/// struct for typed errors of method [`get_time_series`]
1368#[derive(Debug, Clone, Serialize, Deserialize)]
1369#[serde(untagged)]
1370pub enum GetTimeSeriesError {
1371    UnknownValue(serde_json::Value),
1372}
1373
1374/// struct for typed errors of method [`get_time_series_cross`]
1375#[derive(Debug, Clone, Serialize, Deserialize)]
1376#[serde(untagged)]
1377pub enum GetTimeSeriesCrossError {
1378    UnknownValue(serde_json::Value),
1379}
1380
1381
1382/// The currency conversion endpoint provides real-time exchange rates and calculates the converted amount for specified currency pairs, including both forex and cryptocurrencies. This endpoint is useful for obtaining up-to-date conversion values between two currencies, facilitating tasks such as financial reporting, e-commerce transactions, and travel budgeting.
1383pub async fn get_currency_conversion(configuration: &configuration::Configuration, params: GetCurrencyConversionParams) -> Result<models::GetCurrencyConversion200Response, Error<GetCurrencyConversionError>> {
1384    // Extract parameters from params struct
1385    let p_query_symbol = params.symbol;
1386    let p_query_amount = params.amount;
1387    let p_query_date = params.date;
1388    let p_query_format = params.format;
1389    let p_query_delimiter = params.delimiter;
1390    let p_query_dp = params.dp;
1391    let p_query_timezone = params.timezone;
1392
1393    let uri_str = format!("{}/currency_conversion", configuration.base_path);
1394    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1395
1396    req_builder = req_builder.query(&[("symbol", &p_query_symbol.to_string())]);
1397    req_builder = req_builder.query(&[("amount", &p_query_amount.to_string())]);
1398    if let Some(ref param_value) = p_query_date {
1399        req_builder = req_builder.query(&[("date", &param_value.to_string())]);
1400    }
1401    if let Some(ref param_value) = p_query_format {
1402        req_builder = req_builder.query(&[("format", &serde_json::to_string(param_value)?)]);
1403    }
1404    if let Some(ref param_value) = p_query_delimiter {
1405        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
1406    }
1407    if let Some(ref param_value) = p_query_dp {
1408        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1409    }
1410    if let Some(ref param_value) = p_query_timezone {
1411        req_builder = req_builder.query(&[("timezone", &param_value.to_string())]);
1412    }
1413    if let Some(ref user_agent) = configuration.user_agent {
1414        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1415    }
1416    if let Some(ref apikey) = configuration.api_key {
1417        let key = apikey.key.clone();
1418        let value = match apikey.prefix {
1419            Some(ref prefix) => format!("{} {}", prefix, key),
1420            None => key,
1421        };
1422        req_builder = req_builder.header("Authorization", value);
1423    };
1424
1425    let req = req_builder.build()?;
1426    let resp = configuration.client.execute(req).await?;
1427
1428    let status = resp.status();
1429    let content_type = resp
1430        .headers()
1431        .get("content-type")
1432        .and_then(|v| v.to_str().ok())
1433        .unwrap_or("application/octet-stream");
1434    let content_type = super::ContentType::from(content_type);
1435
1436    if !status.is_client_error() && !status.is_server_error() {
1437        let content = resp.text().await?;
1438        match content_type {
1439            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1440            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetCurrencyConversion200Response`"))),
1441            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::GetCurrencyConversion200Response`")))),
1442        }
1443    } else {
1444        let content = resp.text().await?;
1445        let entity: Option<GetCurrencyConversionError> = serde_json::from_str(&content).ok();
1446        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1447    }
1448}
1449
1450/// The End of Day (EOD) Prices endpoint provides the closing price and other relevant metadata for a financial instrument at the end of a trading day. This endpoint is useful for retrieving daily historical data for stocks, ETFs, or other securities, allowing users to track performance over time and compare daily market movements.
1451pub async fn get_eod(configuration: &configuration::Configuration, params: GetEodParams) -> Result<models::GetEod200Response, Error<GetEodError>> {
1452    // Extract parameters from params struct
1453    let p_query_symbol = params.symbol;
1454    let p_query_figi = params.figi;
1455    let p_query_isin = params.isin;
1456    let p_query_cusip = params.cusip;
1457    let p_query_exchange = params.exchange;
1458    let p_query_mic_code = params.mic_code;
1459    let p_query_country = params.country;
1460    let p_query_type = params.r#type;
1461    let p_query_date = params.date;
1462    let p_query_prepost = params.prepost;
1463    let p_query_dp = params.dp;
1464
1465    let uri_str = format!("{}/eod", configuration.base_path);
1466    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1467
1468    if let Some(ref param_value) = p_query_symbol {
1469        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1470    }
1471    if let Some(ref param_value) = p_query_figi {
1472        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1473    }
1474    if let Some(ref param_value) = p_query_isin {
1475        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1476    }
1477    if let Some(ref param_value) = p_query_cusip {
1478        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1479    }
1480    if let Some(ref param_value) = p_query_exchange {
1481        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1482    }
1483    if let Some(ref param_value) = p_query_mic_code {
1484        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
1485    }
1486    if let Some(ref param_value) = p_query_country {
1487        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1488    }
1489    if let Some(ref param_value) = p_query_type {
1490        req_builder = req_builder.query(&[("type", &serde_json::to_string(param_value)?)]);
1491    }
1492    if let Some(ref param_value) = p_query_date {
1493        req_builder = req_builder.query(&[("date", &param_value.to_string())]);
1494    }
1495    if let Some(ref param_value) = p_query_prepost {
1496        req_builder = req_builder.query(&[("prepost", &param_value.to_string())]);
1497    }
1498    if let Some(ref param_value) = p_query_dp {
1499        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1500    }
1501    if let Some(ref user_agent) = configuration.user_agent {
1502        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1503    }
1504    if let Some(ref apikey) = configuration.api_key {
1505        let key = apikey.key.clone();
1506        let value = match apikey.prefix {
1507            Some(ref prefix) => format!("{} {}", prefix, key),
1508            None => key,
1509        };
1510        req_builder = req_builder.header("Authorization", value);
1511    };
1512
1513    let req = req_builder.build()?;
1514    let resp = configuration.client.execute(req).await?;
1515
1516    let status = resp.status();
1517    let content_type = resp
1518        .headers()
1519        .get("content-type")
1520        .and_then(|v| v.to_str().ok())
1521        .unwrap_or("application/octet-stream");
1522    let content_type = super::ContentType::from(content_type);
1523
1524    if !status.is_client_error() && !status.is_server_error() {
1525        let content = resp.text().await?;
1526        match content_type {
1527            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1528            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetEod200Response`"))),
1529            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::GetEod200Response`")))),
1530        }
1531    } else {
1532        let content = resp.text().await?;
1533        let entity: Option<GetEodError> = serde_json::from_str(&content).ok();
1534        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1535    }
1536}
1537
1538/// The exchange rate endpoint provides real-time exchange rates for specified currency pairs, including both forex and cryptocurrency. It returns the current exchange rate value between two currencies, allowing users to quickly access up-to-date conversion rates for financial transactions or market analysis.
1539pub async fn get_exchange_rate(configuration: &configuration::Configuration, params: GetExchangeRateParams) -> Result<models::GetExchangeRate200Response, Error<GetExchangeRateError>> {
1540    // Extract parameters from params struct
1541    let p_query_symbol = params.symbol;
1542    let p_query_date = params.date;
1543    let p_query_format = params.format;
1544    let p_query_delimiter = params.delimiter;
1545    let p_query_dp = params.dp;
1546    let p_query_timezone = params.timezone;
1547
1548    let uri_str = format!("{}/exchange_rate", configuration.base_path);
1549    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1550
1551    req_builder = req_builder.query(&[("symbol", &p_query_symbol.to_string())]);
1552    if let Some(ref param_value) = p_query_date {
1553        req_builder = req_builder.query(&[("date", &param_value.to_string())]);
1554    }
1555    if let Some(ref param_value) = p_query_format {
1556        req_builder = req_builder.query(&[("format", &serde_json::to_string(param_value)?)]);
1557    }
1558    if let Some(ref param_value) = p_query_delimiter {
1559        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
1560    }
1561    if let Some(ref param_value) = p_query_dp {
1562        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1563    }
1564    if let Some(ref param_value) = p_query_timezone {
1565        req_builder = req_builder.query(&[("timezone", &param_value.to_string())]);
1566    }
1567    if let Some(ref user_agent) = configuration.user_agent {
1568        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1569    }
1570    if let Some(ref apikey) = configuration.api_key {
1571        let key = apikey.key.clone();
1572        let value = match apikey.prefix {
1573            Some(ref prefix) => format!("{} {}", prefix, key),
1574            None => key,
1575        };
1576        req_builder = req_builder.header("Authorization", value);
1577    };
1578
1579    let req = req_builder.build()?;
1580    let resp = configuration.client.execute(req).await?;
1581
1582    let status = resp.status();
1583    let content_type = resp
1584        .headers()
1585        .get("content-type")
1586        .and_then(|v| v.to_str().ok())
1587        .unwrap_or("application/octet-stream");
1588    let content_type = super::ContentType::from(content_type);
1589
1590    if !status.is_client_error() && !status.is_server_error() {
1591        let content = resp.text().await?;
1592        match content_type {
1593            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1594            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetExchangeRate200Response`"))),
1595            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::GetExchangeRate200Response`")))),
1596        }
1597    } else {
1598        let content = resp.text().await?;
1599        let entity: Option<GetExchangeRateError> = serde_json::from_str(&content).ok();
1600        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1601    }
1602}
1603
1604/// The market movers endpoint provides a ranked list of the top-gaining and losing assets for the current trading day. It returns detailed data on the highest percentage price increases and decreases since the previous day's close. This endpoint supports international equities, forex, and cryptocurrencies, enabling users to quickly identify significant market movements across various asset classes.
1605pub async fn get_market_movers(configuration: &configuration::Configuration, params: GetMarketMoversParams) -> Result<models::MarketMoversResponseBody, Error<GetMarketMoversError>> {
1606    // Extract parameters from params struct
1607    let p_path_market = params.market;
1608    let p_query_direction = params.direction;
1609    let p_query_outputsize = params.outputsize;
1610    let p_query_country = params.country;
1611    let p_query_price_greater_than = params.price_greater_than;
1612    let p_query_dp = params.dp;
1613
1614    let uri_str = format!("{}/market_movers/{market}", configuration.base_path, market=crate::apis::urlencode(p_path_market));
1615    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1616
1617    if let Some(ref param_value) = p_query_direction {
1618        req_builder = req_builder.query(&[("direction", &serde_json::to_string(param_value)?)]);
1619    }
1620    if let Some(ref param_value) = p_query_outputsize {
1621        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
1622    }
1623    if let Some(ref param_value) = p_query_country {
1624        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1625    }
1626    if let Some(ref param_value) = p_query_price_greater_than {
1627        req_builder = req_builder.query(&[("price_greater_than", &param_value.to_string())]);
1628    }
1629    if let Some(ref param_value) = p_query_dp {
1630        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1631    }
1632    if let Some(ref user_agent) = configuration.user_agent {
1633        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1634    }
1635    if let Some(ref apikey) = configuration.api_key {
1636        let key = apikey.key.clone();
1637        let value = match apikey.prefix {
1638            Some(ref prefix) => format!("{} {}", prefix, key),
1639            None => key,
1640        };
1641        req_builder = req_builder.header("Authorization", value);
1642    };
1643
1644    let req = req_builder.build()?;
1645    let resp = configuration.client.execute(req).await?;
1646
1647    let status = resp.status();
1648    let content_type = resp
1649        .headers()
1650        .get("content-type")
1651        .and_then(|v| v.to_str().ok())
1652        .unwrap_or("application/octet-stream");
1653    let content_type = super::ContentType::from(content_type);
1654
1655    if !status.is_client_error() && !status.is_server_error() {
1656        let content = resp.text().await?;
1657        match content_type {
1658            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1659            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MarketMoversResponseBody`"))),
1660            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::MarketMoversResponseBody`")))),
1661        }
1662    } else {
1663        let content = resp.text().await?;
1664        let entity: Option<GetMarketMoversError> = serde_json::from_str(&content).ok();
1665        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1666    }
1667}
1668
1669/// The latest price endpoint provides the latest market price for a specified financial instrument. It returns a single data point representing the current (or the most recently available) trading price.
1670pub async fn get_price(configuration: &configuration::Configuration, params: GetPriceParams) -> Result<models::GetPrice200Response, Error<GetPriceError>> {
1671    // Extract parameters from params struct
1672    let p_query_symbol = params.symbol;
1673    let p_query_figi = params.figi;
1674    let p_query_isin = params.isin;
1675    let p_query_cusip = params.cusip;
1676    let p_query_exchange = params.exchange;
1677    let p_query_mic_code = params.mic_code;
1678    let p_query_country = params.country;
1679    let p_query_type = params.r#type;
1680    let p_query_format = params.format;
1681    let p_query_delimiter = params.delimiter;
1682    let p_query_prepost = params.prepost;
1683    let p_query_dp = params.dp;
1684
1685    let uri_str = format!("{}/price", configuration.base_path);
1686    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1687
1688    if let Some(ref param_value) = p_query_symbol {
1689        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1690    }
1691    if let Some(ref param_value) = p_query_figi {
1692        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1693    }
1694    if let Some(ref param_value) = p_query_isin {
1695        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1696    }
1697    if let Some(ref param_value) = p_query_cusip {
1698        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1699    }
1700    if let Some(ref param_value) = p_query_exchange {
1701        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1702    }
1703    if let Some(ref param_value) = p_query_mic_code {
1704        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
1705    }
1706    if let Some(ref param_value) = p_query_country {
1707        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1708    }
1709    if let Some(ref param_value) = p_query_type {
1710        req_builder = req_builder.query(&[("type", &serde_json::to_string(param_value)?)]);
1711    }
1712    if let Some(ref param_value) = p_query_format {
1713        req_builder = req_builder.query(&[("format", &serde_json::to_string(param_value)?)]);
1714    }
1715    if let Some(ref param_value) = p_query_delimiter {
1716        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
1717    }
1718    if let Some(ref param_value) = p_query_prepost {
1719        req_builder = req_builder.query(&[("prepost", &param_value.to_string())]);
1720    }
1721    if let Some(ref param_value) = p_query_dp {
1722        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1723    }
1724    if let Some(ref user_agent) = configuration.user_agent {
1725        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1726    }
1727    if let Some(ref apikey) = configuration.api_key {
1728        let key = apikey.key.clone();
1729        let value = match apikey.prefix {
1730            Some(ref prefix) => format!("{} {}", prefix, key),
1731            None => key,
1732        };
1733        req_builder = req_builder.header("Authorization", value);
1734    };
1735
1736    let req = req_builder.build()?;
1737    let resp = configuration.client.execute(req).await?;
1738
1739    let status = resp.status();
1740    let content_type = resp
1741        .headers()
1742        .get("content-type")
1743        .and_then(|v| v.to_str().ok())
1744        .unwrap_or("application/octet-stream");
1745    let content_type = super::ContentType::from(content_type);
1746
1747    if !status.is_client_error() && !status.is_server_error() {
1748        let content = resp.text().await?;
1749        match content_type {
1750            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1751            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetPrice200Response`"))),
1752            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::GetPrice200Response`")))),
1753        }
1754    } else {
1755        let content = resp.text().await?;
1756        let entity: Option<GetPriceError> = serde_json::from_str(&content).ok();
1757        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1758    }
1759}
1760
1761/// The quote endpoint provides real-time data for a selected financial instrument, returning essential information such as the latest price, open, high, low, close, volume, and price change. This endpoint is ideal for users needing up-to-date market data to track price movements and trading activity for specific stocks, ETFs, or other securities.
1762pub async fn get_quote(configuration: &configuration::Configuration, params: GetQuoteParams) -> Result<models::GetQuote200Response, Error<GetQuoteError>> {
1763    // Extract parameters from params struct
1764    let p_query_symbol = params.symbol;
1765    let p_query_figi = params.figi;
1766    let p_query_isin = params.isin;
1767    let p_query_cusip = params.cusip;
1768    let p_query_interval = params.interval;
1769    let p_query_exchange = params.exchange;
1770    let p_query_mic_code = params.mic_code;
1771    let p_query_country = params.country;
1772    let p_query_volume_time_period = params.volume_time_period;
1773    let p_query_type = params.r#type;
1774    let p_query_format = params.format;
1775    let p_query_delimiter = params.delimiter;
1776    let p_query_prepost = params.prepost;
1777    let p_query_eod = params.eod;
1778    let p_query_rolling_period = params.rolling_period;
1779    let p_query_dp = params.dp;
1780    let p_query_timezone = params.timezone;
1781
1782    let uri_str = format!("{}/quote", configuration.base_path);
1783    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1784
1785    if let Some(ref param_value) = p_query_symbol {
1786        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1787    }
1788    if let Some(ref param_value) = p_query_figi {
1789        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1790    }
1791    if let Some(ref param_value) = p_query_isin {
1792        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1793    }
1794    if let Some(ref param_value) = p_query_cusip {
1795        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1796    }
1797    if let Some(ref param_value) = p_query_interval {
1798        req_builder = req_builder.query(&[("interval", &serde_json::to_string(param_value)?)]);
1799    }
1800    if let Some(ref param_value) = p_query_exchange {
1801        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1802    }
1803    if let Some(ref param_value) = p_query_mic_code {
1804        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
1805    }
1806    if let Some(ref param_value) = p_query_country {
1807        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1808    }
1809    if let Some(ref param_value) = p_query_volume_time_period {
1810        req_builder = req_builder.query(&[("volume_time_period", &param_value.to_string())]);
1811    }
1812    if let Some(ref param_value) = p_query_type {
1813        req_builder = req_builder.query(&[("type", &serde_json::to_string(param_value)?)]);
1814    }
1815    if let Some(ref param_value) = p_query_format {
1816        req_builder = req_builder.query(&[("format", &serde_json::to_string(param_value)?)]);
1817    }
1818    if let Some(ref param_value) = p_query_delimiter {
1819        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
1820    }
1821    if let Some(ref param_value) = p_query_prepost {
1822        req_builder = req_builder.query(&[("prepost", &param_value.to_string())]);
1823    }
1824    if let Some(ref param_value) = p_query_eod {
1825        req_builder = req_builder.query(&[("eod", &param_value.to_string())]);
1826    }
1827    if let Some(ref param_value) = p_query_rolling_period {
1828        req_builder = req_builder.query(&[("rolling_period", &param_value.to_string())]);
1829    }
1830    if let Some(ref param_value) = p_query_dp {
1831        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1832    }
1833    if let Some(ref param_value) = p_query_timezone {
1834        req_builder = req_builder.query(&[("timezone", &param_value.to_string())]);
1835    }
1836    if let Some(ref user_agent) = configuration.user_agent {
1837        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1838    }
1839    if let Some(ref apikey) = configuration.api_key {
1840        let key = apikey.key.clone();
1841        let value = match apikey.prefix {
1842            Some(ref prefix) => format!("{} {}", prefix, key),
1843            None => key,
1844        };
1845        req_builder = req_builder.header("Authorization", value);
1846    };
1847
1848    let req = req_builder.build()?;
1849    let resp = configuration.client.execute(req).await?;
1850
1851    let status = resp.status();
1852    let content_type = resp
1853        .headers()
1854        .get("content-type")
1855        .and_then(|v| v.to_str().ok())
1856        .unwrap_or("application/octet-stream");
1857    let content_type = super::ContentType::from(content_type);
1858
1859    if !status.is_client_error() && !status.is_server_error() {
1860        let content = resp.text().await?;
1861        match content_type {
1862            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1863            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetQuote200Response`"))),
1864            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::GetQuote200Response`")))),
1865        }
1866    } else {
1867        let content = resp.text().await?;
1868        let entity: Option<GetQuoteError> = serde_json::from_str(&content).ok();
1869        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1870    }
1871}
1872
1873/// The time series endpoint provides detailed historical data for a specified financial instrument. It returns two main components: metadata, which includes essential information about the instrument, and a time series dataset. The time series consists of chronological entries with Open, High, Low, and Close prices, and for applicable instruments, it also includes trading volume. This endpoint is ideal for retrieving comprehensive historical price data for analysis or visualization purposes.
1874pub async fn get_time_series(configuration: &configuration::Configuration, params: GetTimeSeriesParams) -> Result<models::GetTimeSeries200Response, Error<GetTimeSeriesError>> {
1875    // Extract parameters from params struct
1876    let p_query_interval = params.interval;
1877    let p_query_symbol = params.symbol;
1878    let p_query_isin = params.isin;
1879    let p_query_figi = params.figi;
1880    let p_query_cusip = params.cusip;
1881    let p_query_outputsize = params.outputsize;
1882    let p_query_exchange = params.exchange;
1883    let p_query_mic_code = params.mic_code;
1884    let p_query_country = params.country;
1885    let p_query_type = params.r#type;
1886    let p_query_timezone = params.timezone;
1887    let p_query_start_date = params.start_date;
1888    let p_query_end_date = params.end_date;
1889    let p_query_date = params.date;
1890    let p_query_order = params.order;
1891    let p_query_prepost = params.prepost;
1892    let p_query_format = params.format;
1893    let p_query_delimiter = params.delimiter;
1894    let p_query_dp = params.dp;
1895    let p_query_previous_close = params.previous_close;
1896    let p_query_adjust = params.adjust;
1897
1898    let uri_str = format!("{}/time_series", configuration.base_path);
1899    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1900
1901    if let Some(ref param_value) = p_query_symbol {
1902        req_builder = req_builder.query(&[("symbol", &param_value.to_string())]);
1903    }
1904    if let Some(ref param_value) = p_query_isin {
1905        req_builder = req_builder.query(&[("isin", &param_value.to_string())]);
1906    }
1907    if let Some(ref param_value) = p_query_figi {
1908        req_builder = req_builder.query(&[("figi", &param_value.to_string())]);
1909    }
1910    if let Some(ref param_value) = p_query_cusip {
1911        req_builder = req_builder.query(&[("cusip", &param_value.to_string())]);
1912    }
1913    req_builder = req_builder.query(&[("interval", &p_query_interval.to_string())]);
1914    if let Some(ref param_value) = p_query_outputsize {
1915        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
1916    }
1917    if let Some(ref param_value) = p_query_exchange {
1918        req_builder = req_builder.query(&[("exchange", &param_value.to_string())]);
1919    }
1920    if let Some(ref param_value) = p_query_mic_code {
1921        req_builder = req_builder.query(&[("mic_code", &param_value.to_string())]);
1922    }
1923    if let Some(ref param_value) = p_query_country {
1924        req_builder = req_builder.query(&[("country", &param_value.to_string())]);
1925    }
1926    if let Some(ref param_value) = p_query_type {
1927        req_builder = req_builder.query(&[("type", &serde_json::to_string(param_value)?)]);
1928    }
1929    if let Some(ref param_value) = p_query_timezone {
1930        req_builder = req_builder.query(&[("timezone", &param_value.to_string())]);
1931    }
1932    if let Some(ref param_value) = p_query_start_date {
1933        req_builder = req_builder.query(&[("start_date", &param_value.to_string())]);
1934    }
1935    if let Some(ref param_value) = p_query_end_date {
1936        req_builder = req_builder.query(&[("end_date", &param_value.to_string())]);
1937    }
1938    if let Some(ref param_value) = p_query_date {
1939        req_builder = req_builder.query(&[("date", &param_value.to_string())]);
1940    }
1941    if let Some(ref param_value) = p_query_order {
1942        req_builder = req_builder.query(&[("order", &serde_json::to_string(param_value)?)]);
1943    }
1944    if let Some(ref param_value) = p_query_prepost {
1945        req_builder = req_builder.query(&[("prepost", &param_value.to_string())]);
1946    }
1947    if let Some(ref param_value) = p_query_format {
1948        req_builder = req_builder.query(&[("format", &serde_json::to_string(param_value)?)]);
1949    }
1950    if let Some(ref param_value) = p_query_delimiter {
1951        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
1952    }
1953    if let Some(ref param_value) = p_query_dp {
1954        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
1955    }
1956    if let Some(ref param_value) = p_query_previous_close {
1957        req_builder = req_builder.query(&[("previous_close", &param_value.to_string())]);
1958    }
1959    if let Some(ref param_value) = p_query_adjust {
1960        req_builder = req_builder.query(&[("adjust", &serde_json::to_string(param_value)?)]);
1961    }
1962    if let Some(ref user_agent) = configuration.user_agent {
1963        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1964    }
1965    if let Some(ref apikey) = configuration.api_key {
1966        let key = apikey.key.clone();
1967        let value = match apikey.prefix {
1968            Some(ref prefix) => format!("{} {}", prefix, key),
1969            None => key,
1970        };
1971        req_builder = req_builder.header("Authorization", value);
1972    };
1973
1974    let req = req_builder.build()?;
1975    let resp = configuration.client.execute(req).await?;
1976
1977    let status = resp.status();
1978    let content_type = resp
1979        .headers()
1980        .get("content-type")
1981        .and_then(|v| v.to_str().ok())
1982        .unwrap_or("application/octet-stream");
1983    let content_type = super::ContentType::from(content_type);
1984
1985    if !status.is_client_error() && !status.is_server_error() {
1986        let content = resp.text().await?;
1987        match content_type {
1988            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1989            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTimeSeries200Response`"))),
1990            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::GetTimeSeries200Response`")))),
1991        }
1992    } else {
1993        let content = resp.text().await?;
1994        let entity: Option<GetTimeSeriesError> = serde_json::from_str(&content).ok();
1995        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1996    }
1997}
1998
1999/// The Time Series Cross endpoint calculates and returns historical cross-rate data for exotic forex pairs, cryptocurrencies, or stocks (e.g., Apple Inc. price in Indian Rupees) on the fly. It provides metadata about the requested symbol and a time series array with Open, High, Low, and Close prices, sorted descending by time, enabling analysis of price history and market trends.
2000pub async fn get_time_series_cross(configuration: &configuration::Configuration, params: GetTimeSeriesCrossParams) -> Result<models::GetTimeSeriesCross200Response, Error<GetTimeSeriesCrossError>> {
2001    // Extract parameters from params struct
2002    let p_query_base = params.base;
2003    let p_query_quote = params.quote;
2004    let p_query_interval = params.interval;
2005    let p_query_base_type = params.base_type;
2006    let p_query_base_exchange = params.base_exchange;
2007    let p_query_base_mic_code = params.base_mic_code;
2008    let p_query_quote_type = params.quote_type;
2009    let p_query_quote_exchange = params.quote_exchange;
2010    let p_query_quote_mic_code = params.quote_mic_code;
2011    let p_query_outputsize = params.outputsize;
2012    let p_query_format = params.format;
2013    let p_query_delimiter = params.delimiter;
2014    let p_query_prepost = params.prepost;
2015    let p_query_start_date = params.start_date;
2016    let p_query_end_date = params.end_date;
2017    let p_query_adjust = params.adjust;
2018    let p_query_dp = params.dp;
2019    let p_query_timezone = params.timezone;
2020
2021    let uri_str = format!("{}/time_series/cross", configuration.base_path);
2022    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2023
2024    req_builder = req_builder.query(&[("base", &p_query_base.to_string())]);
2025    if let Some(ref param_value) = p_query_base_type {
2026        req_builder = req_builder.query(&[("base_type", &param_value.to_string())]);
2027    }
2028    if let Some(ref param_value) = p_query_base_exchange {
2029        req_builder = req_builder.query(&[("base_exchange", &param_value.to_string())]);
2030    }
2031    if let Some(ref param_value) = p_query_base_mic_code {
2032        req_builder = req_builder.query(&[("base_mic_code", &param_value.to_string())]);
2033    }
2034    req_builder = req_builder.query(&[("quote", &p_query_quote.to_string())]);
2035    if let Some(ref param_value) = p_query_quote_type {
2036        req_builder = req_builder.query(&[("quote_type", &param_value.to_string())]);
2037    }
2038    if let Some(ref param_value) = p_query_quote_exchange {
2039        req_builder = req_builder.query(&[("quote_exchange", &param_value.to_string())]);
2040    }
2041    if let Some(ref param_value) = p_query_quote_mic_code {
2042        req_builder = req_builder.query(&[("quote_mic_code", &param_value.to_string())]);
2043    }
2044    req_builder = req_builder.query(&[("interval", &p_query_interval.to_string())]);
2045    if let Some(ref param_value) = p_query_outputsize {
2046        req_builder = req_builder.query(&[("outputsize", &param_value.to_string())]);
2047    }
2048    if let Some(ref param_value) = p_query_format {
2049        req_builder = req_builder.query(&[("format", &serde_json::to_string(param_value)?)]);
2050    }
2051    if let Some(ref param_value) = p_query_delimiter {
2052        req_builder = req_builder.query(&[("delimiter", &param_value.to_string())]);
2053    }
2054    if let Some(ref param_value) = p_query_prepost {
2055        req_builder = req_builder.query(&[("prepost", &param_value.to_string())]);
2056    }
2057    if let Some(ref param_value) = p_query_start_date {
2058        req_builder = req_builder.query(&[("start_date", &param_value.to_string())]);
2059    }
2060    if let Some(ref param_value) = p_query_end_date {
2061        req_builder = req_builder.query(&[("end_date", &param_value.to_string())]);
2062    }
2063    if let Some(ref param_value) = p_query_adjust {
2064        req_builder = req_builder.query(&[("adjust", &param_value.to_string())]);
2065    }
2066    if let Some(ref param_value) = p_query_dp {
2067        req_builder = req_builder.query(&[("dp", &param_value.to_string())]);
2068    }
2069    if let Some(ref param_value) = p_query_timezone {
2070        req_builder = req_builder.query(&[("timezone", &param_value.to_string())]);
2071    }
2072    if let Some(ref user_agent) = configuration.user_agent {
2073        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2074    }
2075    if let Some(ref apikey) = configuration.api_key {
2076        let key = apikey.key.clone();
2077        let value = match apikey.prefix {
2078            Some(ref prefix) => format!("{} {}", prefix, key),
2079            None => key,
2080        };
2081        req_builder = req_builder.header("Authorization", value);
2082    };
2083
2084    let req = req_builder.build()?;
2085    let resp = configuration.client.execute(req).await?;
2086
2087    let status = resp.status();
2088    let content_type = resp
2089        .headers()
2090        .get("content-type")
2091        .and_then(|v| v.to_str().ok())
2092        .unwrap_or("application/octet-stream");
2093    let content_type = super::ContentType::from(content_type);
2094
2095    if !status.is_client_error() && !status.is_server_error() {
2096        let content = resp.text().await?;
2097        match content_type {
2098            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2099            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetTimeSeriesCross200Response`"))),
2100            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::GetTimeSeriesCross200Response`")))),
2101        }
2102    } else {
2103        let content = resp.text().await?;
2104        let entity: Option<GetTimeSeriesCrossError> = serde_json::from_str(&content).ok();
2105        Err(Error::ResponseError(ResponseContent { status, content, entity }))
2106    }
2107}
2108