use clap::Args;
use polymarket_hft::client::polymarket::gamma::{
GetCommentsRequest, GetEventsRequest, GetMarketsRequest, GetSeriesRequest, GetTagsRequest,
GetTeamsRequest, SearchRequest,
};
#[derive(Args, Debug, Clone)]
pub struct GetTeamsArgs {
#[arg(short, long)]
pub limit: Option<u32>,
#[arg(short, long)]
pub offset: Option<u32>,
#[arg(long)]
pub order: Option<String>,
#[arg(long)]
pub ascending: Option<bool>,
#[arg(long)]
pub league: Option<Vec<String>>,
#[arg(long)]
pub name: Option<Vec<String>>,
#[arg(long)]
pub abbreviation: Option<Vec<String>>,
}
impl<'a> From<&'a GetTeamsArgs> for GetTeamsRequest<'a> {
fn from(args: &'a GetTeamsArgs) -> Self {
GetTeamsRequest {
limit: args.limit,
offset: args.offset,
order: args.order.as_deref(),
ascending: args.ascending,
league: args.league.clone(),
name: args.name.clone(),
abbreviation: args.abbreviation.clone(),
}
}
}
#[derive(Args, Debug, Clone)]
pub struct GetTagsArgs {
#[arg(short, long)]
pub limit: Option<u32>,
#[arg(short, long)]
pub offset: Option<u32>,
#[arg(long)]
pub order: Option<String>,
#[arg(long)]
pub ascending: Option<bool>,
#[arg(long)]
pub include_template: Option<bool>,
#[arg(long)]
pub is_carousel: Option<bool>,
}
impl<'a> From<&'a GetTagsArgs> for GetTagsRequest<'a> {
fn from(args: &'a GetTagsArgs) -> Self {
GetTagsRequest {
limit: args.limit,
offset: args.offset,
order: args.order.as_deref(),
ascending: args.ascending,
include_template: args.include_template,
is_carousel: args.is_carousel,
}
}
}
#[derive(Args, Debug, Clone)]
pub struct GetEventsArgs {
#[arg(short, long)]
pub limit: Option<u32>,
#[arg(short, long)]
pub offset: Option<u32>,
#[arg(long)]
pub order: Option<String>,
#[arg(long)]
pub ascending: Option<bool>,
#[arg(long)]
pub id: Option<Vec<String>>,
#[arg(long)]
pub tag_id: Option<String>,
#[arg(long)]
pub exclude_tag_id: Option<Vec<String>>,
#[arg(long)]
pub slug: Option<Vec<String>>,
#[arg(long)]
pub tag_slug: Option<String>,
#[arg(long)]
pub related_tags: Option<bool>,
#[arg(long)]
pub active: Option<bool>,
#[arg(long)]
pub archived: Option<bool>,
#[arg(long)]
pub featured: Option<bool>,
#[arg(long)]
pub cyom: Option<bool>,
#[arg(long)]
pub include_chat: Option<bool>,
#[arg(long)]
pub include_template: Option<bool>,
#[arg(long)]
pub recurrence: Option<String>,
#[arg(long)]
pub closed: Option<bool>,
#[arg(long)]
pub liquidity_min: Option<f64>,
#[arg(long)]
pub liquidity_max: Option<f64>,
#[arg(long)]
pub volume_min: Option<f64>,
#[arg(long)]
pub volume_max: Option<f64>,
#[arg(long)]
pub start_date_min: Option<String>,
#[arg(long)]
pub start_date_max: Option<String>,
#[arg(long)]
pub end_date_min: Option<String>,
#[arg(long)]
pub end_date_max: Option<String>,
}
impl<'a> From<&'a GetEventsArgs> for GetEventsRequest<'a> {
fn from(args: &'a GetEventsArgs) -> Self {
GetEventsRequest {
limit: args.limit,
offset: args.offset,
order: args.order.as_deref(),
ascending: args.ascending,
id: args.id.clone(),
tag_id: args.tag_id.as_deref(),
exclude_tag_id: args.exclude_tag_id.clone(),
slug: args.slug.clone(),
tag_slug: args.tag_slug.as_deref(),
related_tags: args.related_tags,
active: args.active,
archived: args.archived,
featured: args.featured,
cyom: args.cyom,
include_chat: args.include_chat,
include_template: args.include_template,
recurrence: args.recurrence.as_deref(),
closed: args.closed,
liquidity_min: args.liquidity_min,
liquidity_max: args.liquidity_max,
volume_min: args.volume_min,
volume_max: args.volume_max,
start_date_min: args.start_date_min.as_deref(),
start_date_max: args.start_date_max.as_deref(),
end_date_min: args.end_date_min.as_deref(),
end_date_max: args.end_date_max.as_deref(),
}
}
}
#[derive(Args, Debug, Clone)]
pub struct GetMarketsArgs {
#[arg(short, long)]
pub limit: Option<u32>,
#[arg(short, long)]
pub offset: Option<u32>,
#[arg(long)]
pub order: Option<String>,
#[arg(long)]
pub ascending: Option<bool>,
#[arg(long)]
pub id: Option<Vec<String>>,
#[arg(long)]
pub slug: Option<Vec<String>>,
#[arg(long)]
pub clob_token_ids: Option<Vec<String>>,
#[arg(long)]
pub condition_ids: Option<Vec<String>>,
#[arg(long)]
pub market_maker_address: Option<Vec<String>>,
#[arg(long)]
pub liquidity_num_min: Option<f64>,
#[arg(long)]
pub liquidity_num_max: Option<f64>,
#[arg(long)]
pub volume_num_min: Option<f64>,
#[arg(long)]
pub volume_num_max: Option<f64>,
#[arg(long)]
pub start_date_min: Option<String>,
#[arg(long)]
pub start_date_max: Option<String>,
#[arg(long)]
pub end_date_min: Option<String>,
#[arg(long)]
pub end_date_max: Option<String>,
#[arg(long)]
pub tag_id: Option<String>,
#[arg(long)]
pub related_tags: Option<bool>,
#[arg(long)]
pub cyom: Option<bool>,
#[arg(long)]
pub uma_resolution_status: Option<String>,
#[arg(long)]
pub game_id: Option<String>,
#[arg(long)]
pub sports_market_types: Option<Vec<String>>,
#[arg(long)]
pub rewards_min_size: Option<f64>,
#[arg(long)]
pub question_ids: Option<Vec<String>>,
#[arg(long)]
pub include_tag: Option<bool>,
#[arg(long)]
pub closed: Option<bool>,
}
impl<'a> From<&'a GetMarketsArgs> for GetMarketsRequest<'a> {
fn from(args: &'a GetMarketsArgs) -> Self {
GetMarketsRequest {
limit: args.limit,
offset: args.offset,
order: args.order.as_deref(),
ascending: args.ascending,
id: args.id.clone(),
slug: args.slug.clone(),
clob_token_ids: args.clob_token_ids.clone(),
condition_ids: args.condition_ids.clone(),
market_maker_address: args.market_maker_address.clone(),
liquidity_num_min: args.liquidity_num_min,
liquidity_num_max: args.liquidity_num_max,
volume_num_min: args.volume_num_min,
volume_num_max: args.volume_num_max,
start_date_min: args.start_date_min.as_deref(),
start_date_max: args.start_date_max.as_deref(),
end_date_min: args.end_date_min.as_deref(),
end_date_max: args.end_date_max.as_deref(),
tag_id: args.tag_id.as_deref(),
related_tags: args.related_tags,
cyom: args.cyom,
uma_resolution_status: args.uma_resolution_status.as_deref(),
game_id: args.game_id.as_deref(),
sports_market_types: args.sports_market_types.clone(),
rewards_min_size: args.rewards_min_size,
question_ids: args.question_ids.clone(),
include_tag: args.include_tag,
closed: args.closed,
}
}
}
#[derive(Args, Debug, Clone)]
pub struct GetSeriesArgs {
#[arg(short, long)]
pub limit: Option<u32>,
#[arg(short, long)]
pub offset: Option<u32>,
#[arg(long)]
pub order: Option<String>,
#[arg(long)]
pub ascending: Option<bool>,
#[arg(short, long)]
pub slug: Option<String>,
#[arg(long)]
pub categories_ids: Option<Vec<String>>,
#[arg(long)]
pub categories_labels: Option<Vec<String>>,
#[arg(long)]
pub closed: Option<bool>,
#[arg(long)]
pub include_chat: Option<bool>,
#[arg(long)]
pub recurrence: Option<String>,
}
impl<'a> From<&'a GetSeriesArgs> for GetSeriesRequest<'a> {
fn from(args: &'a GetSeriesArgs) -> Self {
GetSeriesRequest {
limit: args.limit,
offset: args.offset,
order: args.order.as_deref(),
ascending: args.ascending,
slug: args.slug.as_deref(),
categories_ids: args.categories_ids.clone(),
categories_labels: args.categories_labels.clone(),
closed: args.closed,
include_chat: args.include_chat,
recurrence: args.recurrence.as_deref(),
}
}
}
#[derive(Args, Debug, Clone)]
pub struct GetCommentsArgs {
#[arg(long, value_parser = ["Event", "Series", "market"])]
pub parent_entity_type: String,
#[arg(long)]
pub parent_entity_id: String,
#[arg(short, long)]
pub limit: Option<u32>,
#[arg(short, long)]
pub offset: Option<u32>,
#[arg(long)]
pub order: Option<String>,
#[arg(long)]
pub ascending: Option<bool>,
#[arg(long)]
pub get_positions: Option<bool>,
#[arg(long)]
pub holders_only: Option<bool>,
}
impl<'a> From<&'a GetCommentsArgs> for GetCommentsRequest<'a> {
fn from(args: &'a GetCommentsArgs) -> Self {
GetCommentsRequest {
limit: args.limit,
offset: args.offset,
order: args.order.as_deref(),
ascending: args.ascending,
parent_entity_type: Some(args.parent_entity_type.as_str()),
parent_entity_id: Some(args.parent_entity_id.as_str()),
get_positions: args.get_positions,
holders_only: args.holders_only,
}
}
}
#[derive(Args, Debug, Clone)]
pub struct SearchArgs {
pub query: String,
#[arg(long)]
pub cache: Option<bool>,
#[arg(long)]
pub events_status: Option<String>,
#[arg(long)]
pub limit_per_type: Option<u32>,
#[arg(long)]
pub page: Option<u32>,
#[arg(long)]
pub events_tag: Option<Vec<String>>,
#[arg(long)]
pub keep_closed_markets: Option<u32>,
#[arg(long)]
pub sort: Option<String>,
#[arg(long)]
pub ascending: Option<bool>,
#[arg(long)]
pub search_tags: Option<bool>,
#[arg(long)]
pub search_profiles: Option<bool>,
#[arg(long)]
pub recurrence: Option<String>,
#[arg(long)]
pub exclude_tag_id: Option<Vec<String>>,
#[arg(long)]
pub optimized: Option<bool>,
}
impl<'a> From<&'a SearchArgs> for SearchRequest<'a> {
fn from(args: &'a SearchArgs) -> Self {
SearchRequest {
q: args.query.as_str(),
cache: args.cache,
events_status: args.events_status.as_deref(),
limit_per_type: args.limit_per_type,
page: args.page,
events_tag: args.events_tag.clone(),
keep_closed_markets: args.keep_closed_markets,
sort: args.sort.as_deref(),
ascending: args.ascending,
search_tags: args.search_tags,
search_profiles: args.search_profiles,
recurrence: args.recurrence.as_deref(),
exclude_tag_id: args.exclude_tag_id.clone(),
optimized: args.optimized,
}
}
}