Skip to main content

Crate oxinsider

Crate oxinsider 

Source
Expand description

The official Rust client for the 0xinsider Developer API: Polymarket analytics for sports and esports. Every tracked wallet is graded S to F from settled P&L; the API returns grades, large trades, sharp-money flow, positions, market snapshots, reports and search.

Every operation in the OpenAPI document is a typed async method on Client, named after its operationId in snake_case (listLeaderboard is Client::list_leaderboard). Required parameters are arguments; optional ones go in a ...Params struct.

use oxinsider::{Client, ListLeaderboardParams};

let client = Client::from_env()?; // reads OXINSIDER_API_KEY
let board = client.list_leaderboard(&ListLeaderboardParams::default().limit(10)).await?;
for entry in &board.data {
    println!("{} {:?}", entry.address, entry.grade);
}

Build against the sandbox first: Client::sandbox needs no key and answers every documented operation with example data.

  • Absent is not zero. A field the API did not report is None. Serve a truthful unavailable state; never read it as 0.
  • Errors. A non-2xx answer is Error::Api. Branch on ApiError::code and ApiError::reason, never on the message.
  • Retries. Reads, and writes that carry an Idempotency-Key, are retried on 408, 429, 502, 503 and 504, honoring Retry-After up to 60 seconds.
  • Pagination. Follow cursors to completion with pagination::Pager.
  • Stream. Read GET /api/v1/stream with Client::open_stream.
  • Webhooks. Verify deliveries with webhooks::verify_signature.
  • Where the credential goes. Over https, or http to a loopback host only; anything else fails with Error::InsecureTransport before a request is sent.

Re-exports§

pub use pagination::PaginationError;
pub use pagination::PaginationErrorReason;
pub use self;

Modules§

models
Typed models for every schema the OpenAPI document names, and for the request and response bodies it defines inline.
pagination
Following next_cursor to the end of a list, safely.
provenance
Which OpenAPI document this release was generated from.
webhooks
Verifying webhook deliveries.

Structs§

