libfmp 1.1.0

Async, typed Rust client for the Financial Modeling Prep API
Documentation
//! Response rows returned by insider-trading endpoints.
//!
//! The provider documents every insider-trading route as available for
//! US-based companies only. The Python binding exposes these models under
//! `fmp.insider_trading`.

use serde::{Deserialize, Serialize};

use crate::{
    codecs::NumericString,
    types::{
        CalendarQuarter, CalendarYear, Cik, Count, Cusip, Date, FormType, Price, Quantity, Ticker,
        TransactionTypeCode,
    },
};

/// One insider trade shared by the latest and search feeds.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub struct InsiderTrade {
    pub symbol: Ticker,
    pub filing_date: Date,
    pub transaction_date: Date,
    pub reporting_cik: Cik,
    pub company_cik: Cik,
    pub transaction_type: TransactionTypeCode,
    #[serde(serialize_with = "crate::codecs::integral_f64::serialize")]
    pub securities_owned: Quantity,
    pub reporting_name: String,
    pub type_of_owner: String,
    pub acquisition_or_disposition: String,
    pub direct_or_indirect: String,
    pub form_type: FormType,
    #[serde(serialize_with = "crate::codecs::integral_f64::serialize")]
    pub securities_transacted: Quantity,
    pub price: Price,
    pub security_name: String,
    pub url: String,
}

/// One reporting-person identity returned by reporting-name search.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub struct InsiderReportingName {
    pub reporting_cik: Cik,
    pub reporting_name: String,
}

/// One open insider transaction-type taxonomy entry.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub struct InsiderTransactionType {
    pub transaction_type: TransactionTypeCode,
}

/// One quarterly aggregate of insider-trade activity.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub struct InsiderTradeStatistics {
    pub symbol: Ticker,
    pub cik: Cik,
    pub year: CalendarYear,
    pub quarter: CalendarQuarter,
    #[serde(deserialize_with = "crate::codecs::count::deserialize")]
    pub acquired_transactions: Count,
    #[serde(deserialize_with = "crate::codecs::count::deserialize")]
    pub disposed_transactions: Count,
    pub acquired_disposed_ratio: f64,
    #[serde(serialize_with = "crate::codecs::integral_f64::serialize")]
    pub total_acquired: Quantity,
    #[serde(serialize_with = "crate::codecs::integral_f64::serialize")]
    pub total_disposed: Quantity,
    pub average_acquired: f64,
    pub average_disposed: f64,
    #[serde(deserialize_with = "crate::codecs::count::deserialize")]
    pub total_purchases: Count,
    #[serde(deserialize_with = "crate::codecs::count::deserialize")]
    pub total_sales: Count,
}

/// One beneficial-ownership acquisition filing row.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[non_exhaustive]
#[serde(rename_all = "camelCase")]
pub struct BeneficialOwnershipAcquisition {
    pub cik: Cik,
    pub symbol: Ticker,
    pub filing_date: Date,
    pub accepted_date: Date,
    pub cusip: Cusip,
    pub name_of_reporting_person: String,
    pub citizenship_or_place_of_organization: String,
    pub sole_voting_power: NumericString,
    pub shared_voting_power: NumericString,
    pub sole_dispositive_power: NumericString,
    pub shared_dispositive_power: NumericString,
    pub amount_beneficially_owned: NumericString,
    pub percent_of_class: NumericString,
    pub type_of_reporting_person: String,
    pub url: String,
}