1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
/// Parameters to indicate the desired frequency. When you change the frequency of a dataset, /// Quandl returns the last observation for the given period. /// #[allow(non_camel_case_types)] #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] pub enum Frequency { /// Unspecified frequency. In a data query, will default to the frequency of the dataset. /// none, /// Frequency of one data point every day. /// daily, /// Frequency of one data point every week. /// weekly, /// Frequency of one data point every month. /// monthly, /// Frequency of one data point every 4 months (or 4 times a year). /// quarterly, /// Frequency of one data point every year. /// annual } /// Select the sort order with this enum. The default sort order is descending. /// #[allow(non_camel_case_types)] #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] pub enum Order { /// Ascending ordering, for time series this means the first entry is the earliest date. /// asc, /// Descending ordering, for time series this means the first entry if the latest date. /// desc, } /// Perform calculations on your data prior to downloading. /// #[allow(non_camel_case_types)] #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] pub enum Transform { /// No transformation, also the default. /// none, /// Row-on-row change; a parameter that will transform the data to show the difference between /// days. Equivalent to `y'[t] = y[t] - y[t - 1]`. /// diff, /// Row-on-row percentage change; a parameter that will transform the data to show the /// difference between days divided by the previous day. Equivalent to `y'[t] = (y[t] - y[t - /// 1]) / y[t - 1]`. /// rdiff, /// Row-on-row percentage change from latest value; a parameter that will transfrom the data to /// show the percentage difference between the latest value and all subsequent values (where /// `y[n]` is the latest observation). Equivalent to `y'[t] = (y[n] - y[t]) / y[t]`. /// rdiff_from, /// Cumulative sum; a parameter that will calculate the sum of all preceding data returned. /// Equivalent to `y'[t] = y[t] + y[t - 1] + ... + y[0]`. /// cumul, /// Start at 100; a parameter that will normalize the data to the oldest datapoint returned. /// Equivalent to `y'[t] = (y[t] / y[0]) * 100`. /// normalize, } /// Hold the metadata associated to a specific database. /// #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct DatabaseMetadata { /// Quandl's numerical identifier for this database. /// pub id: usize, /// Name of the database. /// pub name: String, /// Database code; it is the code needed to construct any query on a specific database. /// pub database_code: String, /// Description of the database. /// pub description: String, /// Number of datasets in the database. /// pub datasets_count: usize, /// Number of time the database's content was downloaded. /// pub downloads: usize, /// Whether or not this is a premium database. /// pub premium: bool, /// URL pointing to the logo of the database. /// pub image: String, } /// Hold the metadata associated to a specific dataset. /// #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct DatasetMetadata { /// Quandl's numerical identifier for this dataset. /// pub id: usize, /// The dataset code for the returned dataset. /// pub dataset_code: String, /// The code for the database this dataset belongs to. /// pub database_code: String, /// The title of this dataset. /// pub name: String, /// An explanation of the contents of the data in this dataset. /// pub description: String, /// The last time the data in this dataset and metadata of this dataset was refreshed. /// pub refreshed_at: String, /// The most recent date of all available data points in this dataset. /// pub newest_available_date: String, /// The earliest date of all available data points in this dataset. /// pub oldest_available_date: String, /// The titles for each column of data in this datset. /// pub column_names: Vec<String>, /// How often each data point in the resulting dataset is returned. /// pub frequency: Frequency, /// Whether or not this is a dataset from a premium database. /// pub premium: bool, /// Quandl's numerical identifier for the database containing this dataset. /// pub database_id: usize, } /// Some queries, namely those which list datasets or databases metadata, often return some /// metadata about the search itself. This is a structure to hold that metadata. /// #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct SearchMetadata { /// A string of the search keywords submitted formatted as `format!("{}+{}+...+{}", keyword_1, /// keyword_2, ..., keyword_n)`. /// pub query: String, /// The number of search result per page. /// pub per_page: usize, /// The current page of result that was returned by this query. /// pub current_page: usize, /// The number of the previous page, unless there is no previous page. /// pub prev_page: Option<usize>, /// The total number of pages that can be queried. /// pub total_pages: usize, /// The total number of search result returned. /// pub total_count: usize, /// The number of the next page, unless there is no next page. /// pub next_page: Option<usize>, /// Index of the first result on the current page, with respect to the total number of results. /// pub current_first_item: Option<usize>, /// Index of the last result on the current page, with respect to the total number of results. /// pub current_last_item: Option<usize>, } /// Data structure to hold the result of doing a search database query. /// #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct DatabaseList { /// A vector containing the first page of databases' metadata. /// pub databases: Vec<DatabaseMetadata>, /// The search metadata associated with this listing. /// pub meta: SearchMetadata, } /// Data structure to hold the result of a search dataset query. /// #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct DatasetList { /// A vector containing the first page of datasets' metadata. /// pub datasets: Vec<DatasetMetadata>, /// The search metadata associated with this listing. /// pub meta: SearchMetadata, } /// Data structure to hold the result of a code list query. /// /// It should be noted that I slightly changed the meaning of a "dataset list" in this crate for /// consistency with the `DatabaseList`. In this crate `DatasetList` and `DatabaseList` correspond /// to Quandl's "dataset search" and "database list" respectively while `Vec<Code>` is Quandl's /// equivalent of a "dataset list". /// #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Code { /// The dataset code for the returned dataset. /// pub dataset_code: String, /// The code for the database this dataset belongs to. /// pub database_code: String, /// The title of this dataset. /// pub name: String, }