ActivateWebhookSecretParams
Optional parameters for Client::activate_webhook_secret (POST /api/v1/webhooks/{id}/rotate-secret/activate).
ApiError
A non-2xx answer from the API, decoded from its JSON error envelope.
Client
A typed client for the 0xinsider Developer API.
ClientBuilder
Configures a Client.
CreateMcpJsonRpcResponseParams
Optional parameters for Client::create_mcp_json_rpc_response (POST /api/v1/mcp).
CreateWebhookParams
Optional parameters for Client::create_webhook (POST /api/v1/webhooks).
CreateWebhookVerificationAttemptParams
Optional parameters for Client::create_webhook_verification_attempt (POST /api/v1/webhooks/{id}/verification-attempts).
DecodeError
A 2xx body that did not match the type this release expects.
DeleteWebhookParams
Optional parameters for Client::delete_webhook (DELETE /api/v1/webhooks/{id}).
Download
An open file download. Read it with chunk, bytes or save; dropping it closes the connection.
DownloadError
A download that could not be completed. The signed file URL is never part of it.
ExploreMarketsParams
Optional parameters for Client::explore_markets (GET /api/v1/markets/explore).
GetCategoryLeaderboardParams
Optional parameters for Client::get_category_leaderboard (GET /api/v1/leaderboard/categories/{slug}).
GetComboParams
Optional parameters for Client::get_combo (GET /api/v1/combos/{condition_id}).
GetCombosSummaryParams
Optional parameters for Client::get_combos_summary (GET /api/v1/combos/summary).
GetEdgeHunterParams
Optional parameters for Client::get_edge_hunter (GET /api/v1/edge-hunter).
GetEventReplaySinceParams
Optional parameters for Client::get_event_replay_since (GET /api/v1/events/feed/since).
GetGameHoldersParams
Optional parameters for Client::get_game_holders (GET /api/v1/games/{event_slug}/holders).
GetGameParams
Optional parameters for Client::get_game (GET /api/v1/games/{event_slug}).
GetGameSharpMoneyParams
Optional parameters for Client::get_game_sharp_money (GET /api/v1/games/{event_slug}/sharp-money).
GetHealthParams
Optional parameters for Client::get_health (GET /api/v1/health).
GetInsiderRadarFlagParams
Optional parameters for Client::get_insider_radar_flag (GET /api/v1/insider-radar/{id}).
GetLargeTradeParams
Optional parameters for Client::get_large_trade (GET /api/v1/large-trades/{id}).
GetMarketCandlesParams
Optional parameters for Client::get_market_candles (GET /api/v1/market/{condition_id}/candles).
GetMarketFlowParams
Optional parameters for Client::get_market_flow (GET /api/v1/market/{condition_id}/flow).
GetMarketHoldersParams
Optional parameters for Client::get_market_holders (GET /api/v1/market/{condition_id}/holders).
GetMarketIntelParams
Optional parameters for Client::get_market_intel (GET /api/v1/market/{condition_id}/intel).
GetMarketSnapshotParams
Optional parameters for Client::get_market_snapshot (GET /api/v1/market/{condition_id}/snapshot).
GetMarketTopHoldersParams
Optional parameters for Client::get_market_top_holders (GET /api/v1/market/{condition_id}/top-holders).
GetMarketWalletsInOutParams
Optional parameters for Client::get_market_wallets_in_out (GET /api/v1/market/{condition_id}/wallets-in-out).
GetPickOfTheDayArchiveParams
Optional parameters for Client::get_pick_of_the_day_archive (GET /api/v1/pick-of-the-day/archive).
GetPickOfTheDayLedgerEntryParams
Optional parameters for Client::get_pick_of_the_day_ledger_entry (GET /api/v1/pick-of-the-day/ledger/{pick_id}).
GetPickOfTheDayLedgerParams
Optional parameters for Client::get_pick_of_the_day_ledger (GET /api/v1/pick-of-the-day/ledger).
GetPickOfTheDayParams
Optional parameters for Client::get_pick_of_the_day (GET /api/v1/pick-of-the-day).
GetPickOfTheDayStatsParams
Optional parameters for Client::get_pick_of_the_day_stats (GET /api/v1/pick-of-the-day/stats).
GetPositionTimelineByIdParams
Optional parameters for Client::get_position_timeline_by_id (GET /api/v1/traders/{trader}/position-timeline).
GetPositionTimelineParams
Optional parameters for Client::get_position_timeline (GET /api/v1/trader/{address}/position-timeline).
GetResolutionReportParams
Optional parameters for Client::get_resolution_report (GET /api/v1/reports/resolutions).
GetSportLeaderboardParams
Optional parameters for Client::get_sport_leaderboard (GET /api/v1/leaderboard/sports/{sport}).
GetSuspiciousTradeParams
Optional parameters for Client::get_suspicious_trade (GET /api/v1/suspicious-trades/{id}).
GetTraderCategoryRecordsParams
Optional parameters for Client::get_trader_category_records (GET /api/v1/trader/{address}/categories).
GetTraderContextParams
Optional parameters for Client::get_trader_context (GET /api/v1/trader/{address}/context).
GetTraderGradeAtParams
Optional parameters for Client::get_trader_grade_at (GET /api/v1/trader/{address}/grade-at).
GetTraderParams
Optional parameters for Client::get_trader (GET /api/v1/trader/{address}).
GetTraderPnlParams
Optional parameters for Client::get_trader_pnl (GET /api/v1/trader/{address}/pnl).
GetWeeklyReportSnapshotParams
Optional parameters for Client::get_weekly_report_snapshot (GET /api/v1/reports/weekly).
GetWhaleTradeParams
Optional parameters for Client::get_whale_trade (GET /api/v1/whale-trades/{id}).
InsecureTransportError
A credential would have been sent over plain HTTP to a host that is not loopback. Nothing was sent. origin is the refused destination (scheme, host and port); the credential is never part of it.
ListCategoryLeadersParams
Optional parameters for Client::list_category_leaders (GET /api/v1/leaderboard/categories).
ListComboFillsParams
Optional parameters for Client::list_combo_fills (GET /api/v1/combos/fills).
ListGameMarketsParams
Optional parameters for Client::list_game_markets (GET /api/v1/games/{event_slug}/markets).
ListGameTradesParams
Optional parameters for Client::list_game_trades (GET /api/v1/games/{event_slug}/trades).
ListGamesParams
Optional parameters for Client::list_games (GET /api/v1/games).
ListInsiderRadarParams
Optional parameters for Client::list_insider_radar (GET /api/v1/insider-radar).
ListLargePositionsParams
Optional parameters for Client::list_large_positions (GET /api/v1/large-positions).
ListLargeTradeCounterpartyExecutionsParams
Optional parameters for Client::list_large_trade_counterparty_executions (GET /api/v1/large-trades/{id}/counterparties/executions).
ListLargeTradeCounterpartyMakersParams
Optional parameters for Client::list_large_trade_counterparty_makers (GET /api/v1/large-trades/{id}/counterparties/executions/{execution_id}/makers).
ListLargeTradeHistoryParams
Optional parameters for Client::list_large_trade_history (GET /api/v1/large-trades/history).
ListLargeTradesParams
Optional parameters for Client::list_large_trades (GET /api/v1/large-trades).
ListLeaderboardLeaguesParams
Optional parameters for Client::list_leaderboard_leagues (GET /api/v1/leaderboard/leagues).
ListLeaderboardParams
Optional parameters for Client::list_leaderboard (GET /api/v1/leaderboard).
ListPositionsParams
Optional parameters for Client::list_positions (GET /api/v1/positions).
ListSharpMoneyFlowsParams
Optional parameters for Client::list_sharp_money_flows (GET /api/v1/markets/sharp-money-flows).
ListSmartMoneyFlowsParams
Optional parameters for Client::list_smart_money_flows (GET /api/v1/markets/smart-money-flows).
ListSuspiciousTradesParams
Optional parameters for Client::list_suspicious_trades (GET /api/v1/suspicious-trades).
ListTrendingWalletsParams
Optional parameters for Client::list_trending_wallets (GET /api/v1/leaderboard/trending).
ListWebhookDeliveriesParams
Optional parameters for Client::list_webhook_deliveries (GET /api/v1/webhooks/{id}/deliveries).
ListWhaleTradeCounterpartyExecutionsParams
Optional parameters for Client::list_whale_trade_counterparty_executions (GET /api/v1/whale-trades/{id}/counterparties/executions).
ListWhaleTradeCounterpartyMakersParams
Optional parameters for Client::list_whale_trade_counterparty_makers (GET /api/v1/whale-trades/{id}/counterparties/executions/{execution_id}/makers).
ListWhaleTradeHistoryParams
Optional parameters for Client::list_whale_trade_history (GET /api/v1/whale-trades/history).
ListWhaleTradesParams
Optional parameters for Client::list_whale_trades (GET /api/v1/whale-trades).
Method
The Request Method (VERB)
Operation
One operation in the OpenAPI document. OPERATIONS lists them all.
PrepareWebhookSecretParams
Optional parameters for Client::prepare_webhook_secret (POST /api/v1/webhooks/{id}/rotate-secret/prepare).
RedeliverWebhookDeliveryParams
Optional parameters for Client::redeliver_webhook_delivery (POST /api/v1/webhooks/{id}/deliveries/{delivery_id}/redeliver).
RetireWebhookSecretParams
Optional parameters for Client::retire_webhook_secret (POST /api/v1/webhooks/{id}/rotate-secret/retire).
RotateWebhookSecretParams
Optional parameters for Client::rotate_webhook_secret (POST /api/v1/webhooks/{id}/rotate-secret).
SavedDownload
What Download::save wrote.
SearchContentParams
Optional parameters for Client::search_content (GET /api/v1/content/search).
SearchMarketsParams
Optional parameters for Client::search_markets (GET /api/v1/markets/search).
StreamFrame
One delivered frame.
StreamOptions
Options for Client::open_stream. Start from Default::default().
StreamProtocolError
The stream broke the SSE contract. The connection is closed.
StreamReader
Reads the frames of one stream connection. Dropping it closes the connection.
SubmitTraderExportParams
Optional parameters for Client::submit_trader_export (POST /api/v1/trader/{address}/export).
Tagged
A decoded body and the ETag validator its response carried, from an operation’s ..._with_etag method.
UpdateWebhookParams
Optional parameters for Client::update_webhook (PATCH /api/v1/webhooks/{id}).

