finance_query/adapters/polygon/
alternative.rs1use serde::{Deserialize, Serialize};
4
5use crate::error::Result;
6
7use super::build_client;
8use super::models::PaginatedResponse;
9
10#[derive(Debug, Clone, Serialize, Deserialize)]
12#[non_exhaustive]
13pub struct MerchantAggregate {
14 pub merchant: Option<String>,
16 pub parent: Option<String>,
18 pub date: Option<String>,
20 pub transaction_count: Option<f64>,
22 pub avg_transaction_value: Option<f64>,
24 pub total_spend: Option<f64>,
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[non_exhaustive]
31pub struct MerchantHierarchy {
32 pub merchant: Option<String>,
34 pub parent: Option<String>,
36 pub ticker: Option<String>,
38 pub category: Option<String>,
40}
41
42pub async fn merchant_aggregates(
44 params: &[(&str, &str)],
45) -> Result<PaginatedResponse<MerchantAggregate>> {
46 let client = build_client()?;
47 client
48 .get("/v1/alternative/merchant-aggregates", params)
49 .await
50}
51
52pub async fn merchant_hierarchy(
54 params: &[(&str, &str)],
55) -> Result<PaginatedResponse<MerchantHierarchy>> {
56 let client = build_client()?;
57 client
58 .get("/v1/alternative/merchant-hierarchy", params)
59 .await
60}