Enums§

ApiErrorKind
What kind of failure an ApiError is, from its HTTP status.
DownloadErrorReason
Why a download failed.
Error
Every error this crate returns.
RetryClass
When a failed request may be sent again.
StreamProtocolErrorReason
What the stream did that the SSE contract does not allow.

Constants§

API_KEY_ENV
The environment variable Client::from_env reads the API key from.
DEFAULT_MAX_FRAME_BYTES
Bytes held for one undelivered frame by default: 1 MiB. The largest real frame is a few KB.
DEFAULT_MAX_READ_BYTES
Download::bytes refuses a file larger than this unless told otherwise: 64 MiB.
OPERATIONS
Every operation in the OpenAPI document, in document order.
PRODUCTION_BASE_URL
The production API origin. Every operation path is relative to it.
SANDBOX_BASE_URL
The sandbox: no credential, no production data, every documented operation answered with its example. Add sandbox_status=<code> to a query to get one of the errors the operation documents.
VERSION
This crate’s version, sent in the User-Agent header.

Functions§

is_loopback_host
True for localhost, an address in 127.0.0.0/8, or ::1 (bracketed or not).
is_trusted_destination
True when url may receive a credential: https anywhere, or http to a loopback host.

Type Aliases§

Result
Result with this crate’s Error.