From 2f53120caf1a8812bdbe721eed79147153a48153 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 12 Apr 2024 21:31:59 +0200 Subject: [PATCH 01/37] add new aggregator --- src/rust/Cargo.lock | 24 +- src/rust/Cargo.toml | 2 +- src/rust/aggv2/Cargo.toml | 26 + src/rust/aggv2/README.md | 26 + src/rust/aggv2/src/feed.rs | 472 ++++++++++++++++++ src/rust/aggv2/src/feed/liquidity.rs | 81 +++ src/rust/aggv2/src/feed/spread.rs | 51 ++ src/rust/aggv2/src/feed/state.rs | 331 ++++++++++++ src/rust/aggv2/src/feed/volume.rs | 78 +++ src/rust/aggv2/src/main.rs | 200 ++++++++ src/rust/aggv2/src/numeric.rs | 229 +++++++++ .../down.sql | 3 + .../up.sql | 3 + .../2024-04-09-142800_aggv2/down.sql | 10 + .../migrations/2024-04-09-142800_aggv2/up.sql | 61 +++ 15 files changed, 1593 insertions(+), 4 deletions(-) create mode 100644 src/rust/aggv2/Cargo.toml create mode 100644 src/rust/aggv2/README.md create mode 100644 src/rust/aggv2/src/feed.rs create mode 100644 src/rust/aggv2/src/feed/liquidity.rs create mode 100644 src/rust/aggv2/src/feed/spread.rs create mode 100644 src/rust/aggv2/src/feed/state.rs create mode 100644 src/rust/aggv2/src/feed/volume.rs create mode 100644 src/rust/aggv2/src/main.rs create mode 100644 src/rust/aggv2/src/numeric.rs create mode 100644 src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/down.sql create mode 100644 src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql create mode 100644 src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql create mode 100644 src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 8ad82594..23d95c7c 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -93,6 +93,24 @@ dependencies = [ "url", ] +[[package]] +name = "aggv2" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal 0.3.1", + "chrono", + "dotenvy", + "serde", + "serde_json", + "sqlx", + "sqlx-postgres", + "tokio", + "tracing", + "tracing-subscriber 0.3.17", +] + [[package]] name = "ahash" version = "0.7.6" @@ -1713,10 +1731,10 @@ checksum = "9324c8014cd04590682b34f1e9448d38f0674d0f7b2dc553331016ef0e4e9ebc" dependencies = [ "autocfg", "libm", - "num-bigint", + "num-bigint 0.4.4", "num-integer", - "num-traits 0.2.16", - "serde 1.0.188", + "num-traits", + "serde", ] [[package]] diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 64cfc1ec..b03e64d4 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -9,7 +9,7 @@ members = [ "mqtt-publisher", "types", "sdk", - "sdk/example", + "sdk/example", "aggv2", ] exclude = ["api", "db", "dependencies"] diff --git a/src/rust/aggv2/Cargo.toml b/src/rust/aggv2/Cargo.toml new file mode 100644 index 00000000..1dba7d1a --- /dev/null +++ b/src/rust/aggv2/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "aggv2" +version = "0.1.0" +authors.workspace = true +license.workspace = true +homepage.workspace = true +publish.workspace = true +repository.workspace = true +edition.workspace = true +rust-version.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +anyhow.workspace = true +async-trait = "0.1.73" +bigdecimal = { version = "0.3.1", features = ["serde"] } +chrono.workspace = true +dotenvy.workspace = true +serde.workspace = true +serde_json.workspace = true +sqlx = { workspace = true, features = ["postgres", "chrono", "bigdecimal"] } +sqlx-postgres.workspace = true +tokio = { workspace = true, features = ["full"] } +tracing.workspace = true +tracing-subscriber.workspace = true diff --git a/src/rust/aggv2/README.md b/src/rust/aggv2/README.md new file mode 100644 index 00000000..ff318e61 --- /dev/null +++ b/src/rust/aggv2/README.md @@ -0,0 +1,26 @@ +# Aggregator v2 + +## Architecture + +The new aggregator works using feeds. + +There are three types of feeds: + +- ones that can generate a result from their previous value and the events that occurred since that previous value was generated +- ones that can generate a result from only events that occurred in a time period +- ones that can generate a result from another feed + +You can generate the result for the first two types in parallel. +Once done, you can generate the result of the third type in parallel. + +There are some unit numeric types defined that wrap `BigDecimal`. +This avoids confusion (you can add lots and ticks together) and simplifies calculus (dividing a `Tick` value by a `Price` value outputs a `Lot`). + +## Findings + +Tests and benchmarks have not been conducted yet. + +Although some findings are already here: + +- This implementation is slower to backfill, as it will query events per 1 second batch, rather than bigger batches, although this can be optimized away. +- This implementation is very likely to have higher throughput, as it is more efficient than the other one. diff --git a/src/rust/aggv2/src/feed.rs b/src/rust/aggv2/src/feed.rs new file mode 100644 index 00000000..1434e635 --- /dev/null +++ b/src/rust/aggv2/src/feed.rs @@ -0,0 +1,472 @@ +use std::{time::Duration, sync::Arc}; + +use crate::{BlockchainTimestamp, Event, numeric::*, Direction}; + +mod liquidity; +mod spread; +mod state; +mod volume; + +use chrono::{DateTime, Utc}; +use spread::Spread; +use sqlx::{Executor, Transaction}; +use sqlx_postgres::{PgPool, PgPoolOptions, PgConnection, Postgres}; +use state::ContractState; +use tracing::{span, Level, instrument, Instrument}; + +use self::{liquidity::Liquidity, volume::Volume}; + +const INTERVAL: std::time::Duration = std::time::Duration::from_secs(1); + +pub trait FeedFromEventsAndPrevState { + async fn get_prev_state(pool: &PgPool) -> Self; + fn update(&mut self, events: &Vec); +} + +pub trait FeedFromEvents { + fn new() -> Self; + fn update(&mut self, events: &Vec); +} + +pub trait FeedFromFeed { + fn from_feed(data: &T) -> Self; +} + +pub trait InsertableFeed { + async fn save<'a>(&self, timestamp: DateTime, transaction: &mut Transaction<'a, Postgres>); +} + +pub async fn get_max_timestamp<'a>(transaction: &mut Transaction<'a, Postgres>) -> Option> { + let max_limit = + sqlx::query!(r#"SELECT "time" FROM place_limit_order_events ORDER BY "time" DESC LIMIT 1"#) + .fetch_optional(transaction as &mut PgConnection) + .await + .unwrap() + .map(|o| o.time); + let max_market = sqlx::query!( + r#"SELECT "time" FROM place_market_order_events ORDER BY "time" DESC LIMIT 1"# + ) + .fetch_optional(transaction as &mut PgConnection) + .await + .unwrap() + .map(|o| o.time); + let max_swap = sqlx::query!( + r#"SELECT "time" FROM place_market_order_events ORDER BY "time" DESC LIMIT 1"# + ) + .fetch_optional(transaction as &mut PgConnection) + .await + .unwrap() + .map(|o| o.time); + let max_fill = sqlx::query!( + r#"SELECT "time" FROM place_market_order_events ORDER BY "time" DESC LIMIT 1"# + ) + .fetch_optional(transaction as &mut PgConnection) + .await + .unwrap() + .map(|o| o.time); + let max_market_reg = sqlx::query!( + r#"SELECT "time" FROM place_market_order_events ORDER BY "time" DESC LIMIT 1"# + ) + .fetch_optional(transaction as &mut PgConnection) + .await + .unwrap() + .map(|o| o.time); + max_limit + .max(max_market) + .max(max_swap) + .max(max_fill) + .max(max_market_reg) +} + +pub async fn get_event_batch<'a>( + start_blockchain_timestamp: &BlockchainTimestamp, + max_timestamp: &DateTime, + _amount_of_events: i64, + transaction: &mut Transaction<'a, Postgres>, +) -> Vec { + let mut events: Vec = vec![]; + let place_limit = sqlx::query!( + r#"SELECT * FROM place_limit_order_events WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::PlaceLimitOrder { + txn_version: TxnVersion::new(r.txn_version), + event_idx: EventId::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + user: r.user, + custodian_id: r.custodian_id, + order_id: OrderId::new(r.order_id), + side: if r.side {Direction::Ask} else {Direction::Bid}, + integrator: r.integrator, + initial_size: Lot::new(r.initial_size), + price: Price::new(r.price), + restriction: r.restriction, + self_match_behavior: r.self_match_behavior, + size: Lot::new(r.size), + }); + events.extend(place_limit); + let place_market = sqlx::query!( + r#"SELECT * FROM place_market_order_events WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::PlaceMarketOrder { + txn_version: TxnVersion::new(r.txn_version), + event_idx: EventId::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + user: r.user, + custodian_id: r.custodian_id, + order_id: OrderId::new(r.order_id), + integrator: r.integrator, + self_match_behavior: r.self_match_behavior, + size: Lot::new(r.size), + direction: if r.direction {Direction::Ask} else {Direction::Bid}, + }); + events.extend(place_market); + let place_swap = sqlx::query!( + r#"SELECT * FROM place_swap_order_events WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::PlaceSwapOrder { + txn_version: TxnVersion::new(r.txn_version), + event_idx: EventId::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + order_id: OrderId::new(r.order_id), + integrator: r.integrator, + direction: if r.direction {Direction::Ask} else {Direction::Bid}, + signing_account: r.signing_account, + min_base: r.min_base, + max_base: r.max_base, + min_quote: r.min_quote, + max_quote: r.max_quote, + limit_price: Price::new(r.limit_price), + }); + events.extend(place_swap); + let cancels = sqlx::query!( + r#"SELECT * FROM cancel_order_events WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::Cancel { + txn_version: TxnVersion::new(r.txn_version), + event_idx: EventId::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + user: r.user, + custodian_id: r.custodian_id, + order_id: OrderId::new(r.order_id), + reason: r.reason, + }); + events.extend(cancels); + let changes = sqlx::query!( + r#"SELECT * FROM change_order_size_events WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::ChangeSize { + txn_version: TxnVersion::new(r.txn_version), + event_idx: EventId::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + user: r.user, + custodian_id: r.custodian_id, + order_id: OrderId::new(r.order_id), + side: if r.side {Direction::Ask} else {Direction::Bid}, + new_size: Lot::new(r.new_size), + }); + events.extend(changes); + let fills = sqlx::query!( + r#"SELECT * FROM fill_events WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::Fill { + txn_version: TxnVersion::new(r.txn_version), + event_idx: EventId::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + emit_address: r.emit_address, + maker_address: r.maker_address, + maker_custodian_id: r.maker_custodian_id, + maker_order_id: OrderId::new(r.maker_order_id), + maker_side: if r.maker_side {Direction::Ask} else {Direction::Bid}, + price: Price::new(r.price), + sequence_number_for_trade: r.sequence_number_for_trade, + size: Lot::new(r.size), + taker_address: r.taker_address, + taker_custodian_id: r.taker_custodian_id, + taker_order_id: OrderId::new(r.taker_order_id), + taker_quote_fees_paid: r.taker_quote_fees_paid, + }); + events.extend(fills); + let market_registrations = sqlx::query!( + r#"SELECT * FROM market_registration_events WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::MarketRegistration { + txn_version: TxnVersion::new(r.txn_version), + event_idx: EventId::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + base_account_address: r.base_account_address, + base_module_name: r.base_module_name, + base_struct_name: r.base_struct_name, + base_name_generic: r.base_name_generic, + quote_account_address: r.quote_account_address, + quote_module_name: r.quote_module_name, + quote_struct_name: r.quote_struct_name, + lot_size: r.lot_size, + tick_size: r.tick_size, + min_size: Lot::new(r.min_size), + underwriter_id: r.underwriter_id, + }); + events.extend(market_registrations); + let balance_update_by_handle = sqlx::query!( + r#"SELECT * FROM balance_updates_by_handle WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::BalanceUpdatesByHandle { + txn_version: TxnVersion::new(r.txn_version), + time: r.time, + market_id: MarketId::new(r.market_id), + custodian_id: r.custodian_id, + base_total: BaseSubunit::new(r.base_total), + base_available: BaseSubunit::new(r.base_available), + base_ceiling: BaseSubunit::new(r.base_ceiling), + quote_total: QuoteSubunit::new(r.quote_total), + quote_available: QuoteSubunit::new(r.quote_available), + quote_ceiling: QuoteSubunit::new(r.quote_ceiling), + }); + events.extend(balance_update_by_handle); + let recognized_markets = sqlx::query!( + r#"SELECT * FROM recognized_market_events WHERE txn_version >= $1 AND "time" < $2"#, + start_blockchain_timestamp + .get_transaction_version() + .clone() + .inner(), + max_timestamp + ) + .fetch_all(transaction as &mut PgConnection) + .await + .unwrap() + .into_iter() + .map(|r| Event::MarketRegistration { + txn_version: TxnVersion::new(r.txn_version), + event_idx: EventId::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id.unwrap()), + base_account_address: r.base_account_address, + base_module_name: r.base_module_name, + base_struct_name: r.base_struct_name, + base_name_generic: r.base_name_generic, + quote_account_address: r.quote_account_address, + quote_module_name: r.quote_module_name, + quote_struct_name: r.quote_struct_name, + lot_size: r.lot_size.unwrap(), + tick_size: r.tick_size.unwrap(), + min_size: Lot::new(r.min_size.unwrap()), + underwriter_id: r.underwriter_id.unwrap(), + }); + events.extend(recognized_markets); + events.sort_unstable_by_key(|e| e.blockchain_timestamp()); + events +} + +#[instrument] +pub async fn run() -> anyhow::Result<()> { + tracing::info!("Starting."); + let pool = PgPoolOptions::new() + .after_connect(|conn, _| { + Box::pin(async move { + conn.execute("SET default_transaction_isolation TO 'repeatable read'") + .await?; + Ok(()) + }) + }) + .connect(&std::env::var("DATABASE_URL").unwrap()) + .await + .unwrap(); + + tracing::info!("Connected to database."); + + // Init feeds with state + tracing::info!("Loading feeds."); + let mut state = ContractState::get_prev_state(&pool).await; + let mut volume = Volume::get_prev_state(&pool).await; + tracing::info!("Done loading feeds."); + + let mut max_timestamp = state.timestamp + INTERVAL; + let mut start_blockchain_timestamp = + BlockchainTimestamp::from_transaction_version(state.transaction_version.clone()); + start_blockchain_timestamp.bump_version(); + + tracing::info!( + from_timestamp = state.timestamp.to_string(), + form_blockchain_timestamp = start_blockchain_timestamp.to_string(), + "Start aggregating." + ); + + loop { + let timestamp_string = (max_timestamp - INTERVAL).to_string(); + let blockchain_timestamp_string = start_blockchain_timestamp.to_string(); + (state, volume) = aggregator_loop(&pool, state, volume, &mut max_timestamp, &mut start_blockchain_timestamp).await?; + } +} + +#[instrument(skip(pool, state, volume))] +async fn aggregator_loop(pool: &PgPool, mut state: ContractState, mut volume: Volume, max_timestamp: &mut DateTime, start_blockchain_timestamp: &mut BlockchainTimestamp) -> anyhow::Result<(ContractState, Volume)> { + tracing::trace!("Aggregator loop start."); + + // Intro + let mut transaction = pool.begin().await?; + let t = if let Some(t) = get_max_timestamp(&mut transaction).await { + t + } else { + return Ok((state, volume)); + }; + if &t < max_timestamp { + tracing::debug!(max_db_timestamp = t.to_string(), "Max timestamp in DB is lower than required to run an aggregator loop."); + tokio::time::sleep(Duration::from_millis(100)).await; + return Ok((state, volume)); + } + + // Get events + tracing::trace!("Getting events between start blockchain timestamp and max timestamp."); + let events = + get_event_batch(&start_blockchain_timestamp, max_timestamp, 100_000, &mut transaction).await; + tracing::debug!("Got {} events", events.len()); + if events.len() == 0 { + state.save(state.timestamp, &mut transaction).await; + transaction.commit().await?; + state.update_timestamp(max_timestamp.clone()); + *max_timestamp += INTERVAL; + return Ok((state, volume)); + } + *start_blockchain_timestamp = events.last().unwrap().blockchain_timestamp(); + + // Run first layer + tracing::trace!("Start first layer."); + let events = Arc::new(events); + let events2 = events.clone(); + + let state_handle = tokio::task::spawn_blocking(move || { + let events2 = events2.clone(); + tracing::trace!("Start calculating."); + state.update(&events2); + tracing::trace!("Done calculating."); + state + }).instrument(span!(Level::TRACE, "state")); + let events2 = events.clone(); + let volume_handle = tokio::task::spawn_blocking(move || { + let events2 = events2.clone(); + tracing::trace!("Start calculating."); + volume.update(&events2); + tracing::trace!("Done calculating."); + volume + }).instrument(span!(Level::TRACE, "volume")); + let (state_new, volume_new) = tokio::try_join!(state_handle, volume_handle)?; + volume = volume_new; + state = state_new; + tracing::trace!("Done first layer."); + + // Run second layer + tracing::trace!("Start second layer."); + let arc_state = Arc::new(state); + let arc_state2 = arc_state.clone(); + + let spreads_handle = tokio::task::spawn_blocking(move || { + tracing::trace!("Start calculating."); + let spreads = Spread::from_feed(&arc_state2); + tracing::trace!("Done calculating."); + spreads + }).instrument(span!(Level::TRACE, "spreads")); + let arc_state2 = arc_state.clone(); + let liquidity_handle = tokio::task::spawn_blocking(move || { + tracing::trace!("Start calculating."); + let liquidity = Liquidity::from_feed(&arc_state2); + tracing::trace!("Done calculating."); + liquidity + }).instrument(span!(Level::TRACE, "liquidity")); + let (spreads, liquidity) = tokio::try_join!(spreads_handle, liquidity_handle)?; + state = Arc::::into_inner(arc_state).unwrap(); + tracing::trace!("Done second layer."); + + // Save + tracing::trace!("Start saving."); + state.save(state.timestamp.clone(), &mut transaction).await; + volume.save(state.timestamp.clone(), &mut transaction).await; + spreads.save(state.timestamp.clone(), &mut transaction).await; + liquidity.save(state.timestamp.clone(), &mut transaction).await; + transaction.commit().await?; + tracing::trace!("Done saving."); + + // Outro + state.update_timestamp(max_timestamp.clone()); + *max_timestamp += INTERVAL; + start_blockchain_timestamp.bump_version(); + + Ok((state, volume)) +} diff --git a/src/rust/aggv2/src/feed/liquidity.rs b/src/rust/aggv2/src/feed/liquidity.rs new file mode 100644 index 00000000..d296d9bf --- /dev/null +++ b/src/rust/aggv2/src/feed/liquidity.rs @@ -0,0 +1,81 @@ +use std::collections::HashMap; + +use bigdecimal::BigDecimal; +use sqlx::Transaction; +use sqlx_postgres::{Postgres, PgConnection}; + +use crate::{feed::ContractState, numeric::*}; + +use super::{FeedFromFeed, InsertableFeed}; + +pub type Liquidity = HashMap>; + +pub struct MarketLiquidity { + pub base: Tick, + pub quote: Tick, +} + +impl MarketLiquidity { + pub fn new() -> Self { + Self { + base: Tick::new(0), + quote: Tick::new(0), + } + } +} + +const BPS_TIMES_TEN_MULTIPILER: u64 = 10 * 100 * 100; + +impl FeedFromFeed for Liquidity { + fn from_feed(state: &ContractState) -> Self { + let mut liquidity = Self::default(); + for (market_id, market) in state.markets.iter() { + if !market.last_price.is_some() { + continue; + } + let last_price = market.last_price.clone().unwrap(); + let current_data = liquidity.entry(market_id.clone()).or_default(); + for order in market.asks.values() { + let bps_times_ten = (order.price.clone() * BPS_TIMES_TEN_MULTIPILER / last_price.clone() - 100_000).inner(); + for bps_times_ten_group in [25, 50, 100, 250, 500, 1000, 2000] { + if bps_times_ten <= BigDecimal::from(bps_times_ten_group) { + let market_liquidity = current_data + .entry(bps_times_ten_group) + .or_insert(MarketLiquidity::new()); + market_liquidity.base += &order.size * &last_price; + } + } + } + for order in market.bids.values() { + let bps_times_ten = (order.price.clone() * BPS_TIMES_TEN_MULTIPILER / last_price.clone() - 100_000).inner(); + for bps_times_ten_group in [25, 50, 100, 250, 500, 1000, 2000] { + if bps_times_ten <= BigDecimal::from(bps_times_ten_group) { + let market_liquidity = current_data + .entry(bps_times_ten_group) + .or_insert(MarketLiquidity::new()); + market_liquidity.quote += &order.size * &order.price; + } + } + } + } + liquidity + } +} + +impl InsertableFeed for Liquidity { + async fn save<'a>(&self, timestamp: chrono::prelude::DateTime, transaction: &mut Transaction<'a, Postgres>) { + for (key, value) in self { + for (bps_times_ten, liquidity) in value { + sqlx::query!( + "INSERT INTO aggv2.liquidity VALUES ($1, $2, $3, $4, $5)", + timestamp, + key.clone().inner(), + liquidity.base.clone().inner(), + liquidity.quote.clone().inner(), + bps_times_ten, + ).execute(transaction as &mut PgConnection) + .await.unwrap(); + } + } + } +} diff --git a/src/rust/aggv2/src/feed/spread.rs b/src/rust/aggv2/src/feed/spread.rs new file mode 100644 index 00000000..7a15f947 --- /dev/null +++ b/src/rust/aggv2/src/feed/spread.rs @@ -0,0 +1,51 @@ +use std::collections::HashMap; + +use chrono::{DateTime, Utc}; +use sqlx::Transaction; +use sqlx_postgres::{Postgres, PgConnection}; + +use crate::{numeric::{*}, feed::ContractState}; + +use super::{FeedFromFeed, InsertableFeed}; + +pub type Spread = HashMap; + +#[derive(Clone)] +pub struct MarketSpread { + pub min_ask: Option, + pub max_bid: Option, +} + +impl FeedFromFeed for Spread { + fn from_feed(state: &ContractState) -> Self { + let mut spread = Self::default(); + for (market_id, market) in state.markets.iter() { + let current_data = spread.entry(market_id.clone()).or_insert(MarketSpread { + min_ask: None, + max_bid: None, + }); + let current_min_ask = current_data.min_ask.clone(); + let current_max_bid = current_data.max_bid.clone(); + let min_ask = market.asks.iter().map(|(_, order)| order.price.clone()).min(); + let max_bid = market.bids.iter().map(|(_, order)| order.price.clone()).max(); + current_data.min_ask = current_min_ask.min(min_ask); + current_data.max_bid = current_max_bid.min(max_bid); + } + spread + } +} + +impl InsertableFeed for Spread { + async fn save<'a>(&self, timestamp: DateTime, transaction: &mut Transaction<'a, Postgres>) { + for (key, value) in self { + sqlx::query!( + "INSERT INTO aggv2.spread VALUES ($1, $2, $3, $4)", + timestamp, + key.clone().inner(), + value.clone().min_ask.map(|o| o.inner()), + value.clone().max_bid.map(|o| o.inner()) + ).execute(transaction as &mut PgConnection) + .await.unwrap(); + } + } +} diff --git a/src/rust/aggv2/src/feed/state.rs b/src/rust/aggv2/src/feed/state.rs new file mode 100644 index 00000000..705fb92e --- /dev/null +++ b/src/rust/aggv2/src/feed/state.rs @@ -0,0 +1,331 @@ +use std::collections::HashMap; + +use bigdecimal::BigDecimal; +use chrono::{DateTime, Utc}; +use sqlx::Transaction; +use sqlx_postgres::{PgPool, Postgres, PgConnection}; + +use crate::{Direction, Event, numeric::*}; + +use super::{FeedFromEventsAndPrevState, InsertableFeed}; + +#[derive(Debug)] +pub struct ContractState { + pub markets: HashMap, + pub timestamp: DateTime, + pub transaction_version: TxnVersion, +} + +#[derive(Debug)] +pub struct MarketState { + pub asks: HashMap, + pub bids: HashMap, + pub accounts: HashMap, + pub last_price: Option, +} + +#[derive(Clone, Debug)] +pub struct Account { + pub base: BaseSubunit, + pub quote: QuoteSubunit, +} + +#[derive(Clone, Debug)] +pub struct LimitOrder { + pub last_changed: BlockchainTimestamp, + pub user: String, + pub custodian_id: BigDecimal, + pub direction: Direction, + pub integrator: String, + pub price: Price, + pub size: Lot, +} + +impl ContractState { + pub fn update_timestamp(&mut self, timestamp: DateTime) { + self.timestamp = timestamp; + } +} + +impl FeedFromEventsAndPrevState for ContractState { + async fn get_prev_state(pool: &PgPool) -> Self { + let state_cache = sqlx::query!("SELECT * FROM aggv2.state_cache").fetch_optional(pool).await.unwrap(); + if let Some(state_cache) = state_cache { + let orders_cache = sqlx::query!("SELECT * FROM aggv2.order_cache").fetch_all(pool).await.unwrap(); + let accounts_cache = sqlx::query!("SELECT * FROM aggv2.account_cache").fetch_all(pool).await.unwrap(); + let markets_cache = sqlx::query!("SELECT * FROM aggv2.market_cache").fetch_all(pool).await.unwrap(); + let mut markets = HashMap::new(); + for market_cache in markets_cache { + let market = MarketState { + asks: Default::default(), + bids: Default::default(), + accounts: Default::default(), + last_price: market_cache.last_price.map(|p| Price::new(p)), + }; + markets.insert(MarketId::new(market_cache.market_id), market); + } + + for account_cache in accounts_cache { + let account = Account { + base: BaseSubunit::new(account_cache.base), + quote: QuoteSubunit::new(account_cache.quote), + }; + markets.get_mut(&MarketId::new(account_cache.market_id)).unwrap().accounts.insert(account_cache.user, account); + } + + for order_cache in orders_cache { + let order = LimitOrder { + last_changed: BlockchainTimestamp::from_raw_parts(TxnVersion::new(order_cache.last_changed_transaction_version), EventId::new(order_cache.last_changed_event_id)), + user: order_cache.user, + custodian_id: order_cache.custodian_id, + direction: if order_cache.is_ask { Direction::Ask } else { Direction::Bid }, + integrator: order_cache.integrator, + price: Price::new(order_cache.price), + size: Lot::new(order_cache.size), + }; + if order_cache.is_ask { + markets.get_mut(&MarketId::new(order_cache.market_id)).unwrap().asks.insert(OrderId::new(order_cache.order_id), order); + } else { + markets.get_mut(&MarketId::new(order_cache.market_id)).unwrap().bids.insert(OrderId::new(order_cache.order_id), order); + } + } + + ContractState { + markets, + timestamp: state_cache.time, + transaction_version: TxnVersion::new(state_cache.transaction_version), + } + } else { + let timestamp = sqlx::query!(r#" +WITH mins AS ( + SELECT MIN("time") AS "time" FROM balance_updates_by_handle UNION + SELECT MIN("time") AS "time" FROM cancel_order_events UNION + SELECT MIN("time") AS "time" FROM change_order_size_events UNION + SELECT MIN("time") AS "time" FROM fill_events UNION + SELECT MIN("time") AS "time" FROM market_registration_events UNION + SELECT MIN("time") AS "time" FROM place_limit_order_events UNION + SELECT MIN("time") AS "time" FROM place_market_order_events UNION + SELECT MIN("time") AS "time" FROM place_swap_order_events UNION + SELECT MIN("time") AS "time" FROM recognized_market_events +) +SELECT MIN("time") AS "time" FROM mins + "#).fetch_optional(pool) + .await + .unwrap() + .map(|r| r.time) + .flatten() + .unwrap_or(DateTime::UNIX_EPOCH); + let transaction_version = sqlx::query!(r#" +WITH mins AS ( + SELECT MIN(txn_version) AS txn_version FROM balance_updates_by_handle UNION + SELECT MIN(txn_version) AS txn_version FROM cancel_order_events UNION + SELECT MIN(txn_version) AS txn_version FROM change_order_size_events UNION + SELECT MIN(txn_version) AS txn_version FROM fill_events UNION + SELECT MIN(txn_version) AS txn_version FROM market_registration_events UNION + SELECT MIN(txn_version) AS txn_version FROM place_limit_order_events UNION + SELECT MIN(txn_version) AS txn_version FROM place_market_order_events UNION + SELECT MIN(txn_version) AS txn_version FROM place_swap_order_events UNION + SELECT MIN(txn_version) AS txn_version FROM recognized_market_events +) +SELECT MIN(txn_version) AS txn_version FROM mins + "#).fetch_optional(pool) + .await + .unwrap() + .map(|r| r.txn_version) + .flatten() + .unwrap_or(BigDecimal::from(0)); + ContractState { + markets: Default::default(), + timestamp, + transaction_version: TxnVersion::new(transaction_version), + } + } + } + + fn update(&mut self, events: &Vec) { + for event in events { + match event.clone() { + Event::MarketRegistration { market_id, .. } => { + self.markets.insert( + MarketId::from(market_id), + MarketState { + asks: Default::default(), + bids: Default::default(), + accounts: Default::default(), + last_price: None, + }, + ); + } + Event::PlaceLimitOrder { + txn_version, + event_idx, + market_id, + user, + custodian_id, + order_id, + side, + integrator, + price, + size, + .. + } => { + let market = self.markets.get_mut(&MarketId::from(market_id)).unwrap(); + if matches!(side, Direction::Ask) { + market.asks.insert( + OrderId::from(order_id), + LimitOrder { + last_changed: BlockchainTimestamp::from_raw_parts(txn_version, event_idx), + user, + custodian_id, + direction: Direction::Ask, + integrator, + price, + size, + }, + ); + } else { + market.bids.insert( + OrderId::from(order_id), + LimitOrder { + last_changed: BlockchainTimestamp::from_raw_parts(txn_version, event_idx), + user, + custodian_id, + direction: Direction::Bid, + integrator, + price, + size, + }, + ); + } + } + Event::Fill { + emit_address, + maker_address, + maker_order_id, + maker_side, + market_id, + size, + taker_order_id, + price, + .. + } => { + if maker_address == emit_address { + let market = self.markets.get_mut(&MarketId::from(market_id)).unwrap(); + market.last_price = Some(price); + let (maker_order, taker_order) = if matches!(maker_side, Direction::Ask) { + ( + market.asks.get_mut(&OrderId::from(maker_order_id)), + market.bids.get_mut(&OrderId::from(taker_order_id)), + ) + } else { + ( + market.bids.get_mut(&OrderId::from(maker_order_id)), + market.asks.get_mut(&OrderId::from(taker_order_id)), + ) + }; + if let Some(maker_order) = maker_order { + maker_order.size -= size.clone(); + } + if let Some(taker_order) = taker_order { + taker_order.size -= size.clone(); + } + } + } + Event::Cancel { + market_id, + order_id, + .. + } => { + let market = self.markets.get_mut(&MarketId::from(market_id)).unwrap(); + let order_id = OrderId::from(order_id); + market.asks.remove(&order_id); + market.bids.remove(&order_id); + } + Event::ChangeSize { + txn_version, + event_idx, + market_id, + order_id, + side, + new_size, + .. + } => { + let market = self.markets.get_mut(&MarketId::from(market_id)).unwrap(); + let order = if matches!(side, Direction::Ask) { + market.asks.get_mut(&OrderId::from(order_id)) + } else { + market.bids.get_mut(&OrderId::from(order_id)) + }; + if let Some(order) = order { + order.size = new_size; + order.last_changed = + BlockchainTimestamp::from_raw_parts(txn_version, event_idx); + } + } + _ => {} + } + } + } +} + +impl InsertableFeed for ContractState { + async fn save<'a>(&self, _timestamp: DateTime, transaction: &mut Transaction<'a, Postgres>) { + sqlx::query!("DELETE FROM aggv2.state_cache").execute(transaction as &mut PgConnection).await.unwrap(); + sqlx::query!("DELETE FROM aggv2.account_cache").execute(transaction as &mut PgConnection).await.unwrap(); + sqlx::query!("DELETE FROM aggv2.market_cache").execute(transaction as &mut PgConnection).await.unwrap(); + sqlx::query!("DELETE FROM aggv2.order_cache").execute(transaction as &mut PgConnection).await.unwrap(); + sqlx::query!( + "INSERT INTO aggv2.state_cache VALUES ($1, $2)", + self.timestamp, + self.transaction_version.clone().inner(), + ).execute(transaction as &mut PgConnection).await.unwrap(); + for (market_id, market) in &self.markets { + sqlx::query!( + "INSERT INTO aggv2.market_cache VALUES ($1, $2)", + market_id.clone().inner(), + market.last_price.clone().map(|lp| lp.inner()), + ).execute(transaction as &mut PgConnection).await.unwrap(); + for (order_id, order) in &market.asks { + let order = order.clone(); + sqlx::query!( + "INSERT INTO aggv2.order_cache VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", + market_id.clone().inner(), + true, + order_id.clone().inner(), + order.last_changed.get_transaction_version().clone().inner(), + order.last_changed.get_event_id().clone().inner(), + order.user, + order.custodian_id, + order.integrator, + order.price.inner(), + order.size.inner() + ).execute(transaction as &mut PgConnection).await.unwrap(); + } + for (order_id, order) in &market.bids { + let order = order.clone(); + sqlx::query!( + "INSERT INTO aggv2.order_cache VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", + market_id.clone().inner(), + false, + order_id.clone().inner(), + order.last_changed.get_transaction_version().clone().inner(), + order.last_changed.get_event_id().clone().inner(), + order.user, + order.custodian_id, + order.integrator, + order.price.inner(), + order.size.inner() + ).execute(transaction as &mut PgConnection).await.unwrap(); + } + for (account_id, account) in &market.accounts { + sqlx::query!( + "INSERT INTO aggv2.account_cache VALUES ($1, $2, $3, $4)", + market_id.clone().inner(), + account_id, + account.base.clone().inner(), + account.quote.clone().inner(), + ).execute(transaction as &mut PgConnection).await.unwrap(); + } + } + } +} diff --git a/src/rust/aggv2/src/feed/volume.rs b/src/rust/aggv2/src/feed/volume.rs new file mode 100644 index 00000000..038c3796 --- /dev/null +++ b/src/rust/aggv2/src/feed/volume.rs @@ -0,0 +1,78 @@ +use std::collections::HashMap; + +use chrono::{DateTime, Utc}; +use sqlx::Transaction; +use sqlx_postgres::{PgPool, Postgres, PgConnection}; + +use crate::{numeric::*, Event}; + +use super::{FeedFromEventsAndPrevState, InsertableFeed}; + +#[derive(Debug)] +pub struct Volume { + markets: HashMap, +} + +#[derive(Clone, Debug)] +pub struct MarketVolume { + pub cumulative: Tick, + pub period: Tick, +} + +impl FeedFromEventsAndPrevState for Volume { + fn update(&mut self, events: &Vec) { + for prev_vol in self.markets.iter_mut() { + prev_vol.1.period = Tick::new(0); + } + for event in events.iter() { + match event { + Event::MarketRegistration { market_id, .. } => { + self.markets.insert(MarketId::from(market_id.clone()), MarketVolume { + cumulative: Tick::new(0), + period: Tick::new(0), + }); + } + Event::Fill { size, price, market_id, .. } => { + let market_volume = self.markets.get_mut(&MarketId::from(market_id.clone())).unwrap(); + market_volume.cumulative += size * price; + market_volume.period += size * price; + }, + _ => {} + } + } + } + + async fn get_prev_state(pool: &PgPool) -> Self { + let r = sqlx::query!( + r#"SELECT DISTINCT ON (market_id) * FROM aggv2.volume ORDER BY market_id, "time" DESC"# + ).fetch_all(pool) + .await.unwrap(); + let mut volume = Volume { + markets: Default::default() + }; + for row in r { + let market = volume.markets.entry(MarketId::new(row.market_id)).or_insert(MarketVolume { + cumulative: Tick::new(0), + period: Tick::new(0), + }); + market.cumulative = Tick::new(row.cumulative); + market.period = Tick::new(row.period); + } + volume + } +} + +impl InsertableFeed for Volume { + async fn save<'a>(&self, timestamp: DateTime, transaction: &mut Transaction<'a, Postgres>) { + for (key, value) in &self.markets { + sqlx::query!( + "INSERT INTO aggv2.volume VALUES ($1, $2, $3, $4)", + timestamp, + key.clone().inner(), + value.clone().cumulative.inner(), + value.clone().period.inner() + ).execute(transaction as &mut PgConnection) + .await.unwrap(); + } + } +} diff --git a/src/rust/aggv2/src/main.rs b/src/rust/aggv2/src/main.rs new file mode 100644 index 00000000..e614ac43 --- /dev/null +++ b/src/rust/aggv2/src/main.rs @@ -0,0 +1,200 @@ +use bigdecimal::BigDecimal; +use chrono::{Utc, DateTime}; +use numeric::{BlockchainTimestamp, OrderId, TxnVersion, EventId}; + +mod feed; +mod numeric; + +use numeric::*; + +#[derive(Clone, Debug)] +pub enum Event { + BalanceUpdatesByHandle { + txn_version: TxnVersion, + market_id: MarketId, + custodian_id: BigDecimal, + time: DateTime, + base_total: BaseSubunit, + base_available: BaseSubunit, + base_ceiling: BaseSubunit, + quote_total: QuoteSubunit, + quote_available: QuoteSubunit, + quote_ceiling: QuoteSubunit, + }, + MarketRegistration { + txn_version: TxnVersion, + event_idx: EventId, + market_id: MarketId, + time: DateTime, + base_account_address: Option, + base_module_name: Option, + base_struct_name: Option, + base_name_generic: Option, + quote_account_address: String, + quote_module_name: String, + quote_struct_name: String, + lot_size: BigDecimal, + tick_size: BigDecimal, + min_size: Lot, + underwriter_id: BigDecimal, + }, + MarketRecognition { + txn_version: TxnVersion, + event_idx: EventId, + market_id: MarketId, + time: DateTime, + base_account_address: Option, + base_module_name: Option, + base_struct_name: Option, + base_name_generic: Option, + quote_account_address: String, + quote_module_name: String, + quote_struct_name: String, + lot_size: BigDecimal, + tick_size: BigDecimal, + min_size: Lot, + underwriter_id: BigDecimal, + }, + PlaceLimitOrder { + txn_version: TxnVersion, + event_idx: EventId, + time: DateTime, + market_id: MarketId, + user: String, + custodian_id: BigDecimal, + order_id: OrderId, + side: Direction, + integrator: String, + initial_size: Lot, + price: Price, + restriction: i16, + self_match_behavior: i16, + size: Lot, + }, + PlaceMarketOrder { + txn_version: TxnVersion, + event_idx: EventId, + time: DateTime, + market_id: MarketId, + user: String, + custodian_id: BigDecimal, + order_id: OrderId, + direction: Direction, + integrator: String, + self_match_behavior: i16, + size: Lot, + }, + PlaceSwapOrder { + txn_version: TxnVersion, + event_idx: EventId, + time: DateTime, + market_id: MarketId, + order_id: OrderId, + direction: Direction, + signing_account: String, + integrator: String, + min_base: BigDecimal, + max_base: BigDecimal, + min_quote: BigDecimal, + max_quote: BigDecimal, + limit_price: Price, + }, + Fill { + txn_version: TxnVersion, + event_idx: EventId, + emit_address: String, + time: DateTime, + maker_address: String, + maker_custodian_id: BigDecimal, + maker_order_id: OrderId, + maker_side: Direction, + market_id: MarketId, + price: Price, + sequence_number_for_trade: BigDecimal, + size: Lot, + taker_address: String, + taker_custodian_id: BigDecimal, + taker_order_id: OrderId, + taker_quote_fees_paid: BigDecimal, + }, + Cancel { + txn_version: TxnVersion, + event_idx: EventId, + time: DateTime, + market_id: MarketId, + user: String, + custodian_id: BigDecimal, + order_id: OrderId, + reason: i16, + }, + ChangeSize { + txn_version: TxnVersion, + event_idx: EventId, + time: DateTime, + market_id: MarketId, + user: String, + custodian_id: BigDecimal, + order_id: OrderId, + side: Direction, + new_size: Lot, + }, +} + +impl Event { + pub fn blockchain_timestamp(&self) -> BlockchainTimestamp { + match self.clone() { + Event::MarketRegistration { txn_version, event_idx, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + }, + Event::PlaceLimitOrder { txn_version, event_idx, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + }, + Event::PlaceMarketOrder { txn_version, event_idx, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + }, + Event::PlaceSwapOrder { txn_version, event_idx, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + }, + Event::Fill { txn_version, event_idx, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + }, + Event::Cancel { txn_version, event_idx, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + }, + Event::ChangeSize { txn_version, event_idx, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + }, + Event::BalanceUpdatesByHandle { txn_version, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, EventId::new(0)) + }, + Event::MarketRecognition { txn_version, event_idx, .. } => { + BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + } + } + } +} + +#[derive(Clone, Debug)] +pub enum Direction { + Ask, + Bid, +} + +impl From for Direction { + fn from(value: bool) -> Self { + if value { + Self::Ask + } else { + Self::Bid + } + } +} + +#[tokio::main] +async fn main() -> anyhow::Result<()> { + tracing_subscriber::fmt() + .with_env_filter("aggv2=TRACE") + .init(); + feed::run().await?; + Ok(()) +} diff --git a/src/rust/aggv2/src/numeric.rs b/src/rust/aggv2/src/numeric.rs new file mode 100644 index 00000000..b89d1f45 --- /dev/null +++ b/src/rust/aggv2/src/numeric.rs @@ -0,0 +1,229 @@ +use std::fmt::Display; + +use bigdecimal::BigDecimal; + +macro_rules! make_numeric_type { + ($name:ident) => { + #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Clone)] + pub struct $name(BigDecimal); + + impl std::fmt::Debug for $name { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}({})", stringify!($name), self.0) + } + } + + impl std::fmt::Display for $name { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } + } + + impl $name { + pub fn new(value: impl Into) -> Self { + Self(value.into()) + } + + pub fn inner(self) -> BigDecimal { + self.0 + } + } + + impl std::ops::Add for $name { + type Output = Self; + fn add(self, rhs: Self) -> Self::Output { + $name(self.0 + rhs.0) + } + } + + impl std::ops::Sub for $name { + type Output = Self; + fn sub(self, rhs: Self) -> Self::Output { + $name(self.0 - rhs.0) + } + } + + impl std::ops::Add for $name { + type Output = Self; + fn add(self, rhs: u64) -> Self::Output { + $name(self.0 + bigdecimal::BigDecimal::from(rhs)) + } + } + + impl std::ops::Sub for $name { + type Output = Self; + fn sub(self, rhs: u64) -> Self::Output { + $name(self.0 - bigdecimal::BigDecimal::from(rhs)) + } + } + + impl std::ops::AddAssign for $name { + fn add_assign(&mut self, rhs: Self) { + self.0 += rhs.0; + } + } + + impl std::ops::SubAssign for $name { + fn sub_assign(&mut self, rhs: Self) { + self.0 -= rhs.0; + } + } + + impl std::ops::AddAssign for $name { + fn add_assign(&mut self, rhs: u64) { + self.0 += bigdecimal::BigDecimal::from(rhs); + } + } + + impl std::ops::SubAssign for $name { + fn sub_assign(&mut self, rhs: u64) { + self.0 -= bigdecimal::BigDecimal::from(rhs); + } + } + + impl std::ops::Mul for $name { + type Output = Self; + fn mul(self, rhs: Self) -> Self::Output { + $name(self.0 * rhs.0) + } + } + + impl std::ops::Div for $name { + type Output = Self; + fn div(self, rhs: Self) -> Self::Output { + $name(self.0 / rhs.0) + } + } + + impl std::ops::Mul for $name { + type Output = Self; + fn mul(self, rhs: u64) -> Self::Output { + $name(self.0 * bigdecimal::BigDecimal::from(rhs)) + } + } + + impl std::ops::Div for $name { + type Output = Self; + fn div(self, rhs: u64) -> Self::Output { + $name(self.0 / bigdecimal::BigDecimal::from(rhs)) + } + } + + impl std::ops::MulAssign for $name { + fn mul_assign(&mut self, rhs: Self) { + self.0 *= rhs.0; + } + } + + impl std::ops::DivAssign for $name { + fn div_assign(&mut self, rhs: Self) { + self.0 = &self.0 / rhs.0; + } + } + + impl std::ops::MulAssign for $name { + fn mul_assign(&mut self, rhs: u64) { + self.0 *= bigdecimal::BigDecimal::from(rhs); + } + } + + impl std::ops::DivAssign for $name { + fn div_assign(&mut self, rhs: u64) { + self.0 = &self.0 / bigdecimal::BigDecimal::from(rhs); + } + } + }; +} + +make_numeric_type!(MarketId); +make_numeric_type!(OrderId); +make_numeric_type!(TxnVersion); +make_numeric_type!(EventId); +make_numeric_type!(Lot); +make_numeric_type!(Tick); +make_numeric_type!(BaseSubunit); +make_numeric_type!(QuoteSubunit); +make_numeric_type!(Price); + +#[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Clone)] +pub struct BlockchainTimestamp(TxnVersion, EventId); + +impl Display for BlockchainTimestamp { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}({})", self.0, self.1) + } +} + +impl std::fmt::Debug for BlockchainTimestamp { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{:?}({:?})", self.0, self.1) + } +} + +impl BlockchainTimestamp { + pub fn from_raw_parts(transaction_version: impl Into, event_id: impl Into) -> Self { + BlockchainTimestamp(transaction_version.into(), event_id.into()) + } + + pub fn from_transaction_version(transaction_version: TxnVersion) -> Self { + BlockchainTimestamp(transaction_version, EventId::new(0)) + } + + pub fn bump_version(&mut self) { + self.0 += 1; + self.1 = EventId::new(0); + } + + pub fn bump_event(&mut self) { + self.1 += 1; + } + + pub fn get_transaction_version(&self) -> &TxnVersion { + &self.0 + } + + pub fn get_event_id(&self) -> &EventId { + &self.1 + } +} + +impl std::ops::Mul for Lot { + type Output = Tick; + fn mul(self, rhs: Price) -> Self::Output { + Tick(self.0 * rhs.0) + } +} + +impl std::ops::Mul<&Price> for &Lot { + type Output = Tick; + fn mul(self, rhs: &Price) -> Self::Output { + Tick(&self.0 * &rhs.0) + } +} + +impl std::ops::Div for Tick { + type Output = Lot; + fn div(self, rhs: Price) -> Self::Output { + Lot(self.0 / rhs.0) + } +} + +impl std::ops::Div<&Price> for &Tick { + type Output = Lot; + fn div(self, rhs: &Price) -> Self::Output { + Lot(&self.0 / &rhs.0) + } +} + +impl Tick { + pub fn to_subunits(self, tick_size: impl Into) -> QuoteSubunit { + QuoteSubunit(self.0 * tick_size.into()) + } +} + +impl Lot { + pub fn to_subunits(self, lot_size: impl Into) -> BaseSubunit { + BaseSubunit(self.0 * lot_size.into()) + } +} + diff --git a/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/down.sql b/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/down.sql new file mode 100644 index 00000000..1d8e2315 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/down.sql @@ -0,0 +1,3 @@ +-- This file should undo anything in `up.sql` +ALTER TABLE aggregator.daily_rolling_volume_history DROP CONSTRAINT daily_rolling_volume_history_pkey; +ALTER TABLE aggregator.spreads DROP CONSTRAINT spreads_pkey; diff --git a/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql b/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql new file mode 100644 index 00000000..a2b79518 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql @@ -0,0 +1,3 @@ +-- Your SQL goes here +ALTER TABLE aggregator.daily_rolling_volume_history ADD PRIMARY KEY ("time", market_id); +ALTER TABLE aggregator.spreads ADD PRIMARY KEY ("time", market_id); diff --git a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql new file mode 100644 index 00000000..672eb979 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql @@ -0,0 +1,10 @@ +-- This file should undo anything in `up.sql` +DROP TABLE aggv2.order_cache; +DROP TABLE aggv2.account_cache; +DROP TABLE aggv2.market_cache; +DROP TABLE aggv2.state_cache; +DROP TABLE aggv2.spread; +DROP TABLE aggv2.volume; +DROP TABLE aggv2.liquidity; + +DROP SCHEMA aggv2; diff --git a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql new file mode 100644 index 00000000..acc897ed --- /dev/null +++ b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql @@ -0,0 +1,61 @@ +-- Your SQL goes here +CREATE SCHEMA aggv2; + +CREATE TABLE aggv2.order_cache ( + market_id NUMERIC NOT NULL, + is_ask BOOLEAN NOT NULL, + order_id NUMERIC NOT NULL, + last_changed_transaction_version NUMERIC NOT NULL, + last_changed_event_id NUMERIC NOT NULL, + "user" TEXT NOT NULL, + custodian_id NUMERIC NOT NULL, + integrator TEXT NOT NULL, + price NUMERIC NOT NULL, + size NUMERIC NOT NULL, + PRIMARY KEY (market_id, order_id) +); + +CREATE TABLE aggv2.account_cache ( + market_id NUMERIC NOT NULL, + "user" TEXT NOT NULL, + base NUMERIC NOT NULL, + quote NUMERIC NOT NULL, + PRIMARY KEY (market_id, "user") +); + +CREATE TABLE aggv2.market_cache ( + market_id NUMERIC NOT NULL, + last_price NUMERIC, + PRIMARY KEY (market_id) +); + +CREATE TABLE aggv2.state_cache ( + time TIMESTAMPTZ NOT NULL, + transaction_version NUMERIC NOT NULL, + PRIMARY KEY (time, transaction_version) +); + +CREATE TABLE aggv2.spread ( + time TIMESTAMPTZ NOT NULL, + market_id NUMERIC NOT NULL, + min_ask NUMERIC, + max_bid NUMERIC, + PRIMARY KEY (time, market_id) +); + +CREATE TABLE aggv2.volume ( + time TIMESTAMPTZ NOT NULL, + market_id NUMERIC NOT NULL, + cumulative NUMERIC NOT NULL, + period NUMERIC NOT NULL, + PRIMARY KEY (time, market_id) +); + +CREATE TABLE aggv2.liquidity ( + time TIMESTAMPTZ NOT NULL, + market_id NUMERIC NOT NULL, + base NUMERIC NOT NULL, + quote NUMERIC NOT NULL, + bps_times_ten INT NOT NULL, + PRIMARY KEY (time, market_id, bps_times_ten) +); From e336c5153904749c958b4bed4890622a9baf84a6 Mon Sep 17 00:00:00 2001 From: alnoki <43892045+alnoki@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:57:41 -0700 Subject: [PATCH 02/37] Include upstream incorporation in DSS changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index ac1d0392..517b52a9 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -28,6 +28,10 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- - More details in aggregator logging ([#738]). - Default support for the `all` liquidity group on all markets ([#728]). +### Changed + +- Fork base, to include upstream processor changes ([#725], [#744], [Processor #24]). + ### Fixed - `/tickers` endpoint `base_volume_nominal` and `quote_volume_nominal` fields ([#746], [#749]). @@ -215,6 +219,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#719]: https://github.com/econia-labs/econia/pull/719 [#720]: https://github.com/econia-labs/econia/pull/720 [#723]: https://github.com/econia-labs/econia/pull/723 +[#725]: https://github.com/econia-labs/econia/pull/725 [#727]: https://github.com/econia-labs/econia/pull/727 [#728]: https://github.com/econia-labs/econia/pull/728 [#729]: https://github.com/econia-labs/econia/pull/729 @@ -222,6 +227,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#732]: https://github.com/econia-labs/econia/pull/732 [#736]: https://github.com/econia-labs/econia/pull/736 [#738]: https://github.com/econia-labs/econia/pull/738 +[#744]: https://github.com/econia-labs/econia/pull/744 [#746]: https://github.com/econia-labs/econia/pull/746 [#749]: https://github.com/econia-labs/econia/pull/749 [#753]: https://github.com/econia-labs/econia/pull/753 @@ -232,6 +238,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [processor #21]: https://github.com/econia-labs/aptos-indexer-processors/pull/21 [processor #22]: https://github.com/econia-labs/aptos-indexer-processors/pull/22 [processor #23]: https://github.com/econia-labs/aptos-indexer-processors/pull/23 +[processor #24]: https://github.com/econia-labs/aptos-indexer-processors/pull/24 [processor #25]: https://github.com/econia-labs/aptos-indexer-processors/pull/25 [processor submodule]: https://github.com/econia-labs/aptos-indexer-processors/pulls?q=is%3Aclosed [v1.3.0]: https://github.com/econia-labs/econia/releases/tag/dss-v1.3.0 From ce24cfd6a399391e34e1d20d7489bbc304a1ab4d Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 24 Apr 2024 13:04:52 +0200 Subject: [PATCH 03/37] update aggv2 --- src/rust/.cargo/config.toml | 5 +- src/rust/Cargo.lock | 70 +- src/rust/Cargo.toml | 2 +- src/rust/aggv2/src/feed.rs | 961 +++++++++++------- src/rust/aggv2/src/feed/state.rs | 69 +- src/rust/aggv2/src/feed/volume.rs | 6 +- src/rust/aggv2/src/main.rs | 56 +- src/rust/aggv2/src/numeric.rs | 28 +- .../migrations/2024-04-09-142800_aggv2/up.sql | 8 + 9 files changed, 719 insertions(+), 486 deletions(-) diff --git a/src/rust/.cargo/config.toml b/src/rust/.cargo/config.toml index a1ffc0e3..bff29e6e 100644 --- a/src/rust/.cargo/config.toml +++ b/src/rust/.cargo/config.toml @@ -1,3 +1,2 @@ -[target.x86_64-unknown-linux-gnu] -rustflags = ["-C", "link-arg=-fuse-ld=lld"] - +[build] +rustflags = ["--cfg", "tokio_unstable"] diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 23d95c7c..bd6230ee 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -1999,9 +1999,9 @@ checksum = "18758054972164c3264f7c8386f5fc6da6114cb46b619fd365d4e3b2dc3ae487" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -2009,7 +2009,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -8625,6 +8625,22 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -8637,6 +8653,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -8649,6 +8671,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -8661,6 +8689,18 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -8673,6 +8713,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -8685,6 +8731,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -8697,6 +8749,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -8709,6 +8767,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + [[package]] name = "winnow" version = "0.5.15" diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index b03e64d4..52010f25 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -35,7 +35,7 @@ backtrace = "0.3.58" base64 = "0.13.0" bcs = { git = "https://github.com/aptos-labs/bcs.git", rev = "d31fab9d81748e2594be5cd5cdf845786a30562d" } bigdecimal = { version = "0.4", features = ["serde"] } -chrono = { version = "0.4.26", features = ["clock", "serde"] } +chrono = { version = "0.4", features = ["clock", "serde"] } clap = { version = "4.3.5", features = ["derive", "unstable-styles"] } diesel = { version = "2.1.0", features = [ "chrono", diff --git a/src/rust/aggv2/src/feed.rs b/src/rust/aggv2/src/feed.rs index 1434e635..5b14590e 100644 --- a/src/rust/aggv2/src/feed.rs +++ b/src/rust/aggv2/src/feed.rs @@ -1,26 +1,27 @@ -use std::{time::Duration, sync::Arc}; +use std::{collections::BTreeMap, sync::Arc, time::Duration}; -use crate::{BlockchainTimestamp, Event, numeric::*, Direction}; +use crate::{numeric::*, Direction, Event}; mod liquidity; mod spread; mod state; mod volume; -use chrono::{DateTime, Utc}; +use chrono::{DateTime, DurationRound, Utc}; use spread::Spread; use sqlx::{Executor, Transaction}; -use sqlx_postgres::{PgPool, PgPoolOptions, PgConnection, Postgres}; +use sqlx_postgres::{PgPool, PgPoolOptions, Postgres}; use state::ContractState; -use tracing::{span, Level, instrument, Instrument}; +use tokio::{sync::RwLock, try_join}; +use tracing::instrument; use self::{liquidity::Liquidity, volume::Volume}; -const INTERVAL: std::time::Duration = std::time::Duration::from_secs(1); +const INTERVAL: chrono::Duration = chrono::Duration::seconds(1); pub trait FeedFromEventsAndPrevState { async fn get_prev_state(pool: &PgPool) -> Self; - fn update(&mut self, events: &Vec); + fn update<'a>(&mut self, events: impl Iterator); } pub trait FeedFromEvents { @@ -36,303 +37,370 @@ pub trait InsertableFeed { async fn save<'a>(&self, timestamp: DateTime, transaction: &mut Transaction<'a, Postgres>); } -pub async fn get_max_timestamp<'a>(transaction: &mut Transaction<'a, Postgres>) -> Option> { - let max_limit = - sqlx::query!(r#"SELECT "time" FROM place_limit_order_events ORDER BY "time" DESC LIMIT 1"#) - .fetch_optional(transaction as &mut PgConnection) +pub async fn get_next_start_timestamp( + last_start_timestamp: &DateTime, + event_cache: &Arc, Event>>>, +) -> Option> { + event_cache + .read() + .await + .range(*last_start_timestamp + INTERVAL..) + .next() + .map(|e| e.0.duration_trunc(INTERVAL).unwrap()) +} + +pub async fn fill_cache( + amount_of_events: i64, + pool: &PgPool, + event_cache: &Arc, Event>>>, +) { + tracing::trace!("Adding {} events to cache.", amount_of_events); + let start_timestamp = { + event_cache + .read() .await - .unwrap() - .map(|o| o.time); - let max_market = sqlx::query!( - r#"SELECT "time" FROM place_market_order_events ORDER BY "time" DESC LIMIT 1"# - ) - .fetch_optional(transaction as &mut PgConnection) - .await - .unwrap() - .map(|o| o.time); - let max_swap = sqlx::query!( - r#"SELECT "time" FROM place_market_order_events ORDER BY "time" DESC LIMIT 1"# - ) - .fetch_optional(transaction as &mut PgConnection) - .await - .unwrap() - .map(|o| o.time); - let max_fill = sqlx::query!( - r#"SELECT "time" FROM place_market_order_events ORDER BY "time" DESC LIMIT 1"# - ) - .fetch_optional(transaction as &mut PgConnection) - .await - .unwrap() - .map(|o| o.time); - let max_market_reg = sqlx::query!( - r#"SELECT "time" FROM place_market_order_events ORDER BY "time" DESC LIMIT 1"# + .last_key_value() + .map(|e| e.0.clone()) + .unwrap_or(DateTime::UNIX_EPOCH) + }; + let mut new_event_cache = BTreeMap::new(); + let limit = sqlx::query!( + r#"SELECT "time" FROM events WHERE "time" > $1 ORDER BY "time" offset $2 limit 1"#, + start_timestamp, + amount_of_events - 1 ) - .fetch_optional(transaction as &mut PgConnection) + .fetch_optional(pool) .await .unwrap() - .map(|o| o.time); - max_limit - .max(max_market) - .max(max_swap) - .max(max_fill) - .max(max_market_reg) -} - -pub async fn get_event_batch<'a>( - start_blockchain_timestamp: &BlockchainTimestamp, - max_timestamp: &DateTime, - _amount_of_events: i64, - transaction: &mut Transaction<'a, Postgres>, -) -> Vec { - let mut events: Vec = vec![]; + .map(|e| e.time); + let limit = if let Some(limit) = limit { + limit + } else { + return; + }; let place_limit = sqlx::query!( - r#"SELECT * FROM place_limit_order_events WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM place_limit_order_events WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::PlaceLimitOrder { - txn_version: TxnVersion::new(r.txn_version), - event_idx: EventId::new(r.event_idx), - time: r.time, - market_id: MarketId::new(r.market_id), - user: r.user, - custodian_id: r.custodian_id, - order_id: OrderId::new(r.order_id), - side: if r.side {Direction::Ask} else {Direction::Bid}, - integrator: r.integrator, - initial_size: Lot::new(r.initial_size), - price: Price::new(r.price), - restriction: r.restriction, - self_match_behavior: r.self_match_behavior, - size: Lot::new(r.size), - }); - events.extend(place_limit); + .fetch_all(pool); let place_market = sqlx::query!( - r#"SELECT * FROM place_market_order_events WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM place_market_order_events WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::PlaceMarketOrder { - txn_version: TxnVersion::new(r.txn_version), - event_idx: EventId::new(r.event_idx), - time: r.time, - market_id: MarketId::new(r.market_id), - user: r.user, - custodian_id: r.custodian_id, - order_id: OrderId::new(r.order_id), - integrator: r.integrator, - self_match_behavior: r.self_match_behavior, - size: Lot::new(r.size), - direction: if r.direction {Direction::Ask} else {Direction::Bid}, - }); - events.extend(place_market); + .fetch_all(pool); let place_swap = sqlx::query!( - r#"SELECT * FROM place_swap_order_events WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM place_swap_order_events WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::PlaceSwapOrder { - txn_version: TxnVersion::new(r.txn_version), - event_idx: EventId::new(r.event_idx), - time: r.time, - market_id: MarketId::new(r.market_id), - order_id: OrderId::new(r.order_id), - integrator: r.integrator, - direction: if r.direction {Direction::Ask} else {Direction::Bid}, - signing_account: r.signing_account, - min_base: r.min_base, - max_base: r.max_base, - min_quote: r.min_quote, - max_quote: r.max_quote, - limit_price: Price::new(r.limit_price), - }); - events.extend(place_swap); + .fetch_all(pool); let cancels = sqlx::query!( - r#"SELECT * FROM cancel_order_events WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM cancel_order_events WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::Cancel { - txn_version: TxnVersion::new(r.txn_version), - event_idx: EventId::new(r.event_idx), - time: r.time, - market_id: MarketId::new(r.market_id), - user: r.user, - custodian_id: r.custodian_id, - order_id: OrderId::new(r.order_id), - reason: r.reason, - }); - events.extend(cancels); + .fetch_all(pool); let changes = sqlx::query!( - r#"SELECT * FROM change_order_size_events WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM change_order_size_events WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::ChangeSize { - txn_version: TxnVersion::new(r.txn_version), - event_idx: EventId::new(r.event_idx), - time: r.time, - market_id: MarketId::new(r.market_id), - user: r.user, - custodian_id: r.custodian_id, - order_id: OrderId::new(r.order_id), - side: if r.side {Direction::Ask} else {Direction::Bid}, - new_size: Lot::new(r.new_size), - }); - events.extend(changes); + .fetch_all(pool); let fills = sqlx::query!( - r#"SELECT * FROM fill_events WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM fill_events WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::Fill { - txn_version: TxnVersion::new(r.txn_version), - event_idx: EventId::new(r.event_idx), - time: r.time, - market_id: MarketId::new(r.market_id), - emit_address: r.emit_address, - maker_address: r.maker_address, - maker_custodian_id: r.maker_custodian_id, - maker_order_id: OrderId::new(r.maker_order_id), - maker_side: if r.maker_side {Direction::Ask} else {Direction::Bid}, - price: Price::new(r.price), - sequence_number_for_trade: r.sequence_number_for_trade, - size: Lot::new(r.size), - taker_address: r.taker_address, - taker_custodian_id: r.taker_custodian_id, - taker_order_id: OrderId::new(r.taker_order_id), - taker_quote_fees_paid: r.taker_quote_fees_paid, - }); - events.extend(fills); + .fetch_all(pool); let market_registrations = sqlx::query!( - r#"SELECT * FROM market_registration_events WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM market_registration_events WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::MarketRegistration { - txn_version: TxnVersion::new(r.txn_version), - event_idx: EventId::new(r.event_idx), - time: r.time, - market_id: MarketId::new(r.market_id), - base_account_address: r.base_account_address, - base_module_name: r.base_module_name, - base_struct_name: r.base_struct_name, - base_name_generic: r.base_name_generic, - quote_account_address: r.quote_account_address, - quote_module_name: r.quote_module_name, - quote_struct_name: r.quote_struct_name, - lot_size: r.lot_size, - tick_size: r.tick_size, - min_size: Lot::new(r.min_size), - underwriter_id: r.underwriter_id, - }); - events.extend(market_registrations); + .fetch_all(pool); let balance_update_by_handle = sqlx::query!( - r#"SELECT * FROM balance_updates_by_handle WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM balance_updates_by_handle WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::BalanceUpdatesByHandle { - txn_version: TxnVersion::new(r.txn_version), - time: r.time, - market_id: MarketId::new(r.market_id), - custodian_id: r.custodian_id, - base_total: BaseSubunit::new(r.base_total), - base_available: BaseSubunit::new(r.base_available), - base_ceiling: BaseSubunit::new(r.base_ceiling), - quote_total: QuoteSubunit::new(r.quote_total), - quote_available: QuoteSubunit::new(r.quote_available), - quote_ceiling: QuoteSubunit::new(r.quote_ceiling), - }); - events.extend(balance_update_by_handle); + .fetch_all(pool); let recognized_markets = sqlx::query!( - r#"SELECT * FROM recognized_market_events WHERE txn_version >= $1 AND "time" < $2"#, - start_blockchain_timestamp - .get_transaction_version() - .clone() - .inner(), - max_timestamp + r#"SELECT * FROM recognized_market_events WHERE "time" > $1 AND "time" <= $2"#, + start_timestamp, + limit, ) - .fetch_all(transaction as &mut PgConnection) - .await - .unwrap() - .into_iter() - .map(|r| Event::MarketRegistration { - txn_version: TxnVersion::new(r.txn_version), - event_idx: EventId::new(r.event_idx), - time: r.time, - market_id: MarketId::new(r.market_id.unwrap()), - base_account_address: r.base_account_address, - base_module_name: r.base_module_name, - base_struct_name: r.base_struct_name, - base_name_generic: r.base_name_generic, - quote_account_address: r.quote_account_address, - quote_module_name: r.quote_module_name, - quote_struct_name: r.quote_struct_name, - lot_size: r.lot_size.unwrap(), - tick_size: r.tick_size.unwrap(), - min_size: Lot::new(r.min_size.unwrap()), - underwriter_id: r.underwriter_id.unwrap(), + .fetch_all(pool); + let ( + place_limit, + place_market, + place_swap, + cancels, + changes, + fills, + market_registrations, + balance_update_by_handle, + recognized_markets, + ) = try_join!( + place_limit, + place_market, + place_swap, + cancels, + changes, + fills, + market_registrations, + balance_update_by_handle, + recognized_markets + ) + .unwrap(); + + let place_limit = place_limit.into_iter().map(|r| { + ( + r.time.clone(), + Event::PlaceLimitOrder { + txn_version: TransactionVersion::new(r.txn_version), + event_idx: EventIndex::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + user: r.user, + custodian_id: r.custodian_id, + order_id: OrderId::new(r.order_id), + side: if r.side { + Direction::Ask + } else { + Direction::Bid + }, + integrator: r.integrator, + initial_size: Lot::new(r.initial_size), + price: Price::new(r.price), + restriction: r.restriction, + self_match_behavior: r.self_match_behavior, + size: Lot::new(r.size), + }, + ) + }); + new_event_cache.extend(place_limit); + let place_market = place_market.into_iter().map(|r| { + ( + r.time.clone(), + Event::PlaceMarketOrder { + txn_version: TransactionVersion::new(r.txn_version), + event_idx: EventIndex::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + user: r.user, + custodian_id: r.custodian_id, + order_id: OrderId::new(r.order_id), + integrator: r.integrator, + self_match_behavior: r.self_match_behavior, + size: Lot::new(r.size), + direction: if r.direction { + Direction::Ask + } else { + Direction::Bid + }, + }, + ) }); - events.extend(recognized_markets); - events.sort_unstable_by_key(|e| e.blockchain_timestamp()); - events + new_event_cache.extend(place_market); + let place_swap = place_swap.into_iter().map(|r| { + ( + r.time.clone(), + Event::PlaceSwapOrder { + txn_version: TransactionVersion::new(r.txn_version), + event_idx: EventIndex::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + order_id: OrderId::new(r.order_id), + integrator: r.integrator, + direction: if r.direction { + Direction::Ask + } else { + Direction::Bid + }, + signing_account: r.signing_account, + min_base: r.min_base, + max_base: r.max_base, + min_quote: r.min_quote, + max_quote: r.max_quote, + limit_price: Price::new(r.limit_price), + }, + ) + }); + new_event_cache.extend(place_swap); + let cancels = cancels.into_iter().map(|r| { + ( + r.time.clone(), + Event::Cancel { + txn_version: TransactionVersion::new(r.txn_version), + event_idx: EventIndex::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + user: r.user, + custodian_id: r.custodian_id, + order_id: OrderId::new(r.order_id), + reason: r.reason, + }, + ) + }); + new_event_cache.extend(cancels); + let changes = changes.into_iter().map(|r| { + ( + r.time.clone(), + Event::ChangeSize { + txn_version: TransactionVersion::new(r.txn_version), + event_idx: EventIndex::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + user: r.user, + custodian_id: r.custodian_id, + order_id: OrderId::new(r.order_id), + side: if r.side { + Direction::Ask + } else { + Direction::Bid + }, + new_size: Lot::new(r.new_size), + }, + ) + }); + new_event_cache.extend(changes); + let fills = fills.into_iter().map(|r| { + ( + r.time.clone(), + Event::Fill { + txn_version: TransactionVersion::new(r.txn_version), + event_idx: EventIndex::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + emit_address: r.emit_address, + maker_address: r.maker_address, + maker_custodian_id: r.maker_custodian_id, + maker_order_id: OrderId::new(r.maker_order_id), + maker_side: if r.maker_side { + Direction::Ask + } else { + Direction::Bid + }, + price: Price::new(r.price), + sequence_number_for_trade: r.sequence_number_for_trade, + size: Lot::new(r.size), + taker_address: r.taker_address, + taker_custodian_id: r.taker_custodian_id, + taker_order_id: OrderId::new(r.taker_order_id), + taker_quote_fees_paid: r.taker_quote_fees_paid, + }, + ) + }); + new_event_cache.extend(fills); + let market_registrations = market_registrations.into_iter().map(|r| { + ( + r.time.clone(), + Event::MarketRegistration { + txn_version: TransactionVersion::new(r.txn_version), + event_idx: EventIndex::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id), + base_account_address: r.base_account_address, + base_module_name: r.base_module_name, + base_struct_name: r.base_struct_name, + base_name_generic: r.base_name_generic, + quote_account_address: r.quote_account_address, + quote_module_name: r.quote_module_name, + quote_struct_name: r.quote_struct_name, + lot_size: r.lot_size, + tick_size: r.tick_size, + min_size: Lot::new(r.min_size), + underwriter_id: r.underwriter_id, + }, + ) + }); + new_event_cache.extend(market_registrations); + let balance_update_by_handle = balance_update_by_handle.into_iter().map(|r| { + ( + r.time.clone(), + Event::BalanceUpdatesByHandle { + txn_version: TransactionVersion::new(r.txn_version), + time: r.time, + market_id: MarketId::new(r.market_id), + custodian_id: r.custodian_id, + base_total: BaseSubunit::new(r.base_total), + base_available: BaseSubunit::new(r.base_available), + base_ceiling: BaseSubunit::new(r.base_ceiling), + quote_total: QuoteSubunit::new(r.quote_total), + quote_available: QuoteSubunit::new(r.quote_available), + quote_ceiling: QuoteSubunit::new(r.quote_ceiling), + }, + ) + }); + new_event_cache.extend(balance_update_by_handle); + let recognized_markets = recognized_markets.into_iter().map(|r| { + ( + r.time.clone(), + Event::MarketRegistration { + txn_version: TransactionVersion::new(r.txn_version), + event_idx: EventIndex::new(r.event_idx), + time: r.time, + market_id: MarketId::new(r.market_id.unwrap()), + base_account_address: r.base_account_address, + base_module_name: r.base_module_name, + base_struct_name: r.base_struct_name, + base_name_generic: r.base_name_generic, + quote_account_address: r.quote_account_address, + quote_module_name: r.quote_module_name, + quote_struct_name: r.quote_struct_name, + lot_size: r.lot_size.unwrap(), + tick_size: r.tick_size.unwrap(), + min_size: Lot::new(r.min_size.unwrap()), + underwriter_id: r.underwriter_id.unwrap(), + }, + ) + }); + new_event_cache.extend(recognized_markets); + let mut event_cache = event_cache.write().await; + event_cache.append(&mut new_event_cache); +} + +pub async fn get_event_batch<'a>( + start_timestamp: &DateTime, + event_cache: &'a Arc, Event>>>, +) -> BTreeMap, Event> { + tracing::trace!("Getting event batch."); + loop { + let last_value = { + event_cache + .read() + .await + .last_key_value() + .map(|e| (e.0.clone(), e.1.clone())) + }; + match last_value { + Some((datetime, _)) if datetime >= *start_timestamp + INTERVAL => { + break; + } + _ => { + tokio::time::sleep(Duration::from_millis(100)).await; + } + } + } + let mut ecw = event_cache.write().await; + let mut end = ecw.split_off(&(*start_timestamp + INTERVAL)); + std::mem::swap(&mut *ecw, &mut end); + end +} + +struct Cache { + state_insert_cache: Box>, + spread_insert_cache: Box, Spread)>>, + volume_insert_cache: Box, Volume)>>, + liquidity_insert_cache: Box, Liquidity)>>, +} + +struct AggregatorState { + current_timestamp: DateTime, + events: usize, + cached_events: usize, } #[instrument] @@ -355,118 +423,253 @@ pub async fn run() -> anyhow::Result<()> { // Init feeds with state tracing::info!("Loading feeds."); let mut state = ContractState::get_prev_state(&pool).await; - let mut volume = Volume::get_prev_state(&pool).await; + let volume = Volume::get_prev_state(&pool).await; tracing::info!("Done loading feeds."); - let mut max_timestamp = state.timestamp + INTERVAL; - let mut start_blockchain_timestamp = - BlockchainTimestamp::from_transaction_version(state.transaction_version.clone()); - start_blockchain_timestamp.bump_version(); + state.update_timestamp(state.timestamp + INTERVAL); tracing::info!( from_timestamp = state.timestamp.to_string(), - form_blockchain_timestamp = start_blockchain_timestamp.to_string(), "Start aggregating." ); + let cache = Arc::new(RwLock::new(Cache { + state_insert_cache: Default::default(), + spread_insert_cache: Default::default(), + volume_insert_cache: Default::default(), + liquidity_insert_cache: Default::default(), + })); + + let event_cache = Arc::new(RwLock::new(BTreeMap::new())); + let agg_state = Arc::new(RwLock::new(AggregatorState { + current_timestamp: state.timestamp.clone(), + events: 0, + cached_events: 0, + })); + + let agg_loop = tokio::spawn(aggregator( + state, + volume, + cache.clone(), + event_cache.clone(), + agg_state.clone(), + )); + let insert_loop = tokio::spawn(inserter(pool.clone(), cache.clone())); + let cache_manager = tokio::spawn(cache_manager( + pool.clone(), + event_cache.clone(), + agg_state.clone(), + )); + let logger = tokio::spawn(logger(agg_state)); + + let (res_agg, res_ins, res_cache_manager, res_logger) = + tokio::try_join!(agg_loop, insert_loop, cache_manager, logger)?; + + res_agg?; + res_ins?; + res_cache_manager?; + res_logger?; + + Ok(()) +} + +async fn logger(agg_state: Arc>) -> anyhow::Result<()> { loop { - let timestamp_string = (max_timestamp - INTERVAL).to_string(); - let blockchain_timestamp_string = start_blockchain_timestamp.to_string(); - (state, volume) = aggregator_loop(&pool, state, volume, &mut max_timestamp, &mut start_blockchain_timestamp).await?; + tokio::time::sleep(Duration::from_secs(1)).await; + let mut state = agg_state.write().await; + tracing::info!( + tps = state.events, + timestamp = state.current_timestamp.to_string(), + cached_events = state.cached_events, + ); + state.events = 0; } } -#[instrument(skip(pool, state, volume))] -async fn aggregator_loop(pool: &PgPool, mut state: ContractState, mut volume: Volume, max_timestamp: &mut DateTime, start_blockchain_timestamp: &mut BlockchainTimestamp) -> anyhow::Result<(ContractState, Volume)> { - tracing::trace!("Aggregator loop start."); +#[instrument(skip(pool, event_cache, agg_state))] +async fn cache_manager( + pool: PgPool, + event_cache: Arc, Event>>>, + agg_state: Arc>, +) -> anyhow::Result<()> { + loop { + tokio::time::sleep(Duration::from_millis(50)).await; + let remaining_events = event_cache.read().await.len(); + agg_state.write().await.cached_events = remaining_events; + if remaining_events < 500_000 { + fill_cache(100_000, &pool, &event_cache).await; + } + } +} - // Intro - let mut transaction = pool.begin().await?; - let t = if let Some(t) = get_max_timestamp(&mut transaction).await { - t - } else { - return Ok((state, volume)); - }; - if &t < max_timestamp { - tracing::debug!(max_db_timestamp = t.to_string(), "Max timestamp in DB is lower than required to run an aggregator loop."); - tokio::time::sleep(Duration::from_millis(100)).await; - return Ok((state, volume)); +#[instrument(skip(pool, cache))] +async fn inserter(pool: PgPool, cache: Arc>) -> anyhow::Result<()> { + let mut last_insert = Utc::now(); + loop { + if microseconds_elapsed(last_insert) > 50_000 { + let mut cache_write = cache.write().await; + if cache_write.volume_insert_cache.is_empty() + && cache_write.spread_insert_cache.is_empty() + && cache_write.liquidity_insert_cache.is_empty() + && cache_write.state_insert_cache.is_none() + { + continue; + } + tracing::trace!( + "Inserting {} cached data.", + cache_write.volume_insert_cache.len() + + cache_write.spread_insert_cache.len() + + cache_write.liquidity_insert_cache.len() + + if cache_write.state_insert_cache.is_some() { + 1 + } else { + 0 + } + ); + let volumes = { + let w = &mut cache_write.volume_insert_cache; + let mut empty = Box::new(vec![]); + if !w.is_empty() { + std::mem::swap(w, &mut empty); + } + empty + }; + let spreads = { + let w = &mut cache_write.spread_insert_cache; + let mut empty = Box::new(vec![]); + if !w.is_empty() { + std::mem::swap(w, &mut empty); + } + empty + }; + let liquidities = { + let w = &mut cache_write.liquidity_insert_cache; + let mut empty = Box::new(vec![]); + if !w.is_empty() { + std::mem::swap(w, &mut empty); + } + empty + }; + let state = { + let sicw = &mut cache_write.state_insert_cache; + let state = (*sicw).clone(); + state + }; + drop(cache_write); + last_insert = Utc::now(); + let mut transaction = pool.begin().await?; + for (timestamp, volume) in volumes.iter() { + volume.save(*timestamp, &mut transaction).await; + } + for (timestamp, spreads) in spreads.iter() { + spreads.save(*timestamp, &mut transaction).await; + } + for (timestamp, liquidity) in liquidities.iter() { + liquidity.save(*timestamp, &mut transaction).await; + } + if let Some(state) = *state { + state.save(state.timestamp, &mut transaction).await; + } + transaction.commit().await?; + } + tokio::time::sleep(Duration::from_millis(10)).await; } +} + +fn microseconds_elapsed(time: DateTime) -> i64 { + Utc::now() + .signed_duration_since(time) + .num_microseconds() + .unwrap() +} + +#[instrument(skip(state, volume, cache, event_cache, agg_state))] +async fn aggregator( + mut state: ContractState, + mut volume: Volume, + cache: Arc>, + event_cache: Arc, Event>>>, + agg_state: Arc>, +) -> anyhow::Result<()> { + loop { + loop { + if let Some(new_start_timestamp) = + get_next_start_timestamp(&state.timestamp, &event_cache).await + { + state.update_timestamp(new_start_timestamp); + { + agg_state.write().await.current_timestamp = new_start_timestamp; + } + break; + } + tokio::time::sleep(Duration::from_millis(50)).await; + } + + tracing::debug!( + start_timestamp = state.timestamp.to_string(), + "Running aggregator loop." + ); + + let time_total = Utc::now(); + + // Get events + tracing::trace!("Getting events."); + let time = Utc::now(); + let events = get_event_batch(&state.timestamp, &event_cache).await; + { + agg_state.write().await.events += events.len(); + } + tracing::trace!( + "Got {} events in {} microseconds.", + events.len(), + microseconds_elapsed(time) + ); + + // Run first layer + tracing::trace!("Start first layer."); + let time = Utc::now(); + + let events = events.iter().map(|e| e.1); + + state.update(events.clone()); + volume.update(events.clone()); + + tracing::trace!( + "Done first layer in {} microseconds.", + microseconds_elapsed(time) + ); + + // Run second layer + tracing::trace!("Start second layer."); + let time = Utc::now(); + + let spreads = Spread::from_feed(&state); + let liquidity = Liquidity::from_feed(&state); + + tracing::trace!( + "Done second layer in {} microseconds.", + microseconds_elapsed(time) + ); + + let state2 = state.clone(); + let volume2 = volume.clone(); + + let mut cache_write = cache.write().await; + + cache_write + .spread_insert_cache + .push((state2.timestamp.clone(), spreads)); + cache_write + .volume_insert_cache + .push((state2.timestamp.clone(), volume2)); + cache_write + .liquidity_insert_cache + .push((state2.timestamp.clone(), liquidity)); + cache_write.state_insert_cache = Box::new(Some(state2)); - // Get events - tracing::trace!("Getting events between start blockchain timestamp and max timestamp."); - let events = - get_event_batch(&start_blockchain_timestamp, max_timestamp, 100_000, &mut transaction).await; - tracing::debug!("Got {} events", events.len()); - if events.len() == 0 { - state.save(state.timestamp, &mut transaction).await; - transaction.commit().await?; - state.update_timestamp(max_timestamp.clone()); - *max_timestamp += INTERVAL; - return Ok((state, volume)); + tracing::trace!( + "Ran aggregator loop in {} microseconds.", + microseconds_elapsed(time_total) + ); } - *start_blockchain_timestamp = events.last().unwrap().blockchain_timestamp(); - - // Run first layer - tracing::trace!("Start first layer."); - let events = Arc::new(events); - let events2 = events.clone(); - - let state_handle = tokio::task::spawn_blocking(move || { - let events2 = events2.clone(); - tracing::trace!("Start calculating."); - state.update(&events2); - tracing::trace!("Done calculating."); - state - }).instrument(span!(Level::TRACE, "state")); - let events2 = events.clone(); - let volume_handle = tokio::task::spawn_blocking(move || { - let events2 = events2.clone(); - tracing::trace!("Start calculating."); - volume.update(&events2); - tracing::trace!("Done calculating."); - volume - }).instrument(span!(Level::TRACE, "volume")); - let (state_new, volume_new) = tokio::try_join!(state_handle, volume_handle)?; - volume = volume_new; - state = state_new; - tracing::trace!("Done first layer."); - - // Run second layer - tracing::trace!("Start second layer."); - let arc_state = Arc::new(state); - let arc_state2 = arc_state.clone(); - - let spreads_handle = tokio::task::spawn_blocking(move || { - tracing::trace!("Start calculating."); - let spreads = Spread::from_feed(&arc_state2); - tracing::trace!("Done calculating."); - spreads - }).instrument(span!(Level::TRACE, "spreads")); - let arc_state2 = arc_state.clone(); - let liquidity_handle = tokio::task::spawn_blocking(move || { - tracing::trace!("Start calculating."); - let liquidity = Liquidity::from_feed(&arc_state2); - tracing::trace!("Done calculating."); - liquidity - }).instrument(span!(Level::TRACE, "liquidity")); - let (spreads, liquidity) = tokio::try_join!(spreads_handle, liquidity_handle)?; - state = Arc::::into_inner(arc_state).unwrap(); - tracing::trace!("Done second layer."); - - // Save - tracing::trace!("Start saving."); - state.save(state.timestamp.clone(), &mut transaction).await; - volume.save(state.timestamp.clone(), &mut transaction).await; - spreads.save(state.timestamp.clone(), &mut transaction).await; - liquidity.save(state.timestamp.clone(), &mut transaction).await; - transaction.commit().await?; - tracing::trace!("Done saving."); - - // Outro - state.update_timestamp(max_timestamp.clone()); - *max_timestamp += INTERVAL; - start_blockchain_timestamp.bump_version(); - - Ok((state, volume)) } diff --git a/src/rust/aggv2/src/feed/state.rs b/src/rust/aggv2/src/feed/state.rs index 705fb92e..6a79ce1c 100644 --- a/src/rust/aggv2/src/feed/state.rs +++ b/src/rust/aggv2/src/feed/state.rs @@ -9,14 +9,13 @@ use crate::{Direction, Event, numeric::*}; use super::{FeedFromEventsAndPrevState, InsertableFeed}; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct ContractState { pub markets: HashMap, pub timestamp: DateTime, - pub transaction_version: TxnVersion, } -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct MarketState { pub asks: HashMap, pub bids: HashMap, @@ -32,7 +31,7 @@ pub struct Account { #[derive(Clone, Debug)] pub struct LimitOrder { - pub last_changed: BlockchainTimestamp, + pub last_changed: BlockStamp, pub user: String, pub custodian_id: BigDecimal, pub direction: Direction, @@ -75,7 +74,7 @@ impl FeedFromEventsAndPrevState for ContractState { for order_cache in orders_cache { let order = LimitOrder { - last_changed: BlockchainTimestamp::from_raw_parts(TxnVersion::new(order_cache.last_changed_transaction_version), EventId::new(order_cache.last_changed_event_id)), + last_changed: BlockStamp::from_raw_parts(TransactionVersion::new(order_cache.last_changed_transaction_version), EventIndex::new(order_cache.last_changed_event_id)), user: order_cache.user, custodian_id: order_cache.custodian_id, direction: if order_cache.is_ask { Direction::Ask } else { Direction::Bid }, @@ -93,56 +92,17 @@ impl FeedFromEventsAndPrevState for ContractState { ContractState { markets, timestamp: state_cache.time, - transaction_version: TxnVersion::new(state_cache.transaction_version), } } else { - let timestamp = sqlx::query!(r#" -WITH mins AS ( - SELECT MIN("time") AS "time" FROM balance_updates_by_handle UNION - SELECT MIN("time") AS "time" FROM cancel_order_events UNION - SELECT MIN("time") AS "time" FROM change_order_size_events UNION - SELECT MIN("time") AS "time" FROM fill_events UNION - SELECT MIN("time") AS "time" FROM market_registration_events UNION - SELECT MIN("time") AS "time" FROM place_limit_order_events UNION - SELECT MIN("time") AS "time" FROM place_market_order_events UNION - SELECT MIN("time") AS "time" FROM place_swap_order_events UNION - SELECT MIN("time") AS "time" FROM recognized_market_events -) -SELECT MIN("time") AS "time" FROM mins - "#).fetch_optional(pool) - .await - .unwrap() - .map(|r| r.time) - .flatten() - .unwrap_or(DateTime::UNIX_EPOCH); - let transaction_version = sqlx::query!(r#" -WITH mins AS ( - SELECT MIN(txn_version) AS txn_version FROM balance_updates_by_handle UNION - SELECT MIN(txn_version) AS txn_version FROM cancel_order_events UNION - SELECT MIN(txn_version) AS txn_version FROM change_order_size_events UNION - SELECT MIN(txn_version) AS txn_version FROM fill_events UNION - SELECT MIN(txn_version) AS txn_version FROM market_registration_events UNION - SELECT MIN(txn_version) AS txn_version FROM place_limit_order_events UNION - SELECT MIN(txn_version) AS txn_version FROM place_market_order_events UNION - SELECT MIN(txn_version) AS txn_version FROM place_swap_order_events UNION - SELECT MIN(txn_version) AS txn_version FROM recognized_market_events -) -SELECT MIN(txn_version) AS txn_version FROM mins - "#).fetch_optional(pool) - .await - .unwrap() - .map(|r| r.txn_version) - .flatten() - .unwrap_or(BigDecimal::from(0)); + let timestamp = DateTime::UNIX_EPOCH; ContractState { markets: Default::default(), timestamp, - transaction_version: TxnVersion::new(transaction_version), } } } - fn update(&mut self, events: &Vec) { + fn update<'a>(&mut self, events: impl Iterator) { for event in events { match event.clone() { Event::MarketRegistration { market_id, .. } => { @@ -174,7 +134,7 @@ SELECT MIN(txn_version) AS txn_version FROM mins market.asks.insert( OrderId::from(order_id), LimitOrder { - last_changed: BlockchainTimestamp::from_raw_parts(txn_version, event_idx), + last_changed: BlockStamp::from_raw_parts(txn_version, event_idx), user, custodian_id, direction: Direction::Ask, @@ -187,7 +147,7 @@ SELECT MIN(txn_version) AS txn_version FROM mins market.bids.insert( OrderId::from(order_id), LimitOrder { - last_changed: BlockchainTimestamp::from_raw_parts(txn_version, event_idx), + last_changed: BlockStamp::from_raw_parts(txn_version, event_idx), user, custodian_id, direction: Direction::Bid, @@ -259,7 +219,7 @@ SELECT MIN(txn_version) AS txn_version FROM mins if let Some(order) = order { order.size = new_size; order.last_changed = - BlockchainTimestamp::from_raw_parts(txn_version, event_idx); + BlockStamp::from_raw_parts(txn_version, event_idx); } } _ => {} @@ -275,9 +235,8 @@ impl InsertableFeed for ContractState { sqlx::query!("DELETE FROM aggv2.market_cache").execute(transaction as &mut PgConnection).await.unwrap(); sqlx::query!("DELETE FROM aggv2.order_cache").execute(transaction as &mut PgConnection).await.unwrap(); sqlx::query!( - "INSERT INTO aggv2.state_cache VALUES ($1, $2)", + "INSERT INTO aggv2.state_cache VALUES ($1)", self.timestamp, - self.transaction_version.clone().inner(), ).execute(transaction as &mut PgConnection).await.unwrap(); for (market_id, market) in &self.markets { sqlx::query!( @@ -292,8 +251,8 @@ impl InsertableFeed for ContractState { market_id.clone().inner(), true, order_id.clone().inner(), - order.last_changed.get_transaction_version().clone().inner(), - order.last_changed.get_event_id().clone().inner(), + order.last_changed.transaction_version().clone().inner(), + order.last_changed.event_index().clone().inner(), order.user, order.custodian_id, order.integrator, @@ -308,8 +267,8 @@ impl InsertableFeed for ContractState { market_id.clone().inner(), false, order_id.clone().inner(), - order.last_changed.get_transaction_version().clone().inner(), - order.last_changed.get_event_id().clone().inner(), + order.last_changed.transaction_version().clone().inner(), + order.last_changed.event_index().clone().inner(), order.user, order.custodian_id, order.integrator, diff --git a/src/rust/aggv2/src/feed/volume.rs b/src/rust/aggv2/src/feed/volume.rs index 038c3796..1c0ad265 100644 --- a/src/rust/aggv2/src/feed/volume.rs +++ b/src/rust/aggv2/src/feed/volume.rs @@ -8,7 +8,7 @@ use crate::{numeric::*, Event}; use super::{FeedFromEventsAndPrevState, InsertableFeed}; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct Volume { markets: HashMap, } @@ -20,11 +20,11 @@ pub struct MarketVolume { } impl FeedFromEventsAndPrevState for Volume { - fn update(&mut self, events: &Vec) { + fn update<'a>(&mut self, events: impl Iterator) { for prev_vol in self.markets.iter_mut() { prev_vol.1.period = Tick::new(0); } - for event in events.iter() { + for event in events { match event { Event::MarketRegistration { market_id, .. } => { self.markets.insert(MarketId::from(market_id.clone()), MarketVolume { diff --git a/src/rust/aggv2/src/main.rs b/src/rust/aggv2/src/main.rs index e614ac43..c1d9dc15 100644 --- a/src/rust/aggv2/src/main.rs +++ b/src/rust/aggv2/src/main.rs @@ -1,6 +1,6 @@ use bigdecimal::BigDecimal; use chrono::{Utc, DateTime}; -use numeric::{BlockchainTimestamp, OrderId, TxnVersion, EventId}; +use numeric::{BlockStamp, OrderId, TransactionVersion, EventIndex}; mod feed; mod numeric; @@ -10,7 +10,7 @@ use numeric::*; #[derive(Clone, Debug)] pub enum Event { BalanceUpdatesByHandle { - txn_version: TxnVersion, + txn_version: TransactionVersion, market_id: MarketId, custodian_id: BigDecimal, time: DateTime, @@ -22,8 +22,8 @@ pub enum Event { quote_ceiling: QuoteSubunit, }, MarketRegistration { - txn_version: TxnVersion, - event_idx: EventId, + txn_version: TransactionVersion, + event_idx: EventIndex, market_id: MarketId, time: DateTime, base_account_address: Option, @@ -39,8 +39,8 @@ pub enum Event { underwriter_id: BigDecimal, }, MarketRecognition { - txn_version: TxnVersion, - event_idx: EventId, + txn_version: TransactionVersion, + event_idx: EventIndex, market_id: MarketId, time: DateTime, base_account_address: Option, @@ -56,8 +56,8 @@ pub enum Event { underwriter_id: BigDecimal, }, PlaceLimitOrder { - txn_version: TxnVersion, - event_idx: EventId, + txn_version: TransactionVersion, + event_idx: EventIndex, time: DateTime, market_id: MarketId, user: String, @@ -72,8 +72,8 @@ pub enum Event { size: Lot, }, PlaceMarketOrder { - txn_version: TxnVersion, - event_idx: EventId, + txn_version: TransactionVersion, + event_idx: EventIndex, time: DateTime, market_id: MarketId, user: String, @@ -85,8 +85,8 @@ pub enum Event { size: Lot, }, PlaceSwapOrder { - txn_version: TxnVersion, - event_idx: EventId, + txn_version: TransactionVersion, + event_idx: EventIndex, time: DateTime, market_id: MarketId, order_id: OrderId, @@ -100,8 +100,8 @@ pub enum Event { limit_price: Price, }, Fill { - txn_version: TxnVersion, - event_idx: EventId, + txn_version: TransactionVersion, + event_idx: EventIndex, emit_address: String, time: DateTime, maker_address: String, @@ -118,8 +118,8 @@ pub enum Event { taker_quote_fees_paid: BigDecimal, }, Cancel { - txn_version: TxnVersion, - event_idx: EventId, + txn_version: TransactionVersion, + event_idx: EventIndex, time: DateTime, market_id: MarketId, user: String, @@ -128,8 +128,8 @@ pub enum Event { reason: i16, }, ChangeSize { - txn_version: TxnVersion, - event_idx: EventId, + txn_version: TransactionVersion, + event_idx: EventIndex, time: DateTime, market_id: MarketId, user: String, @@ -141,34 +141,34 @@ pub enum Event { } impl Event { - pub fn blockchain_timestamp(&self) -> BlockchainTimestamp { + pub fn blockstamp(&self) -> BlockStamp { match self.clone() { Event::MarketRegistration { txn_version, event_idx, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + BlockStamp::from_raw_parts(txn_version, event_idx) }, Event::PlaceLimitOrder { txn_version, event_idx, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + BlockStamp::from_raw_parts(txn_version, event_idx) }, Event::PlaceMarketOrder { txn_version, event_idx, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + BlockStamp::from_raw_parts(txn_version, event_idx) }, Event::PlaceSwapOrder { txn_version, event_idx, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + BlockStamp::from_raw_parts(txn_version, event_idx) }, Event::Fill { txn_version, event_idx, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + BlockStamp::from_raw_parts(txn_version, event_idx) }, Event::Cancel { txn_version, event_idx, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + BlockStamp::from_raw_parts(txn_version, event_idx) }, Event::ChangeSize { txn_version, event_idx, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + BlockStamp::from_raw_parts(txn_version, event_idx) }, Event::BalanceUpdatesByHandle { txn_version, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, EventId::new(0)) + BlockStamp::from_raw_parts(txn_version, EventIndex::new(0)) }, Event::MarketRecognition { txn_version, event_idx, .. } => { - BlockchainTimestamp::from_raw_parts(txn_version, event_idx) + BlockStamp::from_raw_parts(txn_version, event_idx) } } } diff --git a/src/rust/aggv2/src/numeric.rs b/src/rust/aggv2/src/numeric.rs index b89d1f45..7b800356 100644 --- a/src/rust/aggv2/src/numeric.rs +++ b/src/rust/aggv2/src/numeric.rs @@ -5,7 +5,7 @@ use bigdecimal::BigDecimal; macro_rules! make_numeric_type { ($name:ident) => { #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Clone)] - pub struct $name(BigDecimal); + pub struct $name(pub BigDecimal); impl std::fmt::Debug for $name { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -137,8 +137,8 @@ macro_rules! make_numeric_type { make_numeric_type!(MarketId); make_numeric_type!(OrderId); -make_numeric_type!(TxnVersion); -make_numeric_type!(EventId); +make_numeric_type!(TransactionVersion); +make_numeric_type!(EventIndex); make_numeric_type!(Lot); make_numeric_type!(Tick); make_numeric_type!(BaseSubunit); @@ -146,43 +146,43 @@ make_numeric_type!(QuoteSubunit); make_numeric_type!(Price); #[derive(Hash, PartialEq, Eq, PartialOrd, Ord, Clone)] -pub struct BlockchainTimestamp(TxnVersion, EventId); +pub struct BlockStamp(TransactionVersion, EventIndex); -impl Display for BlockchainTimestamp { +impl Display for BlockStamp { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}({})", self.0, self.1) } } -impl std::fmt::Debug for BlockchainTimestamp { +impl std::fmt::Debug for BlockStamp { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}({:?})", self.0, self.1) } } -impl BlockchainTimestamp { - pub fn from_raw_parts(transaction_version: impl Into, event_id: impl Into) -> Self { - BlockchainTimestamp(transaction_version.into(), event_id.into()) +impl BlockStamp { + pub fn from_raw_parts(transaction_version: impl Into, event_id: impl Into) -> Self { + BlockStamp(transaction_version.into(), event_id.into()) } - pub fn from_transaction_version(transaction_version: TxnVersion) -> Self { - BlockchainTimestamp(transaction_version, EventId::new(0)) + pub fn from_transaction_version(transaction_version: TransactionVersion) -> Self { + BlockStamp(transaction_version, EventIndex::new(0)) } pub fn bump_version(&mut self) { self.0 += 1; - self.1 = EventId::new(0); + self.1 = EventIndex::new(0); } pub fn bump_event(&mut self) { self.1 += 1; } - pub fn get_transaction_version(&self) -> &TxnVersion { + pub fn transaction_version(&self) -> &TransactionVersion { &self.0 } - pub fn get_event_id(&self) -> &EventId { + pub fn event_index(&self) -> &EventIndex { &self.1 } } diff --git a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql index acc897ed..8c3fc36d 100644 --- a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql +++ b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql @@ -59,3 +59,11 @@ CREATE TABLE aggv2.liquidity ( bps_times_ten INT NOT NULL, PRIMARY KEY (time, market_id, bps_times_ten) ); + +CREATE TABLE events ( + transaction_verson NUMERIC NOT NULL, + event_index NUMERIC NOT NULL, + "time" TIMESTAMPTZ NOT NULL, +); + +CREATE INDEX events_time ON events ("time"); From 676ba916113de14a6faa4c89fc14911b2b109fc1 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 26 Apr 2024 16:53:51 +0200 Subject: [PATCH 04/37] add aggv2 documentation --- src/rust/aggv2/README.md | 73 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/src/rust/aggv2/README.md b/src/rust/aggv2/README.md index ff318e61..b3ea470b 100644 --- a/src/rust/aggv2/README.md +++ b/src/rust/aggv2/README.md @@ -6,21 +6,80 @@ The new aggregator works using feeds. There are three types of feeds: -- ones that can generate a result from their previous value and the events that occurred since that previous value was generated -- ones that can generate a result from only events that occurred in a time period +- ones that can generate a result from their previous value and the events that + occurred since that previous value was generated +- ones that can generate a result from only events that occurred in a time + period - ones that can generate a result from another feed You can generate the result for the first two types in parallel. Once done, you can generate the result of the third type in parallel. There are some unit numeric types defined that wrap `BigDecimal`. -This avoids confusion (you can add lots and ticks together) and simplifies calculus (dividing a `Tick` value by a `Price` value outputs a `Lot`). +This avoids confusion (you can add lots and ticks together) and simplifies +calculus (dividing a `Tick` value by a `Price` value outputs a `Lot`). + +## In depth overview + +There are 3 main threads running (4 if you count the thread responsible for +logging statistics): + +- an aggregator thread +- an inserter thread +- a cache manager thread + +They each play a part in the aggregating process. + +### The cache manager + +There is a piece of shared state called the `event_cache`, which is just a +`BTreeMap` of events that have yet to be aggregated. That map is kept filled up +by the cache manager thread, that checks the length of the cache every X +milliseconds, and if a certain threshold is reached, a DB read will be +triggered and the cached will be filled with the result. Since one of the +current bottlenecks is DB reads, that means that right now, the cache is filled +constantly. The reason this is done in a separate thread is because reading +from the database is a slow process, and does not need to stop the processing +of already read events. + +### The aggregator thread + +The aggregator thread uses the events in `event_cache` to generate data, that +it then puts into the `insert_cache`. It will take all the events from +`truncate(events.first().timestamp, second)` to +`truncate(events.first().timestamp, second) + 1 second` that are in the +`event_cache` and generate the data for that interval. This means that if the +cache isn't filled fast enough, which currently happens for time to time, the +aggregating process will hang briefly while the cache is filled. Once said data is generated, it will be added to the `insert_cache`, which is a map from timestamps to data. The timestamp represents the time frame of the generated data. + +### The inserter thread + +The inserter thread will loop every X milliseconds, and insert everything that +is present in the `insert_cache` if nothing was inserted in the last Y +milliseconds. Since writing to the database is currently a bottleneck, this +means that the insert is triggered on every iteration of the loop. The reason this is done in a separate thread is because writing to the database is a slow process, and does not need so stop the aggregation process of other events. ## Findings -Tests and benchmarks have not been conducted yet. +- This implementation has a throughput of over 50k events per second +- The current bottleneck is reads and writes into PostreSQL +- The upcoming SDK will help alleviate some of the bottlenecks (reads) +- Consider insert optimizations or using something else than PostgreSQL to overcome write bottlenecks + +## Breaking changes + +This aggregator has a fundamental difference in how it operates compared to the +old aggregator. First of all, all data is timestamped and immutable (contract +state is an exception because of how big the database would get if it wasn't), +compared to the old one where some data is being updated (e.g. `user_history`). -Although some findings are already here: +It also does not rely on SQL processing. All the calculations are made in Rust. +This is not a breaking change itself, but that does mean that it does not rely +on SQL views like the previous aggregator. This has the upper side of vastly +improved performance, as nothing is calculated on request, but it has the +downside of being less space efficient and also more time consuming to +implement. -- This implementation is slower to backfill, as it will query events per 1 second batch, rather than bigger batches, although this can be optimized away. -- This implementation is very likely to have higher throughput, as it is more efficient than the other one. +For the preceding reasons, the aggv2 will not be replacing the old aggregator, +but this should be the way to go for the next generations of the Econia +protocol. From b336209dd543a6cb79b8f0636e0246358ea78848 Mon Sep 17 00:00:00 2001 From: alnoki <43892045+alnoki@users.noreply.github.com> Date: Fri, 26 Apr 2024 11:30:39 -0700 Subject: [PATCH 05/37] Flag that build is experimental --- src/rust/aggv2/README.md | 3 +++ src/rust/dependencies/aptos-indexer-processors | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rust/aggv2/README.md b/src/rust/aggv2/README.md index b3ea470b..080f74a4 100644 --- a/src/rust/aggv2/README.md +++ b/src/rust/aggv2/README.md @@ -1,5 +1,8 @@ # Aggregator v2 +This directory contains an experimental aggregator for the Econia Data Service +Stack. + ## Architecture The new aggregator works using feeds. diff --git a/src/rust/dependencies/aptos-indexer-processors b/src/rust/dependencies/aptos-indexer-processors index 2bf374f5..b9d43c9d 160000 --- a/src/rust/dependencies/aptos-indexer-processors +++ b/src/rust/dependencies/aptos-indexer-processors @@ -1 +1 @@ -Subproject commit 2bf374f574f8c1b88672ceedc655f7d69b5c4fd8 +Subproject commit b9d43c9ddfdede49f4631234c91373f6a97430b4 From 25facafe32f3f32fa038c1e2623060435c821e86 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 1 May 2024 14:06:22 +0200 Subject: [PATCH 06/37] fix nominal error in /tickers endpoint --- .../2024-05-01-120043_fix_nominal/down.sql | 33 +++++++++++++++++++ .../2024-05-01-120043_fix_nominal/up.sql | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 src/rust/dbv2/migrations/2024-05-01-120043_fix_nominal/down.sql create mode 100644 src/rust/dbv2/migrations/2024-05-01-120043_fix_nominal/up.sql diff --git a/src/rust/dbv2/migrations/2024-05-01-120043_fix_nominal/down.sql b/src/rust/dbv2/migrations/2024-05-01-120043_fix_nominal/down.sql new file mode 100644 index 00000000..3015286c --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-01-120043_fix_nominal/down.sql @@ -0,0 +1,33 @@ +-- This file should undo anything in `up.sql` +DROP VIEW api.tickers; + + +CREATE VIEW api.tickers AS +SELECT + market_id, + base_account_address || '::' || base_module_name || '::' || base_struct_name AS base_currency, + quote_account_address || '::' || quote_module_name || '::' || quote_struct_name AS quote_currency, + base_volume_24h AS base_volume, + quote_volume_24h AS quote_volume, + ( + base_volume_24h * + (SELECT lot_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,quote_decimals) + ) + AS base_volume_nominal, + ( + quote_volume_24h * + (SELECT tick_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,quote_decimals) + ) + AS quote_volume_nominal, + integer_price_to_quote_nominal(market_id, api.get_market_last_price(market_id)) AS last_price, + integer_price_to_quote_nominal(market_id, api.get_market_best_ask_price(market_id)) AS ask, + integer_price_to_quote_nominal(market_id, api.get_market_best_bid_price(market_id)) AS bid, + integer_price_to_quote_nominal(market_id, api.get_market_24h_high(market_id)) AS high, + integer_price_to_quote_nominal(market_id, api.get_market_24h_low(market_id)) AS low, + api.get_market_liquidity(market_id,200) / get_quote_volume_divisor_for_market(market_id) AS liquidity_in_quote +FROM + api.markets; + +GRANT SELECT ON api.tickers TO web_anon; diff --git a/src/rust/dbv2/migrations/2024-05-01-120043_fix_nominal/up.sql b/src/rust/dbv2/migrations/2024-05-01-120043_fix_nominal/up.sql new file mode 100644 index 00000000..6bed5637 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-01-120043_fix_nominal/up.sql @@ -0,0 +1,33 @@ +-- Your SQL goes here +DROP VIEW api.tickers; + + +CREATE VIEW api.tickers AS +SELECT + market_id, + base_account_address || '::' || base_module_name || '::' || base_struct_name AS base_currency, + quote_account_address || '::' || quote_module_name || '::' || quote_struct_name AS quote_currency, + base_volume_24h AS base_volume, + quote_volume_24h AS quote_volume, + ( + base_volume_24h * + (SELECT lot_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,base_decimals) + ) + AS base_volume_nominal, + ( + quote_volume_24h * + (SELECT tick_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,quote_decimals) + ) + AS quote_volume_nominal, + integer_price_to_quote_nominal(market_id, api.get_market_last_price(market_id)) AS last_price, + integer_price_to_quote_nominal(market_id, api.get_market_best_ask_price(market_id)) AS ask, + integer_price_to_quote_nominal(market_id, api.get_market_best_bid_price(market_id)) AS bid, + integer_price_to_quote_nominal(market_id, api.get_market_24h_high(market_id)) AS high, + integer_price_to_quote_nominal(market_id, api.get_market_24h_low(market_id)) AS low, + api.get_market_liquidity(market_id,200) / get_quote_volume_divisor_for_market(market_id) AS liquidity_in_quote +FROM + api.markets; + +GRANT SELECT ON api.tickers TO web_anon; From 3c8734c8c94b1b48ff64e2baaea59731f3491b3d Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 1 May 2024 14:10:37 +0200 Subject: [PATCH 07/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 517b52a9..f64d0e46 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -18,6 +18,12 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- 1. Merge `main` into `dss-stable`. 1. Push annotated tag to head of `dss-stable`. +## [v2.2.0] (in progress) + +### Fixed + +- `/tickers` endpoint `base_volume_nominal` field ([#761]). + ## [v2.1.0] (hot upgradable) ### Added @@ -231,6 +237,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#746]: https://github.com/econia-labs/econia/pull/746 [#749]: https://github.com/econia-labs/econia/pull/749 [#753]: https://github.com/econia-labs/econia/pull/753 +[#761]: https://github.com/econia-labs/econia/pull/761 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [processor #19]: https://github.com/econia-labs/aptos-indexer-processors/pull/19 From 56d8a9ec0e4e733b4516e1ba4776da59bf11b1db Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 1 May 2024 12:54:28 +0200 Subject: [PATCH 08/37] improve preformance of api.markets --- .../down.sql | 83 ++++++++++++++ .../2024-04-26-152225_optimize_markets/up.sql | 101 ++++++++++++++++++ 2 files changed, 184 insertions(+) create mode 100644 src/rust/dbv2/migrations/2024-04-26-152225_optimize_markets/down.sql create mode 100644 src/rust/dbv2/migrations/2024-04-26-152225_optimize_markets/up.sql diff --git a/src/rust/dbv2/migrations/2024-04-26-152225_optimize_markets/down.sql b/src/rust/dbv2/migrations/2024-04-26-152225_optimize_markets/down.sql new file mode 100644 index 00000000..bd4318ce --- /dev/null +++ b/src/rust/dbv2/migrations/2024-04-26-152225_optimize_markets/down.sql @@ -0,0 +1,83 @@ +-- This file should undo anything in `up.sql` +CREATE OR REPLACE VIEW + api.markets AS +WITH + last_fills AS ( + SELECT DISTINCT + ON (market_id) * + FROM + fill_events + WHERE + "time" >= CURRENT_TIMESTAMP - '1 day'::INTERVAL + ORDER BY + market_id, + txn_version DESC, + event_idx DESC + ), + first_fills AS ( + SELECT DISTINCT + ON (market_id) * + FROM + fill_events + WHERE + "time" >= CURRENT_TIMESTAMP - '1 day'::INTERVAL + ORDER BY + market_id, + txn_version ASC, + event_idx ASC + ) +SELECT + m.market_id, + m.time AS registration_time, + m.base_account_address, + m.base_module_name, + m.base_struct_name, + m.base_name_generic, + m.quote_account_address, + m.quote_module_name, + m.quote_struct_name, + m.lot_size, + m.tick_size, + m.min_size, + m.underwriter_id, + CASE + WHEN r.market_id = m.market_id THEN TRUE + ELSE FALSE + END AS is_recognized, + l.price AS last_fill_price_24hr, + (COALESCE(l.price, 1) - COALESCE(f.price, 1)) / COALESCE(f.price, 1) * 100 AS price_change_as_percent_24hr, + l.price - f.price AS price_change_24hr, + v.min_price_24h, + v.max_price_24h, + v.base_volume_24h, + v.quote_volume_24h, + base.name AS base_name, + base.decimals AS base_decimals, + base.symbol AS base_symbol, + "quote".name AS quote_name, + "quote".decimals AS quote_decimals, + "quote".symbol AS quote_symbol +FROM + market_registration_events AS m + LEFT JOIN aggregator.recognized_markets AS r ON COALESCE(r.base_account_address, '') = COALESCE(m.base_account_address, '') + AND COALESCE(r.base_module_name, '') = COALESCE(m.base_module_name, '') + AND COALESCE(r.base_struct_name, '') = COALESCE(m.base_struct_name, '') + AND COALESCE(r.base_name_generic, '') = COALESCE(m.base_name_generic, '') + AND r.quote_account_address = m.quote_account_address + AND r.quote_module_name = m.quote_module_name + AND r.quote_struct_name = m.quote_struct_name + LEFT JOIN aggregator.coins AS base ON base.address = COALESCE(m.base_account_address, '') + AND base.module = COALESCE(m.base_module_name, '') + AND base.struct = COALESCE(m.base_struct_name, '') + LEFT JOIN aggregator.coins AS "quote" ON "quote".address = COALESCE(m.quote_account_address, '') + AND "quote".module = COALESCE(m.quote_module_name, '') + AND "quote".struct = COALESCE(m.quote_struct_name, '') + LEFT JOIN first_fills AS f ON f.market_id = m.market_id + LEFT JOIN last_fills AS l ON l.market_id = m.market_id + LEFT JOIN aggregator.markets_24h_data AS v ON v.market_id = m.market_id; + + +DROP INDEX markets_market_id_txn_version_event_idx; + + +GRANT SELECT ON api.markets TO web_anon; diff --git a/src/rust/dbv2/migrations/2024-04-26-152225_optimize_markets/up.sql b/src/rust/dbv2/migrations/2024-04-26-152225_optimize_markets/up.sql new file mode 100644 index 00000000..2691890c --- /dev/null +++ b/src/rust/dbv2/migrations/2024-04-26-152225_optimize_markets/up.sql @@ -0,0 +1,101 @@ +-- Your SQL goes here +CREATE INDEX markets_market_id_txn_version_event_idx ON fill_events (market_id, txn_version DESC, event_idx DESC); + +CREATE OR REPLACE VIEW api.markets AS +WITH x AS ( + SELECT + m.market_id, + m.time AS registration_time, + m.base_account_address, + m.base_module_name, + m.base_struct_name, + m.base_name_generic, + m.quote_account_address, + m.quote_module_name, + m.quote_struct_name, + m.lot_size, + m.tick_size, + m.min_size, + m.underwriter_id, + CASE + WHEN r.market_id = m.market_id THEN true + ELSE false + END AS is_recognized, + (SELECT price FROM api.prices WHERE prices.market_id = m.market_id AND "start_time_1m_period" < CURRENT_TIMESTAMP - interval '24 hours' ORDER BY "start_time_1m_period" DESC LIMIT 1) AS price_24h_ago, + (SELECT price FROM fill_events WHERE fill_events.market_id = m.market_id ORDER BY txn_version DESC, event_idx DESC LIMIT 1) AS last_fill_price_24hr, + v.min_price_24h, + v.max_price_24h, + v.base_volume_24h, + v.quote_volume_24h + FROM + market_registration_events AS m + LEFT JOIN + aggregator.recognized_markets AS r + ON + COALESCE(r.base_account_address, '') = COALESCE(m.base_account_address, '') + AND + COALESCE(r.base_module_name, '') = COALESCE(m.base_module_name, '') + AND + COALESCE(r.base_struct_name, '') = COALESCE(m.base_struct_name, '') + AND + COALESCE(r.base_name_generic, '') = COALESCE(m.base_name_generic, '') + AND + r.quote_account_address = m.quote_account_address + AND + r.quote_module_name = m.quote_module_name + AND + r.quote_struct_name = m.quote_struct_name + LEFT JOIN + aggregator.markets_24h_data AS v + ON + v.market_id = m.market_id +) +SELECT + market_id, + registration_time, + base_account_address, + base_module_name, + base_struct_name, + base_name_generic, + quote_account_address, + quote_module_name, + quote_struct_name, + lot_size, + tick_size, + min_size, + underwriter_id, + is_recognized, + last_fill_price_24hr, + CASE + WHEN last_fill_price_24hr IS NULL THEN NULL + ELSE (last_fill_price_24hr - price_24h_ago) / price_24h_ago * 100 + END AS price_change_as_percent_24hr, + CASE + WHEN last_fill_price_24hr IS NULL THEN NULL + ELSE last_fill_price_24hr - price_24h_ago + END AS price_change_24hr, + min_price_24h, + max_price_24h, + base_volume_24h, + quote_volume_24h, + base.name AS base_name, + base.decimals AS base_decimals, + base.symbol AS base_symbol, + "quote".name AS quote_name, + "quote".decimals AS quote_decimals, + "quote".symbol AS quote_symbol +FROM + x +LEFT JOIN + aggregator.coins AS base + ON base.address = COALESCE(x.base_account_address, '') + AND base.module = COALESCE(x.base_module_name, '') + AND base.struct = COALESCE(x.base_struct_name, '') +LEFT JOIN + aggregator.coins AS "quote" + ON "quote".address = COALESCE(x.quote_account_address, '') + AND "quote".module = COALESCE(x.quote_module_name, '') + AND "quote".struct = COALESCE(x.quote_struct_name, ''); + + +GRANT SELECT ON api.markets TO web_anon; From d5189ee609803cf7a511e79fdab04d6f1f817aa9 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 1 May 2024 12:59:46 +0200 Subject: [PATCH 09/37] add changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index f64d0e46..77588445 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -20,6 +20,10 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- ## [v2.2.0] (in progress) +### Changed + +- Improve performance of `/markets` endpoint ([#760]). + ### Fixed - `/tickers` endpoint `base_volume_nominal` field ([#761]). @@ -237,6 +241,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#746]: https://github.com/econia-labs/econia/pull/746 [#749]: https://github.com/econia-labs/econia/pull/749 [#753]: https://github.com/econia-labs/econia/pull/753 +[#760]: https://github.com/econia-labs/econia/pull/760 [#761]: https://github.com/econia-labs/econia/pull/761 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 From fc8606f89e911cc8890e66c49180f509c0d748f5 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Thu, 2 May 2024 12:37:25 +0200 Subject: [PATCH 10/37] fix accidental processor version regression --- src/rust/dependencies/aptos-indexer-processors | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rust/dependencies/aptos-indexer-processors b/src/rust/dependencies/aptos-indexer-processors index b9d43c9d..2bf374f5 160000 --- a/src/rust/dependencies/aptos-indexer-processors +++ b/src/rust/dependencies/aptos-indexer-processors @@ -1 +1 @@ -Subproject commit b9d43c9ddfdede49f4631234c91373f6a97430b4 +Subproject commit 2bf374f574f8c1b88672ceedc655f7d69b5c4fd8 From 5f0dff50460291a2fedac8ba401471413b5eff34 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 1 May 2024 14:00:19 +0200 Subject: [PATCH 11/37] add dynamic batch size --- ...383a7053812b75ffa233ca1a1b4a8de7bff36.json | 71 +++++++++++ ...9778ad3ad01b97b3d3c0b44625d7381186c17.json | 38 ++++++ ...52d373a68c31ce699a8dd28c35e32fffa039e.json | 15 +++ ...5ed1210ec061496ee0a506c21c079ee94db4b.json | 23 ++++ ...a0c579312bf5bcdd1c4e63a3849b60e2e4d4e.json | 101 ++++++++++++++++ ...787bde2fa043ae6d7a636cffb613ce99b75d0.json | 83 +++++++++++++ ...2dda824b8fcf666efbeb9960539e0f2510174.json | 23 ++++ ...681c025a447ebb84cd4b5731b552f4eede893.json | 14 +++ ...29c098af279714c21c80192c870cae6e667b9.json | 12 ++ ...423af9a1c8109a0600c227ae963e86be3c3f0.json | 17 +++ ...98c4e6792b288bd8dfdf59ed4df603d86bd54.json | 113 ++++++++++++++++++ ...36897a96704787e8c5e44f37a21829a31097b.json | 17 +++ ...cf5a64f15dc8b67b603ee7084aeb8476c205b.json | 95 +++++++++++++++ ...e0fe515c099805d9e0e30d5a21df371b206a9.json | 74 ++++++++++++ ...d78ddb8b3b3e07f05a42c7628dcd976809c9e.json | 18 +++ ...6b2ea0553943b868dd80c64b2f943e949b251.json | 107 +++++++++++++++++ ...087a108ac7987338ea7f527261fd9061c9d71.json | 107 +++++++++++++++++ ...1d6f0cf062c97daeec30a1af150bb47a1831e.json | 65 ++++++++++ ...df4fe92fba07f074bcbd5320f4bc1a390b56e.json | 12 ++ ...ae87f277098832584d62e07ae03a76bbe51ae.json | 26 ++++ ...b007dcedb3b22df053418dd7c1a240f85e7b6.json | 26 ++++ ...13c1d7e247e49a941d82d975329b9c95d1947.json | 38 ++++++ ...53563716cbecafb1a1fdbf20516f0f60d9f7f.json | 12 ++ ...b86e07cc85f5f0f4a73f80487153ffd372337.json | 12 ++ ...3c37ac21a67d1b56c1bfa30db730ed6b6242e.json | 83 +++++++++++++ ...fb4278a5bb3e412d6c8df787db3b2e0288981.json | 17 +++ src/rust/Cargo.lock | 24 ++-- src/rust/Cargo.toml | 2 +- src/rust/aggregator/Cargo.toml | 2 +- src/rust/aggregator/src/main.rs | 5 +- .../src/pipelines/order_history_pipelines.rs | 19 ++- .../aggregator/src/pipelines/user_history.rs | 20 +++- src/rust/aggv2/Cargo.toml | 2 +- src/rust/dbv2/Cargo.toml | 2 +- .../migrations/2024-04-09-142800_aggv2/up.sql | 1 + 35 files changed, 1275 insertions(+), 21 deletions(-) create mode 100644 src/rust/.sqlx/query-008767291a4a3e679f5f53891e2383a7053812b75ffa233ca1a1b4a8de7bff36.json create mode 100644 src/rust/.sqlx/query-0aeef92366dfdf782ae8792d4969778ad3ad01b97b3d3c0b44625d7381186c17.json create mode 100644 src/rust/.sqlx/query-2de84d8c53675f9c8ea0f7cc72b52d373a68c31ce699a8dd28c35e32fffa039e.json create mode 100644 src/rust/.sqlx/query-3eb70cec08a9b9ea0e7fb1f87015ed1210ec061496ee0a506c21c079ee94db4b.json create mode 100644 src/rust/.sqlx/query-40dca67697825881a7f58ba5e42a0c579312bf5bcdd1c4e63a3849b60e2e4d4e.json create mode 100644 src/rust/.sqlx/query-43410e8b575d1f89a94dac88057787bde2fa043ae6d7a636cffb613ce99b75d0.json create mode 100644 src/rust/.sqlx/query-444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174.json create mode 100644 src/rust/.sqlx/query-48e966ee8b518828455c71142ac681c025a447ebb84cd4b5731b552f4eede893.json create mode 100644 src/rust/.sqlx/query-4d3168224f14c07f01204dd4abc29c098af279714c21c80192c870cae6e667b9.json create mode 100644 src/rust/.sqlx/query-4ec9ca8c9ab698ad091b1a33486423af9a1c8109a0600c227ae963e86be3c3f0.json create mode 100644 src/rust/.sqlx/query-59718e964d585cc44b1f99b527698c4e6792b288bd8dfdf59ed4df603d86bd54.json create mode 100644 src/rust/.sqlx/query-63143c6343f529ebbe7eb55294536897a96704787e8c5e44f37a21829a31097b.json create mode 100644 src/rust/.sqlx/query-7036df53ef634dd45a0838f2fc9cf5a64f15dc8b67b603ee7084aeb8476c205b.json create mode 100644 src/rust/.sqlx/query-8b41c282738a9763609851b0c0ee0fe515c099805d9e0e30d5a21df371b206a9.json create mode 100644 src/rust/.sqlx/query-8d1caf1d8174be8da7e3ff04939d78ddb8b3b3e07f05a42c7628dcd976809c9e.json create mode 100644 src/rust/.sqlx/query-95c6a01ebdd015a8ccc36e59e4b6b2ea0553943b868dd80c64b2f943e949b251.json create mode 100644 src/rust/.sqlx/query-9cbc3cb42e82f2ffba81dd9738d087a108ac7987338ea7f527261fd9061c9d71.json create mode 100644 src/rust/.sqlx/query-a15da212ba4b221d717495d17241d6f0cf062c97daeec30a1af150bb47a1831e.json create mode 100644 src/rust/.sqlx/query-af4ab365611b625a929c72417f5df4fe92fba07f074bcbd5320f4bc1a390b56e.json create mode 100644 src/rust/.sqlx/query-b250a0e180797a4b07cb6be7207ae87f277098832584d62e07ae03a76bbe51ae.json create mode 100644 src/rust/.sqlx/query-b2ec5314ca34364f251d266ae4eb007dcedb3b22df053418dd7c1a240f85e7b6.json create mode 100644 src/rust/.sqlx/query-b3d88bd8337ce88475b130293f713c1d7e247e49a941d82d975329b9c95d1947.json create mode 100644 src/rust/.sqlx/query-d74d2f296ec6e4107d3205e084753563716cbecafb1a1fdbf20516f0f60d9f7f.json create mode 100644 src/rust/.sqlx/query-e06f44615a2bb831c39018cafa1b86e07cc85f5f0f4a73f80487153ffd372337.json create mode 100644 src/rust/.sqlx/query-e4061c9b9dd43c323b75ce7bb2f3c37ac21a67d1b56c1bfa30db730ed6b6242e.json create mode 100644 src/rust/.sqlx/query-fbf0ca3264605b2e0f2ef4dc869fb4278a5bb3e412d6c8df787db3b2e0288981.json diff --git a/src/rust/.sqlx/query-008767291a4a3e679f5f53891e2383a7053812b75ffa233ca1a1b4a8de7bff36.json b/src/rust/.sqlx/query-008767291a4a3e679f5f53891e2383a7053812b75ffa233ca1a1b4a8de7bff36.json new file mode 100644 index 00000000..bd025303 --- /dev/null +++ b/src/rust/.sqlx/query-008767291a4a3e679f5f53891e2383a7053812b75ffa233ca1a1b4a8de7bff36.json @@ -0,0 +1,71 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM change_order_size_events WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "event_idx", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 3, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 4, + "name": "order_id", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "user", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "custodian_id", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "side", + "type_info": "Bool" + }, + { + "ordinal": 8, + "name": "new_size", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "008767291a4a3e679f5f53891e2383a7053812b75ffa233ca1a1b4a8de7bff36" +} diff --git a/src/rust/.sqlx/query-0aeef92366dfdf782ae8792d4969778ad3ad01b97b3d3c0b44625d7381186c17.json b/src/rust/.sqlx/query-0aeef92366dfdf782ae8792d4969778ad3ad01b97b3d3c0b44625d7381186c17.json new file mode 100644 index 00000000..426925c7 --- /dev/null +++ b/src/rust/.sqlx/query-0aeef92366dfdf782ae8792d4969778ad3ad01b97b3d3c0b44625d7381186c17.json @@ -0,0 +1,38 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT DISTINCT ON (market_id) * FROM aggv2.volume ORDER BY market_id, \"time\" DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 1, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "cumulative", + "type_info": "Numeric" + }, + { + "ordinal": 3, + "name": "period", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "0aeef92366dfdf782ae8792d4969778ad3ad01b97b3d3c0b44625d7381186c17" +} diff --git a/src/rust/.sqlx/query-2de84d8c53675f9c8ea0f7cc72b52d373a68c31ce699a8dd28c35e32fffa039e.json b/src/rust/.sqlx/query-2de84d8c53675f9c8ea0f7cc72b52d373a68c31ce699a8dd28c35e32fffa039e.json new file mode 100644 index 00000000..e8680b32 --- /dev/null +++ b/src/rust/.sqlx/query-2de84d8c53675f9c8ea0f7cc72b52d373a68c31ce699a8dd28c35e32fffa039e.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO aggv2.market_cache VALUES ($1, $2)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Numeric", + "Numeric" + ] + }, + "nullable": [] + }, + "hash": "2de84d8c53675f9c8ea0f7cc72b52d373a68c31ce699a8dd28c35e32fffa039e" +} diff --git a/src/rust/.sqlx/query-3eb70cec08a9b9ea0e7fb1f87015ed1210ec061496ee0a506c21c079ee94db4b.json b/src/rust/.sqlx/query-3eb70cec08a9b9ea0e7fb1f87015ed1210ec061496ee0a506c21c079ee94db4b.json new file mode 100644 index 00000000..fbc0a39d --- /dev/null +++ b/src/rust/.sqlx/query-3eb70cec08a9b9ea0e7fb1f87015ed1210ec061496ee0a506c21c079ee94db4b.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO aggv2.order_cache VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Numeric", + "Bool", + "Numeric", + "Numeric", + "Numeric", + "Text", + "Numeric", + "Text", + "Numeric", + "Numeric" + ] + }, + "nullable": [] + }, + "hash": "3eb70cec08a9b9ea0e7fb1f87015ed1210ec061496ee0a506c21c079ee94db4b" +} diff --git a/src/rust/.sqlx/query-40dca67697825881a7f58ba5e42a0c579312bf5bcdd1c4e63a3849b60e2e4d4e.json b/src/rust/.sqlx/query-40dca67697825881a7f58ba5e42a0c579312bf5bcdd1c4e63a3849b60e2e4d4e.json new file mode 100644 index 00000000..4bbc701b --- /dev/null +++ b/src/rust/.sqlx/query-40dca67697825881a7f58ba5e42a0c579312bf5bcdd1c4e63a3849b60e2e4d4e.json @@ -0,0 +1,101 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM place_limit_order_events WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "event_idx", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 3, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 4, + "name": "user", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "custodian_id", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "order_id", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "side", + "type_info": "Bool" + }, + { + "ordinal": 8, + "name": "integrator", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "initial_size", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "price", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "restriction", + "type_info": "Int2" + }, + { + "ordinal": 12, + "name": "self_match_behavior", + "type_info": "Int2" + }, + { + "ordinal": 13, + "name": "size", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "40dca67697825881a7f58ba5e42a0c579312bf5bcdd1c4e63a3849b60e2e4d4e" +} diff --git a/src/rust/.sqlx/query-43410e8b575d1f89a94dac88057787bde2fa043ae6d7a636cffb613ce99b75d0.json b/src/rust/.sqlx/query-43410e8b575d1f89a94dac88057787bde2fa043ae6d7a636cffb613ce99b75d0.json new file mode 100644 index 00000000..fe5aee73 --- /dev/null +++ b/src/rust/.sqlx/query-43410e8b575d1f89a94dac88057787bde2fa043ae6d7a636cffb613ce99b75d0.json @@ -0,0 +1,83 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM place_market_order_events WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "event_idx", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 3, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 4, + "name": "order_id", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "user", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "custodian_id", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "integrator", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "direction", + "type_info": "Bool" + }, + { + "ordinal": 9, + "name": "size", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "self_match_behavior", + "type_info": "Int2" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "43410e8b575d1f89a94dac88057787bde2fa043ae6d7a636cffb613ce99b75d0" +} diff --git a/src/rust/.sqlx/query-444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174.json b/src/rust/.sqlx/query-444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174.json new file mode 100644 index 00000000..abfbf92a --- /dev/null +++ b/src/rust/.sqlx/query-444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT \"time\" FROM events WHERE \"time\" > $1 ORDER BY \"time\" offset $2 limit 1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Int8" + ] + }, + "nullable": [ + false + ] + }, + "hash": "444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174" +} diff --git a/src/rust/.sqlx/query-48e966ee8b518828455c71142ac681c025a447ebb84cd4b5731b552f4eede893.json b/src/rust/.sqlx/query-48e966ee8b518828455c71142ac681c025a447ebb84cd4b5731b552f4eede893.json new file mode 100644 index 00000000..f85dae6f --- /dev/null +++ b/src/rust/.sqlx/query-48e966ee8b518828455c71142ac681c025a447ebb84cd4b5731b552f4eede893.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO aggv2.state_cache VALUES ($1)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "48e966ee8b518828455c71142ac681c025a447ebb84cd4b5731b552f4eede893" +} diff --git a/src/rust/.sqlx/query-4d3168224f14c07f01204dd4abc29c098af279714c21c80192c870cae6e667b9.json b/src/rust/.sqlx/query-4d3168224f14c07f01204dd4abc29c098af279714c21c80192c870cae6e667b9.json new file mode 100644 index 00000000..7423f164 --- /dev/null +++ b/src/rust/.sqlx/query-4d3168224f14c07f01204dd4abc29c098af279714c21c80192c870cae6e667b9.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM aggv2.state_cache", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "4d3168224f14c07f01204dd4abc29c098af279714c21c80192c870cae6e667b9" +} diff --git a/src/rust/.sqlx/query-4ec9ca8c9ab698ad091b1a33486423af9a1c8109a0600c227ae963e86be3c3f0.json b/src/rust/.sqlx/query-4ec9ca8c9ab698ad091b1a33486423af9a1c8109a0600c227ae963e86be3c3f0.json new file mode 100644 index 00000000..92e5b1fb --- /dev/null +++ b/src/rust/.sqlx/query-4ec9ca8c9ab698ad091b1a33486423af9a1c8109a0600c227ae963e86be3c3f0.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO aggv2.volume VALUES ($1, $2, $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "Numeric", + "Numeric", + "Numeric" + ] + }, + "nullable": [] + }, + "hash": "4ec9ca8c9ab698ad091b1a33486423af9a1c8109a0600c227ae963e86be3c3f0" +} diff --git a/src/rust/.sqlx/query-59718e964d585cc44b1f99b527698c4e6792b288bd8dfdf59ed4df603d86bd54.json b/src/rust/.sqlx/query-59718e964d585cc44b1f99b527698c4e6792b288bd8dfdf59ed4df603d86bd54.json new file mode 100644 index 00000000..bac66299 --- /dev/null +++ b/src/rust/.sqlx/query-59718e964d585cc44b1f99b527698c4e6792b288bd8dfdf59ed4df603d86bd54.json @@ -0,0 +1,113 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM fill_events WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "event_idx", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "emit_address", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 4, + "name": "maker_address", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "maker_custodian_id", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "maker_order_id", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "maker_side", + "type_info": "Bool" + }, + { + "ordinal": 8, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "price", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "sequence_number_for_trade", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "size", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "taker_address", + "type_info": "Varchar" + }, + { + "ordinal": 13, + "name": "taker_custodian_id", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "taker_order_id", + "type_info": "Numeric" + }, + { + "ordinal": 15, + "name": "taker_quote_fees_paid", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "59718e964d585cc44b1f99b527698c4e6792b288bd8dfdf59ed4df603d86bd54" +} diff --git a/src/rust/.sqlx/query-63143c6343f529ebbe7eb55294536897a96704787e8c5e44f37a21829a31097b.json b/src/rust/.sqlx/query-63143c6343f529ebbe7eb55294536897a96704787e8c5e44f37a21829a31097b.json new file mode 100644 index 00000000..2f0b9f86 --- /dev/null +++ b/src/rust/.sqlx/query-63143c6343f529ebbe7eb55294536897a96704787e8c5e44f37a21829a31097b.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO aggv2.spread VALUES ($1, $2, $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "Numeric", + "Numeric", + "Numeric" + ] + }, + "nullable": [] + }, + "hash": "63143c6343f529ebbe7eb55294536897a96704787e8c5e44f37a21829a31097b" +} diff --git a/src/rust/.sqlx/query-7036df53ef634dd45a0838f2fc9cf5a64f15dc8b67b603ee7084aeb8476c205b.json b/src/rust/.sqlx/query-7036df53ef634dd45a0838f2fc9cf5a64f15dc8b67b603ee7084aeb8476c205b.json new file mode 100644 index 00000000..2f7b2159 --- /dev/null +++ b/src/rust/.sqlx/query-7036df53ef634dd45a0838f2fc9cf5a64f15dc8b67b603ee7084aeb8476c205b.json @@ -0,0 +1,95 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM place_swap_order_events WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "event_idx", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 3, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 4, + "name": "order_id", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "signing_account", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "integrator", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "direction", + "type_info": "Bool" + }, + { + "ordinal": 8, + "name": "min_base", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "max_base", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "min_quote", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "max_quote", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "limit_price", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "7036df53ef634dd45a0838f2fc9cf5a64f15dc8b67b603ee7084aeb8476c205b" +} diff --git a/src/rust/.sqlx/query-8b41c282738a9763609851b0c0ee0fe515c099805d9e0e30d5a21df371b206a9.json b/src/rust/.sqlx/query-8b41c282738a9763609851b0c0ee0fe515c099805d9e0e30d5a21df371b206a9.json new file mode 100644 index 00000000..a58ea499 --- /dev/null +++ b/src/rust/.sqlx/query-8b41c282738a9763609851b0c0ee0fe515c099805d9e0e30d5a21df371b206a9.json @@ -0,0 +1,74 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM aggv2.order_cache", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "is_ask", + "type_info": "Bool" + }, + { + "ordinal": 2, + "name": "order_id", + "type_info": "Numeric" + }, + { + "ordinal": 3, + "name": "last_changed_transaction_version", + "type_info": "Numeric" + }, + { + "ordinal": 4, + "name": "last_changed_event_id", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "user", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "custodian_id", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "integrator", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "price", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "size", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "8b41c282738a9763609851b0c0ee0fe515c099805d9e0e30d5a21df371b206a9" +} diff --git a/src/rust/.sqlx/query-8d1caf1d8174be8da7e3ff04939d78ddb8b3b3e07f05a42c7628dcd976809c9e.json b/src/rust/.sqlx/query-8d1caf1d8174be8da7e3ff04939d78ddb8b3b3e07f05a42c7628dcd976809c9e.json new file mode 100644 index 00000000..108c8699 --- /dev/null +++ b/src/rust/.sqlx/query-8d1caf1d8174be8da7e3ff04939d78ddb8b3b3e07f05a42c7628dcd976809c9e.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO aggv2.liquidity VALUES ($1, $2, $3, $4, $5)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "Numeric", + "Numeric", + "Numeric", + "Int4" + ] + }, + "nullable": [] + }, + "hash": "8d1caf1d8174be8da7e3ff04939d78ddb8b3b3e07f05a42c7628dcd976809c9e" +} diff --git a/src/rust/.sqlx/query-95c6a01ebdd015a8ccc36e59e4b6b2ea0553943b868dd80c64b2f943e949b251.json b/src/rust/.sqlx/query-95c6a01ebdd015a8ccc36e59e4b6b2ea0553943b868dd80c64b2f943e949b251.json new file mode 100644 index 00000000..75a2389f --- /dev/null +++ b/src/rust/.sqlx/query-95c6a01ebdd015a8ccc36e59e4b6b2ea0553943b868dd80c64b2f943e949b251.json @@ -0,0 +1,107 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM market_registration_events WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "event_idx", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 3, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 4, + "name": "base_account_address", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "base_module_name", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "base_struct_name", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "base_name_generic", + "type_info": "Text" + }, + { + "ordinal": 8, + "name": "quote_account_address", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "quote_module_name", + "type_info": "Text" + }, + { + "ordinal": 10, + "name": "quote_struct_name", + "type_info": "Text" + }, + { + "ordinal": 11, + "name": "lot_size", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "tick_size", + "type_info": "Numeric" + }, + { + "ordinal": 13, + "name": "min_size", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "underwriter_id", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false, + true, + true, + true, + true, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "95c6a01ebdd015a8ccc36e59e4b6b2ea0553943b868dd80c64b2f943e949b251" +} diff --git a/src/rust/.sqlx/query-9cbc3cb42e82f2ffba81dd9738d087a108ac7987338ea7f527261fd9061c9d71.json b/src/rust/.sqlx/query-9cbc3cb42e82f2ffba81dd9738d087a108ac7987338ea7f527261fd9061c9d71.json new file mode 100644 index 00000000..0f3fe859 --- /dev/null +++ b/src/rust/.sqlx/query-9cbc3cb42e82f2ffba81dd9738d087a108ac7987338ea7f527261fd9061c9d71.json @@ -0,0 +1,107 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM recognized_market_events WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "event_idx", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 3, + "name": "base_account_address", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "base_module_name", + "type_info": "Text" + }, + { + "ordinal": 5, + "name": "base_struct_name", + "type_info": "Text" + }, + { + "ordinal": 6, + "name": "base_name_generic", + "type_info": "Text" + }, + { + "ordinal": 7, + "name": "quote_account_address", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "quote_module_name", + "type_info": "Text" + }, + { + "ordinal": 9, + "name": "quote_struct_name", + "type_info": "Text" + }, + { + "ordinal": 10, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "lot_size", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "tick_size", + "type_info": "Numeric" + }, + { + "ordinal": 13, + "name": "min_size", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "underwriter_id", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + false, + false, + false, + true, + true, + true, + true, + true + ] + }, + "hash": "9cbc3cb42e82f2ffba81dd9738d087a108ac7987338ea7f527261fd9061c9d71" +} diff --git a/src/rust/.sqlx/query-a15da212ba4b221d717495d17241d6f0cf062c97daeec30a1af150bb47a1831e.json b/src/rust/.sqlx/query-a15da212ba4b221d717495d17241d6f0cf062c97daeec30a1af150bb47a1831e.json new file mode 100644 index 00000000..171599eb --- /dev/null +++ b/src/rust/.sqlx/query-a15da212ba4b221d717495d17241d6f0cf062c97daeec30a1af150bb47a1831e.json @@ -0,0 +1,65 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM cancel_order_events WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "event_idx", + "type_info": "Numeric" + }, + { + "ordinal": 2, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 3, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 4, + "name": "user", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "custodian_id", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "order_id", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "reason", + "type_info": "Int2" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "a15da212ba4b221d717495d17241d6f0cf062c97daeec30a1af150bb47a1831e" +} diff --git a/src/rust/.sqlx/query-af4ab365611b625a929c72417f5df4fe92fba07f074bcbd5320f4bc1a390b56e.json b/src/rust/.sqlx/query-af4ab365611b625a929c72417f5df4fe92fba07f074bcbd5320f4bc1a390b56e.json new file mode 100644 index 00000000..00e404be --- /dev/null +++ b/src/rust/.sqlx/query-af4ab365611b625a929c72417f5df4fe92fba07f074bcbd5320f4bc1a390b56e.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM aggv2.market_cache", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "af4ab365611b625a929c72417f5df4fe92fba07f074bcbd5320f4bc1a390b56e" +} diff --git a/src/rust/.sqlx/query-b250a0e180797a4b07cb6be7207ae87f277098832584d62e07ae03a76bbe51ae.json b/src/rust/.sqlx/query-b250a0e180797a4b07cb6be7207ae87f277098832584d62e07ae03a76bbe51ae.json new file mode 100644 index 00000000..e19e94c6 --- /dev/null +++ b/src/rust/.sqlx/query-b250a0e180797a4b07cb6be7207ae87f277098832584d62e07ae03a76bbe51ae.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM aggv2.state_cache", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 1, + "name": "transaction_version", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false + ] + }, + "hash": "b250a0e180797a4b07cb6be7207ae87f277098832584d62e07ae03a76bbe51ae" +} diff --git a/src/rust/.sqlx/query-b2ec5314ca34364f251d266ae4eb007dcedb3b22df053418dd7c1a240f85e7b6.json b/src/rust/.sqlx/query-b2ec5314ca34364f251d266ae4eb007dcedb3b22df053418dd7c1a240f85e7b6.json new file mode 100644 index 00000000..99244ffe --- /dev/null +++ b/src/rust/.sqlx/query-b2ec5314ca34364f251d266ae4eb007dcedb3b22df053418dd7c1a240f85e7b6.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM aggv2.market_cache", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "last_price", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + true + ] + }, + "hash": "b2ec5314ca34364f251d266ae4eb007dcedb3b22df053418dd7c1a240f85e7b6" +} diff --git a/src/rust/.sqlx/query-b3d88bd8337ce88475b130293f713c1d7e247e49a941d82d975329b9c95d1947.json b/src/rust/.sqlx/query-b3d88bd8337ce88475b130293f713c1d7e247e49a941d82d975329b9c95d1947.json new file mode 100644 index 00000000..1fd98e51 --- /dev/null +++ b/src/rust/.sqlx/query-b3d88bd8337ce88475b130293f713c1d7e247e49a941d82d975329b9c95d1947.json @@ -0,0 +1,38 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM aggv2.account_cache", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "user", + "type_info": "Text" + }, + { + "ordinal": 2, + "name": "base", + "type_info": "Numeric" + }, + { + "ordinal": 3, + "name": "quote", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "b3d88bd8337ce88475b130293f713c1d7e247e49a941d82d975329b9c95d1947" +} diff --git a/src/rust/.sqlx/query-d74d2f296ec6e4107d3205e084753563716cbecafb1a1fdbf20516f0f60d9f7f.json b/src/rust/.sqlx/query-d74d2f296ec6e4107d3205e084753563716cbecafb1a1fdbf20516f0f60d9f7f.json new file mode 100644 index 00000000..9177f23b --- /dev/null +++ b/src/rust/.sqlx/query-d74d2f296ec6e4107d3205e084753563716cbecafb1a1fdbf20516f0f60d9f7f.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM aggv2.account_cache", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "d74d2f296ec6e4107d3205e084753563716cbecafb1a1fdbf20516f0f60d9f7f" +} diff --git a/src/rust/.sqlx/query-e06f44615a2bb831c39018cafa1b86e07cc85f5f0f4a73f80487153ffd372337.json b/src/rust/.sqlx/query-e06f44615a2bb831c39018cafa1b86e07cc85f5f0f4a73f80487153ffd372337.json new file mode 100644 index 00000000..6ed811e2 --- /dev/null +++ b/src/rust/.sqlx/query-e06f44615a2bb831c39018cafa1b86e07cc85f5f0f4a73f80487153ffd372337.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM aggv2.order_cache", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "e06f44615a2bb831c39018cafa1b86e07cc85f5f0f4a73f80487153ffd372337" +} diff --git a/src/rust/.sqlx/query-e4061c9b9dd43c323b75ce7bb2f3c37ac21a67d1b56c1bfa30db730ed6b6242e.json b/src/rust/.sqlx/query-e4061c9b9dd43c323b75ce7bb2f3c37ac21a67d1b56c1bfa30db730ed6b6242e.json new file mode 100644 index 00000000..2afa77a3 --- /dev/null +++ b/src/rust/.sqlx/query-e4061c9b9dd43c323b75ce7bb2f3c37ac21a67d1b56c1bfa30db730ed6b6242e.json @@ -0,0 +1,83 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM balance_updates_by_handle WHERE \"time\" > $1 AND \"time\" <= $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "txn_version", + "type_info": "Numeric" + }, + { + "ordinal": 1, + "name": "handle", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "market_id", + "type_info": "Numeric" + }, + { + "ordinal": 3, + "name": "custodian_id", + "type_info": "Numeric" + }, + { + "ordinal": 4, + "name": "time", + "type_info": "Timestamptz" + }, + { + "ordinal": 5, + "name": "base_total", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "base_available", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "base_ceiling", + "type_info": "Numeric" + }, + { + "ordinal": 8, + "name": "quote_total", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "quote_available", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "quote_ceiling", + "type_info": "Numeric" + } + ], + "parameters": { + "Left": [ + "Timestamptz", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "e4061c9b9dd43c323b75ce7bb2f3c37ac21a67d1b56c1bfa30db730ed6b6242e" +} diff --git a/src/rust/.sqlx/query-fbf0ca3264605b2e0f2ef4dc869fb4278a5bb3e412d6c8df787db3b2e0288981.json b/src/rust/.sqlx/query-fbf0ca3264605b2e0f2ef4dc869fb4278a5bb3e412d6c8df787db3b2e0288981.json new file mode 100644 index 00000000..d03ddf89 --- /dev/null +++ b/src/rust/.sqlx/query-fbf0ca3264605b2e0f2ef4dc869fb4278a5bb3e412d6c8df787db3b2e0288981.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO aggv2.account_cache VALUES ($1, $2, $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Numeric", + "Text", + "Numeric", + "Numeric" + ] + }, + "nullable": [] + }, + "hash": "fbf0ca3264605b2e0f2ef4dc869fb4278a5bb3e412d6c8df787db3b2e0288981" +} diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index a3d4839b..ade12204 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -75,7 +75,7 @@ dependencies = [ "anyhow", "aptos-sdk", "async-trait", - "bigdecimal 0.3.1", + "bigdecimal 0.3.0", "chrono", "clap 4.4.6", "dotenvy", @@ -99,7 +99,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "bigdecimal 0.3.1", + "bigdecimal 0.3.0", "chrono", "dotenvy", "serde", @@ -1713,9 +1713,9 @@ dependencies = [ [[package]] name = "bigdecimal" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" +checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744" dependencies = [ "num-bigint 0.4.4", "num-integer", @@ -2651,7 +2651,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" name = "dbv2" version = "0.1.0" dependencies = [ - "bigdecimal 0.4.3", + "bigdecimal 0.3.0", "chrono", "diesel", "serde", @@ -2717,11 +2717,11 @@ checksum = "d95203a6a50906215a502507c0f879a0ce7ff205a6111e2db2a5ef8e4bb92e43" [[package]] name = "diesel" -version = "2.1.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53c8a2cb22327206568569e5a45bb5a2c946455efdd76e24d15b7e82171af95e" +checksum = "f7a532c1f99a0f596f6960a60d1e119e91582b24b39e2d83a190e61262c3ef0c" dependencies = [ - "bigdecimal 0.4.3", + "bigdecimal 0.3.0", "bitflags 2.4.0", "byteorder", "chrono", @@ -4143,7 +4143,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -7221,7 +7221,7 @@ checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d" dependencies = [ "ahash 0.8.11", "atoi", - "bigdecimal 0.3.1", + "bigdecimal 0.3.0", "byteorder", "bytes", "chrono", @@ -7305,7 +7305,7 @@ checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db" dependencies = [ "atoi", "base64 0.21.4", - "bigdecimal 0.3.1", + "bigdecimal 0.3.0", "bitflags 2.4.0", "byteorder", "bytes", @@ -7349,7 +7349,7 @@ checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624" dependencies = [ "atoi", "base64 0.21.4", - "bigdecimal 0.3.1", + "bigdecimal 0.3.0", "bitflags 2.4.0", "byteorder", "chrono", diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 52010f25..bcb232a6 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -37,7 +37,7 @@ bcs = { git = "https://github.com/aptos-labs/bcs.git", rev = "d31fab9d81748e2594 bigdecimal = { version = "0.4", features = ["serde"] } chrono = { version = "0.4", features = ["clock", "serde"] } clap = { version = "4.3.5", features = ["derive", "unstable-styles"] } -diesel = { version = "2.1.0", features = [ +diesel = { version = "=2.1.0", features = [ "chrono", "postgres", "r2d2", diff --git a/src/rust/aggregator/Cargo.toml b/src/rust/aggregator/Cargo.toml index 29143918..ded60387 100644 --- a/src/rust/aggregator/Cargo.toml +++ b/src/rust/aggregator/Cargo.toml @@ -8,7 +8,7 @@ aptos-sdk.workspace = true anyhow.workspace = true async-trait = "0.1.73" -bigdecimal = { version = "0.3.1", features = ["serde"] } +bigdecimal = { version = "=0.3.0", features = ["serde"] } chrono.workspace = true clap = { workspace = true, features = ["derive", "string"] } dotenvy.workspace = true diff --git a/src/rust/aggregator/src/main.rs b/src/rust/aggregator/src/main.rs index 784e2412..a22a229a 100644 --- a/src/rust/aggregator/src/main.rs +++ b/src/rust/aggregator/src/main.rs @@ -45,7 +45,10 @@ struct Args { aptos_network: Option, } -const MAX_BATCH_SIZE: u64 = 100_000; +const MAX_BATCH_SIZE: u64 = 1_000_000; + +/// The number of events a pipeline should target to load into ram at once. +const TARGET_EVENTS: usize = 1_000_000; #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] pub enum Pipelines { diff --git a/src/rust/aggregator/src/pipelines/order_history_pipelines.rs b/src/rust/aggregator/src/pipelines/order_history_pipelines.rs index 6b754cc5..300bdfb7 100644 --- a/src/rust/aggregator/src/pipelines/order_history_pipelines.rs +++ b/src/rust/aggregator/src/pipelines/order_history_pipelines.rs @@ -8,7 +8,7 @@ use aggregator::{util::*, Pipeline, PipelineAggregationResult, PipelineError}; use sqlx_postgres::Postgres; use tokio::sync::RwLock; -use crate::MAX_BATCH_SIZE; +use crate::{TARGET_EVENTS, MAX_BATCH_SIZE}; pub const TIMEOUT: std::time::Duration = std::time::Duration::from_secs(1); @@ -26,6 +26,7 @@ pub struct OrderHistoryPipelines { last_indexed_timestamp: Option>, state: Option, last_prices: HashMap>, + batch_size: BigDecimal, } impl OrderHistoryPipelines { @@ -35,6 +36,10 @@ impl OrderHistoryPipelines { last_indexed_timestamp: None, state: None, last_prices: Default::default(), + // Start with a very small batch size. + // This way, if the aggregator is restarting after a crash due to too many events in + // ram, it will not just crash again. + batch_size: BigDecimal::from(10), } } } @@ -160,7 +165,7 @@ impl OrderHistoryPipelines { // Limit the number of transactions that will be processed in one batch. Not limiting this // could cause out of memory issues. let txn_version = - (txn_version_of_state.clone() + BigDecimal::from(MAX_BATCH_SIZE)).min(txn_version); + (txn_version_of_state.clone() + &self.batch_size).min(txn_version); // Get all place events that happened between the last transaction included in the previous // state and the last transaction that happened before the given timestamp. @@ -209,6 +214,16 @@ impl OrderHistoryPipelines { .await .map_err(to_pipeline_error)?; + // Update the batch size based on how many events the current batch contained. + let n_events = places.len() + fills.len() + changes.len() + cancels.len(); + if n_events > TARGET_EVENTS && self.batch_size > BigDecimal::from(1) { + self.batch_size = &self.batch_size / BigDecimal::from(10); + tracing::debug!("Batch size reduced to {}", self.batch_size); + } else if n_events < TARGET_EVENTS / 10 && self.batch_size < BigDecimal::from(MAX_BATCH_SIZE) { + self.batch_size = &self.batch_size * BigDecimal::from(10); + tracing::debug!("Batch size increased to {}", self.batch_size); + } + // Insert all places as orders into the state. for place in places { orders.insert((place.market_id.clone(), place.order_id.clone()), place); diff --git a/src/rust/aggregator/src/pipelines/user_history.rs b/src/rust/aggregator/src/pipelines/user_history.rs index 3b429e25..3866a84e 100644 --- a/src/rust/aggregator/src/pipelines/user_history.rs +++ b/src/rust/aggregator/src/pipelines/user_history.rs @@ -8,7 +8,7 @@ use aggregator::{ Pipeline, PipelineAggregationResult, PipelineError, }; -use crate::{dbtypes::OrderType, MAX_BATCH_SIZE}; +use crate::{dbtypes::OrderType, TARGET_EVENTS, MAX_BATCH_SIZE}; /// Number of bits to shift when encoding transaction version. const SHIFT_TXN_VERSION: u8 = 64; @@ -18,6 +18,7 @@ pub const TIMEOUT: std::time::Duration = std::time::Duration::from_millis(100); pub struct UserHistory { pool: PgPool, last_indexed_timestamp: Option>, + batch_size: BigDecimal, } impl UserHistory { @@ -25,6 +26,10 @@ impl UserHistory { Self { pool, last_indexed_timestamp: None, + // Start with a very small batch size. + // This way, if the aggregator is restarting after a crash due to too many events in + // ram, it will not just crash again. + batch_size: BigDecimal::from(10), } } } @@ -103,7 +108,7 @@ impl Pipeline for UserHistory { while txn_version_start < txn_version_stop { let txn_version_iter_stop = (txn_version_start.clone() - + BigDecimal::from(MAX_BATCH_SIZE)) + + &self.batch_size) .min(txn_version_stop.clone()); let fill_events = sqlx::query_file!( "sqlx_queries/user_history/get_fill_events.sql", @@ -121,6 +126,17 @@ impl Pipeline for UserHistory { .fetch_all(&mut transaction as &mut PgConnection) .await .map_err(|e| PipelineError::ProcessingError(anyhow!(e)))?; + + // Update the batch size based on how many events the current batch contained. + let n_events = fill_events.len() + change_events.len(); + if n_events > TARGET_EVENTS && self.batch_size > BigDecimal::from(1) { + self.batch_size = &self.batch_size / BigDecimal::from(10); + tracing::debug!("Batch size reduced to {}", self.batch_size); + } else if n_events < TARGET_EVENTS / 10 && self.batch_size < BigDecimal::from(MAX_BATCH_SIZE) { + self.batch_size = &self.batch_size * BigDecimal::from(10); + tracing::debug!("Batch size increased to {}", self.batch_size); + } + // Step through fill and change events in total order. let mut fill_index = 0; let mut change_index = 0; diff --git a/src/rust/aggv2/Cargo.toml b/src/rust/aggv2/Cargo.toml index 1dba7d1a..a68a28d8 100644 --- a/src/rust/aggv2/Cargo.toml +++ b/src/rust/aggv2/Cargo.toml @@ -14,7 +14,7 @@ rust-version.workspace = true [dependencies] anyhow.workspace = true async-trait = "0.1.73" -bigdecimal = { version = "0.3.1", features = ["serde"] } +bigdecimal = { version = "=0.3.0", features = ["serde"] } chrono.workspace = true dotenvy.workspace = true serde.workspace = true diff --git a/src/rust/dbv2/Cargo.toml b/src/rust/dbv2/Cargo.toml index 0216d97f..edbe426d 100644 --- a/src/rust/dbv2/Cargo.toml +++ b/src/rust/dbv2/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bigdecimal = { workspace = true } +bigdecimal = { version = "=0.3.0", features = ["serde"] } chrono = { workspace = true } diesel = { workspace = true, features = ["chrono", "numeric", "postgres"] } serde = { workspace = true } diff --git a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql index 8c3fc36d..6c300fe5 100644 --- a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql +++ b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql @@ -64,6 +64,7 @@ CREATE TABLE events ( transaction_verson NUMERIC NOT NULL, event_index NUMERIC NOT NULL, "time" TIMESTAMPTZ NOT NULL, + PRIMARY KEY (transaction_verson, event_index) ); CREATE INDEX events_time ON events ("time"); From a921ff2ee9ec4bbc1b91fd76eb25acf78b4e309c Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Thu, 2 May 2024 12:54:21 +0200 Subject: [PATCH 12/37] factorize batch sizing logic --- src/rust/aggregator/src/main.rs | 46 +++++++++++++++++-- .../src/pipelines/order_history_pipelines.rs | 13 ++---- .../aggregator/src/pipelines/user_history.rs | 13 ++---- src/rust/aggregator/src/util.rs | 1 + 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/src/rust/aggregator/src/main.rs b/src/rust/aggregator/src/main.rs index a22a229a..e074a11b 100644 --- a/src/rust/aggregator/src/main.rs +++ b/src/rust/aggregator/src/main.rs @@ -7,6 +7,7 @@ use std::{ use aggregator::Pipeline; use anyhow::{anyhow, Result}; use aptos_sdk::rest_client::AptosBaseUrl; +use bigdecimal::BigDecimal; use clap::{Parser, ValueEnum}; use pipelines::{ Candlesticks, Coins, EnumeratedVolume, Fees, Leaderboards, OrderHistoryPipelines, Prices, @@ -45,11 +46,6 @@ struct Args { aptos_network: Option, } -const MAX_BATCH_SIZE: u64 = 1_000_000; - -/// The number of events a pipeline should target to load into ram at once. -const TARGET_EVENTS: usize = 1_000_000; - #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, ValueEnum)] pub enum Pipelines { Candlesticks, @@ -426,3 +422,43 @@ async fn main() -> Result<()> { Ok(()) } + +/// The maximum number of transactions processed in one batch. +const MAX_BATCH_SIZE: u64 = 1_000_000; +/// The minimum number of transactions processed in one batch. +const MIN_BATCH_SIZE: u64 = 1; + +/// The batch size used to initialize pipelines. +const DEFAULT_BATCH_SIZE: u64 = 1; + +// The coefficient by which to multiply when increasing batch size. +const BATCH_SIZE_INCREASE_COEFFICIENT: u64 = 2; +// The coefficient by which to divide when reducing batch size. +const BATCH_SIZE_REDUCE_COEFFICIENT: u64 = 10; + +/// The number of events a pipeline should target to load into ram at once. +const TARGET_EVENTS: usize = 1_000_000; +// The denominator of the ratio of `TARGET_EVENTS` when to start increasing the batch size. +const TARGET_EVENTS_RATIO_DENOMINATOR: usize = 10; + +/// Update the batch size based on how many events the current batch contained. +fn update_batch_size(current_batch_size: &mut BigDecimal, n_events: usize) { + let min_batch_size = BigDecimal::from(MIN_BATCH_SIZE); + let max_batch_size = BigDecimal::from(MAX_BATCH_SIZE); + + if n_events > TARGET_EVENTS && *current_batch_size > min_batch_size { + *current_batch_size = (current_batch_size.clone() + / BigDecimal::from(BATCH_SIZE_REDUCE_COEFFICIENT)) + .max(min_batch_size); + + tracing::debug!("Batch size reduced to {}", current_batch_size); + } else if n_events < TARGET_EVENTS / TARGET_EVENTS_RATIO_DENOMINATOR + && *current_batch_size < max_batch_size + { + *current_batch_size = (current_batch_size.clone() + * BigDecimal::from(BATCH_SIZE_INCREASE_COEFFICIENT)) + .min(max_batch_size); + + tracing::debug!("Batch size increased to {}", current_batch_size); + } +} diff --git a/src/rust/aggregator/src/pipelines/order_history_pipelines.rs b/src/rust/aggregator/src/pipelines/order_history_pipelines.rs index 300bdfb7..d2501571 100644 --- a/src/rust/aggregator/src/pipelines/order_history_pipelines.rs +++ b/src/rust/aggregator/src/pipelines/order_history_pipelines.rs @@ -8,7 +8,7 @@ use aggregator::{util::*, Pipeline, PipelineAggregationResult, PipelineError}; use sqlx_postgres::Postgres; use tokio::sync::RwLock; -use crate::{TARGET_EVENTS, MAX_BATCH_SIZE}; +use crate::{TARGET_EVENTS, MAX_BATCH_SIZE, update_batch_size, DEFAULT_BATCH_SIZE}; pub const TIMEOUT: std::time::Duration = std::time::Duration::from_secs(1); @@ -39,7 +39,7 @@ impl OrderHistoryPipelines { // Start with a very small batch size. // This way, if the aggregator is restarting after a crash due to too many events in // ram, it will not just crash again. - batch_size: BigDecimal::from(10), + batch_size: BigDecimal::from(DEFAULT_BATCH_SIZE), } } } @@ -214,15 +214,8 @@ impl OrderHistoryPipelines { .await .map_err(to_pipeline_error)?; - // Update the batch size based on how many events the current batch contained. let n_events = places.len() + fills.len() + changes.len() + cancels.len(); - if n_events > TARGET_EVENTS && self.batch_size > BigDecimal::from(1) { - self.batch_size = &self.batch_size / BigDecimal::from(10); - tracing::debug!("Batch size reduced to {}", self.batch_size); - } else if n_events < TARGET_EVENTS / 10 && self.batch_size < BigDecimal::from(MAX_BATCH_SIZE) { - self.batch_size = &self.batch_size * BigDecimal::from(10); - tracing::debug!("Batch size increased to {}", self.batch_size); - } + update_batch_size(&mut self.batch_size, n_events); // Insert all places as orders into the state. for place in places { diff --git a/src/rust/aggregator/src/pipelines/user_history.rs b/src/rust/aggregator/src/pipelines/user_history.rs index 3866a84e..d203a8df 100644 --- a/src/rust/aggregator/src/pipelines/user_history.rs +++ b/src/rust/aggregator/src/pipelines/user_history.rs @@ -8,7 +8,7 @@ use aggregator::{ Pipeline, PipelineAggregationResult, PipelineError, }; -use crate::{dbtypes::OrderType, TARGET_EVENTS, MAX_BATCH_SIZE}; +use crate::{dbtypes::OrderType, TARGET_EVENTS, MAX_BATCH_SIZE, update_batch_size, DEFAULT_BATCH_SIZE}; /// Number of bits to shift when encoding transaction version. const SHIFT_TXN_VERSION: u8 = 64; @@ -29,7 +29,7 @@ impl UserHistory { // Start with a very small batch size. // This way, if the aggregator is restarting after a crash due to too many events in // ram, it will not just crash again. - batch_size: BigDecimal::from(10), + batch_size: BigDecimal::from(DEFAULT_BATCH_SIZE), } } } @@ -127,15 +127,8 @@ impl Pipeline for UserHistory { .await .map_err(|e| PipelineError::ProcessingError(anyhow!(e)))?; - // Update the batch size based on how many events the current batch contained. let n_events = fill_events.len() + change_events.len(); - if n_events > TARGET_EVENTS && self.batch_size > BigDecimal::from(1) { - self.batch_size = &self.batch_size / BigDecimal::from(10); - tracing::debug!("Batch size reduced to {}", self.batch_size); - } else if n_events < TARGET_EVENTS / 10 && self.batch_size < BigDecimal::from(MAX_BATCH_SIZE) { - self.batch_size = &self.batch_size * BigDecimal::from(10); - tracing::debug!("Batch size increased to {}", self.batch_size); - } + update_batch_size(&mut self.batch_size, n_events); // Step through fill and change events in total order. let mut fill_index = 0; diff --git a/src/rust/aggregator/src/util.rs b/src/rust/aggregator/src/util.rs index ee026dfd..3b92958a 100644 --- a/src/rust/aggregator/src/util.rs +++ b/src/rust/aggregator/src/util.rs @@ -1,4 +1,5 @@ use anyhow::anyhow; +use bigdecimal::BigDecimal; use sqlx::{Executor, Pool, Transaction}; use sqlx_postgres::Postgres; From 93946a20b8262eeaafdb8f7970949840d784c1fd Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 3 May 2024 11:39:49 +0200 Subject: [PATCH 13/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 77588445..9edd75e7 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -28,6 +28,10 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- - `/tickers` endpoint `base_volume_nominal` field ([#761]). +### Internal + +- Added dynamic batch sizing to avoid crashes during high usage ([#762]). + ## [v2.1.0] (hot upgradable) ### Added @@ -243,6 +247,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#753]: https://github.com/econia-labs/econia/pull/753 [#760]: https://github.com/econia-labs/econia/pull/760 [#761]: https://github.com/econia-labs/econia/pull/761 +[#762]: https://github.com/econia-labs/econia/pull/762 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [processor #19]: https://github.com/econia-labs/aptos-indexer-processors/pull/19 From af63e447415e5c967d45071a7d0a072918996973 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Mon, 6 May 2024 15:31:14 +0200 Subject: [PATCH 14/37] fix and update deps --- src/rust/Cargo.lock | 70 +++++++++++++++++----------------- src/rust/Cargo.toml | 8 ++-- src/rust/aggregator/Cargo.toml | 2 +- src/rust/aggv2/Cargo.toml | 2 +- src/rust/dbv2/Cargo.toml | 2 +- 5 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index ade12204..09438842 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -75,7 +75,7 @@ dependencies = [ "anyhow", "aptos-sdk", "async-trait", - "bigdecimal 0.3.0", + "bigdecimal 0.3.1", "chrono", "clap 4.4.6", "dotenvy", @@ -99,7 +99,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "bigdecimal 0.3.0", + "bigdecimal 0.3.1", "chrono", "dotenvy", "serde", @@ -1713,9 +1713,9 @@ dependencies = [ [[package]] name = "bigdecimal" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744" +checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" dependencies = [ "num-bigint 0.4.4", "num-integer", @@ -2651,7 +2651,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" name = "dbv2" version = "0.1.0" dependencies = [ - "bigdecimal 0.3.0", + "bigdecimal 0.4.3", "chrono", "diesel", "serde", @@ -2717,11 +2717,11 @@ checksum = "d95203a6a50906215a502507c0f879a0ce7ff205a6111e2db2a5ef8e4bb92e43" [[package]] name = "diesel" -version = "2.1.0" +version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a532c1f99a0f596f6960a60d1e119e91582b24b39e2d83a190e61262c3ef0c" +checksum = "ff236accb9a5069572099f0b350a92e9560e8e63a9b8d546162f4a5e03026bb2" dependencies = [ - "bigdecimal 0.3.0", + "bigdecimal 0.4.3", "bitflags 2.4.0", "byteorder", "chrono", @@ -4218,9 +4218,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" dependencies = [ "cc", "pkg-config", @@ -7202,9 +7202,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e50c216e3624ec8e7ecd14c6a6a6370aad6ee5d8cfc3ab30b5162eeeef2ed33" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" dependencies = [ "sqlx-core", "sqlx-macros", @@ -7215,19 +7215,18 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d6753e460c998bbd4cd8c6f0ed9a64346fcca0723d6e75e52fdc351c5d2169d" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" dependencies = [ "ahash 0.8.11", "atoi", - "bigdecimal 0.3.0", + "bigdecimal 0.3.1", "byteorder", "bytes", "chrono", "crc", "crossbeam-queue", - "dotenvy", "either", "event-listener", "futures-channel", @@ -7260,9 +7259,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a793bb3ba331ec8359c1853bd39eed32cdd7baaf22c35ccf5c92a7e8d1189ec" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" dependencies = [ "proc-macro2", "quote", @@ -7273,9 +7272,9 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a4ee1e104e00dedb6aa5ffdd1343107b0a4702e862a84320ee7cc74782d96fc" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" dependencies = [ "dotenvy", "either", @@ -7299,13 +7298,13 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" dependencies = [ "atoi", "base64 0.21.4", - "bigdecimal 0.3.0", + "bigdecimal 0.3.1", "bitflags 2.4.0", "byteorder", "bytes", @@ -7343,13 +7342,13 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ "atoi", "base64 0.21.4", - "bigdecimal 0.3.0", + "bigdecimal 0.3.1", "bitflags 2.4.0", "byteorder", "chrono", @@ -7373,7 +7372,6 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "sha1", "sha2 0.10.8", "smallvec", "sqlx-core", @@ -7385,9 +7383,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59dc83cf45d89c555a577694534fcd1b55c545a816c816ce51f20bbe56a4f3f" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" dependencies = [ "atoi", "chrono", @@ -7404,6 +7402,7 @@ dependencies = [ "sqlx-core", "tracing", "url", + "urlencoding", ] [[package]] @@ -8326,6 +8325,12 @@ dependencies = [ "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf-8" version = "0.7.6" @@ -8503,12 +8508,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.24.0" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b291546d5d9d1eab74f069c77749f2cb8504a12caa20f0f2de93ddbf6f411888" -dependencies = [ - "rustls-webpki", -] +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "whoami" diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index bcb232a6..dc24cf4d 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -34,10 +34,10 @@ axum = "0.6.19" backtrace = "0.3.58" base64 = "0.13.0" bcs = { git = "https://github.com/aptos-labs/bcs.git", rev = "d31fab9d81748e2594be5cd5cdf845786a30562d" } -bigdecimal = { version = "0.4", features = ["serde"] } +bigdecimal = { version = "=0.4.3", features = ["serde"] } chrono = { version = "0.4", features = ["clock", "serde"] } clap = { version = "4.3.5", features = ["derive", "unstable-styles"] } -diesel = { version = "=2.1.0", features = [ +diesel = { version = "=2.1.6", features = [ "chrono", "postgres", "r2d2", @@ -69,8 +69,8 @@ serde_json = { version = "1.0", features = ["preserve_order"] } serde_yaml = "0.8.24" sha2 = "0.9.3" sha3 = "0.9.1" -sqlx = { version = "0.7.1", features = ["runtime-tokio-rustls"] } -sqlx-postgres = "0.7.1" +sqlx = { version = "0.7.4", features = ["runtime-tokio-rustls"] } +sqlx-postgres = "0.7.4" tempfile = "3.3.0" toml = "0.7.4" thiserror = "1.0.44" diff --git a/src/rust/aggregator/Cargo.toml b/src/rust/aggregator/Cargo.toml index ded60387..29143918 100644 --- a/src/rust/aggregator/Cargo.toml +++ b/src/rust/aggregator/Cargo.toml @@ -8,7 +8,7 @@ aptos-sdk.workspace = true anyhow.workspace = true async-trait = "0.1.73" -bigdecimal = { version = "=0.3.0", features = ["serde"] } +bigdecimal = { version = "0.3.1", features = ["serde"] } chrono.workspace = true clap = { workspace = true, features = ["derive", "string"] } dotenvy.workspace = true diff --git a/src/rust/aggv2/Cargo.toml b/src/rust/aggv2/Cargo.toml index a68a28d8..1dba7d1a 100644 --- a/src/rust/aggv2/Cargo.toml +++ b/src/rust/aggv2/Cargo.toml @@ -14,7 +14,7 @@ rust-version.workspace = true [dependencies] anyhow.workspace = true async-trait = "0.1.73" -bigdecimal = { version = "=0.3.0", features = ["serde"] } +bigdecimal = { version = "0.3.1", features = ["serde"] } chrono.workspace = true dotenvy.workspace = true serde.workspace = true diff --git a/src/rust/dbv2/Cargo.toml b/src/rust/dbv2/Cargo.toml index edbe426d..0a03828e 100644 --- a/src/rust/dbv2/Cargo.toml +++ b/src/rust/dbv2/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bigdecimal = { version = "=0.3.0", features = ["serde"] } +bigdecimal = { workspace = true, features = ["serde"] } chrono = { workspace = true } diesel = { workspace = true, features = ["chrono", "numeric", "postgres"] } serde = { workspace = true } From 8172718cb826c224783edffd90af67eecae27e33 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Mon, 6 May 2024 15:33:58 +0200 Subject: [PATCH 15/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 9edd75e7..83df2ddb 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -31,6 +31,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- ### Internal - Added dynamic batch sizing to avoid crashes during high usage ([#762]). +- Updated Rust dependencies ([#764]). ## [v2.1.0] (hot upgradable) @@ -248,6 +249,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#760]: https://github.com/econia-labs/econia/pull/760 [#761]: https://github.com/econia-labs/econia/pull/761 [#762]: https://github.com/econia-labs/econia/pull/762 +[#764]: https://github.com/econia-labs/econia/pull/764 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [processor #19]: https://github.com/econia-labs/aptos-indexer-processors/pull/19 From 3454037cf9c849a8bd421900bfebae628eb872e2 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 8 May 2024 14:55:25 +0200 Subject: [PATCH 16/37] fix last price in tickers --- .../2024-05-08-124631_fix_nominal_2/down.sql | 42 ++++++++++++++++++ .../2024-05-08-124631_fix_nominal_2/up.sql | 43 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql create mode 100644 src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql diff --git a/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql b/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql new file mode 100644 index 00000000..5ae2e46e --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql @@ -0,0 +1,42 @@ +-- This file should undo anything in `up.sql` +CREATE FUNCTION api.get_market_last_price (market_id numeric) RETURNS NUMERIC AS $$ + SELECT price + FROM fill_events + ORDER BY txn_version DESC, event_idx DESC + LIMIT 1; +$$ LANGUAGE SQL; + + +DROP VIEW api.tickers; + + +CREATE VIEW api.tickers AS +SELECT + market_id, + base_account_address || '::' || base_module_name || '::' || base_struct_name AS base_currency, + quote_account_address || '::' || quote_module_name || '::' || quote_struct_name AS quote_currency, + base_volume_24h AS base_volume, + quote_volume_24h AS quote_volume, + ( + base_volume_24h * + (SELECT lot_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,base_decimals) + ) + AS base_volume_nominal, + ( + quote_volume_24h * + (SELECT tick_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,quote_decimals) + ) + AS quote_volume_nominal, + integer_price_to_quote_nominal(market_id, api.get_market_last_price(market_id)) AS last_price, + integer_price_to_quote_nominal(market_id, api.get_market_best_ask_price(market_id)) AS ask, + integer_price_to_quote_nominal(market_id, api.get_market_best_bid_price(market_id)) AS bid, + integer_price_to_quote_nominal(market_id, api.get_market_24h_high(market_id)) AS high, + integer_price_to_quote_nominal(market_id, api.get_market_24h_low(market_id)) AS low, + api.get_market_liquidity(market_id,200) / get_quote_volume_divisor_for_market(market_id) AS liquidity_in_quote +FROM + api.markets; + + +GRANT SELECT ON api.tickers TO web_anon; diff --git a/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql b/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql new file mode 100644 index 00000000..25af85ef --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql @@ -0,0 +1,43 @@ +-- Your SQL goes here +CREATE FUNCTION api.get_market_last_price (market_id numeric) RETURNS NUMERIC AS $$ + SELECT price + FROM fill_events + WHERE market_id = $1 + ORDER BY txn_version DESC, event_idx DESC + LIMIT 1; +$$ LANGUAGE SQL; + + +DROP VIEW api.tickers; + + +CREATE VIEW api.tickers AS +SELECT + market_id, + base_account_address || '::' || base_module_name || '::' || base_struct_name AS base_currency, + quote_account_address || '::' || quote_module_name || '::' || quote_struct_name AS quote_currency, + base_volume_24h AS base_volume, + quote_volume_24h AS quote_volume, + ( + base_volume_24h * + (SELECT lot_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,base_decimals) + ) + AS base_volume_nominal, + ( + quote_volume_24h * + (SELECT tick_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,quote_decimals) + ) + AS quote_volume_nominal, + integer_price_to_quote_nominal(market_id, api.get_market_last_price(market_id)) AS last_price, + integer_price_to_quote_nominal(market_id, api.get_market_best_ask_price(market_id)) AS ask, + integer_price_to_quote_nominal(market_id, api.get_market_best_bid_price(market_id)) AS bid, + integer_price_to_quote_nominal(market_id, api.get_market_24h_high(market_id)) AS high, + integer_price_to_quote_nominal(market_id, api.get_market_24h_low(market_id)) AS low, + api.get_market_liquidity(market_id,200) / get_quote_volume_divisor_for_market(market_id) AS liquidity_in_quote +FROM + api.markets; + + +GRANT SELECT ON api.tickers TO web_anon; From b608aebec1e335ecacc53c2e6a05eea3c9a625be Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 8 May 2024 16:49:14 +0200 Subject: [PATCH 17/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 83df2ddb..4c63e843 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -27,6 +27,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- ### Fixed - `/tickers` endpoint `base_volume_nominal` field ([#761]). +- `/tickers` endpoint `price` field ([#766]). ### Internal @@ -250,6 +251,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#761]: https://github.com/econia-labs/econia/pull/761 [#762]: https://github.com/econia-labs/econia/pull/762 [#764]: https://github.com/econia-labs/econia/pull/764 +[#766]: https://github.com/econia-labs/econia/pull/766 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [processor #19]: https://github.com/econia-labs/aptos-indexer-processors/pull/19 From 392c0477454c8292d707ce994c7420808cda0f9b Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 8 May 2024 16:57:23 +0200 Subject: [PATCH 18/37] use create and replace --- .../dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql | 2 +- src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql b/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql index 5ae2e46e..bc4902d4 100644 --- a/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql +++ b/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/down.sql @@ -1,5 +1,5 @@ -- This file should undo anything in `up.sql` -CREATE FUNCTION api.get_market_last_price (market_id numeric) RETURNS NUMERIC AS $$ +CREATE OR REPLACE FUNCTION api.get_market_last_price (market_id numeric) RETURNS NUMERIC AS $$ SELECT price FROM fill_events ORDER BY txn_version DESC, event_idx DESC diff --git a/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql b/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql index 25af85ef..b54c0c9f 100644 --- a/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql +++ b/src/rust/dbv2/migrations/2024-05-08-124631_fix_nominal_2/up.sql @@ -1,5 +1,5 @@ -- Your SQL goes here -CREATE FUNCTION api.get_market_last_price (market_id numeric) RETURNS NUMERIC AS $$ +CREATE OR REPLACE FUNCTION api.get_market_last_price (market_id numeric) RETURNS NUMERIC AS $$ SELECT price FROM fill_events WHERE market_id = $1 From 349d6431dba7bf35b6708f1d25a8a4af86759c29 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 8 May 2024 16:44:40 +0200 Subject: [PATCH 19/37] fix migrations and rolling volume bug --- ...b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json} | 4 ++-- ...6904f654484a257419a3d196835b4f2cc3756e7f6bcabeaee2d5.json} | 4 ++-- .../rolling_volume/insert_daily_rolling_volume.sql | 4 +++- src/rust/aggv2/src/feed.rs | 2 +- src/rust/dbv2/check_db.sh | 2 +- .../up.sql | 1 + src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql | 1 + src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql | 4 ++-- 8 files changed, 13 insertions(+), 9 deletions(-) rename src/rust/.sqlx/{query-eb4155db42a5d4ef61a291a4644b436ed001e7a3b4375667e1ad72951c44fc87.json => query-b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json} (83%) rename src/rust/.sqlx/{query-444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174.json => query-bae01b66db956904f654484a257419a3d196835b4f2cc3756e7f6bcabeaee2d5.json} (62%) diff --git a/src/rust/.sqlx/query-eb4155db42a5d4ef61a291a4644b436ed001e7a3b4375667e1ad72951c44fc87.json b/src/rust/.sqlx/query-b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json similarity index 83% rename from src/rust/.sqlx/query-eb4155db42a5d4ef61a291a4644b436ed001e7a3b4375667e1ad72951c44fc87.json rename to src/rust/.sqlx/query-b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json index 6ac04dee..3bb109aa 100644 --- a/src/rust/.sqlx/query-eb4155db42a5d4ef61a291a4644b436ed001e7a3b4375667e1ad72951c44fc87.json +++ b/src/rust/.sqlx/query-b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO aggregator.daily_rolling_volume_history\n(\"time\", \"market_id\", \"volume_in_quote_subunits\")\nWITH \"times\" AS (\n SELECT\n DATE_TRUNC('minute', dd) AS \"time\"\n FROM\n generate_series((SELECT \"time\" FROM fill_events ORDER BY \"time\" LIMIT 1), (SELECT * FROM aggregator.order_history_latest_event_timestamp), '1 minute'::interval) dd\n WHERE\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n dd > (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp)\n)\nSELECT\n \"times\".\"time\",\n fill_events.market_id,\n SUM(fill_events.\"size\" * fill_events.price) * market_registration_events.tick_size AS volume_in_quote_subunits\nFROM\n fill_events,\n market_registration_events,\n \"times\"\nWHERE\n fill_events.maker_address = fill_events.emit_address\nAND\n fill_events.\"time\" BETWEEN (\"times\".\"time\" - '1 day'::interval) AND \"times\".\"time\"\nAND\n market_registration_events.market_id = fill_events.market_id\nGROUP BY\n fill_events.market_id,\n market_registration_events.tick_size,\n \"times\".\"time\";\n", + "query": "INSERT INTO aggregator.daily_rolling_volume_history\n(\"time\", \"market_id\", \"volume_in_quote_subunits\")\nWITH \"times\" AS (\n SELECT\n DATE_TRUNC('minute', dd) AS \"time\"\n FROM\n generate_series((SELECT \"time\" FROM fill_events ORDER BY \"time\" LIMIT 1), (SELECT * FROM aggregator.order_history_latest_event_timestamp), '1 minute'::interval) dd\n WHERE\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n dd > (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp)\n)\nSELECT\n \"times\".\"time\",\n fill_events.market_id,\n SUM(fill_events.\"size\" * fill_events.price) * market_registration_events.tick_size AS volume_in_quote_subunits\nFROM\n fill_events,\n market_registration_events,\n \"times\"\nWHERE\n fill_events.maker_address = fill_events.emit_address\nAND\n fill_events.\"time\" BETWEEN (\"times\".\"time\" - '1 day'::interval) AND \"times\".\"time\"\nAND\n market_registration_events.market_id = fill_events.market_id\nGROUP BY\n fill_events.market_id,\n market_registration_events.tick_size,\n \"times\".\"time\"\nON CONFLICT ON CONSTRAINT daily_rolling_volume_history_pkey DO UPDATE\nSET volume_in_quote_subunits = EXCLUDED.volume_in_quote_subunits;\n", "describe": { "columns": [], "parameters": { @@ -8,5 +8,5 @@ }, "nullable": [] }, - "hash": "eb4155db42a5d4ef61a291a4644b436ed001e7a3b4375667e1ad72951c44fc87" + "hash": "b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d" } diff --git a/src/rust/.sqlx/query-444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174.json b/src/rust/.sqlx/query-bae01b66db956904f654484a257419a3d196835b4f2cc3756e7f6bcabeaee2d5.json similarity index 62% rename from src/rust/.sqlx/query-444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174.json rename to src/rust/.sqlx/query-bae01b66db956904f654484a257419a3d196835b4f2cc3756e7f6bcabeaee2d5.json index abfbf92a..7730b5fc 100644 --- a/src/rust/.sqlx/query-444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174.json +++ b/src/rust/.sqlx/query-bae01b66db956904f654484a257419a3d196835b4f2cc3756e7f6bcabeaee2d5.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT \"time\" FROM events WHERE \"time\" > $1 ORDER BY \"time\" offset $2 limit 1", + "query": "SELECT \"time\" FROM aggv2.events WHERE \"time\" > $1 ORDER BY \"time\" offset $2 limit 1", "describe": { "columns": [ { @@ -19,5 +19,5 @@ false ] }, - "hash": "444889bb869590a596f1691ee3b2dda824b8fcf666efbeb9960539e0f2510174" + "hash": "bae01b66db956904f654484a257419a3d196835b4f2cc3756e7f6bcabeaee2d5" } diff --git a/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql b/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql index 432217dc..d10bb387 100644 --- a/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql +++ b/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql @@ -27,4 +27,6 @@ AND GROUP BY fill_events.market_id, market_registration_events.tick_size, - "times"."time"; + "times"."time" +ON CONFLICT ON CONSTRAINT daily_rolling_volume_history_pkey DO UPDATE +SET volume_in_quote_subunits = EXCLUDED.volume_in_quote_subunits; diff --git a/src/rust/aggv2/src/feed.rs b/src/rust/aggv2/src/feed.rs index 5b14590e..51801317 100644 --- a/src/rust/aggv2/src/feed.rs +++ b/src/rust/aggv2/src/feed.rs @@ -65,7 +65,7 @@ pub async fn fill_cache( }; let mut new_event_cache = BTreeMap::new(); let limit = sqlx::query!( - r#"SELECT "time" FROM events WHERE "time" > $1 ORDER BY "time" offset $2 limit 1"#, + r#"SELECT "time" FROM aggv2.events WHERE "time" > $1 ORDER BY "time" offset $2 limit 1"#, start_timestamp, amount_of_events - 1 ) diff --git a/src/rust/dbv2/check_db.sh b/src/rust/dbv2/check_db.sh index 98c1d786..4db7b63f 100644 --- a/src/rust/dbv2/check_db.sh +++ b/src/rust/dbv2/check_db.sh @@ -2,7 +2,7 @@ echo "Starting a dedicated PostgreSQL Docker instance" -docker run -d --rm --name econia_db_test -e POSTGRES_PASSWORD=pgpw -p 37949:5432 postgres > /dev/null +docker run -d --rm --name econia_db_test -e POSTGRES_PASSWORD=pgpw -e POSTGRES_DB=econia -p 37949:5432 postgres > /dev/null TEST_DATABASE_URL=postgres://postgres:pgpw@localhost:37949/econia diff --git a/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql b/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql index a2b79518..33b6ef2e 100644 --- a/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql +++ b/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql @@ -1,3 +1,4 @@ -- Your SQL goes here +DELETE FROM aggregator.daily_rolling_volume_history; ALTER TABLE aggregator.daily_rolling_volume_history ADD PRIMARY KEY ("time", market_id); ALTER TABLE aggregator.spreads ADD PRIMARY KEY ("time", market_id); diff --git a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql index 672eb979..a0aa0ca7 100644 --- a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql +++ b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/down.sql @@ -6,5 +6,6 @@ DROP TABLE aggv2.state_cache; DROP TABLE aggv2.spread; DROP TABLE aggv2.volume; DROP TABLE aggv2.liquidity; +DROP TABLE aggv2.events; DROP SCHEMA aggv2; diff --git a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql index 6c300fe5..668fc43d 100644 --- a/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql +++ b/src/rust/dbv2/migrations/2024-04-09-142800_aggv2/up.sql @@ -60,11 +60,11 @@ CREATE TABLE aggv2.liquidity ( PRIMARY KEY (time, market_id, bps_times_ten) ); -CREATE TABLE events ( +CREATE TABLE aggv2.events ( transaction_verson NUMERIC NOT NULL, event_index NUMERIC NOT NULL, "time" TIMESTAMPTZ NOT NULL, PRIMARY KEY (transaction_verson, event_index) ); -CREATE INDEX events_time ON events ("time"); +CREATE INDEX events_time ON aggv2.events ("time"); From 78ca0bb1ae6343da55a059658a63d9f3deaaddff Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 8 May 2024 16:47:20 +0200 Subject: [PATCH 20/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 4c63e843..1e1584d7 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -28,6 +28,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- - `/tickers` endpoint `base_volume_nominal` field ([#761]). - `/tickers` endpoint `price` field ([#766]). +- fixed potential duplicates in `daily_rolling_volume_history`([#765]). ### Internal @@ -251,6 +252,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#761]: https://github.com/econia-labs/econia/pull/761 [#762]: https://github.com/econia-labs/econia/pull/762 [#764]: https://github.com/econia-labs/econia/pull/764 +[#765]: https://github.com/econia-labs/econia/pull/765 [#766]: https://github.com/econia-labs/econia/pull/766 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 From f1149889d50fac450395e700e9fd276f7167a01a Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Thu, 9 May 2024 16:02:46 +0200 Subject: [PATCH 21/37] allow regeneration of historical data --- .../2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql b/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql index 33b6ef2e..b9a7c5bb 100644 --- a/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql +++ b/src/rust/dbv2/migrations/2024-04-01-112425_add_pkey_to_rolling_volume_history/up.sql @@ -1,4 +1,5 @@ -- Your SQL goes here DELETE FROM aggregator.daily_rolling_volume_history; +DELETE FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp; ALTER TABLE aggregator.daily_rolling_volume_history ADD PRIMARY KEY ("time", market_id); ALTER TABLE aggregator.spreads ADD PRIMARY KEY ("time", market_id); From 6739139a9fec151fd7bbdd11d5bc2c7a0caa22c8 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 10 May 2024 12:18:09 +0200 Subject: [PATCH 22/37] fix price when tick size isn't 0 --- .../2024-05-10-100712_fix_price_nominal/down.sql | 4 ++++ .../2024-05-10-100712_fix_price_nominal/up.sql | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 src/rust/dbv2/migrations/2024-05-10-100712_fix_price_nominal/down.sql create mode 100644 src/rust/dbv2/migrations/2024-05-10-100712_fix_price_nominal/up.sql diff --git a/src/rust/dbv2/migrations/2024-05-10-100712_fix_price_nominal/down.sql b/src/rust/dbv2/migrations/2024-05-10-100712_fix_price_nominal/down.sql new file mode 100644 index 00000000..d8da09a1 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-10-100712_fix_price_nominal/down.sql @@ -0,0 +1,4 @@ +-- This file should undo anything in `up.sql` +CREATE OR REPLACE FUNCTION integer_price_to_quote_nominal(market_id numeric, price numeric) RETURNS NUMERIC IMMUTABLE AS $$ + SELECT integer_price_to_quote_indivisible_subunits(market_id, price) / get_quote_volume_divisor_for_market(market_id); +$$ LANGUAGE sql; diff --git a/src/rust/dbv2/migrations/2024-05-10-100712_fix_price_nominal/up.sql b/src/rust/dbv2/migrations/2024-05-10-100712_fix_price_nominal/up.sql new file mode 100644 index 00000000..d263d497 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-10-100712_fix_price_nominal/up.sql @@ -0,0 +1,10 @@ +-- Your SQL goes here +CREATE OR REPLACE FUNCTION integer_price_to_quote_nominal(market_id numeric, price numeric) RETURNS NUMERIC IMMUTABLE AS $$ + SELECT integer_price_to_quote_indivisible_subunits($1, $2) / POW(10,decimals) + FROM market_registration_events AS m + INNER JOIN api.coins AS c + ON m.quote_account_address = c."address" + AND m.quote_module_name = c.module + AND m.quote_struct_name = c.struct + WHERE market_id = $1; +$$ LANGUAGE sql; From 4eaaba40fed3ec013df785c83fe31810ffe071df Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 10 May 2024 12:20:09 +0200 Subject: [PATCH 23/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 1e1584d7..1334734a 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -28,6 +28,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- - `/tickers` endpoint `base_volume_nominal` field ([#761]). - `/tickers` endpoint `price` field ([#766]). +- fixed nominal issues when tickers isn't 0 ([#767]). - fixed potential duplicates in `daily_rolling_volume_history`([#765]). ### Internal @@ -254,6 +255,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#764]: https://github.com/econia-labs/econia/pull/764 [#765]: https://github.com/econia-labs/econia/pull/765 [#766]: https://github.com/econia-labs/econia/pull/766 +[#767]: https://github.com/econia-labs/econia/pull/767 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [processor #19]: https://github.com/econia-labs/aptos-indexer-processors/pull/19 From 90989990e3dc65eb03de478ba509c4550d4327f4 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 10 May 2024 15:22:15 +0200 Subject: [PATCH 24/37] speed up daily volume --- .../insert_daily_rolling_volume.sql | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql b/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql index d10bb387..e39c95b0 100644 --- a/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql +++ b/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql @@ -1,32 +1,32 @@ INSERT INTO aggregator.daily_rolling_volume_history ("time", "market_id", "volume_in_quote_subunits") -WITH "times" AS ( +WITH vpm AS ( SELECT - DATE_TRUNC('minute', dd) AS "time" - FROM - generate_series((SELECT "time" FROM fill_events ORDER BY "time" LIMIT 1), (SELECT * FROM aggregator.order_history_latest_event_timestamp), '1 minute'::interval) dd - WHERE + SUM(size * price) volume, + DATE_TRUNC('minute', "time") AS minute, + market_id + FROM fill_events + WHERE emit_address = maker_address + AND ( + (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL + OR + DATE_TRUNC('minute', "time") >= DATE_TRUNC('minute', (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp)) - interval '1 day' + ) + GROUP BY DATE_TRUNC('minute', "time"), market_id + ORDER BY DATE_TRUNC('minute', "time") +), +t AS ( + SELECT + minute, + market_id, + SUM(volume) OVER (PARTITION BY market_id ORDER BY minute RANGE BETWEEN '24 hours' PRECEDING AND CURRENT ROW) AS volume + FROM vpm +) +SELECT * FROM t +WHERE ( (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL OR - dd > (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) + "minute" >= DATE_TRUNC('minute', (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp)) ) -SELECT - "times"."time", - fill_events.market_id, - SUM(fill_events."size" * fill_events.price) * market_registration_events.tick_size AS volume_in_quote_subunits -FROM - fill_events, - market_registration_events, - "times" -WHERE - fill_events.maker_address = fill_events.emit_address -AND - fill_events."time" BETWEEN ("times"."time" - '1 day'::interval) AND "times"."time" -AND - market_registration_events.market_id = fill_events.market_id -GROUP BY - fill_events.market_id, - market_registration_events.tick_size, - "times"."time" ON CONFLICT ON CONSTRAINT daily_rolling_volume_history_pkey DO UPDATE SET volume_in_quote_subunits = EXCLUDED.volume_in_quote_subunits; From 36e9d82dc8b4015c2734ea54356d37d478b77a69 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 10 May 2024 17:27:26 +0200 Subject: [PATCH 25/37] generate sqlx --- ...3e092b87486e1cb06fae58c5559f83d3b62e977d8361.json | 12 ++++++++++++ ...d04b99ce710735039dbf71d1e10b2a32ee342901d03d.json | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 src/rust/.sqlx/query-52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361.json delete mode 100644 src/rust/.sqlx/query-b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json diff --git a/src/rust/.sqlx/query-52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361.json b/src/rust/.sqlx/query-52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361.json new file mode 100644 index 00000000..73341f63 --- /dev/null +++ b/src/rust/.sqlx/query-52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO aggregator.daily_rolling_volume_history\n(\"time\", \"market_id\", \"volume_in_quote_subunits\")\nWITH vpm AS (\n SELECT\n SUM(size * price) volume,\n DATE_TRUNC('minute', \"time\") AS minute,\n market_id\n FROM fill_events\n WHERE emit_address = maker_address\n AND (\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n DATE_TRUNC('minute', \"time\") >= DATE_TRUNC('minute', (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp)) - interval '1 day'\n )\n GROUP BY DATE_TRUNC('minute', \"time\"), market_id\n ORDER BY DATE_TRUNC('minute', \"time\")\n),\nt AS (\n SELECT\n minute,\n market_id,\n SUM(volume) OVER (PARTITION BY market_id ORDER BY minute RANGE BETWEEN '24 hours' PRECEDING AND CURRENT ROW) AS volume\n FROM vpm\n)\nSELECT * FROM t\nWHERE (\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n \"minute\" >= DATE_TRUNC('minute', (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp))\n)\nON CONFLICT ON CONSTRAINT daily_rolling_volume_history_pkey DO UPDATE\nSET volume_in_quote_subunits = EXCLUDED.volume_in_quote_subunits;\n", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361" +} diff --git a/src/rust/.sqlx/query-b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json b/src/rust/.sqlx/query-b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json deleted file mode 100644 index 3bb109aa..00000000 --- a/src/rust/.sqlx/query-b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO aggregator.daily_rolling_volume_history\n(\"time\", \"market_id\", \"volume_in_quote_subunits\")\nWITH \"times\" AS (\n SELECT\n DATE_TRUNC('minute', dd) AS \"time\"\n FROM\n generate_series((SELECT \"time\" FROM fill_events ORDER BY \"time\" LIMIT 1), (SELECT * FROM aggregator.order_history_latest_event_timestamp), '1 minute'::interval) dd\n WHERE\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n dd > (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp)\n)\nSELECT\n \"times\".\"time\",\n fill_events.market_id,\n SUM(fill_events.\"size\" * fill_events.price) * market_registration_events.tick_size AS volume_in_quote_subunits\nFROM\n fill_events,\n market_registration_events,\n \"times\"\nWHERE\n fill_events.maker_address = fill_events.emit_address\nAND\n fill_events.\"time\" BETWEEN (\"times\".\"time\" - '1 day'::interval) AND \"times\".\"time\"\nAND\n market_registration_events.market_id = fill_events.market_id\nGROUP BY\n fill_events.market_id,\n market_registration_events.tick_size,\n \"times\".\"time\"\nON CONFLICT ON CONSTRAINT daily_rolling_volume_history_pkey DO UPDATE\nSET volume_in_quote_subunits = EXCLUDED.volume_in_quote_subunits;\n", - "describe": { - "columns": [], - "parameters": { - "Left": [] - }, - "nullable": [] - }, - "hash": "b36001ac8929b9dfe41cd04b99ce710735039dbf71d1e10b2a32ee342901d03d" -} From bf89aa198173056c93c8217b27ffe1d3cfb562ee Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 10 May 2024 18:56:44 +0200 Subject: [PATCH 26/37] fix tick logic --- ...c5cd8556a7daa33b9c1912b299f140330b7045cd79643cbc7fa3.json} | 4 ++-- .../rolling_volume/insert_daily_rolling_volume.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/rust/.sqlx/{query-52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361.json => query-8d983e8a99ffc5cd8556a7daa33b9c1912b299f140330b7045cd79643cbc7fa3.json} (62%) diff --git a/src/rust/.sqlx/query-52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361.json b/src/rust/.sqlx/query-8d983e8a99ffc5cd8556a7daa33b9c1912b299f140330b7045cd79643cbc7fa3.json similarity index 62% rename from src/rust/.sqlx/query-52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361.json rename to src/rust/.sqlx/query-8d983e8a99ffc5cd8556a7daa33b9c1912b299f140330b7045cd79643cbc7fa3.json index 73341f63..4dbfd9ac 100644 --- a/src/rust/.sqlx/query-52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361.json +++ b/src/rust/.sqlx/query-8d983e8a99ffc5cd8556a7daa33b9c1912b299f140330b7045cd79643cbc7fa3.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO aggregator.daily_rolling_volume_history\n(\"time\", \"market_id\", \"volume_in_quote_subunits\")\nWITH vpm AS (\n SELECT\n SUM(size * price) volume,\n DATE_TRUNC('minute', \"time\") AS minute,\n market_id\n FROM fill_events\n WHERE emit_address = maker_address\n AND (\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n DATE_TRUNC('minute', \"time\") >= DATE_TRUNC('minute', (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp)) - interval '1 day'\n )\n GROUP BY DATE_TRUNC('minute', \"time\"), market_id\n ORDER BY DATE_TRUNC('minute', \"time\")\n),\nt AS (\n SELECT\n minute,\n market_id,\n SUM(volume) OVER (PARTITION BY market_id ORDER BY minute RANGE BETWEEN '24 hours' PRECEDING AND CURRENT ROW) AS volume\n FROM vpm\n)\nSELECT * FROM t\nWHERE (\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n \"minute\" >= DATE_TRUNC('minute', (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp))\n)\nON CONFLICT ON CONSTRAINT daily_rolling_volume_history_pkey DO UPDATE\nSET volume_in_quote_subunits = EXCLUDED.volume_in_quote_subunits;\n", + "query": "INSERT INTO aggregator.daily_rolling_volume_history\n(\"time\", \"market_id\", \"volume_in_quote_subunits\")\nWITH vpm AS (\n SELECT\n SUM(size * price) volume,\n DATE_TRUNC('minute', \"time\") AS minute,\n market_id\n FROM fill_events\n WHERE emit_address = maker_address\n AND (\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n DATE_TRUNC('minute', \"time\") >= DATE_TRUNC('minute', (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp)) - interval '1 day'\n )\n GROUP BY DATE_TRUNC('minute', \"time\"), market_id\n ORDER BY DATE_TRUNC('minute', \"time\")\n),\nt AS (\n SELECT\n minute,\n market_id,\n SUM(volume) OVER (PARTITION BY market_id ORDER BY minute RANGE BETWEEN '24 hours' PRECEDING AND CURRENT ROW) AS volume\n FROM vpm\n)\nSELECT minute, market_id, volume * (SELECT tick_size FROM market_registration_events m WHERE m.market_id = t.market_id) FROM t\nWHERE (\n (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL\n OR\n \"minute\" >= DATE_TRUNC('minute', (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp))\n)\nON CONFLICT ON CONSTRAINT daily_rolling_volume_history_pkey DO UPDATE\nSET volume_in_quote_subunits = EXCLUDED.volume_in_quote_subunits;\n", "describe": { "columns": [], "parameters": { @@ -8,5 +8,5 @@ }, "nullable": [] }, - "hash": "52307376a0641fb813633e092b87486e1cb06fae58c5559f83d3b62e977d8361" + "hash": "8d983e8a99ffc5cd8556a7daa33b9c1912b299f140330b7045cd79643cbc7fa3" } diff --git a/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql b/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql index e39c95b0..5940dc16 100644 --- a/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql +++ b/src/rust/aggregator/sqlx_queries/rolling_volume/insert_daily_rolling_volume.sql @@ -22,7 +22,7 @@ t AS ( SUM(volume) OVER (PARTITION BY market_id ORDER BY minute RANGE BETWEEN '24 hours' PRECEDING AND CURRENT ROW) AS volume FROM vpm ) -SELECT * FROM t +SELECT minute, market_id, volume * (SELECT tick_size FROM market_registration_events m WHERE m.market_id = t.market_id) FROM t WHERE ( (SELECT * FROM aggregator.daily_rolling_volume_history_last_indexed_timestamp) IS NULL OR From 992a367e26ed31a5ddf1687e8fc942cc00272b9b Mon Sep 17 00:00:00 2001 From: alnoki <43892045+alnoki@users.noreply.github.com> Date: Fri, 10 May 2024 12:05:30 -0500 Subject: [PATCH 27/37] Fix typo on tick size --- doc/doc-site/docs/off-chain/dss/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 1334734a..d9a8b18e 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -28,7 +28,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- - `/tickers` endpoint `base_volume_nominal` field ([#761]). - `/tickers` endpoint `price` field ([#766]). -- fixed nominal issues when tickers isn't 0 ([#767]). +- fixed nominal issues when tickers isn't 1 ([#767]). - fixed potential duplicates in `daily_rolling_volume_history`([#765]). ### Internal From 01cb4acaec23746828a27a627794d2ce3bc0b2ca Mon Sep 17 00:00:00 2001 From: alnoki <43892045+alnoki@users.noreply.github.com> Date: Fri, 10 May 2024 12:10:01 -0500 Subject: [PATCH 28/37] Add note on changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 1e1584d7..8785f3cc 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -34,6 +34,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- - Added dynamic batch sizing to avoid crashes during high usage ([#762]). - Updated Rust dependencies ([#764]). +- Optimize daily volume calculations wrapped query ([#768]). ## [v2.1.0] (hot upgradable) @@ -254,6 +255,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#764]: https://github.com/econia-labs/econia/pull/764 [#765]: https://github.com/econia-labs/econia/pull/765 [#766]: https://github.com/econia-labs/econia/pull/766 +[#768]: https://github.com/econia-labs/econia/pull/768 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [processor #19]: https://github.com/econia-labs/aptos-indexer-processors/pull/19 From 12a480d2eaae0c42706ceae60b7adce409730710 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Sun, 12 May 2024 18:17:30 +0200 Subject: [PATCH 29/37] fix tick size calculations --- .../2024-05-12-144131_fix_tick_size/down.sql | 59 ++++++++++++++++++ .../2024-05-12-144131_fix_tick_size/up.sql | 61 +++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 src/rust/dbv2/migrations/2024-05-12-144131_fix_tick_size/down.sql create mode 100644 src/rust/dbv2/migrations/2024-05-12-144131_fix_tick_size/up.sql diff --git a/src/rust/dbv2/migrations/2024-05-12-144131_fix_tick_size/down.sql b/src/rust/dbv2/migrations/2024-05-12-144131_fix_tick_size/down.sql new file mode 100644 index 00000000..2d1e5fde --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-12-144131_fix_tick_size/down.sql @@ -0,0 +1,59 @@ +-- This file should undo anything in `up.sql` +CREATE OR REPLACE FUNCTION api.get_market_liquidity (market_id numeric, depth numeric) RETURNS NUMERIC AS $$ + SELECT (amount_ask_ticks + amount_bid_ticks) / (SELECT tick_size FROM market_registration_events WHERE market_id = $1) + FROM api.liquidity + WHERE group_id = ( + SELECT group_id FROM api.liquidity_groups WHERE name = 'all' AND market_id = $1 + ) + AND bps_times_ten = $2 * 10 + ORDER BY "time" DESC + LIMIT 1; +$$ LANGUAGE SQL; + + +CREATE OR REPLACE FUNCTION get_quote_volume_divisor_for_market(numeric) RETURNS NUMERIC IMMUTABLE AS $$ + SELECT tick_size * POW(10::numeric,decimals::numeric) + FROM market_registration_events AS m + INNER JOIN api.coins AS c + ON m.quote_account_address = c."address" + AND m.quote_module_name = c.module + AND m.quote_struct_name = c.struct + WHERE market_id = $1; +$$ LANGUAGE sql; + + +CREATE OR REPLACE VIEW api.tickers AS +SELECT + market_id, + base_account_address || '::' || base_module_name || '::' || base_struct_name AS base_currency, + quote_account_address || '::' || quote_module_name || '::' || quote_struct_name AS quote_currency, + base_volume_24h AS base_volume, + quote_volume_24h AS quote_volume, + ( + base_volume_24h * + (SELECT lot_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,base_decimals) + ) + AS base_volume_nominal, + ( + quote_volume_24h * + (SELECT tick_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,quote_decimals) + ) + AS quote_volume_nominal, + integer_price_to_quote_nominal(market_id, api.get_market_last_price(market_id)) AS last_price, + integer_price_to_quote_nominal(market_id, api.get_market_best_ask_price(market_id)) AS ask, + integer_price_to_quote_nominal(market_id, api.get_market_best_bid_price(market_id)) AS bid, + integer_price_to_quote_nominal(market_id, api.get_market_24h_high(market_id)) AS high, + integer_price_to_quote_nominal(market_id, api.get_market_24h_low(market_id)) AS low, + api.get_market_liquidity(market_id,200) / get_quote_volume_divisor_for_market(market_id) AS liquidity_in_quote +FROM + api.markets; + + +DROP FUNCTION api.quote_indivisible_subunits_to_nominal; + + +GRANT +SELECT + ON api.tickers TO web_anon; diff --git a/src/rust/dbv2/migrations/2024-05-12-144131_fix_tick_size/up.sql b/src/rust/dbv2/migrations/2024-05-12-144131_fix_tick_size/up.sql new file mode 100644 index 00000000..e11ee672 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-12-144131_fix_tick_size/up.sql @@ -0,0 +1,61 @@ +-- Your SQL goes here +CREATE OR REPLACE FUNCTION api.get_market_liquidity (market_id numeric, depth numeric) RETURNS NUMERIC AS $$ + SELECT (amount_ask_ticks + amount_bid_ticks) * (SELECT tick_size FROM market_registration_events WHERE market_id = $1) + FROM api.liquidity + WHERE group_id = ( + SELECT group_id FROM api.liquidity_groups WHERE name = 'all' AND market_id = $1 + ) + AND bps_times_ten = $2 * 10 + ORDER BY "time" DESC + LIMIT 1; +$$ LANGUAGE SQL; + + +CREATE OR REPLACE FUNCTION api.quote_indivisible_subunits_to_nominal (market_id numeric, subunits numeric) RETURNS NUMERIC AS $$ + SELECT subunits / POW(10::numeric,quote_decimals::numeric) FROM api.markets WHERE markets.market_id = $1; +$$ LANGUAGE SQL; + + +CREATE OR REPLACE FUNCTION get_quote_volume_divisor_for_market(numeric) RETURNS NUMERIC IMMUTABLE AS $$ + SELECT POW(10::numeric,decimals::numeric) / tick_size + FROM market_registration_events AS m + INNER JOIN api.coins AS c + ON m.quote_account_address = c."address" + AND m.quote_module_name = c.module + AND m.quote_struct_name = c.struct + WHERE market_id = $1; +$$ LANGUAGE sql; + + +CREATE OR REPLACE VIEW api.tickers AS +SELECT + market_id, + base_account_address || '::' || base_module_name || '::' || base_struct_name AS base_currency, + quote_account_address || '::' || quote_module_name || '::' || quote_struct_name AS quote_currency, + base_volume_24h AS base_volume, + quote_volume_24h AS quote_volume, + ( + base_volume_24h * + (SELECT lot_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,base_decimals) + ) + AS base_volume_nominal, + ( + quote_volume_24h * + (SELECT tick_size FROM market_registration_events AS x WHERE x.market_id = markets.market_id) / + POW(10,quote_decimals) + ) + AS quote_volume_nominal, + integer_price_to_quote_nominal(market_id, api.get_market_last_price(market_id)) AS last_price, + integer_price_to_quote_nominal(market_id, api.get_market_best_ask_price(market_id)) AS ask, + integer_price_to_quote_nominal(market_id, api.get_market_best_bid_price(market_id)) AS bid, + integer_price_to_quote_nominal(market_id, api.get_market_24h_high(market_id)) AS high, + integer_price_to_quote_nominal(market_id, api.get_market_24h_low(market_id)) AS low, + api.quote_indivisible_subunits_to_nominal(market_id, api.get_market_liquidity(market_id,200)) AS liquidity_in_quote +FROM + api.markets; + + +GRANT +SELECT + ON api.tickers TO web_anon; From 3d6aebf57fb964ee407e790fa693d3817be47135 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Mon, 13 May 2024 12:02:43 +0200 Subject: [PATCH 30/37] update openapi json --- doc/doc-site/openapi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doc-site/openapi.json b/doc/doc-site/openapi.json index 95e2dbe0..c53eec82 100644 --- a/doc/doc-site/openapi.json +++ b/doc/doc-site/openapi.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"description":"This is a dynamic API generated by PostgREST","title":"PostgREST API","version":"11.2.1"},"host":"0.0.0.0:3000","basePath":"/","schemes":["http"],"consumes":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json","text/csv"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json","text/csv"],"paths":{"/":{"get":{"tags":["Introspection"],"summary":"OpenAPI description (this document)","produces":["application/openapi+json","application/json"],"responses":{"200":{"description":"OK"}}}},"/tickers":{"get":{"tags":["tickers"],"parameters":[{"$ref":"#/parameters/rowFilter.tickers.market_id"},{"$ref":"#/parameters/rowFilter.tickers.base_currency"},{"$ref":"#/parameters/rowFilter.tickers.quote_currency"},{"$ref":"#/parameters/rowFilter.tickers.base_volume"},{"$ref":"#/parameters/rowFilter.tickers.quote_volume"},{"$ref":"#/parameters/rowFilter.tickers.base_volume_nominal"},{"$ref":"#/parameters/rowFilter.tickers.quote_volume_nominal"},{"$ref":"#/parameters/rowFilter.tickers.last_price"},{"$ref":"#/parameters/rowFilter.tickers.ask"},{"$ref":"#/parameters/rowFilter.tickers.bid"},{"$ref":"#/parameters/rowFilter.tickers.high"},{"$ref":"#/parameters/rowFilter.tickers.low"},{"$ref":"#/parameters/rowFilter.tickers.liquidity_in_quote"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/tickers"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/market_registration_events":{"get":{"tags":["market_registration_events"],"parameters":[{"$ref":"#/parameters/rowFilter.market_registration_events.txn_version"},{"$ref":"#/parameters/rowFilter.market_registration_events.event_idx"},{"$ref":"#/parameters/rowFilter.market_registration_events.market_id"},{"$ref":"#/parameters/rowFilter.market_registration_events.time"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.lot_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.tick_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.min_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.underwriter_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/market_registration_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["market_registration_events"],"parameters":[{"$ref":"#/parameters/body.market_registration_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["market_registration_events"],"parameters":[{"$ref":"#/parameters/rowFilter.market_registration_events.txn_version"},{"$ref":"#/parameters/rowFilter.market_registration_events.event_idx"},{"$ref":"#/parameters/rowFilter.market_registration_events.market_id"},{"$ref":"#/parameters/rowFilter.market_registration_events.time"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.lot_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.tick_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.min_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.underwriter_id"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["market_registration_events"],"parameters":[{"$ref":"#/parameters/rowFilter.market_registration_events.txn_version"},{"$ref":"#/parameters/rowFilter.market_registration_events.event_idx"},{"$ref":"#/parameters/rowFilter.market_registration_events.market_id"},{"$ref":"#/parameters/rowFilter.market_registration_events.time"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.lot_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.tick_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.min_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.underwriter_id"},{"$ref":"#/parameters/body.market_registration_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/enumerated_volume":{"get":{"tags":["enumerated_volume"],"parameters":[{"$ref":"#/parameters/rowFilter.enumerated_volume.address"},{"$ref":"#/parameters/rowFilter.enumerated_volume.module"},{"$ref":"#/parameters/rowFilter.enumerated_volume.struct"},{"$ref":"#/parameters/rowFilter.enumerated_volume.volume_as_base"},{"$ref":"#/parameters/rowFilter.enumerated_volume.volume_as_quote"},{"$ref":"#/parameters/rowFilter.enumerated_volume.generic_asset_name"},{"$ref":"#/parameters/rowFilter.enumerated_volume.last_indexed_txn"},{"$ref":"#/parameters/rowFilter.enumerated_volume.name"},{"$ref":"#/parameters/rowFilter.enumerated_volume.symbol"},{"$ref":"#/parameters/rowFilter.enumerated_volume.decimals"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/enumerated_volume"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/orders":{"get":{"tags":["orders"],"parameters":[{"$ref":"#/parameters/rowFilter.orders.market_id"},{"$ref":"#/parameters/rowFilter.orders.order_id"},{"$ref":"#/parameters/rowFilter.orders.created_at"},{"$ref":"#/parameters/rowFilter.orders.last_updated_at"},{"$ref":"#/parameters/rowFilter.orders.integrator"},{"$ref":"#/parameters/rowFilter.orders.total_filled"},{"$ref":"#/parameters/rowFilter.orders.remaining_size"},{"$ref":"#/parameters/rowFilter.orders.order_status"},{"$ref":"#/parameters/rowFilter.orders.order_type"},{"$ref":"#/parameters/rowFilter.orders.user"},{"$ref":"#/parameters/rowFilter.orders.direction"},{"$ref":"#/parameters/rowFilter.orders.price"},{"$ref":"#/parameters/rowFilter.orders.average_execution_price"},{"$ref":"#/parameters/rowFilter.orders.custodian_id"},{"$ref":"#/parameters/rowFilter.orders.self_match_behavior"},{"$ref":"#/parameters/rowFilter.orders.restriction"},{"$ref":"#/parameters/rowFilter.orders.last_increase_stamp"},{"$ref":"#/parameters/rowFilter.orders.min_base"},{"$ref":"#/parameters/rowFilter.orders.max_base"},{"$ref":"#/parameters/rowFilter.orders.min_quote"},{"$ref":"#/parameters/rowFilter.orders.max_quote"},{"$ref":"#/parameters/rowFilter.orders.total_fees_paid_in_quote_subunits"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/orders"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["orders"],"parameters":[{"$ref":"#/parameters/body.orders"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["orders"],"parameters":[{"$ref":"#/parameters/rowFilter.orders.market_id"},{"$ref":"#/parameters/rowFilter.orders.order_id"},{"$ref":"#/parameters/rowFilter.orders.created_at"},{"$ref":"#/parameters/rowFilter.orders.last_updated_at"},{"$ref":"#/parameters/rowFilter.orders.integrator"},{"$ref":"#/parameters/rowFilter.orders.total_filled"},{"$ref":"#/parameters/rowFilter.orders.remaining_size"},{"$ref":"#/parameters/rowFilter.orders.order_status"},{"$ref":"#/parameters/rowFilter.orders.order_type"},{"$ref":"#/parameters/rowFilter.orders.user"},{"$ref":"#/parameters/rowFilter.orders.direction"},{"$ref":"#/parameters/rowFilter.orders.price"},{"$ref":"#/parameters/rowFilter.orders.average_execution_price"},{"$ref":"#/parameters/rowFilter.orders.custodian_id"},{"$ref":"#/parameters/rowFilter.orders.self_match_behavior"},{"$ref":"#/parameters/rowFilter.orders.restriction"},{"$ref":"#/parameters/rowFilter.orders.last_increase_stamp"},{"$ref":"#/parameters/rowFilter.orders.min_base"},{"$ref":"#/parameters/rowFilter.orders.max_base"},{"$ref":"#/parameters/rowFilter.orders.min_quote"},{"$ref":"#/parameters/rowFilter.orders.max_quote"},{"$ref":"#/parameters/rowFilter.orders.total_fees_paid_in_quote_subunits"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["orders"],"parameters":[{"$ref":"#/parameters/rowFilter.orders.market_id"},{"$ref":"#/parameters/rowFilter.orders.order_id"},{"$ref":"#/parameters/rowFilter.orders.created_at"},{"$ref":"#/parameters/rowFilter.orders.last_updated_at"},{"$ref":"#/parameters/rowFilter.orders.integrator"},{"$ref":"#/parameters/rowFilter.orders.total_filled"},{"$ref":"#/parameters/rowFilter.orders.remaining_size"},{"$ref":"#/parameters/rowFilter.orders.order_status"},{"$ref":"#/parameters/rowFilter.orders.order_type"},{"$ref":"#/parameters/rowFilter.orders.user"},{"$ref":"#/parameters/rowFilter.orders.direction"},{"$ref":"#/parameters/rowFilter.orders.price"},{"$ref":"#/parameters/rowFilter.orders.average_execution_price"},{"$ref":"#/parameters/rowFilter.orders.custodian_id"},{"$ref":"#/parameters/rowFilter.orders.self_match_behavior"},{"$ref":"#/parameters/rowFilter.orders.restriction"},{"$ref":"#/parameters/rowFilter.orders.last_increase_stamp"},{"$ref":"#/parameters/rowFilter.orders.min_base"},{"$ref":"#/parameters/rowFilter.orders.max_base"},{"$ref":"#/parameters/rowFilter.orders.min_quote"},{"$ref":"#/parameters/rowFilter.orders.max_quote"},{"$ref":"#/parameters/rowFilter.orders.total_fees_paid_in_quote_subunits"},{"$ref":"#/parameters/body.orders"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/tvl_per_market":{"get":{"tags":["tvl_per_market"],"parameters":[{"$ref":"#/parameters/rowFilter.tvl_per_market.base_value"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_value"},{"$ref":"#/parameters/rowFilter.tvl_per_market.market_id"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_account_address"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_module_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_struct_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_name_generic"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_account_address"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_module_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_struct_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_symbol"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_decimals"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_symbol"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_decimals"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/tvl_per_market"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/place_market_order_events":{"get":{"tags":["place_market_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_market_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_market_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_market_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.time"},{"$ref":"#/parameters/rowFilter.place_market_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.user"},{"$ref":"#/parameters/rowFilter.place_market_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_market_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_market_order_events.size"},{"$ref":"#/parameters/rowFilter.place_market_order_events.self_match_behavior"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/place_market_order_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["place_market_order_events"],"parameters":[{"$ref":"#/parameters/body.place_market_order_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["place_market_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_market_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_market_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_market_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.time"},{"$ref":"#/parameters/rowFilter.place_market_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.user"},{"$ref":"#/parameters/rowFilter.place_market_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_market_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_market_order_events.size"},{"$ref":"#/parameters/rowFilter.place_market_order_events.self_match_behavior"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["place_market_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_market_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_market_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_market_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.time"},{"$ref":"#/parameters/rowFilter.place_market_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.user"},{"$ref":"#/parameters/rowFilter.place_market_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_market_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_market_order_events.size"},{"$ref":"#/parameters/rowFilter.place_market_order_events.self_match_behavior"},{"$ref":"#/parameters/body.place_market_order_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/place_limit_order_events":{"get":{"tags":["place_limit_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_limit_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.time"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.user"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.side"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.initial_size"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.price"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.restriction"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.self_match_behavior"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.size"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/place_limit_order_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["place_limit_order_events"],"parameters":[{"$ref":"#/parameters/body.place_limit_order_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["place_limit_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_limit_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.time"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.user"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.side"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.initial_size"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.price"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.restriction"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.self_match_behavior"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.size"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["place_limit_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_limit_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.time"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.user"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.side"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.initial_size"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.price"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.restriction"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.self_match_behavior"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.size"},{"$ref":"#/parameters/body.place_limit_order_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/candlesticks_last_indexed_txn":{"get":{"tags":["candlesticks_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.txn_version"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/candlesticks_last_indexed_txn"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["candlesticks_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/body.candlesticks_last_indexed_txn"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["candlesticks_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.txn_version"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["candlesticks_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.txn_version"},{"$ref":"#/parameters/body.candlesticks_last_indexed_txn"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/market_account_handles":{"get":{"tags":["market_account_handles"],"parameters":[{"$ref":"#/parameters/rowFilter.market_account_handles.user"},{"$ref":"#/parameters/rowFilter.market_account_handles.handle"},{"$ref":"#/parameters/rowFilter.market_account_handles.creation_time"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/market_account_handles"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["market_account_handles"],"parameters":[{"$ref":"#/parameters/body.market_account_handles"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["market_account_handles"],"parameters":[{"$ref":"#/parameters/rowFilter.market_account_handles.user"},{"$ref":"#/parameters/rowFilter.market_account_handles.handle"},{"$ref":"#/parameters/rowFilter.market_account_handles.creation_time"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["market_account_handles"],"parameters":[{"$ref":"#/parameters/rowFilter.market_account_handles.user"},{"$ref":"#/parameters/rowFilter.market_account_handles.handle"},{"$ref":"#/parameters/rowFilter.market_account_handles.creation_time"},{"$ref":"#/parameters/body.market_account_handles"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/balance_updates":{"get":{"tags":["balance_updates"],"parameters":[{"$ref":"#/parameters/rowFilter.balance_updates.time"},{"$ref":"#/parameters/rowFilter.balance_updates.txn_version"},{"$ref":"#/parameters/rowFilter.balance_updates.user"},{"$ref":"#/parameters/rowFilter.balance_updates.market_id"},{"$ref":"#/parameters/rowFilter.balance_updates.custodian_id"},{"$ref":"#/parameters/rowFilter.balance_updates.base_total"},{"$ref":"#/parameters/rowFilter.balance_updates.base_available"},{"$ref":"#/parameters/rowFilter.balance_updates.base_ceiling"},{"$ref":"#/parameters/rowFilter.balance_updates.quote_total"},{"$ref":"#/parameters/rowFilter.balance_updates.quote_available"},{"$ref":"#/parameters/rowFilter.balance_updates.quote_ceiling"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/balance_updates"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/competition_leaderboard_users":{"get":{"tags":["competition_leaderboard_users"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.user"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.volume"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.integrators_used"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.n_trades"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.points"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.competition_id"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.rank"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/competition_leaderboard_users"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/fill_events_deduped":{"get":{"tags":["fill_events_deduped"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events_deduped.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.time"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.market_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.price"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.size"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_quote_fees_paid"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/fill_events_deduped"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["fill_events_deduped"],"parameters":[{"$ref":"#/parameters/body.fill_events_deduped"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["fill_events_deduped"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events_deduped.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.time"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.market_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.price"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.size"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_quote_fees_paid"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["fill_events_deduped"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events_deduped.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.time"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.market_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.price"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.size"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_quote_fees_paid"},{"$ref":"#/parameters/body.fill_events_deduped"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/competition_metadata":{"get":{"tags":["competition_metadata"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_metadata.id"},{"$ref":"#/parameters/rowFilter.competition_metadata.start"},{"$ref":"#/parameters/rowFilter.competition_metadata.end"},{"$ref":"#/parameters/rowFilter.competition_metadata.prize"},{"$ref":"#/parameters/rowFilter.competition_metadata.market_id"},{"$ref":"#/parameters/rowFilter.competition_metadata.integrators_required"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/competition_metadata"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["competition_metadata"],"parameters":[{"$ref":"#/parameters/body.competition_metadata"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["competition_metadata"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_metadata.id"},{"$ref":"#/parameters/rowFilter.competition_metadata.start"},{"$ref":"#/parameters/rowFilter.competition_metadata.end"},{"$ref":"#/parameters/rowFilter.competition_metadata.prize"},{"$ref":"#/parameters/rowFilter.competition_metadata.market_id"},{"$ref":"#/parameters/rowFilter.competition_metadata.integrators_required"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["competition_metadata"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_metadata.id"},{"$ref":"#/parameters/rowFilter.competition_metadata.start"},{"$ref":"#/parameters/rowFilter.competition_metadata.end"},{"$ref":"#/parameters/rowFilter.competition_metadata.prize"},{"$ref":"#/parameters/rowFilter.competition_metadata.market_id"},{"$ref":"#/parameters/rowFilter.competition_metadata.integrators_required"},{"$ref":"#/parameters/body.competition_metadata"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/recognized_market_events":{"get":{"tags":["recognized_market_events"],"parameters":[{"$ref":"#/parameters/rowFilter.recognized_market_events.txn_version"},{"$ref":"#/parameters/rowFilter.recognized_market_events.event_idx"},{"$ref":"#/parameters/rowFilter.recognized_market_events.time"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.market_id"},{"$ref":"#/parameters/rowFilter.recognized_market_events.lot_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.tick_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.min_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.underwriter_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/recognized_market_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["recognized_market_events"],"parameters":[{"$ref":"#/parameters/body.recognized_market_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["recognized_market_events"],"parameters":[{"$ref":"#/parameters/rowFilter.recognized_market_events.txn_version"},{"$ref":"#/parameters/rowFilter.recognized_market_events.event_idx"},{"$ref":"#/parameters/rowFilter.recognized_market_events.time"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.market_id"},{"$ref":"#/parameters/rowFilter.recognized_market_events.lot_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.tick_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.min_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.underwriter_id"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["recognized_market_events"],"parameters":[{"$ref":"#/parameters/rowFilter.recognized_market_events.txn_version"},{"$ref":"#/parameters/rowFilter.recognized_market_events.event_idx"},{"$ref":"#/parameters/rowFilter.recognized_market_events.time"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.market_id"},{"$ref":"#/parameters/rowFilter.recognized_market_events.lot_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.tick_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.min_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.underwriter_id"},{"$ref":"#/parameters/body.recognized_market_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/liquidity_groups":{"get":{"tags":["liquidity_groups"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity_groups.group_id"},{"$ref":"#/parameters/rowFilter.liquidity_groups.name"},{"$ref":"#/parameters/rowFilter.liquidity_groups.market_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/liquidity_groups"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["liquidity_groups"],"parameters":[{"$ref":"#/parameters/body.liquidity_groups"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["liquidity_groups"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity_groups.group_id"},{"$ref":"#/parameters/rowFilter.liquidity_groups.name"},{"$ref":"#/parameters/rowFilter.liquidity_groups.market_id"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["liquidity_groups"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity_groups.group_id"},{"$ref":"#/parameters/rowFilter.liquidity_groups.name"},{"$ref":"#/parameters/rowFilter.liquidity_groups.market_id"},{"$ref":"#/parameters/body.liquidity_groups"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/balance_updates_by_handle":{"get":{"tags":["balance_updates_by_handle"],"parameters":[{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.txn_version"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.handle"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.market_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.custodian_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.time"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_ceiling"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_ceiling"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/balance_updates_by_handle"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["balance_updates_by_handle"],"parameters":[{"$ref":"#/parameters/body.balance_updates_by_handle"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["balance_updates_by_handle"],"parameters":[{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.txn_version"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.handle"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.market_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.custodian_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.time"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_ceiling"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_ceiling"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["balance_updates_by_handle"],"parameters":[{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.txn_version"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.handle"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.market_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.custodian_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.time"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_ceiling"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_ceiling"},{"$ref":"#/parameters/body.balance_updates_by_handle"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/fees":{"get":{"tags":["fees"],"parameters":[{"$ref":"#/parameters/rowFilter.fees.start_time_1hr_period"},{"$ref":"#/parameters/rowFilter.fees.market_id"},{"$ref":"#/parameters/rowFilter.fees.fees_in_quote_subunits"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/fees"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["fees"],"parameters":[{"$ref":"#/parameters/body.fees"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["fees"],"parameters":[{"$ref":"#/parameters/rowFilter.fees.start_time_1hr_period"},{"$ref":"#/parameters/rowFilter.fees.market_id"},{"$ref":"#/parameters/rowFilter.fees.fees_in_quote_subunits"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["fees"],"parameters":[{"$ref":"#/parameters/rowFilter.fees.start_time_1hr_period"},{"$ref":"#/parameters/rowFilter.fees.market_id"},{"$ref":"#/parameters/rowFilter.fees.fees_in_quote_subunits"},{"$ref":"#/parameters/body.fees"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/prices":{"get":{"tags":["prices"],"parameters":[{"$ref":"#/parameters/rowFilter.prices.market_id"},{"$ref":"#/parameters/rowFilter.prices.start_time_1m_period"},{"$ref":"#/parameters/rowFilter.prices.price"},{"$ref":"#/parameters/rowFilter.prices.sum_fill_size_1m_period"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/prices"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["prices"],"parameters":[{"$ref":"#/parameters/body.prices"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["prices"],"parameters":[{"$ref":"#/parameters/rowFilter.prices.market_id"},{"$ref":"#/parameters/rowFilter.prices.start_time_1m_period"},{"$ref":"#/parameters/rowFilter.prices.price"},{"$ref":"#/parameters/rowFilter.prices.sum_fill_size_1m_period"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["prices"],"parameters":[{"$ref":"#/parameters/rowFilter.prices.market_id"},{"$ref":"#/parameters/rowFilter.prices.start_time_1m_period"},{"$ref":"#/parameters/rowFilter.prices.price"},{"$ref":"#/parameters/rowFilter.prices.sum_fill_size_1m_period"},{"$ref":"#/parameters/body.prices"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/spreads":{"get":{"tags":["spreads"],"parameters":[{"$ref":"#/parameters/rowFilter.spreads.market_id"},{"$ref":"#/parameters/rowFilter.spreads.time"},{"$ref":"#/parameters/rowFilter.spreads.min_ask"},{"$ref":"#/parameters/rowFilter.spreads.max_bid"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/spreads"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["spreads"],"parameters":[{"$ref":"#/parameters/body.spreads"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["spreads"],"parameters":[{"$ref":"#/parameters/rowFilter.spreads.market_id"},{"$ref":"#/parameters/rowFilter.spreads.time"},{"$ref":"#/parameters/rowFilter.spreads.min_ask"},{"$ref":"#/parameters/rowFilter.spreads.max_bid"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["spreads"],"parameters":[{"$ref":"#/parameters/rowFilter.spreads.market_id"},{"$ref":"#/parameters/rowFilter.spreads.time"},{"$ref":"#/parameters/rowFilter.spreads.min_ask"},{"$ref":"#/parameters/rowFilter.spreads.max_bid"},{"$ref":"#/parameters/body.spreads"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/coins":{"get":{"tags":["coins"],"parameters":[{"$ref":"#/parameters/rowFilter.coins.name"},{"$ref":"#/parameters/rowFilter.coins.symbol"},{"$ref":"#/parameters/rowFilter.coins.decimals"},{"$ref":"#/parameters/rowFilter.coins.address"},{"$ref":"#/parameters/rowFilter.coins.module"},{"$ref":"#/parameters/rowFilter.coins.struct"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/coins"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["coins"],"parameters":[{"$ref":"#/parameters/body.coins"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["coins"],"parameters":[{"$ref":"#/parameters/rowFilter.coins.name"},{"$ref":"#/parameters/rowFilter.coins.symbol"},{"$ref":"#/parameters/rowFilter.coins.decimals"},{"$ref":"#/parameters/rowFilter.coins.address"},{"$ref":"#/parameters/rowFilter.coins.module"},{"$ref":"#/parameters/rowFilter.coins.struct"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["coins"],"parameters":[{"$ref":"#/parameters/rowFilter.coins.name"},{"$ref":"#/parameters/rowFilter.coins.symbol"},{"$ref":"#/parameters/rowFilter.coins.decimals"},{"$ref":"#/parameters/rowFilter.coins.address"},{"$ref":"#/parameters/rowFilter.coins.module"},{"$ref":"#/parameters/rowFilter.coins.struct"},{"$ref":"#/parameters/body.coins"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/markets":{"get":{"tags":["markets"],"parameters":[{"$ref":"#/parameters/rowFilter.markets.market_id"},{"$ref":"#/parameters/rowFilter.markets.registration_time"},{"$ref":"#/parameters/rowFilter.markets.base_account_address"},{"$ref":"#/parameters/rowFilter.markets.base_module_name"},{"$ref":"#/parameters/rowFilter.markets.base_struct_name"},{"$ref":"#/parameters/rowFilter.markets.base_name_generic"},{"$ref":"#/parameters/rowFilter.markets.quote_account_address"},{"$ref":"#/parameters/rowFilter.markets.quote_module_name"},{"$ref":"#/parameters/rowFilter.markets.quote_struct_name"},{"$ref":"#/parameters/rowFilter.markets.lot_size"},{"$ref":"#/parameters/rowFilter.markets.tick_size"},{"$ref":"#/parameters/rowFilter.markets.min_size"},{"$ref":"#/parameters/rowFilter.markets.underwriter_id"},{"$ref":"#/parameters/rowFilter.markets.is_recognized"},{"$ref":"#/parameters/rowFilter.markets.last_fill_price_24hr"},{"$ref":"#/parameters/rowFilter.markets.price_change_as_percent_24hr"},{"$ref":"#/parameters/rowFilter.markets.price_change_24hr"},{"$ref":"#/parameters/rowFilter.markets.min_price_24h"},{"$ref":"#/parameters/rowFilter.markets.max_price_24h"},{"$ref":"#/parameters/rowFilter.markets.base_volume_24h"},{"$ref":"#/parameters/rowFilter.markets.quote_volume_24h"},{"$ref":"#/parameters/rowFilter.markets.base_name"},{"$ref":"#/parameters/rowFilter.markets.base_decimals"},{"$ref":"#/parameters/rowFilter.markets.base_symbol"},{"$ref":"#/parameters/rowFilter.markets.quote_name"},{"$ref":"#/parameters/rowFilter.markets.quote_decimals"},{"$ref":"#/parameters/rowFilter.markets.quote_symbol"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/markets"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/data_status":{"get":{"tags":["data_status"],"parameters":[{"$ref":"#/parameters/rowFilter.data_status.current_time"},{"$ref":"#/parameters/rowFilter.data_status.processor_last_txn_version_processed"},{"$ref":"#/parameters/rowFilter.data_status.aggregator_user_history_last_txn_version_processed"},{"$ref":"#/parameters/rowFilter.data_status.aggregator_candlesticks_last_txn_version_processed"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/data_status"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/historical_trades":{"get":{"tags":["historical_trades"],"parameters":[{"$ref":"#/parameters/rowFilter.historical_trades.txn_version"},{"$ref":"#/parameters/rowFilter.historical_trades.event_idx"},{"$ref":"#/parameters/rowFilter.historical_trades.market_id"},{"$ref":"#/parameters/rowFilter.historical_trades.time"},{"$ref":"#/parameters/rowFilter.historical_trades.integer_price_to_quote_nominal"},{"$ref":"#/parameters/rowFilter.historical_trades.base_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.quote_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.type"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/historical_trades"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["historical_trades"],"parameters":[{"$ref":"#/parameters/body.historical_trades"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["historical_trades"],"parameters":[{"$ref":"#/parameters/rowFilter.historical_trades.txn_version"},{"$ref":"#/parameters/rowFilter.historical_trades.event_idx"},{"$ref":"#/parameters/rowFilter.historical_trades.market_id"},{"$ref":"#/parameters/rowFilter.historical_trades.time"},{"$ref":"#/parameters/rowFilter.historical_trades.integer_price_to_quote_nominal"},{"$ref":"#/parameters/rowFilter.historical_trades.base_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.quote_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.type"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["historical_trades"],"parameters":[{"$ref":"#/parameters/rowFilter.historical_trades.txn_version"},{"$ref":"#/parameters/rowFilter.historical_trades.event_idx"},{"$ref":"#/parameters/rowFilter.historical_trades.market_id"},{"$ref":"#/parameters/rowFilter.historical_trades.time"},{"$ref":"#/parameters/rowFilter.historical_trades.integer_price_to_quote_nominal"},{"$ref":"#/parameters/rowFilter.historical_trades.base_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.quote_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.type"},{"$ref":"#/parameters/body.historical_trades"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/place_swap_order_events":{"get":{"tags":["place_swap_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_swap_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.time"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.signing_account"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.limit_price"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/place_swap_order_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["place_swap_order_events"],"parameters":[{"$ref":"#/parameters/body.place_swap_order_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["place_swap_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_swap_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.time"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.signing_account"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.limit_price"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["place_swap_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_swap_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.time"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.signing_account"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.limit_price"},{"$ref":"#/parameters/body.place_swap_order_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/change_order_size_events":{"get":{"tags":["change_order_size_events"],"parameters":[{"$ref":"#/parameters/rowFilter.change_order_size_events.txn_version"},{"$ref":"#/parameters/rowFilter.change_order_size_events.event_idx"},{"$ref":"#/parameters/rowFilter.change_order_size_events.market_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.time"},{"$ref":"#/parameters/rowFilter.change_order_size_events.order_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.user"},{"$ref":"#/parameters/rowFilter.change_order_size_events.custodian_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.side"},{"$ref":"#/parameters/rowFilter.change_order_size_events.new_size"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/change_order_size_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["change_order_size_events"],"parameters":[{"$ref":"#/parameters/body.change_order_size_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["change_order_size_events"],"parameters":[{"$ref":"#/parameters/rowFilter.change_order_size_events.txn_version"},{"$ref":"#/parameters/rowFilter.change_order_size_events.event_idx"},{"$ref":"#/parameters/rowFilter.change_order_size_events.market_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.time"},{"$ref":"#/parameters/rowFilter.change_order_size_events.order_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.user"},{"$ref":"#/parameters/rowFilter.change_order_size_events.custodian_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.side"},{"$ref":"#/parameters/rowFilter.change_order_size_events.new_size"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["change_order_size_events"],"parameters":[{"$ref":"#/parameters/rowFilter.change_order_size_events.txn_version"},{"$ref":"#/parameters/rowFilter.change_order_size_events.event_idx"},{"$ref":"#/parameters/rowFilter.change_order_size_events.market_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.time"},{"$ref":"#/parameters/rowFilter.change_order_size_events.order_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.user"},{"$ref":"#/parameters/rowFilter.change_order_size_events.custodian_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.side"},{"$ref":"#/parameters/rowFilter.change_order_size_events.new_size"},{"$ref":"#/parameters/body.change_order_size_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/liquidity":{"get":{"tags":["liquidity"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity.group_id"},{"$ref":"#/parameters/rowFilter.liquidity.time"},{"$ref":"#/parameters/rowFilter.liquidity.bps_times_ten"},{"$ref":"#/parameters/rowFilter.liquidity.amount_ask_ticks"},{"$ref":"#/parameters/rowFilter.liquidity.amount_bid_ticks"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/liquidity"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["liquidity"],"parameters":[{"$ref":"#/parameters/body.liquidity"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["liquidity"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity.group_id"},{"$ref":"#/parameters/rowFilter.liquidity.time"},{"$ref":"#/parameters/rowFilter.liquidity.bps_times_ten"},{"$ref":"#/parameters/rowFilter.liquidity.amount_ask_ticks"},{"$ref":"#/parameters/rowFilter.liquidity.amount_bid_ticks"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["liquidity"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity.group_id"},{"$ref":"#/parameters/rowFilter.liquidity.time"},{"$ref":"#/parameters/rowFilter.liquidity.bps_times_ten"},{"$ref":"#/parameters/rowFilter.liquidity.amount_ask_ticks"},{"$ref":"#/parameters/rowFilter.liquidity.amount_bid_ticks"},{"$ref":"#/parameters/body.liquidity"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/price_levels":{"get":{"tags":["price_levels"],"parameters":[{"$ref":"#/parameters/rowFilter.price_levels.market_id"},{"$ref":"#/parameters/rowFilter.price_levels.direction"},{"$ref":"#/parameters/rowFilter.price_levels.price"},{"$ref":"#/parameters/rowFilter.price_levels.total_size"},{"$ref":"#/parameters/rowFilter.price_levels.version"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/price_levels"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/cancel_order_events":{"get":{"tags":["cancel_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.cancel_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.cancel_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.cancel_order_events.time"},{"$ref":"#/parameters/rowFilter.cancel_order_events.market_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.user"},{"$ref":"#/parameters/rowFilter.cancel_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.order_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.reason"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/cancel_order_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["cancel_order_events"],"parameters":[{"$ref":"#/parameters/body.cancel_order_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["cancel_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.cancel_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.cancel_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.cancel_order_events.time"},{"$ref":"#/parameters/rowFilter.cancel_order_events.market_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.user"},{"$ref":"#/parameters/rowFilter.cancel_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.order_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.reason"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["cancel_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.cancel_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.cancel_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.cancel_order_events.time"},{"$ref":"#/parameters/rowFilter.cancel_order_events.market_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.user"},{"$ref":"#/parameters/rowFilter.cancel_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.order_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.reason"},{"$ref":"#/parameters/body.cancel_order_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/fill_events":{"get":{"tags":["fill_events"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events.time"},{"$ref":"#/parameters/rowFilter.fill_events.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events.market_id"},{"$ref":"#/parameters/rowFilter.fill_events.price"},{"$ref":"#/parameters/rowFilter.fill_events.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events.size"},{"$ref":"#/parameters/rowFilter.fill_events.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_quote_fees_paid"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/fill_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["fill_events"],"parameters":[{"$ref":"#/parameters/body.fill_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["fill_events"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events.time"},{"$ref":"#/parameters/rowFilter.fill_events.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events.market_id"},{"$ref":"#/parameters/rowFilter.fill_events.price"},{"$ref":"#/parameters/rowFilter.fill_events.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events.size"},{"$ref":"#/parameters/rowFilter.fill_events.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_quote_fees_paid"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["fill_events"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events.time"},{"$ref":"#/parameters/rowFilter.fill_events.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events.market_id"},{"$ref":"#/parameters/rowFilter.fill_events.price"},{"$ref":"#/parameters/rowFilter.fill_events.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events.size"},{"$ref":"#/parameters/rowFilter.fill_events.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_quote_fees_paid"},{"$ref":"#/parameters/body.fill_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/tvl_per_asset":{"get":{"tags":["tvl_per_asset"],"parameters":[{"$ref":"#/parameters/rowFilter.tvl_per_asset.address"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.module"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.struct"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.value"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.coin_name_generic"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.market_id"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.name"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.symbol"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.decimals"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/tvl_per_asset"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/user_balances":{"get":{"tags":["user_balances"],"parameters":[{"$ref":"#/parameters/rowFilter.user_balances.address"},{"$ref":"#/parameters/rowFilter.user_balances.custodian_id"},{"$ref":"#/parameters/rowFilter.user_balances.market_id"},{"$ref":"#/parameters/rowFilter.user_balances.handle"},{"$ref":"#/parameters/rowFilter.user_balances.base_total"},{"$ref":"#/parameters/rowFilter.user_balances.base_available"},{"$ref":"#/parameters/rowFilter.user_balances.base_ceiling"},{"$ref":"#/parameters/rowFilter.user_balances.quote_total"},{"$ref":"#/parameters/rowFilter.user_balances.quote_available"},{"$ref":"#/parameters/rowFilter.user_balances.quote_ceiling"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/user_balances"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["user_balances"],"parameters":[{"$ref":"#/parameters/body.user_balances"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["user_balances"],"parameters":[{"$ref":"#/parameters/rowFilter.user_balances.address"},{"$ref":"#/parameters/rowFilter.user_balances.custodian_id"},{"$ref":"#/parameters/rowFilter.user_balances.market_id"},{"$ref":"#/parameters/rowFilter.user_balances.handle"},{"$ref":"#/parameters/rowFilter.user_balances.base_total"},{"$ref":"#/parameters/rowFilter.user_balances.base_available"},{"$ref":"#/parameters/rowFilter.user_balances.base_ceiling"},{"$ref":"#/parameters/rowFilter.user_balances.quote_total"},{"$ref":"#/parameters/rowFilter.user_balances.quote_available"},{"$ref":"#/parameters/rowFilter.user_balances.quote_ceiling"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["user_balances"],"parameters":[{"$ref":"#/parameters/rowFilter.user_balances.address"},{"$ref":"#/parameters/rowFilter.user_balances.custodian_id"},{"$ref":"#/parameters/rowFilter.user_balances.market_id"},{"$ref":"#/parameters/rowFilter.user_balances.handle"},{"$ref":"#/parameters/rowFilter.user_balances.base_total"},{"$ref":"#/parameters/rowFilter.user_balances.base_available"},{"$ref":"#/parameters/rowFilter.user_balances.base_ceiling"},{"$ref":"#/parameters/rowFilter.user_balances.quote_total"},{"$ref":"#/parameters/rowFilter.user_balances.quote_available"},{"$ref":"#/parameters/rowFilter.user_balances.quote_ceiling"},{"$ref":"#/parameters/body.user_balances"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/fees_24h":{"get":{"tags":["fees_24h"],"parameters":[{"$ref":"#/parameters/rowFilter.fees_24h.fees"},{"$ref":"#/parameters/rowFilter.fees_24h.day"},{"$ref":"#/parameters/rowFilter.fees_24h.market_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/fees_24h"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/competition_exclusion_list":{"get":{"tags":["competition_exclusion_list"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_exclusion_list.user"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.reason"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.competition_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/competition_exclusion_list"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["competition_exclusion_list"],"parameters":[{"$ref":"#/parameters/body.competition_exclusion_list"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["competition_exclusion_list"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_exclusion_list.user"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.reason"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.competition_id"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["competition_exclusion_list"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_exclusion_list.user"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.reason"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.competition_id"},{"$ref":"#/parameters/body.competition_exclusion_list"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/daily_rolling_volume_history":{"get":{"tags":["daily_rolling_volume_history"],"parameters":[{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.time"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.market_id"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.volume_in_quote_subunits"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/daily_rolling_volume_history"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["daily_rolling_volume_history"],"parameters":[{"$ref":"#/parameters/body.daily_rolling_volume_history"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["daily_rolling_volume_history"],"parameters":[{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.time"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.market_id"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.volume_in_quote_subunits"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["daily_rolling_volume_history"],"parameters":[{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.time"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.market_id"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.volume_in_quote_subunits"},{"$ref":"#/parameters/body.daily_rolling_volume_history"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/candlestick_resolutions":{"get":{"tags":["candlestick_resolutions"],"parameters":[{"$ref":"#/parameters/rowFilter.candlestick_resolutions.resolution"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/candlestick_resolutions"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/candlesticks":{"get":{"tags":["candlesticks"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks.market_id"},{"$ref":"#/parameters/rowFilter.candlesticks.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks.start_time"},{"$ref":"#/parameters/rowFilter.candlesticks.open"},{"$ref":"#/parameters/rowFilter.candlesticks.high"},{"$ref":"#/parameters/rowFilter.candlesticks.low"},{"$ref":"#/parameters/rowFilter.candlesticks.close"},{"$ref":"#/parameters/rowFilter.candlesticks.volume"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/candlesticks"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["candlesticks"],"parameters":[{"$ref":"#/parameters/body.candlesticks"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["candlesticks"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks.market_id"},{"$ref":"#/parameters/rowFilter.candlesticks.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks.start_time"},{"$ref":"#/parameters/rowFilter.candlesticks.open"},{"$ref":"#/parameters/rowFilter.candlesticks.high"},{"$ref":"#/parameters/rowFilter.candlesticks.low"},{"$ref":"#/parameters/rowFilter.candlesticks.close"},{"$ref":"#/parameters/rowFilter.candlesticks.volume"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["candlesticks"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks.market_id"},{"$ref":"#/parameters/rowFilter.candlesticks.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks.start_time"},{"$ref":"#/parameters/rowFilter.candlesticks.open"},{"$ref":"#/parameters/rowFilter.candlesticks.high"},{"$ref":"#/parameters/rowFilter.candlesticks.low"},{"$ref":"#/parameters/rowFilter.candlesticks.close"},{"$ref":"#/parameters/rowFilter.candlesticks.volume"},{"$ref":"#/parameters/body.candlesticks"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/user_history_last_indexed_txn":{"get":{"tags":["user_history_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.user_history_last_indexed_txn.txn_version"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/user_history_last_indexed_txn"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["user_history_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/body.user_history_last_indexed_txn"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["user_history_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.user_history_last_indexed_txn.txn_version"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["user_history_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.user_history_last_indexed_txn.txn_version"},{"$ref":"#/parameters/body.user_history_last_indexed_txn"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/recognized_markets":{"get":{"tags":["recognized_markets"],"parameters":[{"$ref":"#/parameters/rowFilter.recognized_markets.market_id"},{"$ref":"#/parameters/rowFilter.recognized_markets.time"},{"$ref":"#/parameters/rowFilter.recognized_markets.base_account_address"},{"$ref":"#/parameters/rowFilter.recognized_markets.base_module_name"},{"$ref":"#/parameters/rowFilter.recognized_markets.base_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_markets.base_name_generic"},{"$ref":"#/parameters/rowFilter.recognized_markets.quote_account_address"},{"$ref":"#/parameters/rowFilter.recognized_markets.quote_module_name"},{"$ref":"#/parameters/rowFilter.recognized_markets.quote_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_markets.lot_size"},{"$ref":"#/parameters/rowFilter.recognized_markets.tick_size"},{"$ref":"#/parameters/rowFilter.recognized_markets.min_size"},{"$ref":"#/parameters/rowFilter.recognized_markets.underwriter_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/recognized_markets"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/enumerated_volume_24h":{"get":{"tags":["enumerated_volume_24h"],"parameters":[{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.address"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.module"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.struct"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.volume_as_base"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.volume_as_quote"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.generic_asset_name"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.name"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.symbol"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.decimals"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/enumerated_volume_24h"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/rpc/get_market_mid_price":{"get":{"tags":["(rpc) get_market_mid_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_mid_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_cumulative_fees":{"get":{"tags":["(rpc) get_market_cumulative_fees"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"timestamp with time zone","in":"query","name":"up_to","required":true,"type":"string"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_cumulative_fees"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"},"up_to":{"format":"timestamp with time zone","type":"string"}},"required":["market_id","up_to"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_24h_low":{"get":{"tags":["(rpc) get_market_24h_low"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_24h_low"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/orderbook":{"get":{"tags":["(rpc) orderbook"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"numeric","in":"query","name":"depth","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) orderbook"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"depth":{"format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"}},"required":["market_id","depth"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/user_handle":{"get":{"tags":["(rpc) user_handle"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"text","in":"query","name":"user_address","required":true,"type":"string"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) user_handle"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"user_address":{"format":"text","type":"string"}},"required":["user_address"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_last_price":{"get":{"tags":["(rpc) get_market_last_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_last_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/fees":{"get":{"tags":["(rpc) fees"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"timestamp with time zone","in":"query","name":"time","required":true,"type":"string"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) fees"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"}},"required":["market_id","time"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/data_is_consistent":{"get":{"tags":["(rpc) data_is_consistent"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) data_is_consistent"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/volume_history":{"get":{"tags":["(rpc) volume_history"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"timestamp with time zone","in":"query","name":"time","required":true,"type":"string"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) volume_history"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"}},"required":["market_id","time"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/market_aggregated_info":{"get":{"tags":["(rpc) market_aggregated_info"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"integer","in":"query","name":"market","required":true,"type":"integer"},{"format":"integer","in":"query","name":"seconds","required":true,"type":"integer"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) market_aggregated_info"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market":{"format":"integer","type":"integer"},"seconds":{"format":"integer","type":"integer"}},"required":["market","seconds"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_best_ask_price":{"get":{"tags":["(rpc) get_market_best_ask_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_best_ask_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_best_bid_price":{"get":{"tags":["(rpc) get_market_best_bid_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_best_bid_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_liquidity":{"get":{"tags":["(rpc) get_market_liquidity"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"numeric","in":"query","name":"depth","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_liquidity"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"depth":{"format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"}},"required":["market_id","depth"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/user_balance":{"get":{"tags":["(rpc) user_balance"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"text","in":"query","name":"user_address","required":true,"type":"string"},{"format":"numeric","in":"query","name":"market","required":true,"type":"number"},{"format":"numeric","in":"query","name":"custodian","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) user_balance"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"custodian":{"format":"numeric","type":"number"},"market":{"format":"numeric","type":"number"},"user_address":{"format":"text","type":"string"}},"required":["user_address","market","custodian"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_24h_high":{"get":{"tags":["(rpc) get_market_24h_high"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_24h_high"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}}},"definitions":{"tickers":{"properties":{"market_id":{"format":"numeric","type":"number"},"base_currency":{"format":"text","type":"string"},"quote_currency":{"format":"text","type":"string"},"base_volume":{"format":"numeric","type":"number"},"quote_volume":{"format":"numeric","type":"number"},"base_volume_nominal":{"format":"double precision","type":"number"},"quote_volume_nominal":{"format":"double precision","type":"number"},"last_price":{"format":"numeric","type":"number"},"ask":{"format":"numeric","type":"number"},"bid":{"format":"numeric","type":"number"},"high":{"format":"numeric","type":"number"},"low":{"format":"numeric","type":"number"},"liquidity_in_quote":{"format":"numeric","type":"number"}},"type":"object"},"market_registration_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"lot_size":{"format":"numeric","type":"number"},"tick_size":{"format":"numeric","type":"number"},"min_size":{"format":"numeric","type":"number"},"underwriter_id":{"format":"numeric","type":"number"}},"type":"object"},"enumerated_volume":{"properties":{"address":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"module":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"struct":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"volume_as_base":{"format":"numeric","type":"number"},"volume_as_quote":{"format":"numeric","type":"number"},"generic_asset_name":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"last_indexed_txn":{"format":"numeric","type":"number"},"name":{"format":"text","type":"string"},"symbol":{"format":"text","type":"string"},"decimals":{"format":"smallint","type":"integer"}},"type":"object"},"orders":{"properties":{"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"order_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"created_at":{"format":"timestamp with time zone","type":"string"},"last_updated_at":{"format":"timestamp with time zone","type":"string"},"integrator":{"format":"text","type":"string"},"total_filled":{"format":"numeric","type":"number"},"remaining_size":{"format":"numeric","type":"number"},"order_status":{"enum":["open","closed","cancelled"],"format":"public.order_status","type":"string"},"order_type":{"enum":["limit","market","swap"],"format":"public.order_type","type":"string"},"user":{"format":"text","type":"string"},"direction":{"enum":["sell","buy","ask","bid"],"format":"public.order_direction","type":"string"},"price":{"format":"numeric","type":"number"},"average_execution_price":{"format":"numeric","type":"number"},"custodian_id":{"format":"numeric","type":"number"},"self_match_behavior":{"format":"smallint","type":"integer"},"restriction":{"format":"smallint","type":"integer"},"last_increase_stamp":{"format":"numeric","type":"number"},"min_base":{"format":"numeric","type":"number"},"max_base":{"format":"numeric","type":"number"},"min_quote":{"format":"numeric","type":"number"},"max_quote":{"format":"numeric","type":"number"},"total_fees_paid_in_quote_subunits":{"format":"numeric","type":"number"}},"type":"object"},"tvl_per_market":{"properties":{"base_value":{"format":"numeric","type":"number"},"quote_value":{"format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"base_name":{"format":"text","type":"string"},"base_symbol":{"format":"text","type":"string"},"base_decimals":{"format":"smallint","type":"integer"},"quote_name":{"format":"text","type":"string"},"quote_symbol":{"format":"text","type":"string"},"quote_decimals":{"format":"smallint","type":"integer"}},"type":"object"},"place_market_order_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"order_id":{"format":"numeric","type":"number"},"user":{"format":"character varying","maxLength":70,"type":"string"},"custodian_id":{"format":"numeric","type":"number"},"integrator":{"format":"character varying","maxLength":70,"type":"string"},"direction":{"format":"text","type":"string"},"size":{"format":"numeric","type":"number"},"self_match_behavior":{"format":"smallint","type":"integer"}},"type":"object"},"place_limit_order_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"market_id":{"format":"numeric","type":"number"},"user":{"format":"character varying","maxLength":70,"type":"string"},"custodian_id":{"format":"numeric","type":"number"},"order_id":{"format":"numeric","type":"number"},"side":{"format":"boolean","type":"boolean"},"integrator":{"format":"character varying","maxLength":70,"type":"string"},"initial_size":{"format":"numeric","type":"number"},"price":{"format":"numeric","type":"number"},"restriction":{"format":"smallint","type":"integer"},"self_match_behavior":{"format":"smallint","type":"integer"},"size":{"format":"numeric","type":"number"}},"type":"object"},"candlesticks_last_indexed_txn":{"properties":{"resolution":{"description":"Note:\nThis is a Primary Key.","format":"integer","type":"integer"},"txn_version":{"format":"numeric","type":"number"}},"type":"object"},"market_account_handles":{"properties":{"user":{"description":"Note:\nThis is a Primary Key.","format":"character varying","maxLength":70,"type":"string"},"handle":{"format":"character varying","maxLength":70,"type":"string"},"creation_time":{"format":"timestamp with time zone","type":"string"}},"type":"object"},"balance_updates":{"properties":{"time":{"format":"timestamp with time zone","type":"string"},"txn_version":{"format":"numeric","type":"number"},"user":{"description":"Note:\nThis is a Primary Key.","format":"character varying","maxLength":70,"type":"string"},"market_id":{"format":"numeric","type":"number"},"custodian_id":{"format":"numeric","type":"number"},"base_total":{"format":"numeric","type":"number"},"base_available":{"format":"numeric","type":"number"},"base_ceiling":{"format":"numeric","type":"number"},"quote_total":{"format":"numeric","type":"number"},"quote_available":{"format":"numeric","type":"number"},"quote_ceiling":{"format":"numeric","type":"number"}},"type":"object"},"competition_leaderboard_users":{"properties":{"user":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"volume":{"format":"numeric","type":"number"},"integrators_used":{"format":"text[]","items":{"type":"string"},"type":"array"},"n_trades":{"format":"integer","type":"integer"},"points":{"format":"numeric","type":"number"},"competition_id":{"description":"Note:\nThis is a Primary Key.\nThis is a Foreign Key to `competition_metadata.id`.","format":"integer","type":"integer"},"rank":{"format":"bigint","type":"integer"}},"type":"object"},"fill_events_deduped":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"emit_address":{"format":"character varying","maxLength":70,"type":"string"},"time":{"format":"timestamp with time zone","type":"string"},"maker_address":{"format":"character varying","maxLength":70,"type":"string"},"maker_custodian_id":{"format":"numeric","type":"number"},"maker_order_id":{"format":"numeric","type":"number"},"maker_side":{"format":"boolean","type":"boolean"},"market_id":{"format":"numeric","type":"number"},"price":{"format":"numeric","type":"number"},"sequence_number_for_trade":{"format":"numeric","type":"number"},"size":{"format":"numeric","type":"number"},"taker_address":{"format":"character varying","maxLength":70,"type":"string"},"taker_custodian_id":{"format":"numeric","type":"number"},"taker_order_id":{"format":"numeric","type":"number"},"taker_quote_fees_paid":{"format":"numeric","type":"number"}},"type":"object"},"competition_metadata":{"properties":{"id":{"description":"Note:\nThis is a Primary Key.","format":"integer","type":"integer"},"start":{"format":"timestamp with time zone","type":"string"},"end":{"format":"timestamp with time zone","type":"string"},"prize":{"format":"integer","type":"integer"},"market_id":{"format":"numeric","type":"number"},"integrators_required":{"format":"text[]","items":{"type":"string"},"type":"array"}},"type":"object"},"recognized_market_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"market_id":{"format":"numeric","type":"number"},"lot_size":{"format":"numeric","type":"number"},"tick_size":{"format":"numeric","type":"number"},"min_size":{"format":"numeric","type":"number"},"underwriter_id":{"format":"numeric","type":"number"}},"type":"object"},"liquidity_groups":{"properties":{"group_id":{"description":"Note:\nThis is a Primary Key.","format":"integer","type":"integer"},"name":{"format":"text","type":"string"},"market_id":{"format":"numeric","type":"number"}},"type":"object"},"balance_updates_by_handle":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"handle":{"description":"Note:\nThis is a Primary Key.","format":"character varying","maxLength":70,"type":"string"},"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"custodian_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"base_total":{"format":"numeric","type":"number"},"base_available":{"format":"numeric","type":"number"},"base_ceiling":{"format":"numeric","type":"number"},"quote_total":{"format":"numeric","type":"number"},"quote_available":{"format":"numeric","type":"number"},"quote_ceiling":{"format":"numeric","type":"number"}},"type":"object"},"fees":{"properties":{"start_time_1hr_period":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"fees_in_quote_subunits":{"format":"numeric","type":"number"}},"type":"object"},"prices":{"properties":{"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"start_time_1m_period":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"price":{"format":"numeric","type":"number"},"sum_fill_size_1m_period":{"format":"numeric","type":"number"}},"type":"object"},"spreads":{"properties":{"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"min_ask":{"format":"numeric","type":"number"},"max_bid":{"format":"numeric","type":"number"}},"type":"object"},"coins":{"properties":{"name":{"format":"text","type":"string"},"symbol":{"format":"text","type":"string"},"decimals":{"format":"smallint","type":"integer"},"address":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"module":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"struct":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"}},"type":"object"},"markets":{"properties":{"market_id":{"format":"numeric","type":"number"},"registration_time":{"format":"timestamp with time zone","type":"string"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"lot_size":{"format":"numeric","type":"number"},"tick_size":{"format":"numeric","type":"number"},"min_size":{"format":"numeric","type":"number"},"underwriter_id":{"format":"numeric","type":"number"},"is_recognized":{"format":"boolean","type":"boolean"},"last_fill_price_24hr":{"format":"numeric","type":"number"},"price_change_as_percent_24hr":{"format":"numeric","type":"number"},"price_change_24hr":{"format":"numeric","type":"number"},"min_price_24h":{"format":"numeric","type":"number"},"max_price_24h":{"format":"numeric","type":"number"},"base_volume_24h":{"format":"numeric","type":"number"},"quote_volume_24h":{"format":"numeric","type":"number"},"base_name":{"format":"text","type":"string"},"base_decimals":{"format":"smallint","type":"integer"},"base_symbol":{"format":"text","type":"string"},"quote_name":{"format":"text","type":"string"},"quote_decimals":{"format":"smallint","type":"integer"},"quote_symbol":{"format":"text","type":"string"}},"type":"object"},"data_status":{"properties":{"current_time":{"format":"timestamp with time zone","type":"string"},"processor_last_txn_version_processed":{"format":"bigint","type":"integer"},"aggregator_user_history_last_txn_version_processed":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"aggregator_candlesticks_last_txn_version_processed":{"format":"numeric[]","items":{"type":"number"},"type":"array"}},"type":"object"},"historical_trades":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"integer_price_to_quote_nominal":{"format":"numeric","type":"number"},"base_volume":{"format":"numeric","type":"number"},"quote_volume":{"format":"numeric","type":"number"},"type":{"format":"text","type":"string"}},"type":"object"},"place_swap_order_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"order_id":{"format":"numeric","type":"number"},"signing_account":{"format":"character varying","maxLength":70,"type":"string"},"integrator":{"format":"character varying","maxLength":70,"type":"string"},"direction":{"format":"text","type":"string"},"min_base":{"format":"numeric","type":"number"},"max_base":{"format":"numeric","type":"number"},"min_quote":{"format":"numeric","type":"number"},"max_quote":{"format":"numeric","type":"number"},"limit_price":{"format":"numeric","type":"number"}},"type":"object"},"change_order_size_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"order_id":{"format":"numeric","type":"number"},"user":{"format":"character varying","maxLength":70,"type":"string"},"custodian_id":{"format":"numeric","type":"number"},"side":{"format":"boolean","type":"boolean"},"new_size":{"format":"numeric","type":"number"}},"type":"object"},"liquidity":{"properties":{"group_id":{"description":"Note:\nThis is a Primary Key.\nThis is a Foreign Key to `liquidity_groups.group_id`.","format":"integer","type":"integer"},"time":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"bps_times_ten":{"description":"Note:\nThis is a Primary Key.","format":"smallint","type":"integer"},"amount_ask_ticks":{"format":"numeric","type":"number"},"amount_bid_ticks":{"format":"numeric","type":"number"}},"type":"object"},"price_levels":{"properties":{"market_id":{"format":"numeric","type":"number"},"direction":{"enum":["sell","buy","ask","bid"],"format":"public.order_direction","type":"string"},"price":{"format":"numeric","type":"number"},"total_size":{"format":"numeric","type":"number"},"version":{"format":"numeric","type":"number"}},"type":"object"},"cancel_order_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"market_id":{"format":"numeric","type":"number"},"user":{"format":"character varying","maxLength":70,"type":"string"},"custodian_id":{"format":"numeric","type":"number"},"order_id":{"format":"numeric","type":"number"},"reason":{"format":"smallint","type":"integer"}},"type":"object"},"fill_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"emit_address":{"format":"character varying","maxLength":70,"type":"string"},"time":{"format":"timestamp with time zone","type":"string"},"maker_address":{"format":"character varying","maxLength":70,"type":"string"},"maker_custodian_id":{"format":"numeric","type":"number"},"maker_order_id":{"format":"numeric","type":"number"},"maker_side":{"format":"boolean","type":"boolean"},"market_id":{"format":"numeric","type":"number"},"price":{"format":"numeric","type":"number"},"sequence_number_for_trade":{"format":"numeric","type":"number"},"size":{"format":"numeric","type":"number"},"taker_address":{"format":"character varying","maxLength":70,"type":"string"},"taker_custodian_id":{"format":"numeric","type":"number"},"taker_order_id":{"format":"numeric","type":"number"},"taker_quote_fees_paid":{"format":"numeric","type":"number"}},"type":"object"},"tvl_per_asset":{"properties":{"address":{"format":"character varying","type":"string"},"module":{"format":"text","type":"string"},"struct":{"format":"text","type":"string"},"value":{"format":"numeric","type":"number"},"coin_name_generic":{"format":"text","type":"string"},"market_id":{"format":"numeric","type":"number"},"name":{"format":"text","type":"string"},"symbol":{"format":"text","type":"string"},"decimals":{"format":"smallint","type":"integer"}},"type":"object"},"user_balances":{"properties":{"address":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"custodian_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"handle":{"format":"text","type":"string"},"base_total":{"format":"numeric","type":"number"},"base_available":{"format":"numeric","type":"number"},"base_ceiling":{"format":"numeric","type":"number"},"quote_total":{"format":"numeric","type":"number"},"quote_available":{"format":"numeric","type":"number"},"quote_ceiling":{"format":"numeric","type":"number"}},"type":"object"},"fees_24h":{"properties":{"fees":{"format":"numeric","type":"number"},"day":{"format":"timestamp with time zone","type":"string"},"market_id":{"format":"numeric","type":"number"}},"type":"object"},"competition_exclusion_list":{"properties":{"user":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"reason":{"format":"text","type":"string"},"competition_id":{"description":"Note:\nThis is a Primary Key.\nThis is a Foreign Key to `competition_metadata.id`.","format":"integer","type":"integer"}},"type":"object"},"daily_rolling_volume_history":{"properties":{"time":{"format":"timestamp with time zone","type":"string"},"market_id":{"format":"numeric","type":"number"},"volume_in_quote_subunits":{"format":"numeric","type":"number"}},"type":"object"},"candlestick_resolutions":{"properties":{"resolution":{"format":"integer","type":"integer"}},"type":"object"},"candlesticks":{"properties":{"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"resolution":{"description":"Note:\nThis is a Primary Key.","format":"integer","type":"integer"},"start_time":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"open":{"format":"numeric","type":"number"},"high":{"format":"numeric","type":"number"},"low":{"format":"numeric","type":"number"},"close":{"format":"numeric","type":"number"},"volume":{"format":"numeric","type":"number"}},"type":"object"},"user_history_last_indexed_txn":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"}},"type":"object"},"recognized_markets":{"properties":{"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"lot_size":{"format":"numeric","type":"number"},"tick_size":{"format":"numeric","type":"number"},"min_size":{"format":"numeric","type":"number"},"underwriter_id":{"format":"numeric","type":"number"}},"type":"object"},"enumerated_volume_24h":{"properties":{"address":{"format":"character varying","type":"string"},"module":{"format":"text","type":"string"},"struct":{"format":"text","type":"string"},"volume_as_base":{"format":"numeric","type":"number"},"volume_as_quote":{"format":"numeric","type":"number"},"generic_asset_name":{"format":"text","type":"string"},"name":{"format":"text","type":"string"},"symbol":{"format":"text","type":"string"},"decimals":{"format":"smallint","type":"integer"}},"type":"object"}},"parameters":{"preferParams":{"name":"Prefer","description":"Preference","required":false,"enum":["params=single-object"],"in":"header","type":"string"},"preferReturn":{"name":"Prefer","description":"Preference","required":false,"enum":["return=representation","return=minimal","return=none"],"in":"header","type":"string"},"preferCount":{"name":"Prefer","description":"Preference","required":false,"enum":["count=none"],"in":"header","type":"string"},"preferPost":{"name":"Prefer","description":"Preference","required":false,"enum":["return=representation","return=minimal","return=none","resolution=ignore-duplicates","resolution=merge-duplicates"],"in":"header","type":"string"},"select":{"name":"select","description":"Filtering Columns","required":false,"in":"query","type":"string"},"on_conflict":{"name":"on_conflict","description":"On Conflict","required":false,"in":"query","type":"string"},"order":{"name":"order","description":"Ordering","required":false,"in":"query","type":"string"},"range":{"name":"Range","description":"Limiting and Pagination","required":false,"in":"header","type":"string"},"rangeUnit":{"name":"Range-Unit","description":"Limiting and Pagination","required":false,"default":"items","in":"header","type":"string"},"offset":{"name":"offset","description":"Limiting and Pagination","required":false,"in":"query","type":"string"},"limit":{"name":"limit","description":"Limiting and Pagination","required":false,"in":"query","type":"string"},"body.tickers":{"name":"tickers","description":"tickers","required":false,"in":"body","schema":{"$ref":"#/definitions/tickers"}},"rowFilter.tickers.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.base_currency":{"name":"base_currency","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tickers.quote_currency":{"name":"quote_currency","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tickers.base_volume":{"name":"base_volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.quote_volume":{"name":"quote_volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.base_volume_nominal":{"name":"base_volume_nominal","required":false,"format":"double precision","in":"query","type":"string"},"rowFilter.tickers.quote_volume_nominal":{"name":"quote_volume_nominal","required":false,"format":"double precision","in":"query","type":"string"},"rowFilter.tickers.last_price":{"name":"last_price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.ask":{"name":"ask","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.bid":{"name":"bid","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.high":{"name":"high","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.low":{"name":"low","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.liquidity_in_quote":{"name":"liquidity_in_quote","required":false,"format":"numeric","in":"query","type":"string"},"body.market_registration_events":{"name":"market_registration_events","description":"market_registration_events","required":false,"in":"body","schema":{"$ref":"#/definitions/market_registration_events"}},"rowFilter.market_registration_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.market_registration_events.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.market_registration_events.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.market_registration_events.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.lot_size":{"name":"lot_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.tick_size":{"name":"tick_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.min_size":{"name":"min_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.underwriter_id":{"name":"underwriter_id","required":false,"format":"numeric","in":"query","type":"string"},"body.enumerated_volume":{"name":"enumerated_volume","description":"enumerated_volume","required":false,"in":"body","schema":{"$ref":"#/definitions/enumerated_volume"}},"rowFilter.enumerated_volume.address":{"name":"address","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.module":{"name":"module","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.struct":{"name":"struct","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.volume_as_base":{"name":"volume_as_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume.volume_as_quote":{"name":"volume_as_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume.generic_asset_name":{"name":"generic_asset_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.last_indexed_txn":{"name":"last_indexed_txn","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.symbol":{"name":"symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.decimals":{"name":"decimals","required":false,"format":"smallint","in":"query","type":"string"},"body.orders":{"name":"orders","description":"orders","required":false,"in":"body","schema":{"$ref":"#/definitions/orders"}},"rowFilter.orders.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.created_at":{"name":"created_at","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.orders.last_updated_at":{"name":"last_updated_at","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.orders.integrator":{"name":"integrator","required":false,"format":"text","in":"query","type":"string"},"rowFilter.orders.total_filled":{"name":"total_filled","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.remaining_size":{"name":"remaining_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.order_status":{"name":"order_status","required":false,"format":"public.order_status","in":"query","type":"string"},"rowFilter.orders.order_type":{"name":"order_type","required":false,"format":"public.order_type","in":"query","type":"string"},"rowFilter.orders.user":{"name":"user","required":false,"format":"text","in":"query","type":"string"},"rowFilter.orders.direction":{"name":"direction","required":false,"format":"public.order_direction","in":"query","type":"string"},"rowFilter.orders.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.average_execution_price":{"name":"average_execution_price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.self_match_behavior":{"name":"self_match_behavior","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.orders.restriction":{"name":"restriction","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.orders.last_increase_stamp":{"name":"last_increase_stamp","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.min_base":{"name":"min_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.max_base":{"name":"max_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.min_quote":{"name":"min_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.max_quote":{"name":"max_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.total_fees_paid_in_quote_subunits":{"name":"total_fees_paid_in_quote_subunits","required":false,"format":"numeric","in":"query","type":"string"},"body.tvl_per_market":{"name":"tvl_per_market","description":"tvl_per_market","required":false,"in":"body","schema":{"$ref":"#/definitions/tvl_per_market"}},"rowFilter.tvl_per_market.base_value":{"name":"base_value","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_value":{"name":"quote_value","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_market.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_market.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.tvl_per_market.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_name":{"name":"base_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_symbol":{"name":"base_symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_decimals":{"name":"base_decimals","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_name":{"name":"quote_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_symbol":{"name":"quote_symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_decimals":{"name":"quote_decimals","required":false,"format":"smallint","in":"query","type":"string"},"body.place_market_order_events":{"name":"place_market_order_events","description":"place_market_order_events","required":false,"in":"body","schema":{"$ref":"#/definitions/place_market_order_events"}},"rowFilter.place_market_order_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.place_market_order_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_market_order_events.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.integrator":{"name":"integrator","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_market_order_events.direction":{"name":"direction","required":false,"format":"text","in":"query","type":"string"},"rowFilter.place_market_order_events.size":{"name":"size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.self_match_behavior":{"name":"self_match_behavior","required":false,"format":"smallint","in":"query","type":"string"},"body.place_limit_order_events":{"name":"place_limit_order_events","description":"place_limit_order_events","required":false,"in":"body","schema":{"$ref":"#/definitions/place_limit_order_events"}},"rowFilter.place_limit_order_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.place_limit_order_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_limit_order_events.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.side":{"name":"side","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.place_limit_order_events.integrator":{"name":"integrator","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_limit_order_events.initial_size":{"name":"initial_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.restriction":{"name":"restriction","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.place_limit_order_events.self_match_behavior":{"name":"self_match_behavior","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.place_limit_order_events.size":{"name":"size","required":false,"format":"numeric","in":"query","type":"string"},"body.candlesticks_last_indexed_txn":{"name":"candlesticks_last_indexed_txn","description":"candlesticks_last_indexed_txn","required":false,"in":"body","schema":{"$ref":"#/definitions/candlesticks_last_indexed_txn"}},"rowFilter.candlesticks_last_indexed_txn.resolution":{"name":"resolution","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.candlesticks_last_indexed_txn.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"body.market_account_handles":{"name":"market_account_handles","description":"market_account_handles","required":false,"in":"body","schema":{"$ref":"#/definitions/market_account_handles"}},"rowFilter.market_account_handles.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.market_account_handles.handle":{"name":"handle","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.market_account_handles.creation_time":{"name":"creation_time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"body.balance_updates":{"name":"balance_updates","description":"balance_updates","required":false,"in":"body","schema":{"$ref":"#/definitions/balance_updates"}},"rowFilter.balance_updates.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.balance_updates.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.balance_updates.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.base_total":{"name":"base_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.base_available":{"name":"base_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.base_ceiling":{"name":"base_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.quote_total":{"name":"quote_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.quote_available":{"name":"quote_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.quote_ceiling":{"name":"quote_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"body.competition_leaderboard_users":{"name":"competition_leaderboard_users","description":"competition_leaderboard_users","required":false,"in":"body","schema":{"$ref":"#/definitions/competition_leaderboard_users"}},"rowFilter.competition_leaderboard_users.user":{"name":"user","required":false,"format":"text","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.volume":{"name":"volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.integrators_used":{"name":"integrators_used","required":false,"format":"text[]","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.n_trades":{"name":"n_trades","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.points":{"name":"points","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.competition_id":{"name":"competition_id","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.rank":{"name":"rank","required":false,"format":"bigint","in":"query","type":"string"},"body.fill_events_deduped":{"name":"fill_events_deduped","description":"fill_events_deduped","required":false,"in":"body","schema":{"$ref":"#/definitions/fill_events_deduped"}},"rowFilter.fill_events_deduped.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.emit_address":{"name":"emit_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events_deduped.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.fill_events_deduped.maker_address":{"name":"maker_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events_deduped.maker_custodian_id":{"name":"maker_custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.maker_order_id":{"name":"maker_order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.maker_side":{"name":"maker_side","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.fill_events_deduped.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.sequence_number_for_trade":{"name":"sequence_number_for_trade","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.size":{"name":"size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.taker_address":{"name":"taker_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events_deduped.taker_custodian_id":{"name":"taker_custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.taker_order_id":{"name":"taker_order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.taker_quote_fees_paid":{"name":"taker_quote_fees_paid","required":false,"format":"numeric","in":"query","type":"string"},"body.competition_metadata":{"name":"competition_metadata","description":"competition_metadata","required":false,"in":"body","schema":{"$ref":"#/definitions/competition_metadata"}},"rowFilter.competition_metadata.id":{"name":"id","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.competition_metadata.start":{"name":"start","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.competition_metadata.end":{"name":"end","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.competition_metadata.prize":{"name":"prize","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.competition_metadata.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.competition_metadata.integrators_required":{"name":"integrators_required","required":false,"format":"text[]","in":"query","type":"string"},"body.recognized_market_events":{"name":"recognized_market_events","description":"recognized_market_events","required":false,"in":"body","schema":{"$ref":"#/definitions/recognized_market_events"}},"rowFilter.recognized_market_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.recognized_market_events.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.recognized_market_events.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.recognized_market_events.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.lot_size":{"name":"lot_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.tick_size":{"name":"tick_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.min_size":{"name":"min_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.underwriter_id":{"name":"underwriter_id","required":false,"format":"numeric","in":"query","type":"string"},"body.liquidity_groups":{"name":"liquidity_groups","description":"liquidity_groups","required":false,"in":"body","schema":{"$ref":"#/definitions/liquidity_groups"}},"rowFilter.liquidity_groups.group_id":{"name":"group_id","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.liquidity_groups.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.liquidity_groups.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"body.balance_updates_by_handle":{"name":"balance_updates_by_handle","description":"balance_updates_by_handle","required":false,"in":"body","schema":{"$ref":"#/definitions/balance_updates_by_handle"}},"rowFilter.balance_updates_by_handle.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.handle":{"name":"handle","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.base_total":{"name":"base_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.base_available":{"name":"base_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.base_ceiling":{"name":"base_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.quote_total":{"name":"quote_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.quote_available":{"name":"quote_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.quote_ceiling":{"name":"quote_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"body.fees":{"name":"fees","description":"fees","required":false,"in":"body","schema":{"$ref":"#/definitions/fees"}},"rowFilter.fees.start_time_1hr_period":{"name":"start_time_1hr_period","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.fees.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fees.fees_in_quote_subunits":{"name":"fees_in_quote_subunits","required":false,"format":"numeric","in":"query","type":"string"},"body.prices":{"name":"prices","description":"prices","required":false,"in":"body","schema":{"$ref":"#/definitions/prices"}},"rowFilter.prices.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.prices.start_time_1m_period":{"name":"start_time_1m_period","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.prices.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.prices.sum_fill_size_1m_period":{"name":"sum_fill_size_1m_period","required":false,"format":"numeric","in":"query","type":"string"},"body.spreads":{"name":"spreads","description":"spreads","required":false,"in":"body","schema":{"$ref":"#/definitions/spreads"}},"rowFilter.spreads.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.spreads.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.spreads.min_ask":{"name":"min_ask","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.spreads.max_bid":{"name":"max_bid","required":false,"format":"numeric","in":"query","type":"string"},"body.coins":{"name":"coins","description":"coins","required":false,"in":"body","schema":{"$ref":"#/definitions/coins"}},"rowFilter.coins.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.coins.symbol":{"name":"symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.coins.decimals":{"name":"decimals","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.coins.address":{"name":"address","required":false,"format":"text","in":"query","type":"string"},"rowFilter.coins.module":{"name":"module","required":false,"format":"text","in":"query","type":"string"},"rowFilter.coins.struct":{"name":"struct","required":false,"format":"text","in":"query","type":"string"},"body.markets":{"name":"markets","description":"markets","required":false,"in":"body","schema":{"$ref":"#/definitions/markets"}},"rowFilter.markets.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.registration_time":{"name":"registration_time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.markets.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.markets.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.markets.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.lot_size":{"name":"lot_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.tick_size":{"name":"tick_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.min_size":{"name":"min_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.underwriter_id":{"name":"underwriter_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.is_recognized":{"name":"is_recognized","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.markets.last_fill_price_24hr":{"name":"last_fill_price_24hr","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.price_change_as_percent_24hr":{"name":"price_change_as_percent_24hr","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.price_change_24hr":{"name":"price_change_24hr","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.min_price_24h":{"name":"min_price_24h","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.max_price_24h":{"name":"max_price_24h","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.base_volume_24h":{"name":"base_volume_24h","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.quote_volume_24h":{"name":"quote_volume_24h","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.base_name":{"name":"base_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.base_decimals":{"name":"base_decimals","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.markets.base_symbol":{"name":"base_symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.quote_name":{"name":"quote_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.quote_decimals":{"name":"quote_decimals","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.markets.quote_symbol":{"name":"quote_symbol","required":false,"format":"text","in":"query","type":"string"},"body.data_status":{"name":"data_status","description":"data_status","required":false,"in":"body","schema":{"$ref":"#/definitions/data_status"}},"rowFilter.data_status.current_time":{"name":"current_time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.data_status.processor_last_txn_version_processed":{"name":"processor_last_txn_version_processed","required":false,"format":"bigint","in":"query","type":"string"},"rowFilter.data_status.aggregator_user_history_last_txn_version_processed":{"name":"aggregator_user_history_last_txn_version_processed","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.data_status.aggregator_candlesticks_last_txn_version_processed":{"name":"aggregator_candlesticks_last_txn_version_processed","required":false,"format":"numeric[]","in":"query","type":"string"},"body.historical_trades":{"name":"historical_trades","description":"historical_trades","required":false,"in":"body","schema":{"$ref":"#/definitions/historical_trades"}},"rowFilter.historical_trades.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.historical_trades.integer_price_to_quote_nominal":{"name":"integer_price_to_quote_nominal","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.base_volume":{"name":"base_volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.quote_volume":{"name":"quote_volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.type":{"name":"type","required":false,"format":"text","in":"query","type":"string"},"body.place_swap_order_events":{"name":"place_swap_order_events","description":"place_swap_order_events","required":false,"in":"body","schema":{"$ref":"#/definitions/place_swap_order_events"}},"rowFilter.place_swap_order_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.place_swap_order_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.signing_account":{"name":"signing_account","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_swap_order_events.integrator":{"name":"integrator","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_swap_order_events.direction":{"name":"direction","required":false,"format":"text","in":"query","type":"string"},"rowFilter.place_swap_order_events.min_base":{"name":"min_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.max_base":{"name":"max_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.min_quote":{"name":"min_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.max_quote":{"name":"max_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.limit_price":{"name":"limit_price","required":false,"format":"numeric","in":"query","type":"string"},"body.change_order_size_events":{"name":"change_order_size_events","description":"change_order_size_events","required":false,"in":"body","schema":{"$ref":"#/definitions/change_order_size_events"}},"rowFilter.change_order_size_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.change_order_size_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.change_order_size_events.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.side":{"name":"side","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.change_order_size_events.new_size":{"name":"new_size","required":false,"format":"numeric","in":"query","type":"string"},"body.liquidity":{"name":"liquidity","description":"liquidity","required":false,"in":"body","schema":{"$ref":"#/definitions/liquidity"}},"rowFilter.liquidity.group_id":{"name":"group_id","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.liquidity.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.liquidity.bps_times_ten":{"name":"bps_times_ten","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.liquidity.amount_ask_ticks":{"name":"amount_ask_ticks","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.liquidity.amount_bid_ticks":{"name":"amount_bid_ticks","required":false,"format":"numeric","in":"query","type":"string"},"body.price_levels":{"name":"price_levels","description":"price_levels","required":false,"in":"body","schema":{"$ref":"#/definitions/price_levels"}},"rowFilter.price_levels.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.price_levels.direction":{"name":"direction","required":false,"format":"public.order_direction","in":"query","type":"string"},"rowFilter.price_levels.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.price_levels.total_size":{"name":"total_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.price_levels.version":{"name":"version","required":false,"format":"numeric","in":"query","type":"string"},"body.cancel_order_events":{"name":"cancel_order_events","description":"cancel_order_events","required":false,"in":"body","schema":{"$ref":"#/definitions/cancel_order_events"}},"rowFilter.cancel_order_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.cancel_order_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.cancel_order_events.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.reason":{"name":"reason","required":false,"format":"smallint","in":"query","type":"string"},"body.fill_events":{"name":"fill_events","description":"fill_events","required":false,"in":"body","schema":{"$ref":"#/definitions/fill_events"}},"rowFilter.fill_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.emit_address":{"name":"emit_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.fill_events.maker_address":{"name":"maker_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events.maker_custodian_id":{"name":"maker_custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.maker_order_id":{"name":"maker_order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.maker_side":{"name":"maker_side","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.fill_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.sequence_number_for_trade":{"name":"sequence_number_for_trade","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.size":{"name":"size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.taker_address":{"name":"taker_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events.taker_custodian_id":{"name":"taker_custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.taker_order_id":{"name":"taker_order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.taker_quote_fees_paid":{"name":"taker_quote_fees_paid","required":false,"format":"numeric","in":"query","type":"string"},"body.tvl_per_asset":{"name":"tvl_per_asset","description":"tvl_per_asset","required":false,"in":"body","schema":{"$ref":"#/definitions/tvl_per_asset"}},"rowFilter.tvl_per_asset.address":{"name":"address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.tvl_per_asset.module":{"name":"module","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.struct":{"name":"struct","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.value":{"name":"value","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_asset.coin_name_generic":{"name":"coin_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_asset.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.symbol":{"name":"symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.decimals":{"name":"decimals","required":false,"format":"smallint","in":"query","type":"string"},"body.user_balances":{"name":"user_balances","description":"user_balances","required":false,"in":"body","schema":{"$ref":"#/definitions/user_balances"}},"rowFilter.user_balances.address":{"name":"address","required":false,"format":"text","in":"query","type":"string"},"rowFilter.user_balances.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.handle":{"name":"handle","required":false,"format":"text","in":"query","type":"string"},"rowFilter.user_balances.base_total":{"name":"base_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.base_available":{"name":"base_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.base_ceiling":{"name":"base_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.quote_total":{"name":"quote_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.quote_available":{"name":"quote_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.quote_ceiling":{"name":"quote_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"body.fees_24h":{"name":"fees_24h","description":"fees_24h","required":false,"in":"body","schema":{"$ref":"#/definitions/fees_24h"}},"rowFilter.fees_24h.fees":{"name":"fees","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fees_24h.day":{"name":"day","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.fees_24h.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"body.competition_exclusion_list":{"name":"competition_exclusion_list","description":"competition_exclusion_list","required":false,"in":"body","schema":{"$ref":"#/definitions/competition_exclusion_list"}},"rowFilter.competition_exclusion_list.user":{"name":"user","required":false,"format":"text","in":"query","type":"string"},"rowFilter.competition_exclusion_list.reason":{"name":"reason","required":false,"format":"text","in":"query","type":"string"},"rowFilter.competition_exclusion_list.competition_id":{"name":"competition_id","required":false,"format":"integer","in":"query","type":"string"},"body.daily_rolling_volume_history":{"name":"daily_rolling_volume_history","description":"daily_rolling_volume_history","required":false,"in":"body","schema":{"$ref":"#/definitions/daily_rolling_volume_history"}},"rowFilter.daily_rolling_volume_history.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.daily_rolling_volume_history.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.daily_rolling_volume_history.volume_in_quote_subunits":{"name":"volume_in_quote_subunits","required":false,"format":"numeric","in":"query","type":"string"},"body.candlestick_resolutions":{"name":"candlestick_resolutions","description":"candlestick_resolutions","required":false,"in":"body","schema":{"$ref":"#/definitions/candlestick_resolutions"}},"rowFilter.candlestick_resolutions.resolution":{"name":"resolution","required":false,"format":"integer","in":"query","type":"string"},"body.candlesticks":{"name":"candlesticks","description":"candlesticks","required":false,"in":"body","schema":{"$ref":"#/definitions/candlesticks"}},"rowFilter.candlesticks.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.resolution":{"name":"resolution","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.candlesticks.start_time":{"name":"start_time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.candlesticks.open":{"name":"open","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.high":{"name":"high","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.low":{"name":"low","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.close":{"name":"close","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.volume":{"name":"volume","required":false,"format":"numeric","in":"query","type":"string"},"body.user_history_last_indexed_txn":{"name":"user_history_last_indexed_txn","description":"user_history_last_indexed_txn","required":false,"in":"body","schema":{"$ref":"#/definitions/user_history_last_indexed_txn"}},"rowFilter.user_history_last_indexed_txn.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"body.recognized_markets":{"name":"recognized_markets","description":"recognized_markets","required":false,"in":"body","schema":{"$ref":"#/definitions/recognized_markets"}},"rowFilter.recognized_markets.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_markets.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.recognized_markets.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.recognized_markets.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.recognized_markets.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.lot_size":{"name":"lot_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_markets.tick_size":{"name":"tick_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_markets.min_size":{"name":"min_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_markets.underwriter_id":{"name":"underwriter_id","required":false,"format":"numeric","in":"query","type":"string"},"body.enumerated_volume_24h":{"name":"enumerated_volume_24h","description":"enumerated_volume_24h","required":false,"in":"body","schema":{"$ref":"#/definitions/enumerated_volume_24h"}},"rowFilter.enumerated_volume_24h.address":{"name":"address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.module":{"name":"module","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.struct":{"name":"struct","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.volume_as_base":{"name":"volume_as_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.volume_as_quote":{"name":"volume_as_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.generic_asset_name":{"name":"generic_asset_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.symbol":{"name":"symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.decimals":{"name":"decimals","required":false,"format":"smallint","in":"query","type":"string"}},"externalDocs":{"description":"PostgREST Documentation","url":"https://postgrest.org/en/v11.2/api.html"}} \ No newline at end of file +{"swagger":"2.0","info":{"description":"This is a dynamic API generated by PostgREST","title":"PostgREST API","version":"11.2.1"},"host":"0.0.0.0:3000","basePath":"/","schemes":["http"],"consumes":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json","text/csv"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json","text/csv"],"paths":{"/":{"get":{"tags":["Introspection"],"summary":"OpenAPI description (this document)","produces":["application/openapi+json","application/json"],"responses":{"200":{"description":"OK"}}}},"/tickers":{"get":{"tags":["tickers"],"parameters":[{"$ref":"#/parameters/rowFilter.tickers.market_id"},{"$ref":"#/parameters/rowFilter.tickers.base_currency"},{"$ref":"#/parameters/rowFilter.tickers.quote_currency"},{"$ref":"#/parameters/rowFilter.tickers.base_volume"},{"$ref":"#/parameters/rowFilter.tickers.quote_volume"},{"$ref":"#/parameters/rowFilter.tickers.base_volume_nominal"},{"$ref":"#/parameters/rowFilter.tickers.quote_volume_nominal"},{"$ref":"#/parameters/rowFilter.tickers.last_price"},{"$ref":"#/parameters/rowFilter.tickers.ask"},{"$ref":"#/parameters/rowFilter.tickers.bid"},{"$ref":"#/parameters/rowFilter.tickers.high"},{"$ref":"#/parameters/rowFilter.tickers.low"},{"$ref":"#/parameters/rowFilter.tickers.liquidity_in_quote"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/tickers"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/market_registration_events":{"get":{"tags":["market_registration_events"],"parameters":[{"$ref":"#/parameters/rowFilter.market_registration_events.txn_version"},{"$ref":"#/parameters/rowFilter.market_registration_events.event_idx"},{"$ref":"#/parameters/rowFilter.market_registration_events.market_id"},{"$ref":"#/parameters/rowFilter.market_registration_events.time"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.lot_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.tick_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.min_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.underwriter_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/market_registration_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["market_registration_events"],"parameters":[{"$ref":"#/parameters/body.market_registration_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["market_registration_events"],"parameters":[{"$ref":"#/parameters/rowFilter.market_registration_events.txn_version"},{"$ref":"#/parameters/rowFilter.market_registration_events.event_idx"},{"$ref":"#/parameters/rowFilter.market_registration_events.market_id"},{"$ref":"#/parameters/rowFilter.market_registration_events.time"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.lot_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.tick_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.min_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.underwriter_id"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["market_registration_events"],"parameters":[{"$ref":"#/parameters/rowFilter.market_registration_events.txn_version"},{"$ref":"#/parameters/rowFilter.market_registration_events.event_idx"},{"$ref":"#/parameters/rowFilter.market_registration_events.market_id"},{"$ref":"#/parameters/rowFilter.market_registration_events.time"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.market_registration_events.lot_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.tick_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.min_size"},{"$ref":"#/parameters/rowFilter.market_registration_events.underwriter_id"},{"$ref":"#/parameters/body.market_registration_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/enumerated_volume":{"get":{"tags":["enumerated_volume"],"parameters":[{"$ref":"#/parameters/rowFilter.enumerated_volume.address"},{"$ref":"#/parameters/rowFilter.enumerated_volume.module"},{"$ref":"#/parameters/rowFilter.enumerated_volume.struct"},{"$ref":"#/parameters/rowFilter.enumerated_volume.volume_as_base"},{"$ref":"#/parameters/rowFilter.enumerated_volume.volume_as_quote"},{"$ref":"#/parameters/rowFilter.enumerated_volume.generic_asset_name"},{"$ref":"#/parameters/rowFilter.enumerated_volume.last_indexed_txn"},{"$ref":"#/parameters/rowFilter.enumerated_volume.name"},{"$ref":"#/parameters/rowFilter.enumerated_volume.symbol"},{"$ref":"#/parameters/rowFilter.enumerated_volume.decimals"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/enumerated_volume"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/orders":{"get":{"tags":["orders"],"parameters":[{"$ref":"#/parameters/rowFilter.orders.market_id"},{"$ref":"#/parameters/rowFilter.orders.order_id"},{"$ref":"#/parameters/rowFilter.orders.created_at"},{"$ref":"#/parameters/rowFilter.orders.last_updated_at"},{"$ref":"#/parameters/rowFilter.orders.integrator"},{"$ref":"#/parameters/rowFilter.orders.total_filled"},{"$ref":"#/parameters/rowFilter.orders.remaining_size"},{"$ref":"#/parameters/rowFilter.orders.order_status"},{"$ref":"#/parameters/rowFilter.orders.order_type"},{"$ref":"#/parameters/rowFilter.orders.user"},{"$ref":"#/parameters/rowFilter.orders.direction"},{"$ref":"#/parameters/rowFilter.orders.price"},{"$ref":"#/parameters/rowFilter.orders.average_execution_price"},{"$ref":"#/parameters/rowFilter.orders.custodian_id"},{"$ref":"#/parameters/rowFilter.orders.self_match_behavior"},{"$ref":"#/parameters/rowFilter.orders.restriction"},{"$ref":"#/parameters/rowFilter.orders.last_increase_stamp"},{"$ref":"#/parameters/rowFilter.orders.min_base"},{"$ref":"#/parameters/rowFilter.orders.max_base"},{"$ref":"#/parameters/rowFilter.orders.min_quote"},{"$ref":"#/parameters/rowFilter.orders.max_quote"},{"$ref":"#/parameters/rowFilter.orders.total_fees_paid_in_quote_subunits"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/orders"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["orders"],"parameters":[{"$ref":"#/parameters/body.orders"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["orders"],"parameters":[{"$ref":"#/parameters/rowFilter.orders.market_id"},{"$ref":"#/parameters/rowFilter.orders.order_id"},{"$ref":"#/parameters/rowFilter.orders.created_at"},{"$ref":"#/parameters/rowFilter.orders.last_updated_at"},{"$ref":"#/parameters/rowFilter.orders.integrator"},{"$ref":"#/parameters/rowFilter.orders.total_filled"},{"$ref":"#/parameters/rowFilter.orders.remaining_size"},{"$ref":"#/parameters/rowFilter.orders.order_status"},{"$ref":"#/parameters/rowFilter.orders.order_type"},{"$ref":"#/parameters/rowFilter.orders.user"},{"$ref":"#/parameters/rowFilter.orders.direction"},{"$ref":"#/parameters/rowFilter.orders.price"},{"$ref":"#/parameters/rowFilter.orders.average_execution_price"},{"$ref":"#/parameters/rowFilter.orders.custodian_id"},{"$ref":"#/parameters/rowFilter.orders.self_match_behavior"},{"$ref":"#/parameters/rowFilter.orders.restriction"},{"$ref":"#/parameters/rowFilter.orders.last_increase_stamp"},{"$ref":"#/parameters/rowFilter.orders.min_base"},{"$ref":"#/parameters/rowFilter.orders.max_base"},{"$ref":"#/parameters/rowFilter.orders.min_quote"},{"$ref":"#/parameters/rowFilter.orders.max_quote"},{"$ref":"#/parameters/rowFilter.orders.total_fees_paid_in_quote_subunits"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["orders"],"parameters":[{"$ref":"#/parameters/rowFilter.orders.market_id"},{"$ref":"#/parameters/rowFilter.orders.order_id"},{"$ref":"#/parameters/rowFilter.orders.created_at"},{"$ref":"#/parameters/rowFilter.orders.last_updated_at"},{"$ref":"#/parameters/rowFilter.orders.integrator"},{"$ref":"#/parameters/rowFilter.orders.total_filled"},{"$ref":"#/parameters/rowFilter.orders.remaining_size"},{"$ref":"#/parameters/rowFilter.orders.order_status"},{"$ref":"#/parameters/rowFilter.orders.order_type"},{"$ref":"#/parameters/rowFilter.orders.user"},{"$ref":"#/parameters/rowFilter.orders.direction"},{"$ref":"#/parameters/rowFilter.orders.price"},{"$ref":"#/parameters/rowFilter.orders.average_execution_price"},{"$ref":"#/parameters/rowFilter.orders.custodian_id"},{"$ref":"#/parameters/rowFilter.orders.self_match_behavior"},{"$ref":"#/parameters/rowFilter.orders.restriction"},{"$ref":"#/parameters/rowFilter.orders.last_increase_stamp"},{"$ref":"#/parameters/rowFilter.orders.min_base"},{"$ref":"#/parameters/rowFilter.orders.max_base"},{"$ref":"#/parameters/rowFilter.orders.min_quote"},{"$ref":"#/parameters/rowFilter.orders.max_quote"},{"$ref":"#/parameters/rowFilter.orders.total_fees_paid_in_quote_subunits"},{"$ref":"#/parameters/body.orders"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/tvl_per_market":{"get":{"tags":["tvl_per_market"],"parameters":[{"$ref":"#/parameters/rowFilter.tvl_per_market.base_value"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_value"},{"$ref":"#/parameters/rowFilter.tvl_per_market.market_id"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_account_address"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_module_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_struct_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_name_generic"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_account_address"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_module_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_struct_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_symbol"},{"$ref":"#/parameters/rowFilter.tvl_per_market.base_decimals"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_name"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_symbol"},{"$ref":"#/parameters/rowFilter.tvl_per_market.quote_decimals"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/tvl_per_market"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/place_market_order_events":{"get":{"tags":["place_market_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_market_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_market_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_market_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.time"},{"$ref":"#/parameters/rowFilter.place_market_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.user"},{"$ref":"#/parameters/rowFilter.place_market_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_market_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_market_order_events.size"},{"$ref":"#/parameters/rowFilter.place_market_order_events.self_match_behavior"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/place_market_order_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["place_market_order_events"],"parameters":[{"$ref":"#/parameters/body.place_market_order_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["place_market_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_market_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_market_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_market_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.time"},{"$ref":"#/parameters/rowFilter.place_market_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.user"},{"$ref":"#/parameters/rowFilter.place_market_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_market_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_market_order_events.size"},{"$ref":"#/parameters/rowFilter.place_market_order_events.self_match_behavior"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["place_market_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_market_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_market_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_market_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.time"},{"$ref":"#/parameters/rowFilter.place_market_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.user"},{"$ref":"#/parameters/rowFilter.place_market_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_market_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_market_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_market_order_events.size"},{"$ref":"#/parameters/rowFilter.place_market_order_events.self_match_behavior"},{"$ref":"#/parameters/body.place_market_order_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/place_limit_order_events":{"get":{"tags":["place_limit_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_limit_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.time"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.user"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.side"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.initial_size"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.price"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.restriction"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.self_match_behavior"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.size"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/place_limit_order_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["place_limit_order_events"],"parameters":[{"$ref":"#/parameters/body.place_limit_order_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["place_limit_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_limit_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.time"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.user"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.side"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.initial_size"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.price"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.restriction"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.self_match_behavior"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.size"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["place_limit_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_limit_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.time"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.user"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.side"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.initial_size"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.price"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.restriction"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.self_match_behavior"},{"$ref":"#/parameters/rowFilter.place_limit_order_events.size"},{"$ref":"#/parameters/body.place_limit_order_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/candlesticks_last_indexed_txn":{"get":{"tags":["candlesticks_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.txn_version"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/candlesticks_last_indexed_txn"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["candlesticks_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/body.candlesticks_last_indexed_txn"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["candlesticks_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.txn_version"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["candlesticks_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks_last_indexed_txn.txn_version"},{"$ref":"#/parameters/body.candlesticks_last_indexed_txn"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/market_account_handles":{"get":{"tags":["market_account_handles"],"parameters":[{"$ref":"#/parameters/rowFilter.market_account_handles.user"},{"$ref":"#/parameters/rowFilter.market_account_handles.handle"},{"$ref":"#/parameters/rowFilter.market_account_handles.creation_time"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/market_account_handles"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["market_account_handles"],"parameters":[{"$ref":"#/parameters/body.market_account_handles"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["market_account_handles"],"parameters":[{"$ref":"#/parameters/rowFilter.market_account_handles.user"},{"$ref":"#/parameters/rowFilter.market_account_handles.handle"},{"$ref":"#/parameters/rowFilter.market_account_handles.creation_time"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["market_account_handles"],"parameters":[{"$ref":"#/parameters/rowFilter.market_account_handles.user"},{"$ref":"#/parameters/rowFilter.market_account_handles.handle"},{"$ref":"#/parameters/rowFilter.market_account_handles.creation_time"},{"$ref":"#/parameters/body.market_account_handles"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/balance_updates":{"get":{"tags":["balance_updates"],"parameters":[{"$ref":"#/parameters/rowFilter.balance_updates.time"},{"$ref":"#/parameters/rowFilter.balance_updates.txn_version"},{"$ref":"#/parameters/rowFilter.balance_updates.user"},{"$ref":"#/parameters/rowFilter.balance_updates.market_id"},{"$ref":"#/parameters/rowFilter.balance_updates.custodian_id"},{"$ref":"#/parameters/rowFilter.balance_updates.base_total"},{"$ref":"#/parameters/rowFilter.balance_updates.base_available"},{"$ref":"#/parameters/rowFilter.balance_updates.base_ceiling"},{"$ref":"#/parameters/rowFilter.balance_updates.quote_total"},{"$ref":"#/parameters/rowFilter.balance_updates.quote_available"},{"$ref":"#/parameters/rowFilter.balance_updates.quote_ceiling"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/balance_updates"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/competition_leaderboard_users":{"get":{"tags":["competition_leaderboard_users"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.user"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.volume"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.integrators_used"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.n_trades"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.points"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.competition_id"},{"$ref":"#/parameters/rowFilter.competition_leaderboard_users.rank"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/competition_leaderboard_users"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/fill_events_deduped":{"get":{"tags":["fill_events_deduped"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events_deduped.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.time"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.market_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.price"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.size"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_quote_fees_paid"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/fill_events_deduped"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["fill_events_deduped"],"parameters":[{"$ref":"#/parameters/body.fill_events_deduped"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["fill_events_deduped"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events_deduped.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.time"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.market_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.price"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.size"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_quote_fees_paid"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["fill_events_deduped"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events_deduped.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.time"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.market_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.price"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.size"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events_deduped.taker_quote_fees_paid"},{"$ref":"#/parameters/body.fill_events_deduped"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/competition_metadata":{"get":{"tags":["competition_metadata"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_metadata.id"},{"$ref":"#/parameters/rowFilter.competition_metadata.start"},{"$ref":"#/parameters/rowFilter.competition_metadata.end"},{"$ref":"#/parameters/rowFilter.competition_metadata.prize"},{"$ref":"#/parameters/rowFilter.competition_metadata.market_id"},{"$ref":"#/parameters/rowFilter.competition_metadata.integrators_required"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/competition_metadata"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["competition_metadata"],"parameters":[{"$ref":"#/parameters/body.competition_metadata"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["competition_metadata"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_metadata.id"},{"$ref":"#/parameters/rowFilter.competition_metadata.start"},{"$ref":"#/parameters/rowFilter.competition_metadata.end"},{"$ref":"#/parameters/rowFilter.competition_metadata.prize"},{"$ref":"#/parameters/rowFilter.competition_metadata.market_id"},{"$ref":"#/parameters/rowFilter.competition_metadata.integrators_required"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["competition_metadata"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_metadata.id"},{"$ref":"#/parameters/rowFilter.competition_metadata.start"},{"$ref":"#/parameters/rowFilter.competition_metadata.end"},{"$ref":"#/parameters/rowFilter.competition_metadata.prize"},{"$ref":"#/parameters/rowFilter.competition_metadata.market_id"},{"$ref":"#/parameters/rowFilter.competition_metadata.integrators_required"},{"$ref":"#/parameters/body.competition_metadata"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/recognized_market_events":{"get":{"tags":["recognized_market_events"],"parameters":[{"$ref":"#/parameters/rowFilter.recognized_market_events.txn_version"},{"$ref":"#/parameters/rowFilter.recognized_market_events.event_idx"},{"$ref":"#/parameters/rowFilter.recognized_market_events.time"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.market_id"},{"$ref":"#/parameters/rowFilter.recognized_market_events.lot_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.tick_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.min_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.underwriter_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/recognized_market_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["recognized_market_events"],"parameters":[{"$ref":"#/parameters/body.recognized_market_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["recognized_market_events"],"parameters":[{"$ref":"#/parameters/rowFilter.recognized_market_events.txn_version"},{"$ref":"#/parameters/rowFilter.recognized_market_events.event_idx"},{"$ref":"#/parameters/rowFilter.recognized_market_events.time"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.market_id"},{"$ref":"#/parameters/rowFilter.recognized_market_events.lot_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.tick_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.min_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.underwriter_id"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["recognized_market_events"],"parameters":[{"$ref":"#/parameters/rowFilter.recognized_market_events.txn_version"},{"$ref":"#/parameters/rowFilter.recognized_market_events.event_idx"},{"$ref":"#/parameters/rowFilter.recognized_market_events.time"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.base_name_generic"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_account_address"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_module_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.quote_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_market_events.market_id"},{"$ref":"#/parameters/rowFilter.recognized_market_events.lot_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.tick_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.min_size"},{"$ref":"#/parameters/rowFilter.recognized_market_events.underwriter_id"},{"$ref":"#/parameters/body.recognized_market_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/liquidity_groups":{"get":{"tags":["liquidity_groups"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity_groups.group_id"},{"$ref":"#/parameters/rowFilter.liquidity_groups.name"},{"$ref":"#/parameters/rowFilter.liquidity_groups.market_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/liquidity_groups"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["liquidity_groups"],"parameters":[{"$ref":"#/parameters/body.liquidity_groups"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["liquidity_groups"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity_groups.group_id"},{"$ref":"#/parameters/rowFilter.liquidity_groups.name"},{"$ref":"#/parameters/rowFilter.liquidity_groups.market_id"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["liquidity_groups"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity_groups.group_id"},{"$ref":"#/parameters/rowFilter.liquidity_groups.name"},{"$ref":"#/parameters/rowFilter.liquidity_groups.market_id"},{"$ref":"#/parameters/body.liquidity_groups"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/balance_updates_by_handle":{"get":{"tags":["balance_updates_by_handle"],"parameters":[{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.txn_version"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.handle"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.market_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.custodian_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.time"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_ceiling"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_ceiling"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/balance_updates_by_handle"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["balance_updates_by_handle"],"parameters":[{"$ref":"#/parameters/body.balance_updates_by_handle"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["balance_updates_by_handle"],"parameters":[{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.txn_version"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.handle"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.market_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.custodian_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.time"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_ceiling"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_ceiling"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["balance_updates_by_handle"],"parameters":[{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.txn_version"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.handle"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.market_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.custodian_id"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.time"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.base_ceiling"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_total"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_available"},{"$ref":"#/parameters/rowFilter.balance_updates_by_handle.quote_ceiling"},{"$ref":"#/parameters/body.balance_updates_by_handle"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/fees":{"get":{"tags":["fees"],"parameters":[{"$ref":"#/parameters/rowFilter.fees.start_time_1hr_period"},{"$ref":"#/parameters/rowFilter.fees.market_id"},{"$ref":"#/parameters/rowFilter.fees.fees_in_quote_subunits"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/fees"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["fees"],"parameters":[{"$ref":"#/parameters/body.fees"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["fees"],"parameters":[{"$ref":"#/parameters/rowFilter.fees.start_time_1hr_period"},{"$ref":"#/parameters/rowFilter.fees.market_id"},{"$ref":"#/parameters/rowFilter.fees.fees_in_quote_subunits"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["fees"],"parameters":[{"$ref":"#/parameters/rowFilter.fees.start_time_1hr_period"},{"$ref":"#/parameters/rowFilter.fees.market_id"},{"$ref":"#/parameters/rowFilter.fees.fees_in_quote_subunits"},{"$ref":"#/parameters/body.fees"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/prices":{"get":{"tags":["prices"],"parameters":[{"$ref":"#/parameters/rowFilter.prices.market_id"},{"$ref":"#/parameters/rowFilter.prices.start_time_1m_period"},{"$ref":"#/parameters/rowFilter.prices.price"},{"$ref":"#/parameters/rowFilter.prices.sum_fill_size_1m_period"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/prices"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["prices"],"parameters":[{"$ref":"#/parameters/body.prices"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["prices"],"parameters":[{"$ref":"#/parameters/rowFilter.prices.market_id"},{"$ref":"#/parameters/rowFilter.prices.start_time_1m_period"},{"$ref":"#/parameters/rowFilter.prices.price"},{"$ref":"#/parameters/rowFilter.prices.sum_fill_size_1m_period"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["prices"],"parameters":[{"$ref":"#/parameters/rowFilter.prices.market_id"},{"$ref":"#/parameters/rowFilter.prices.start_time_1m_period"},{"$ref":"#/parameters/rowFilter.prices.price"},{"$ref":"#/parameters/rowFilter.prices.sum_fill_size_1m_period"},{"$ref":"#/parameters/body.prices"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/spreads":{"get":{"tags":["spreads"],"parameters":[{"$ref":"#/parameters/rowFilter.spreads.market_id"},{"$ref":"#/parameters/rowFilter.spreads.time"},{"$ref":"#/parameters/rowFilter.spreads.min_ask"},{"$ref":"#/parameters/rowFilter.spreads.max_bid"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/spreads"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["spreads"],"parameters":[{"$ref":"#/parameters/body.spreads"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["spreads"],"parameters":[{"$ref":"#/parameters/rowFilter.spreads.market_id"},{"$ref":"#/parameters/rowFilter.spreads.time"},{"$ref":"#/parameters/rowFilter.spreads.min_ask"},{"$ref":"#/parameters/rowFilter.spreads.max_bid"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["spreads"],"parameters":[{"$ref":"#/parameters/rowFilter.spreads.market_id"},{"$ref":"#/parameters/rowFilter.spreads.time"},{"$ref":"#/parameters/rowFilter.spreads.min_ask"},{"$ref":"#/parameters/rowFilter.spreads.max_bid"},{"$ref":"#/parameters/body.spreads"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/coins":{"get":{"tags":["coins"],"parameters":[{"$ref":"#/parameters/rowFilter.coins.name"},{"$ref":"#/parameters/rowFilter.coins.symbol"},{"$ref":"#/parameters/rowFilter.coins.decimals"},{"$ref":"#/parameters/rowFilter.coins.address"},{"$ref":"#/parameters/rowFilter.coins.module"},{"$ref":"#/parameters/rowFilter.coins.struct"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/coins"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["coins"],"parameters":[{"$ref":"#/parameters/body.coins"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["coins"],"parameters":[{"$ref":"#/parameters/rowFilter.coins.name"},{"$ref":"#/parameters/rowFilter.coins.symbol"},{"$ref":"#/parameters/rowFilter.coins.decimals"},{"$ref":"#/parameters/rowFilter.coins.address"},{"$ref":"#/parameters/rowFilter.coins.module"},{"$ref":"#/parameters/rowFilter.coins.struct"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["coins"],"parameters":[{"$ref":"#/parameters/rowFilter.coins.name"},{"$ref":"#/parameters/rowFilter.coins.symbol"},{"$ref":"#/parameters/rowFilter.coins.decimals"},{"$ref":"#/parameters/rowFilter.coins.address"},{"$ref":"#/parameters/rowFilter.coins.module"},{"$ref":"#/parameters/rowFilter.coins.struct"},{"$ref":"#/parameters/body.coins"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/markets":{"get":{"tags":["markets"],"parameters":[{"$ref":"#/parameters/rowFilter.markets.market_id"},{"$ref":"#/parameters/rowFilter.markets.registration_time"},{"$ref":"#/parameters/rowFilter.markets.base_account_address"},{"$ref":"#/parameters/rowFilter.markets.base_module_name"},{"$ref":"#/parameters/rowFilter.markets.base_struct_name"},{"$ref":"#/parameters/rowFilter.markets.base_name_generic"},{"$ref":"#/parameters/rowFilter.markets.quote_account_address"},{"$ref":"#/parameters/rowFilter.markets.quote_module_name"},{"$ref":"#/parameters/rowFilter.markets.quote_struct_name"},{"$ref":"#/parameters/rowFilter.markets.lot_size"},{"$ref":"#/parameters/rowFilter.markets.tick_size"},{"$ref":"#/parameters/rowFilter.markets.min_size"},{"$ref":"#/parameters/rowFilter.markets.underwriter_id"},{"$ref":"#/parameters/rowFilter.markets.is_recognized"},{"$ref":"#/parameters/rowFilter.markets.last_fill_price_24hr"},{"$ref":"#/parameters/rowFilter.markets.price_change_as_percent_24hr"},{"$ref":"#/parameters/rowFilter.markets.price_change_24hr"},{"$ref":"#/parameters/rowFilter.markets.min_price_24h"},{"$ref":"#/parameters/rowFilter.markets.max_price_24h"},{"$ref":"#/parameters/rowFilter.markets.base_volume_24h"},{"$ref":"#/parameters/rowFilter.markets.quote_volume_24h"},{"$ref":"#/parameters/rowFilter.markets.base_name"},{"$ref":"#/parameters/rowFilter.markets.base_decimals"},{"$ref":"#/parameters/rowFilter.markets.base_symbol"},{"$ref":"#/parameters/rowFilter.markets.quote_name"},{"$ref":"#/parameters/rowFilter.markets.quote_decimals"},{"$ref":"#/parameters/rowFilter.markets.quote_symbol"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/markets"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/data_status":{"get":{"tags":["data_status"],"parameters":[{"$ref":"#/parameters/rowFilter.data_status.current_time"},{"$ref":"#/parameters/rowFilter.data_status.processor_last_txn_version_processed"},{"$ref":"#/parameters/rowFilter.data_status.aggregator_user_history_last_txn_version_processed"},{"$ref":"#/parameters/rowFilter.data_status.aggregator_candlesticks_last_txn_version_processed"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/data_status"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/historical_trades":{"get":{"tags":["historical_trades"],"parameters":[{"$ref":"#/parameters/rowFilter.historical_trades.txn_version"},{"$ref":"#/parameters/rowFilter.historical_trades.event_idx"},{"$ref":"#/parameters/rowFilter.historical_trades.market_id"},{"$ref":"#/parameters/rowFilter.historical_trades.time"},{"$ref":"#/parameters/rowFilter.historical_trades.integer_price_to_quote_nominal"},{"$ref":"#/parameters/rowFilter.historical_trades.base_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.quote_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.type"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/historical_trades"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["historical_trades"],"parameters":[{"$ref":"#/parameters/body.historical_trades"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["historical_trades"],"parameters":[{"$ref":"#/parameters/rowFilter.historical_trades.txn_version"},{"$ref":"#/parameters/rowFilter.historical_trades.event_idx"},{"$ref":"#/parameters/rowFilter.historical_trades.market_id"},{"$ref":"#/parameters/rowFilter.historical_trades.time"},{"$ref":"#/parameters/rowFilter.historical_trades.integer_price_to_quote_nominal"},{"$ref":"#/parameters/rowFilter.historical_trades.base_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.quote_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.type"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["historical_trades"],"parameters":[{"$ref":"#/parameters/rowFilter.historical_trades.txn_version"},{"$ref":"#/parameters/rowFilter.historical_trades.event_idx"},{"$ref":"#/parameters/rowFilter.historical_trades.market_id"},{"$ref":"#/parameters/rowFilter.historical_trades.time"},{"$ref":"#/parameters/rowFilter.historical_trades.integer_price_to_quote_nominal"},{"$ref":"#/parameters/rowFilter.historical_trades.base_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.quote_volume"},{"$ref":"#/parameters/rowFilter.historical_trades.type"},{"$ref":"#/parameters/body.historical_trades"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/place_swap_order_events":{"get":{"tags":["place_swap_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_swap_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.time"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.signing_account"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.limit_price"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/place_swap_order_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["place_swap_order_events"],"parameters":[{"$ref":"#/parameters/body.place_swap_order_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["place_swap_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_swap_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.time"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.signing_account"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.limit_price"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["place_swap_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.place_swap_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.market_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.time"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.order_id"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.signing_account"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.integrator"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.direction"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_base"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.min_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.max_quote"},{"$ref":"#/parameters/rowFilter.place_swap_order_events.limit_price"},{"$ref":"#/parameters/body.place_swap_order_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/change_order_size_events":{"get":{"tags":["change_order_size_events"],"parameters":[{"$ref":"#/parameters/rowFilter.change_order_size_events.txn_version"},{"$ref":"#/parameters/rowFilter.change_order_size_events.event_idx"},{"$ref":"#/parameters/rowFilter.change_order_size_events.market_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.time"},{"$ref":"#/parameters/rowFilter.change_order_size_events.order_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.user"},{"$ref":"#/parameters/rowFilter.change_order_size_events.custodian_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.side"},{"$ref":"#/parameters/rowFilter.change_order_size_events.new_size"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/change_order_size_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["change_order_size_events"],"parameters":[{"$ref":"#/parameters/body.change_order_size_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["change_order_size_events"],"parameters":[{"$ref":"#/parameters/rowFilter.change_order_size_events.txn_version"},{"$ref":"#/parameters/rowFilter.change_order_size_events.event_idx"},{"$ref":"#/parameters/rowFilter.change_order_size_events.market_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.time"},{"$ref":"#/parameters/rowFilter.change_order_size_events.order_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.user"},{"$ref":"#/parameters/rowFilter.change_order_size_events.custodian_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.side"},{"$ref":"#/parameters/rowFilter.change_order_size_events.new_size"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["change_order_size_events"],"parameters":[{"$ref":"#/parameters/rowFilter.change_order_size_events.txn_version"},{"$ref":"#/parameters/rowFilter.change_order_size_events.event_idx"},{"$ref":"#/parameters/rowFilter.change_order_size_events.market_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.time"},{"$ref":"#/parameters/rowFilter.change_order_size_events.order_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.user"},{"$ref":"#/parameters/rowFilter.change_order_size_events.custodian_id"},{"$ref":"#/parameters/rowFilter.change_order_size_events.side"},{"$ref":"#/parameters/rowFilter.change_order_size_events.new_size"},{"$ref":"#/parameters/body.change_order_size_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/liquidity":{"get":{"tags":["liquidity"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity.group_id"},{"$ref":"#/parameters/rowFilter.liquidity.time"},{"$ref":"#/parameters/rowFilter.liquidity.bps_times_ten"},{"$ref":"#/parameters/rowFilter.liquidity.amount_ask_ticks"},{"$ref":"#/parameters/rowFilter.liquidity.amount_bid_ticks"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/liquidity"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["liquidity"],"parameters":[{"$ref":"#/parameters/body.liquidity"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["liquidity"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity.group_id"},{"$ref":"#/parameters/rowFilter.liquidity.time"},{"$ref":"#/parameters/rowFilter.liquidity.bps_times_ten"},{"$ref":"#/parameters/rowFilter.liquidity.amount_ask_ticks"},{"$ref":"#/parameters/rowFilter.liquidity.amount_bid_ticks"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["liquidity"],"parameters":[{"$ref":"#/parameters/rowFilter.liquidity.group_id"},{"$ref":"#/parameters/rowFilter.liquidity.time"},{"$ref":"#/parameters/rowFilter.liquidity.bps_times_ten"},{"$ref":"#/parameters/rowFilter.liquidity.amount_ask_ticks"},{"$ref":"#/parameters/rowFilter.liquidity.amount_bid_ticks"},{"$ref":"#/parameters/body.liquidity"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/price_levels":{"get":{"tags":["price_levels"],"parameters":[{"$ref":"#/parameters/rowFilter.price_levels.market_id"},{"$ref":"#/parameters/rowFilter.price_levels.direction"},{"$ref":"#/parameters/rowFilter.price_levels.price"},{"$ref":"#/parameters/rowFilter.price_levels.total_size"},{"$ref":"#/parameters/rowFilter.price_levels.version"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/price_levels"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/cancel_order_events":{"get":{"tags":["cancel_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.cancel_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.cancel_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.cancel_order_events.time"},{"$ref":"#/parameters/rowFilter.cancel_order_events.market_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.user"},{"$ref":"#/parameters/rowFilter.cancel_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.order_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.reason"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/cancel_order_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["cancel_order_events"],"parameters":[{"$ref":"#/parameters/body.cancel_order_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["cancel_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.cancel_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.cancel_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.cancel_order_events.time"},{"$ref":"#/parameters/rowFilter.cancel_order_events.market_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.user"},{"$ref":"#/parameters/rowFilter.cancel_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.order_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.reason"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["cancel_order_events"],"parameters":[{"$ref":"#/parameters/rowFilter.cancel_order_events.txn_version"},{"$ref":"#/parameters/rowFilter.cancel_order_events.event_idx"},{"$ref":"#/parameters/rowFilter.cancel_order_events.time"},{"$ref":"#/parameters/rowFilter.cancel_order_events.market_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.user"},{"$ref":"#/parameters/rowFilter.cancel_order_events.custodian_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.order_id"},{"$ref":"#/parameters/rowFilter.cancel_order_events.reason"},{"$ref":"#/parameters/body.cancel_order_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/fill_events":{"get":{"tags":["fill_events"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events.time"},{"$ref":"#/parameters/rowFilter.fill_events.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events.market_id"},{"$ref":"#/parameters/rowFilter.fill_events.price"},{"$ref":"#/parameters/rowFilter.fill_events.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events.size"},{"$ref":"#/parameters/rowFilter.fill_events.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_quote_fees_paid"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/fill_events"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["fill_events"],"parameters":[{"$ref":"#/parameters/body.fill_events"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["fill_events"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events.time"},{"$ref":"#/parameters/rowFilter.fill_events.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events.market_id"},{"$ref":"#/parameters/rowFilter.fill_events.price"},{"$ref":"#/parameters/rowFilter.fill_events.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events.size"},{"$ref":"#/parameters/rowFilter.fill_events.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_quote_fees_paid"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["fill_events"],"parameters":[{"$ref":"#/parameters/rowFilter.fill_events.txn_version"},{"$ref":"#/parameters/rowFilter.fill_events.event_idx"},{"$ref":"#/parameters/rowFilter.fill_events.emit_address"},{"$ref":"#/parameters/rowFilter.fill_events.time"},{"$ref":"#/parameters/rowFilter.fill_events.maker_address"},{"$ref":"#/parameters/rowFilter.fill_events.maker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.maker_side"},{"$ref":"#/parameters/rowFilter.fill_events.market_id"},{"$ref":"#/parameters/rowFilter.fill_events.price"},{"$ref":"#/parameters/rowFilter.fill_events.sequence_number_for_trade"},{"$ref":"#/parameters/rowFilter.fill_events.size"},{"$ref":"#/parameters/rowFilter.fill_events.taker_address"},{"$ref":"#/parameters/rowFilter.fill_events.taker_custodian_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_order_id"},{"$ref":"#/parameters/rowFilter.fill_events.taker_quote_fees_paid"},{"$ref":"#/parameters/body.fill_events"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/tvl_per_asset":{"get":{"tags":["tvl_per_asset"],"parameters":[{"$ref":"#/parameters/rowFilter.tvl_per_asset.address"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.module"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.struct"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.value"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.coin_name_generic"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.market_id"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.name"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.symbol"},{"$ref":"#/parameters/rowFilter.tvl_per_asset.decimals"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/tvl_per_asset"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/user_balances":{"get":{"tags":["user_balances"],"parameters":[{"$ref":"#/parameters/rowFilter.user_balances.address"},{"$ref":"#/parameters/rowFilter.user_balances.custodian_id"},{"$ref":"#/parameters/rowFilter.user_balances.market_id"},{"$ref":"#/parameters/rowFilter.user_balances.handle"},{"$ref":"#/parameters/rowFilter.user_balances.base_total"},{"$ref":"#/parameters/rowFilter.user_balances.base_available"},{"$ref":"#/parameters/rowFilter.user_balances.base_ceiling"},{"$ref":"#/parameters/rowFilter.user_balances.quote_total"},{"$ref":"#/parameters/rowFilter.user_balances.quote_available"},{"$ref":"#/parameters/rowFilter.user_balances.quote_ceiling"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/user_balances"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["user_balances"],"parameters":[{"$ref":"#/parameters/body.user_balances"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["user_balances"],"parameters":[{"$ref":"#/parameters/rowFilter.user_balances.address"},{"$ref":"#/parameters/rowFilter.user_balances.custodian_id"},{"$ref":"#/parameters/rowFilter.user_balances.market_id"},{"$ref":"#/parameters/rowFilter.user_balances.handle"},{"$ref":"#/parameters/rowFilter.user_balances.base_total"},{"$ref":"#/parameters/rowFilter.user_balances.base_available"},{"$ref":"#/parameters/rowFilter.user_balances.base_ceiling"},{"$ref":"#/parameters/rowFilter.user_balances.quote_total"},{"$ref":"#/parameters/rowFilter.user_balances.quote_available"},{"$ref":"#/parameters/rowFilter.user_balances.quote_ceiling"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["user_balances"],"parameters":[{"$ref":"#/parameters/rowFilter.user_balances.address"},{"$ref":"#/parameters/rowFilter.user_balances.custodian_id"},{"$ref":"#/parameters/rowFilter.user_balances.market_id"},{"$ref":"#/parameters/rowFilter.user_balances.handle"},{"$ref":"#/parameters/rowFilter.user_balances.base_total"},{"$ref":"#/parameters/rowFilter.user_balances.base_available"},{"$ref":"#/parameters/rowFilter.user_balances.base_ceiling"},{"$ref":"#/parameters/rowFilter.user_balances.quote_total"},{"$ref":"#/parameters/rowFilter.user_balances.quote_available"},{"$ref":"#/parameters/rowFilter.user_balances.quote_ceiling"},{"$ref":"#/parameters/body.user_balances"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/fees_24h":{"get":{"tags":["fees_24h"],"parameters":[{"$ref":"#/parameters/rowFilter.fees_24h.fees"},{"$ref":"#/parameters/rowFilter.fees_24h.day"},{"$ref":"#/parameters/rowFilter.fees_24h.market_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/fees_24h"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/competition_exclusion_list":{"get":{"tags":["competition_exclusion_list"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_exclusion_list.user"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.reason"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.competition_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/competition_exclusion_list"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["competition_exclusion_list"],"parameters":[{"$ref":"#/parameters/body.competition_exclusion_list"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["competition_exclusion_list"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_exclusion_list.user"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.reason"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.competition_id"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["competition_exclusion_list"],"parameters":[{"$ref":"#/parameters/rowFilter.competition_exclusion_list.user"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.reason"},{"$ref":"#/parameters/rowFilter.competition_exclusion_list.competition_id"},{"$ref":"#/parameters/body.competition_exclusion_list"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/daily_rolling_volume_history":{"get":{"tags":["daily_rolling_volume_history"],"parameters":[{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.time"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.market_id"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.volume_in_quote_subunits"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/daily_rolling_volume_history"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["daily_rolling_volume_history"],"parameters":[{"$ref":"#/parameters/body.daily_rolling_volume_history"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["daily_rolling_volume_history"],"parameters":[{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.time"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.market_id"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.volume_in_quote_subunits"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["daily_rolling_volume_history"],"parameters":[{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.time"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.market_id"},{"$ref":"#/parameters/rowFilter.daily_rolling_volume_history.volume_in_quote_subunits"},{"$ref":"#/parameters/body.daily_rolling_volume_history"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/candlestick_resolutions":{"get":{"tags":["candlestick_resolutions"],"parameters":[{"$ref":"#/parameters/rowFilter.candlestick_resolutions.resolution"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/candlestick_resolutions"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/candlesticks":{"get":{"tags":["candlesticks"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks.market_id"},{"$ref":"#/parameters/rowFilter.candlesticks.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks.start_time"},{"$ref":"#/parameters/rowFilter.candlesticks.open"},{"$ref":"#/parameters/rowFilter.candlesticks.high"},{"$ref":"#/parameters/rowFilter.candlesticks.low"},{"$ref":"#/parameters/rowFilter.candlesticks.close"},{"$ref":"#/parameters/rowFilter.candlesticks.volume"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/candlesticks"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["candlesticks"],"parameters":[{"$ref":"#/parameters/body.candlesticks"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["candlesticks"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks.market_id"},{"$ref":"#/parameters/rowFilter.candlesticks.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks.start_time"},{"$ref":"#/parameters/rowFilter.candlesticks.open"},{"$ref":"#/parameters/rowFilter.candlesticks.high"},{"$ref":"#/parameters/rowFilter.candlesticks.low"},{"$ref":"#/parameters/rowFilter.candlesticks.close"},{"$ref":"#/parameters/rowFilter.candlesticks.volume"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["candlesticks"],"parameters":[{"$ref":"#/parameters/rowFilter.candlesticks.market_id"},{"$ref":"#/parameters/rowFilter.candlesticks.resolution"},{"$ref":"#/parameters/rowFilter.candlesticks.start_time"},{"$ref":"#/parameters/rowFilter.candlesticks.open"},{"$ref":"#/parameters/rowFilter.candlesticks.high"},{"$ref":"#/parameters/rowFilter.candlesticks.low"},{"$ref":"#/parameters/rowFilter.candlesticks.close"},{"$ref":"#/parameters/rowFilter.candlesticks.volume"},{"$ref":"#/parameters/body.candlesticks"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/user_history_last_indexed_txn":{"get":{"tags":["user_history_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.user_history_last_indexed_txn.txn_version"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/user_history_last_indexed_txn"},"type":"array"}},"206":{"description":"Partial Content"}}},"post":{"tags":["user_history_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/body.user_history_last_indexed_txn"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/preferPost"}],"responses":{"201":{"description":"Created"}}},"delete":{"tags":["user_history_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.user_history_last_indexed_txn.txn_version"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}},"patch":{"tags":["user_history_last_indexed_txn"],"parameters":[{"$ref":"#/parameters/rowFilter.user_history_last_indexed_txn.txn_version"},{"$ref":"#/parameters/body.user_history_last_indexed_txn"},{"$ref":"#/parameters/preferReturn"}],"responses":{"204":{"description":"No Content"}}}},"/recognized_markets":{"get":{"tags":["recognized_markets"],"parameters":[{"$ref":"#/parameters/rowFilter.recognized_markets.market_id"},{"$ref":"#/parameters/rowFilter.recognized_markets.time"},{"$ref":"#/parameters/rowFilter.recognized_markets.base_account_address"},{"$ref":"#/parameters/rowFilter.recognized_markets.base_module_name"},{"$ref":"#/parameters/rowFilter.recognized_markets.base_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_markets.base_name_generic"},{"$ref":"#/parameters/rowFilter.recognized_markets.quote_account_address"},{"$ref":"#/parameters/rowFilter.recognized_markets.quote_module_name"},{"$ref":"#/parameters/rowFilter.recognized_markets.quote_struct_name"},{"$ref":"#/parameters/rowFilter.recognized_markets.lot_size"},{"$ref":"#/parameters/rowFilter.recognized_markets.tick_size"},{"$ref":"#/parameters/rowFilter.recognized_markets.min_size"},{"$ref":"#/parameters/rowFilter.recognized_markets.underwriter_id"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/recognized_markets"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/enumerated_volume_24h":{"get":{"tags":["enumerated_volume_24h"],"parameters":[{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.address"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.module"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.struct"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.volume_as_base"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.volume_as_quote"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.generic_asset_name"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.name"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.symbol"},{"$ref":"#/parameters/rowFilter.enumerated_volume_24h.decimals"},{"$ref":"#/parameters/select"},{"$ref":"#/parameters/order"},{"$ref":"#/parameters/range"},{"$ref":"#/parameters/rangeUnit"},{"$ref":"#/parameters/offset"},{"$ref":"#/parameters/limit"},{"$ref":"#/parameters/preferCount"}],"responses":{"200":{"description":"OK","schema":{"items":{"$ref":"#/definitions/enumerated_volume_24h"},"type":"array"}},"206":{"description":"Partial Content"}}}},"/rpc/get_market_mid_price":{"get":{"tags":["(rpc) get_market_mid_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_mid_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_cumulative_fees":{"get":{"tags":["(rpc) get_market_cumulative_fees"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"timestamp with time zone","in":"query","name":"up_to","required":true,"type":"string"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_cumulative_fees"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"},"up_to":{"format":"timestamp with time zone","type":"string"}},"required":["market_id","up_to"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_24h_low":{"get":{"tags":["(rpc) get_market_24h_low"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_24h_low"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/orderbook":{"get":{"tags":["(rpc) orderbook"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"numeric","in":"query","name":"depth","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) orderbook"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"depth":{"format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"}},"required":["market_id","depth"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/user_handle":{"get":{"tags":["(rpc) user_handle"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"text","in":"query","name":"user_address","required":true,"type":"string"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) user_handle"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"user_address":{"format":"text","type":"string"}},"required":["user_address"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_last_price":{"get":{"tags":["(rpc) get_market_last_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_last_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/quote_indivisible_subunits_to_nominal":{"get":{"tags":["(rpc) quote_indivisible_subunits_to_nominal"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"numeric","in":"query","name":"subunits","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) quote_indivisible_subunits_to_nominal"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"},"subunits":{"format":"numeric","type":"number"}},"required":["market_id","subunits"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/fees":{"get":{"tags":["(rpc) fees"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"timestamp with time zone","in":"query","name":"time","required":true,"type":"string"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) fees"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"}},"required":["market_id","time"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/data_is_consistent":{"get":{"tags":["(rpc) data_is_consistent"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) data_is_consistent"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/volume_history":{"get":{"tags":["(rpc) volume_history"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"timestamp with time zone","in":"query","name":"time","required":true,"type":"string"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) volume_history"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"}},"required":["market_id","time"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/market_aggregated_info":{"get":{"tags":["(rpc) market_aggregated_info"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"integer","in":"query","name":"market","required":true,"type":"integer"},{"format":"integer","in":"query","name":"seconds","required":true,"type":"integer"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) market_aggregated_info"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market":{"format":"integer","type":"integer"},"seconds":{"format":"integer","type":"integer"}},"required":["market","seconds"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_best_ask_price":{"get":{"tags":["(rpc) get_market_best_ask_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_best_ask_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_best_bid_price":{"get":{"tags":["(rpc) get_market_best_bid_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_best_bid_price"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_liquidity":{"get":{"tags":["(rpc) get_market_liquidity"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"},{"format":"numeric","in":"query","name":"depth","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_liquidity"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"depth":{"format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"}},"required":["market_id","depth"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/user_balance":{"get":{"tags":["(rpc) user_balance"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"text","in":"query","name":"user_address","required":true,"type":"string"},{"format":"numeric","in":"query","name":"market","required":true,"type":"number"},{"format":"numeric","in":"query","name":"custodian","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) user_balance"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"custodian":{"format":"numeric","type":"number"},"market":{"format":"numeric","type":"number"},"user_address":{"format":"text","type":"string"}},"required":["user_address","market","custodian"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}},"/rpc/get_market_24h_high":{"get":{"tags":["(rpc) get_market_24h_high"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"format":"numeric","in":"query","name":"market_id","required":true,"type":"number"}],"responses":{"200":{"description":"OK"}}},"post":{"tags":["(rpc) get_market_24h_high"],"produces":["application/json","application/vnd.pgrst.object+json;nulls=stripped","application/vnd.pgrst.object+json"],"parameters":[{"in":"body","name":"args","required":true,"schema":{"properties":{"market_id":{"format":"numeric","type":"number"}},"required":["market_id"],"type":"object"}},{"$ref":"#/parameters/preferParams"}],"responses":{"200":{"description":"OK"}}}}},"definitions":{"tickers":{"properties":{"market_id":{"format":"numeric","type":"number"},"base_currency":{"format":"text","type":"string"},"quote_currency":{"format":"text","type":"string"},"base_volume":{"format":"numeric","type":"number"},"quote_volume":{"format":"numeric","type":"number"},"base_volume_nominal":{"format":"double precision","type":"number"},"quote_volume_nominal":{"format":"double precision","type":"number"},"last_price":{"format":"numeric","type":"number"},"ask":{"format":"numeric","type":"number"},"bid":{"format":"numeric","type":"number"},"high":{"format":"numeric","type":"number"},"low":{"format":"numeric","type":"number"},"liquidity_in_quote":{"format":"numeric","type":"number"}},"type":"object"},"market_registration_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"lot_size":{"format":"numeric","type":"number"},"tick_size":{"format":"numeric","type":"number"},"min_size":{"format":"numeric","type":"number"},"underwriter_id":{"format":"numeric","type":"number"}},"type":"object"},"enumerated_volume":{"properties":{"address":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"module":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"struct":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"volume_as_base":{"format":"numeric","type":"number"},"volume_as_quote":{"format":"numeric","type":"number"},"generic_asset_name":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"last_indexed_txn":{"format":"numeric","type":"number"},"name":{"format":"text","type":"string"},"symbol":{"format":"text","type":"string"},"decimals":{"format":"smallint","type":"integer"}},"type":"object"},"orders":{"properties":{"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"order_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"created_at":{"format":"timestamp with time zone","type":"string"},"last_updated_at":{"format":"timestamp with time zone","type":"string"},"integrator":{"format":"text","type":"string"},"total_filled":{"format":"numeric","type":"number"},"remaining_size":{"format":"numeric","type":"number"},"order_status":{"enum":["open","closed","cancelled"],"format":"public.order_status","type":"string"},"order_type":{"enum":["limit","market","swap"],"format":"public.order_type","type":"string"},"user":{"format":"text","type":"string"},"direction":{"enum":["sell","buy","ask","bid"],"format":"public.order_direction","type":"string"},"price":{"format":"numeric","type":"number"},"average_execution_price":{"format":"numeric","type":"number"},"custodian_id":{"format":"numeric","type":"number"},"self_match_behavior":{"format":"smallint","type":"integer"},"restriction":{"format":"smallint","type":"integer"},"last_increase_stamp":{"format":"numeric","type":"number"},"min_base":{"format":"numeric","type":"number"},"max_base":{"format":"numeric","type":"number"},"min_quote":{"format":"numeric","type":"number"},"max_quote":{"format":"numeric","type":"number"},"total_fees_paid_in_quote_subunits":{"format":"numeric","type":"number"}},"type":"object"},"tvl_per_market":{"properties":{"base_value":{"format":"numeric","type":"number"},"quote_value":{"format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"base_name":{"format":"text","type":"string"},"base_symbol":{"format":"text","type":"string"},"base_decimals":{"format":"smallint","type":"integer"},"quote_name":{"format":"text","type":"string"},"quote_symbol":{"format":"text","type":"string"},"quote_decimals":{"format":"smallint","type":"integer"}},"type":"object"},"place_market_order_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"order_id":{"format":"numeric","type":"number"},"user":{"format":"character varying","maxLength":70,"type":"string"},"custodian_id":{"format":"numeric","type":"number"},"integrator":{"format":"character varying","maxLength":70,"type":"string"},"direction":{"format":"text","type":"string"},"size":{"format":"numeric","type":"number"},"self_match_behavior":{"format":"smallint","type":"integer"}},"type":"object"},"place_limit_order_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"market_id":{"format":"numeric","type":"number"},"user":{"format":"character varying","maxLength":70,"type":"string"},"custodian_id":{"format":"numeric","type":"number"},"order_id":{"format":"numeric","type":"number"},"side":{"format":"boolean","type":"boolean"},"integrator":{"format":"character varying","maxLength":70,"type":"string"},"initial_size":{"format":"numeric","type":"number"},"price":{"format":"numeric","type":"number"},"restriction":{"format":"smallint","type":"integer"},"self_match_behavior":{"format":"smallint","type":"integer"},"size":{"format":"numeric","type":"number"}},"type":"object"},"candlesticks_last_indexed_txn":{"properties":{"resolution":{"description":"Note:\nThis is a Primary Key.","format":"integer","type":"integer"},"txn_version":{"format":"numeric","type":"number"}},"type":"object"},"market_account_handles":{"properties":{"user":{"description":"Note:\nThis is a Primary Key.","format":"character varying","maxLength":70,"type":"string"},"handle":{"format":"character varying","maxLength":70,"type":"string"},"creation_time":{"format":"timestamp with time zone","type":"string"}},"type":"object"},"balance_updates":{"properties":{"time":{"format":"timestamp with time zone","type":"string"},"txn_version":{"format":"numeric","type":"number"},"user":{"description":"Note:\nThis is a Primary Key.","format":"character varying","maxLength":70,"type":"string"},"market_id":{"format":"numeric","type":"number"},"custodian_id":{"format":"numeric","type":"number"},"base_total":{"format":"numeric","type":"number"},"base_available":{"format":"numeric","type":"number"},"base_ceiling":{"format":"numeric","type":"number"},"quote_total":{"format":"numeric","type":"number"},"quote_available":{"format":"numeric","type":"number"},"quote_ceiling":{"format":"numeric","type":"number"}},"type":"object"},"competition_leaderboard_users":{"properties":{"user":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"volume":{"format":"numeric","type":"number"},"integrators_used":{"format":"text[]","items":{"type":"string"},"type":"array"},"n_trades":{"format":"integer","type":"integer"},"points":{"format":"numeric","type":"number"},"competition_id":{"description":"Note:\nThis is a Primary Key.\nThis is a Foreign Key to `competition_metadata.id`.","format":"integer","type":"integer"},"rank":{"format":"bigint","type":"integer"}},"type":"object"},"fill_events_deduped":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"emit_address":{"format":"character varying","maxLength":70,"type":"string"},"time":{"format":"timestamp with time zone","type":"string"},"maker_address":{"format":"character varying","maxLength":70,"type":"string"},"maker_custodian_id":{"format":"numeric","type":"number"},"maker_order_id":{"format":"numeric","type":"number"},"maker_side":{"format":"boolean","type":"boolean"},"market_id":{"format":"numeric","type":"number"},"price":{"format":"numeric","type":"number"},"sequence_number_for_trade":{"format":"numeric","type":"number"},"size":{"format":"numeric","type":"number"},"taker_address":{"format":"character varying","maxLength":70,"type":"string"},"taker_custodian_id":{"format":"numeric","type":"number"},"taker_order_id":{"format":"numeric","type":"number"},"taker_quote_fees_paid":{"format":"numeric","type":"number"}},"type":"object"},"competition_metadata":{"properties":{"id":{"description":"Note:\nThis is a Primary Key.","format":"integer","type":"integer"},"start":{"format":"timestamp with time zone","type":"string"},"end":{"format":"timestamp with time zone","type":"string"},"prize":{"format":"integer","type":"integer"},"market_id":{"format":"numeric","type":"number"},"integrators_required":{"format":"text[]","items":{"type":"string"},"type":"array"}},"type":"object"},"recognized_market_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"market_id":{"format":"numeric","type":"number"},"lot_size":{"format":"numeric","type":"number"},"tick_size":{"format":"numeric","type":"number"},"min_size":{"format":"numeric","type":"number"},"underwriter_id":{"format":"numeric","type":"number"}},"type":"object"},"liquidity_groups":{"properties":{"group_id":{"description":"Note:\nThis is a Primary Key.","format":"integer","type":"integer"},"name":{"format":"text","type":"string"},"market_id":{"format":"numeric","type":"number"}},"type":"object"},"balance_updates_by_handle":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"handle":{"description":"Note:\nThis is a Primary Key.","format":"character varying","maxLength":70,"type":"string"},"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"custodian_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"base_total":{"format":"numeric","type":"number"},"base_available":{"format":"numeric","type":"number"},"base_ceiling":{"format":"numeric","type":"number"},"quote_total":{"format":"numeric","type":"number"},"quote_available":{"format":"numeric","type":"number"},"quote_ceiling":{"format":"numeric","type":"number"}},"type":"object"},"fees":{"properties":{"start_time_1hr_period":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"fees_in_quote_subunits":{"format":"numeric","type":"number"}},"type":"object"},"prices":{"properties":{"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"start_time_1m_period":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"price":{"format":"numeric","type":"number"},"sum_fill_size_1m_period":{"format":"numeric","type":"number"}},"type":"object"},"spreads":{"properties":{"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"min_ask":{"format":"numeric","type":"number"},"max_bid":{"format":"numeric","type":"number"}},"type":"object"},"coins":{"properties":{"name":{"format":"text","type":"string"},"symbol":{"format":"text","type":"string"},"decimals":{"format":"smallint","type":"integer"},"address":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"module":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"struct":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"}},"type":"object"},"markets":{"properties":{"market_id":{"format":"numeric","type":"number"},"registration_time":{"format":"timestamp with time zone","type":"string"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"lot_size":{"format":"numeric","type":"number"},"tick_size":{"format":"numeric","type":"number"},"min_size":{"format":"numeric","type":"number"},"underwriter_id":{"format":"numeric","type":"number"},"is_recognized":{"format":"boolean","type":"boolean"},"last_fill_price_24hr":{"format":"numeric","type":"number"},"price_change_as_percent_24hr":{"format":"numeric","type":"number"},"price_change_24hr":{"format":"numeric","type":"number"},"min_price_24h":{"format":"numeric","type":"number"},"max_price_24h":{"format":"numeric","type":"number"},"base_volume_24h":{"format":"numeric","type":"number"},"quote_volume_24h":{"format":"numeric","type":"number"},"base_name":{"format":"text","type":"string"},"base_decimals":{"format":"smallint","type":"integer"},"base_symbol":{"format":"text","type":"string"},"quote_name":{"format":"text","type":"string"},"quote_decimals":{"format":"smallint","type":"integer"},"quote_symbol":{"format":"text","type":"string"}},"type":"object"},"data_status":{"properties":{"current_time":{"format":"timestamp with time zone","type":"string"},"processor_last_txn_version_processed":{"format":"bigint","type":"integer"},"aggregator_user_history_last_txn_version_processed":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"aggregator_candlesticks_last_txn_version_processed":{"format":"numeric[]","items":{"type":"number"},"type":"array"}},"type":"object"},"historical_trades":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"integer_price_to_quote_nominal":{"format":"numeric","type":"number"},"base_volume":{"format":"numeric","type":"number"},"quote_volume":{"format":"numeric","type":"number"},"type":{"format":"text","type":"string"}},"type":"object"},"place_swap_order_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"order_id":{"format":"numeric","type":"number"},"signing_account":{"format":"character varying","maxLength":70,"type":"string"},"integrator":{"format":"character varying","maxLength":70,"type":"string"},"direction":{"format":"text","type":"string"},"min_base":{"format":"numeric","type":"number"},"max_base":{"format":"numeric","type":"number"},"min_quote":{"format":"numeric","type":"number"},"max_quote":{"format":"numeric","type":"number"},"limit_price":{"format":"numeric","type":"number"}},"type":"object"},"change_order_size_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"order_id":{"format":"numeric","type":"number"},"user":{"format":"character varying","maxLength":70,"type":"string"},"custodian_id":{"format":"numeric","type":"number"},"side":{"format":"boolean","type":"boolean"},"new_size":{"format":"numeric","type":"number"}},"type":"object"},"liquidity":{"properties":{"group_id":{"description":"Note:\nThis is a Primary Key.\nThis is a Foreign Key to `liquidity_groups.group_id`.","format":"integer","type":"integer"},"time":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"bps_times_ten":{"description":"Note:\nThis is a Primary Key.","format":"smallint","type":"integer"},"amount_ask_ticks":{"format":"numeric","type":"number"},"amount_bid_ticks":{"format":"numeric","type":"number"}},"type":"object"},"price_levels":{"properties":{"market_id":{"format":"numeric","type":"number"},"direction":{"enum":["sell","buy","ask","bid"],"format":"public.order_direction","type":"string"},"price":{"format":"numeric","type":"number"},"total_size":{"format":"numeric","type":"number"},"version":{"format":"numeric","type":"number"}},"type":"object"},"cancel_order_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"market_id":{"format":"numeric","type":"number"},"user":{"format":"character varying","maxLength":70,"type":"string"},"custodian_id":{"format":"numeric","type":"number"},"order_id":{"format":"numeric","type":"number"},"reason":{"format":"smallint","type":"integer"}},"type":"object"},"fill_events":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"event_idx":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"emit_address":{"format":"character varying","maxLength":70,"type":"string"},"time":{"format":"timestamp with time zone","type":"string"},"maker_address":{"format":"character varying","maxLength":70,"type":"string"},"maker_custodian_id":{"format":"numeric","type":"number"},"maker_order_id":{"format":"numeric","type":"number"},"maker_side":{"format":"boolean","type":"boolean"},"market_id":{"format":"numeric","type":"number"},"price":{"format":"numeric","type":"number"},"sequence_number_for_trade":{"format":"numeric","type":"number"},"size":{"format":"numeric","type":"number"},"taker_address":{"format":"character varying","maxLength":70,"type":"string"},"taker_custodian_id":{"format":"numeric","type":"number"},"taker_order_id":{"format":"numeric","type":"number"},"taker_quote_fees_paid":{"format":"numeric","type":"number"}},"type":"object"},"tvl_per_asset":{"properties":{"address":{"format":"character varying","type":"string"},"module":{"format":"text","type":"string"},"struct":{"format":"text","type":"string"},"value":{"format":"numeric","type":"number"},"coin_name_generic":{"format":"text","type":"string"},"market_id":{"format":"numeric","type":"number"},"name":{"format":"text","type":"string"},"symbol":{"format":"text","type":"string"},"decimals":{"format":"smallint","type":"integer"}},"type":"object"},"user_balances":{"properties":{"address":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"custodian_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"handle":{"format":"text","type":"string"},"base_total":{"format":"numeric","type":"number"},"base_available":{"format":"numeric","type":"number"},"base_ceiling":{"format":"numeric","type":"number"},"quote_total":{"format":"numeric","type":"number"},"quote_available":{"format":"numeric","type":"number"},"quote_ceiling":{"format":"numeric","type":"number"}},"type":"object"},"fees_24h":{"properties":{"fees":{"format":"numeric","type":"number"},"day":{"format":"timestamp with time zone","type":"string"},"market_id":{"format":"numeric","type":"number"}},"type":"object"},"competition_exclusion_list":{"properties":{"user":{"description":"Note:\nThis is a Primary Key.","format":"text","type":"string"},"reason":{"format":"text","type":"string"},"competition_id":{"description":"Note:\nThis is a Primary Key.\nThis is a Foreign Key to `competition_metadata.id`.","format":"integer","type":"integer"}},"type":"object"},"daily_rolling_volume_history":{"properties":{"time":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"volume_in_quote_subunits":{"format":"numeric","type":"number"}},"type":"object"},"candlestick_resolutions":{"properties":{"resolution":{"format":"integer","type":"integer"}},"type":"object"},"candlesticks":{"properties":{"market_id":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"},"resolution":{"description":"Note:\nThis is a Primary Key.","format":"integer","type":"integer"},"start_time":{"description":"Note:\nThis is a Primary Key.","format":"timestamp with time zone","type":"string"},"open":{"format":"numeric","type":"number"},"high":{"format":"numeric","type":"number"},"low":{"format":"numeric","type":"number"},"close":{"format":"numeric","type":"number"},"volume":{"format":"numeric","type":"number"}},"type":"object"},"user_history_last_indexed_txn":{"properties":{"txn_version":{"description":"Note:\nThis is a Primary Key.","format":"numeric","type":"number"}},"type":"object"},"recognized_markets":{"properties":{"market_id":{"format":"numeric","type":"number"},"time":{"format":"timestamp with time zone","type":"string"},"base_account_address":{"format":"character varying","maxLength":70,"type":"string"},"base_module_name":{"format":"text","type":"string"},"base_struct_name":{"format":"text","type":"string"},"base_name_generic":{"format":"text","type":"string"},"quote_account_address":{"format":"character varying","maxLength":70,"type":"string"},"quote_module_name":{"format":"text","type":"string"},"quote_struct_name":{"format":"text","type":"string"},"lot_size":{"format":"numeric","type":"number"},"tick_size":{"format":"numeric","type":"number"},"min_size":{"format":"numeric","type":"number"},"underwriter_id":{"format":"numeric","type":"number"}},"type":"object"},"enumerated_volume_24h":{"properties":{"address":{"format":"character varying","type":"string"},"module":{"format":"text","type":"string"},"struct":{"format":"text","type":"string"},"volume_as_base":{"format":"numeric","type":"number"},"volume_as_quote":{"format":"numeric","type":"number"},"generic_asset_name":{"format":"text","type":"string"},"name":{"format":"text","type":"string"},"symbol":{"format":"text","type":"string"},"decimals":{"format":"smallint","type":"integer"}},"type":"object"}},"parameters":{"preferParams":{"name":"Prefer","description":"Preference","required":false,"enum":["params=single-object"],"in":"header","type":"string"},"preferReturn":{"name":"Prefer","description":"Preference","required":false,"enum":["return=representation","return=minimal","return=none"],"in":"header","type":"string"},"preferCount":{"name":"Prefer","description":"Preference","required":false,"enum":["count=none"],"in":"header","type":"string"},"preferPost":{"name":"Prefer","description":"Preference","required":false,"enum":["return=representation","return=minimal","return=none","resolution=ignore-duplicates","resolution=merge-duplicates"],"in":"header","type":"string"},"select":{"name":"select","description":"Filtering Columns","required":false,"in":"query","type":"string"},"on_conflict":{"name":"on_conflict","description":"On Conflict","required":false,"in":"query","type":"string"},"order":{"name":"order","description":"Ordering","required":false,"in":"query","type":"string"},"range":{"name":"Range","description":"Limiting and Pagination","required":false,"in":"header","type":"string"},"rangeUnit":{"name":"Range-Unit","description":"Limiting and Pagination","required":false,"default":"items","in":"header","type":"string"},"offset":{"name":"offset","description":"Limiting and Pagination","required":false,"in":"query","type":"string"},"limit":{"name":"limit","description":"Limiting and Pagination","required":false,"in":"query","type":"string"},"body.tickers":{"name":"tickers","description":"tickers","required":false,"in":"body","schema":{"$ref":"#/definitions/tickers"}},"rowFilter.tickers.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.base_currency":{"name":"base_currency","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tickers.quote_currency":{"name":"quote_currency","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tickers.base_volume":{"name":"base_volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.quote_volume":{"name":"quote_volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.base_volume_nominal":{"name":"base_volume_nominal","required":false,"format":"double precision","in":"query","type":"string"},"rowFilter.tickers.quote_volume_nominal":{"name":"quote_volume_nominal","required":false,"format":"double precision","in":"query","type":"string"},"rowFilter.tickers.last_price":{"name":"last_price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.ask":{"name":"ask","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.bid":{"name":"bid","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.high":{"name":"high","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.low":{"name":"low","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tickers.liquidity_in_quote":{"name":"liquidity_in_quote","required":false,"format":"numeric","in":"query","type":"string"},"body.market_registration_events":{"name":"market_registration_events","description":"market_registration_events","required":false,"in":"body","schema":{"$ref":"#/definitions/market_registration_events"}},"rowFilter.market_registration_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.market_registration_events.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.market_registration_events.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.market_registration_events.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.market_registration_events.lot_size":{"name":"lot_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.tick_size":{"name":"tick_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.min_size":{"name":"min_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.market_registration_events.underwriter_id":{"name":"underwriter_id","required":false,"format":"numeric","in":"query","type":"string"},"body.enumerated_volume":{"name":"enumerated_volume","description":"enumerated_volume","required":false,"in":"body","schema":{"$ref":"#/definitions/enumerated_volume"}},"rowFilter.enumerated_volume.address":{"name":"address","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.module":{"name":"module","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.struct":{"name":"struct","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.volume_as_base":{"name":"volume_as_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume.volume_as_quote":{"name":"volume_as_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume.generic_asset_name":{"name":"generic_asset_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.last_indexed_txn":{"name":"last_indexed_txn","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.symbol":{"name":"symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume.decimals":{"name":"decimals","required":false,"format":"smallint","in":"query","type":"string"},"body.orders":{"name":"orders","description":"orders","required":false,"in":"body","schema":{"$ref":"#/definitions/orders"}},"rowFilter.orders.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.created_at":{"name":"created_at","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.orders.last_updated_at":{"name":"last_updated_at","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.orders.integrator":{"name":"integrator","required":false,"format":"text","in":"query","type":"string"},"rowFilter.orders.total_filled":{"name":"total_filled","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.remaining_size":{"name":"remaining_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.order_status":{"name":"order_status","required":false,"format":"public.order_status","in":"query","type":"string"},"rowFilter.orders.order_type":{"name":"order_type","required":false,"format":"public.order_type","in":"query","type":"string"},"rowFilter.orders.user":{"name":"user","required":false,"format":"text","in":"query","type":"string"},"rowFilter.orders.direction":{"name":"direction","required":false,"format":"public.order_direction","in":"query","type":"string"},"rowFilter.orders.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.average_execution_price":{"name":"average_execution_price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.self_match_behavior":{"name":"self_match_behavior","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.orders.restriction":{"name":"restriction","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.orders.last_increase_stamp":{"name":"last_increase_stamp","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.min_base":{"name":"min_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.max_base":{"name":"max_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.min_quote":{"name":"min_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.max_quote":{"name":"max_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.orders.total_fees_paid_in_quote_subunits":{"name":"total_fees_paid_in_quote_subunits","required":false,"format":"numeric","in":"query","type":"string"},"body.tvl_per_market":{"name":"tvl_per_market","description":"tvl_per_market","required":false,"in":"body","schema":{"$ref":"#/definitions/tvl_per_market"}},"rowFilter.tvl_per_market.base_value":{"name":"base_value","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_value":{"name":"quote_value","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_market.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_market.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.tvl_per_market.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_name":{"name":"base_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_symbol":{"name":"base_symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.base_decimals":{"name":"base_decimals","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_name":{"name":"quote_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_symbol":{"name":"quote_symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_market.quote_decimals":{"name":"quote_decimals","required":false,"format":"smallint","in":"query","type":"string"},"body.place_market_order_events":{"name":"place_market_order_events","description":"place_market_order_events","required":false,"in":"body","schema":{"$ref":"#/definitions/place_market_order_events"}},"rowFilter.place_market_order_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.place_market_order_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_market_order_events.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.integrator":{"name":"integrator","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_market_order_events.direction":{"name":"direction","required":false,"format":"text","in":"query","type":"string"},"rowFilter.place_market_order_events.size":{"name":"size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_market_order_events.self_match_behavior":{"name":"self_match_behavior","required":false,"format":"smallint","in":"query","type":"string"},"body.place_limit_order_events":{"name":"place_limit_order_events","description":"place_limit_order_events","required":false,"in":"body","schema":{"$ref":"#/definitions/place_limit_order_events"}},"rowFilter.place_limit_order_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.place_limit_order_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_limit_order_events.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.side":{"name":"side","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.place_limit_order_events.integrator":{"name":"integrator","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_limit_order_events.initial_size":{"name":"initial_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_limit_order_events.restriction":{"name":"restriction","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.place_limit_order_events.self_match_behavior":{"name":"self_match_behavior","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.place_limit_order_events.size":{"name":"size","required":false,"format":"numeric","in":"query","type":"string"},"body.candlesticks_last_indexed_txn":{"name":"candlesticks_last_indexed_txn","description":"candlesticks_last_indexed_txn","required":false,"in":"body","schema":{"$ref":"#/definitions/candlesticks_last_indexed_txn"}},"rowFilter.candlesticks_last_indexed_txn.resolution":{"name":"resolution","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.candlesticks_last_indexed_txn.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"body.market_account_handles":{"name":"market_account_handles","description":"market_account_handles","required":false,"in":"body","schema":{"$ref":"#/definitions/market_account_handles"}},"rowFilter.market_account_handles.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.market_account_handles.handle":{"name":"handle","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.market_account_handles.creation_time":{"name":"creation_time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"body.balance_updates":{"name":"balance_updates","description":"balance_updates","required":false,"in":"body","schema":{"$ref":"#/definitions/balance_updates"}},"rowFilter.balance_updates.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.balance_updates.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.balance_updates.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.base_total":{"name":"base_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.base_available":{"name":"base_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.base_ceiling":{"name":"base_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.quote_total":{"name":"quote_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.quote_available":{"name":"quote_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates.quote_ceiling":{"name":"quote_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"body.competition_leaderboard_users":{"name":"competition_leaderboard_users","description":"competition_leaderboard_users","required":false,"in":"body","schema":{"$ref":"#/definitions/competition_leaderboard_users"}},"rowFilter.competition_leaderboard_users.user":{"name":"user","required":false,"format":"text","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.volume":{"name":"volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.integrators_used":{"name":"integrators_used","required":false,"format":"text[]","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.n_trades":{"name":"n_trades","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.points":{"name":"points","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.competition_id":{"name":"competition_id","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.competition_leaderboard_users.rank":{"name":"rank","required":false,"format":"bigint","in":"query","type":"string"},"body.fill_events_deduped":{"name":"fill_events_deduped","description":"fill_events_deduped","required":false,"in":"body","schema":{"$ref":"#/definitions/fill_events_deduped"}},"rowFilter.fill_events_deduped.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.emit_address":{"name":"emit_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events_deduped.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.fill_events_deduped.maker_address":{"name":"maker_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events_deduped.maker_custodian_id":{"name":"maker_custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.maker_order_id":{"name":"maker_order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.maker_side":{"name":"maker_side","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.fill_events_deduped.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.sequence_number_for_trade":{"name":"sequence_number_for_trade","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.size":{"name":"size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.taker_address":{"name":"taker_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events_deduped.taker_custodian_id":{"name":"taker_custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.taker_order_id":{"name":"taker_order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events_deduped.taker_quote_fees_paid":{"name":"taker_quote_fees_paid","required":false,"format":"numeric","in":"query","type":"string"},"body.competition_metadata":{"name":"competition_metadata","description":"competition_metadata","required":false,"in":"body","schema":{"$ref":"#/definitions/competition_metadata"}},"rowFilter.competition_metadata.id":{"name":"id","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.competition_metadata.start":{"name":"start","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.competition_metadata.end":{"name":"end","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.competition_metadata.prize":{"name":"prize","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.competition_metadata.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.competition_metadata.integrators_required":{"name":"integrators_required","required":false,"format":"text[]","in":"query","type":"string"},"body.recognized_market_events":{"name":"recognized_market_events","description":"recognized_market_events","required":false,"in":"body","schema":{"$ref":"#/definitions/recognized_market_events"}},"rowFilter.recognized_market_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.recognized_market_events.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.recognized_market_events.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.recognized_market_events.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_market_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.lot_size":{"name":"lot_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.tick_size":{"name":"tick_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.min_size":{"name":"min_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_market_events.underwriter_id":{"name":"underwriter_id","required":false,"format":"numeric","in":"query","type":"string"},"body.liquidity_groups":{"name":"liquidity_groups","description":"liquidity_groups","required":false,"in":"body","schema":{"$ref":"#/definitions/liquidity_groups"}},"rowFilter.liquidity_groups.group_id":{"name":"group_id","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.liquidity_groups.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.liquidity_groups.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"body.balance_updates_by_handle":{"name":"balance_updates_by_handle","description":"balance_updates_by_handle","required":false,"in":"body","schema":{"$ref":"#/definitions/balance_updates_by_handle"}},"rowFilter.balance_updates_by_handle.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.handle":{"name":"handle","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.base_total":{"name":"base_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.base_available":{"name":"base_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.base_ceiling":{"name":"base_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.quote_total":{"name":"quote_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.quote_available":{"name":"quote_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.balance_updates_by_handle.quote_ceiling":{"name":"quote_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"body.fees":{"name":"fees","description":"fees","required":false,"in":"body","schema":{"$ref":"#/definitions/fees"}},"rowFilter.fees.start_time_1hr_period":{"name":"start_time_1hr_period","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.fees.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fees.fees_in_quote_subunits":{"name":"fees_in_quote_subunits","required":false,"format":"numeric","in":"query","type":"string"},"body.prices":{"name":"prices","description":"prices","required":false,"in":"body","schema":{"$ref":"#/definitions/prices"}},"rowFilter.prices.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.prices.start_time_1m_period":{"name":"start_time_1m_period","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.prices.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.prices.sum_fill_size_1m_period":{"name":"sum_fill_size_1m_period","required":false,"format":"numeric","in":"query","type":"string"},"body.spreads":{"name":"spreads","description":"spreads","required":false,"in":"body","schema":{"$ref":"#/definitions/spreads"}},"rowFilter.spreads.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.spreads.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.spreads.min_ask":{"name":"min_ask","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.spreads.max_bid":{"name":"max_bid","required":false,"format":"numeric","in":"query","type":"string"},"body.coins":{"name":"coins","description":"coins","required":false,"in":"body","schema":{"$ref":"#/definitions/coins"}},"rowFilter.coins.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.coins.symbol":{"name":"symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.coins.decimals":{"name":"decimals","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.coins.address":{"name":"address","required":false,"format":"text","in":"query","type":"string"},"rowFilter.coins.module":{"name":"module","required":false,"format":"text","in":"query","type":"string"},"rowFilter.coins.struct":{"name":"struct","required":false,"format":"text","in":"query","type":"string"},"body.markets":{"name":"markets","description":"markets","required":false,"in":"body","schema":{"$ref":"#/definitions/markets"}},"rowFilter.markets.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.registration_time":{"name":"registration_time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.markets.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.markets.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.markets.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.lot_size":{"name":"lot_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.tick_size":{"name":"tick_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.min_size":{"name":"min_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.underwriter_id":{"name":"underwriter_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.is_recognized":{"name":"is_recognized","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.markets.last_fill_price_24hr":{"name":"last_fill_price_24hr","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.price_change_as_percent_24hr":{"name":"price_change_as_percent_24hr","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.price_change_24hr":{"name":"price_change_24hr","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.min_price_24h":{"name":"min_price_24h","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.max_price_24h":{"name":"max_price_24h","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.base_volume_24h":{"name":"base_volume_24h","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.quote_volume_24h":{"name":"quote_volume_24h","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.markets.base_name":{"name":"base_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.base_decimals":{"name":"base_decimals","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.markets.base_symbol":{"name":"base_symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.quote_name":{"name":"quote_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.markets.quote_decimals":{"name":"quote_decimals","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.markets.quote_symbol":{"name":"quote_symbol","required":false,"format":"text","in":"query","type":"string"},"body.data_status":{"name":"data_status","description":"data_status","required":false,"in":"body","schema":{"$ref":"#/definitions/data_status"}},"rowFilter.data_status.current_time":{"name":"current_time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.data_status.processor_last_txn_version_processed":{"name":"processor_last_txn_version_processed","required":false,"format":"bigint","in":"query","type":"string"},"rowFilter.data_status.aggregator_user_history_last_txn_version_processed":{"name":"aggregator_user_history_last_txn_version_processed","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.data_status.aggregator_candlesticks_last_txn_version_processed":{"name":"aggregator_candlesticks_last_txn_version_processed","required":false,"format":"numeric[]","in":"query","type":"string"},"body.historical_trades":{"name":"historical_trades","description":"historical_trades","required":false,"in":"body","schema":{"$ref":"#/definitions/historical_trades"}},"rowFilter.historical_trades.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.historical_trades.integer_price_to_quote_nominal":{"name":"integer_price_to_quote_nominal","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.base_volume":{"name":"base_volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.quote_volume":{"name":"quote_volume","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.historical_trades.type":{"name":"type","required":false,"format":"text","in":"query","type":"string"},"body.place_swap_order_events":{"name":"place_swap_order_events","description":"place_swap_order_events","required":false,"in":"body","schema":{"$ref":"#/definitions/place_swap_order_events"}},"rowFilter.place_swap_order_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.place_swap_order_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.signing_account":{"name":"signing_account","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_swap_order_events.integrator":{"name":"integrator","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.place_swap_order_events.direction":{"name":"direction","required":false,"format":"text","in":"query","type":"string"},"rowFilter.place_swap_order_events.min_base":{"name":"min_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.max_base":{"name":"max_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.min_quote":{"name":"min_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.max_quote":{"name":"max_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.place_swap_order_events.limit_price":{"name":"limit_price","required":false,"format":"numeric","in":"query","type":"string"},"body.change_order_size_events":{"name":"change_order_size_events","description":"change_order_size_events","required":false,"in":"body","schema":{"$ref":"#/definitions/change_order_size_events"}},"rowFilter.change_order_size_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.change_order_size_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.change_order_size_events.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.change_order_size_events.side":{"name":"side","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.change_order_size_events.new_size":{"name":"new_size","required":false,"format":"numeric","in":"query","type":"string"},"body.liquidity":{"name":"liquidity","description":"liquidity","required":false,"in":"body","schema":{"$ref":"#/definitions/liquidity"}},"rowFilter.liquidity.group_id":{"name":"group_id","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.liquidity.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.liquidity.bps_times_ten":{"name":"bps_times_ten","required":false,"format":"smallint","in":"query","type":"string"},"rowFilter.liquidity.amount_ask_ticks":{"name":"amount_ask_ticks","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.liquidity.amount_bid_ticks":{"name":"amount_bid_ticks","required":false,"format":"numeric","in":"query","type":"string"},"body.price_levels":{"name":"price_levels","description":"price_levels","required":false,"in":"body","schema":{"$ref":"#/definitions/price_levels"}},"rowFilter.price_levels.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.price_levels.direction":{"name":"direction","required":false,"format":"public.order_direction","in":"query","type":"string"},"rowFilter.price_levels.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.price_levels.total_size":{"name":"total_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.price_levels.version":{"name":"version","required":false,"format":"numeric","in":"query","type":"string"},"body.cancel_order_events":{"name":"cancel_order_events","description":"cancel_order_events","required":false,"in":"body","schema":{"$ref":"#/definitions/cancel_order_events"}},"rowFilter.cancel_order_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.cancel_order_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.user":{"name":"user","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.cancel_order_events.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.order_id":{"name":"order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.cancel_order_events.reason":{"name":"reason","required":false,"format":"smallint","in":"query","type":"string"},"body.fill_events":{"name":"fill_events","description":"fill_events","required":false,"in":"body","schema":{"$ref":"#/definitions/fill_events"}},"rowFilter.fill_events.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.event_idx":{"name":"event_idx","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.emit_address":{"name":"emit_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.fill_events.maker_address":{"name":"maker_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events.maker_custodian_id":{"name":"maker_custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.maker_order_id":{"name":"maker_order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.maker_side":{"name":"maker_side","required":false,"format":"boolean","in":"query","type":"string"},"rowFilter.fill_events.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.price":{"name":"price","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.sequence_number_for_trade":{"name":"sequence_number_for_trade","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.size":{"name":"size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.taker_address":{"name":"taker_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.fill_events.taker_custodian_id":{"name":"taker_custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.taker_order_id":{"name":"taker_order_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fill_events.taker_quote_fees_paid":{"name":"taker_quote_fees_paid","required":false,"format":"numeric","in":"query","type":"string"},"body.tvl_per_asset":{"name":"tvl_per_asset","description":"tvl_per_asset","required":false,"in":"body","schema":{"$ref":"#/definitions/tvl_per_asset"}},"rowFilter.tvl_per_asset.address":{"name":"address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.tvl_per_asset.module":{"name":"module","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.struct":{"name":"struct","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.value":{"name":"value","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_asset.coin_name_generic":{"name":"coin_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.tvl_per_asset.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.symbol":{"name":"symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.tvl_per_asset.decimals":{"name":"decimals","required":false,"format":"smallint","in":"query","type":"string"},"body.user_balances":{"name":"user_balances","description":"user_balances","required":false,"in":"body","schema":{"$ref":"#/definitions/user_balances"}},"rowFilter.user_balances.address":{"name":"address","required":false,"format":"text","in":"query","type":"string"},"rowFilter.user_balances.custodian_id":{"name":"custodian_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.handle":{"name":"handle","required":false,"format":"text","in":"query","type":"string"},"rowFilter.user_balances.base_total":{"name":"base_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.base_available":{"name":"base_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.base_ceiling":{"name":"base_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.quote_total":{"name":"quote_total","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.quote_available":{"name":"quote_available","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.user_balances.quote_ceiling":{"name":"quote_ceiling","required":false,"format":"numeric","in":"query","type":"string"},"body.fees_24h":{"name":"fees_24h","description":"fees_24h","required":false,"in":"body","schema":{"$ref":"#/definitions/fees_24h"}},"rowFilter.fees_24h.fees":{"name":"fees","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.fees_24h.day":{"name":"day","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.fees_24h.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"body.competition_exclusion_list":{"name":"competition_exclusion_list","description":"competition_exclusion_list","required":false,"in":"body","schema":{"$ref":"#/definitions/competition_exclusion_list"}},"rowFilter.competition_exclusion_list.user":{"name":"user","required":false,"format":"text","in":"query","type":"string"},"rowFilter.competition_exclusion_list.reason":{"name":"reason","required":false,"format":"text","in":"query","type":"string"},"rowFilter.competition_exclusion_list.competition_id":{"name":"competition_id","required":false,"format":"integer","in":"query","type":"string"},"body.daily_rolling_volume_history":{"name":"daily_rolling_volume_history","description":"daily_rolling_volume_history","required":false,"in":"body","schema":{"$ref":"#/definitions/daily_rolling_volume_history"}},"rowFilter.daily_rolling_volume_history.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.daily_rolling_volume_history.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.daily_rolling_volume_history.volume_in_quote_subunits":{"name":"volume_in_quote_subunits","required":false,"format":"numeric","in":"query","type":"string"},"body.candlestick_resolutions":{"name":"candlestick_resolutions","description":"candlestick_resolutions","required":false,"in":"body","schema":{"$ref":"#/definitions/candlestick_resolutions"}},"rowFilter.candlestick_resolutions.resolution":{"name":"resolution","required":false,"format":"integer","in":"query","type":"string"},"body.candlesticks":{"name":"candlesticks","description":"candlesticks","required":false,"in":"body","schema":{"$ref":"#/definitions/candlesticks"}},"rowFilter.candlesticks.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.resolution":{"name":"resolution","required":false,"format":"integer","in":"query","type":"string"},"rowFilter.candlesticks.start_time":{"name":"start_time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.candlesticks.open":{"name":"open","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.high":{"name":"high","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.low":{"name":"low","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.close":{"name":"close","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.candlesticks.volume":{"name":"volume","required":false,"format":"numeric","in":"query","type":"string"},"body.user_history_last_indexed_txn":{"name":"user_history_last_indexed_txn","description":"user_history_last_indexed_txn","required":false,"in":"body","schema":{"$ref":"#/definitions/user_history_last_indexed_txn"}},"rowFilter.user_history_last_indexed_txn.txn_version":{"name":"txn_version","required":false,"format":"numeric","in":"query","type":"string"},"body.recognized_markets":{"name":"recognized_markets","description":"recognized_markets","required":false,"in":"body","schema":{"$ref":"#/definitions/recognized_markets"}},"rowFilter.recognized_markets.market_id":{"name":"market_id","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_markets.time":{"name":"time","required":false,"format":"timestamp with time zone","in":"query","type":"string"},"rowFilter.recognized_markets.base_account_address":{"name":"base_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.recognized_markets.base_module_name":{"name":"base_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.base_struct_name":{"name":"base_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.base_name_generic":{"name":"base_name_generic","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.quote_account_address":{"name":"quote_account_address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.recognized_markets.quote_module_name":{"name":"quote_module_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.quote_struct_name":{"name":"quote_struct_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.recognized_markets.lot_size":{"name":"lot_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_markets.tick_size":{"name":"tick_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_markets.min_size":{"name":"min_size","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.recognized_markets.underwriter_id":{"name":"underwriter_id","required":false,"format":"numeric","in":"query","type":"string"},"body.enumerated_volume_24h":{"name":"enumerated_volume_24h","description":"enumerated_volume_24h","required":false,"in":"body","schema":{"$ref":"#/definitions/enumerated_volume_24h"}},"rowFilter.enumerated_volume_24h.address":{"name":"address","required":false,"format":"character varying","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.module":{"name":"module","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.struct":{"name":"struct","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.volume_as_base":{"name":"volume_as_base","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.volume_as_quote":{"name":"volume_as_quote","required":false,"format":"numeric","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.generic_asset_name":{"name":"generic_asset_name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.name":{"name":"name","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.symbol":{"name":"symbol","required":false,"format":"text","in":"query","type":"string"},"rowFilter.enumerated_volume_24h.decimals":{"name":"decimals","required":false,"format":"smallint","in":"query","type":"string"}},"externalDocs":{"description":"PostgREST Documentation","url":"https://postgrest.org/en/v11.2/api.html"}} \ No newline at end of file From 42805fc8f685d63ac786dc763d4d913dadd82e90 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Tue, 14 May 2024 13:04:43 +0200 Subject: [PATCH 31/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 049262e0..dc507053 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -18,7 +18,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- 1. Merge `main` into `dss-stable`. 1. Push annotated tag to head of `dss-stable`. -## [v2.2.0] (in progress) +## [v2.2.0-rc.1] (hot upgradable) ### Changed @@ -276,5 +276,8 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [v2.0.0]: https://github.com/econia-labs/econia/compare/dss-v1.6.1...dss-v2.0.0 [v2.0.1]: https://github.com/econia-labs/econia/compare/dss-v2.0.0...dss-v2.0.1 [v2.1.0]: https://github.com/econia-labs/econia/compare/dss-v2.0.1...dss-v2.1.0 +[v2.2.0-rc.1]: https://github.com/econia-labs/econia/compare/dss-v2.1.0...dss-v2.2.0-rc.1 [`dss-stable`]: https://github.com/econia-labs/econia/tree/dss-stable [`econia` repo]: https://github.com/econia-labs/econia/pulls?q=is%3Aclosed + + From 2b6417c8f270a8860f17e0df945533b2d1ae833a Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 22 May 2024 13:24:14 +0200 Subject: [PATCH 32/37] fix 24h price when missing --- .../down.sql | 99 +++++++++++++++++ .../up.sql | 101 ++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 src/rust/dbv2/migrations/2024-05-22-111841_fix_market_24h_price/down.sql create mode 100644 src/rust/dbv2/migrations/2024-05-22-111841_fix_market_24h_price/up.sql diff --git a/src/rust/dbv2/migrations/2024-05-22-111841_fix_market_24h_price/down.sql b/src/rust/dbv2/migrations/2024-05-22-111841_fix_market_24h_price/down.sql new file mode 100644 index 00000000..de080bc3 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-22-111841_fix_market_24h_price/down.sql @@ -0,0 +1,99 @@ +-- This file should undo anything in `up.sql` +CREATE OR REPLACE VIEW api.markets AS +WITH x AS ( + SELECT + m.market_id, + m.time AS registration_time, + m.base_account_address, + m.base_module_name, + m.base_struct_name, + m.base_name_generic, + m.quote_account_address, + m.quote_module_name, + m.quote_struct_name, + m.lot_size, + m.tick_size, + m.min_size, + m.underwriter_id, + CASE + WHEN r.market_id = m.market_id THEN true + ELSE false + END AS is_recognized, + (SELECT price FROM api.prices WHERE prices.market_id = m.market_id AND "start_time_1m_period" < CURRENT_TIMESTAMP - interval '24 hours' ORDER BY "start_time_1m_period" DESC LIMIT 1) AS price_24h_ago, + (SELECT price FROM fill_events WHERE fill_events.market_id = m.market_id ORDER BY txn_version DESC, event_idx DESC LIMIT 1) AS last_fill_price_24hr, + v.min_price_24h, + v.max_price_24h, + v.base_volume_24h, + v.quote_volume_24h + FROM + market_registration_events AS m + LEFT JOIN + aggregator.recognized_markets AS r + ON + COALESCE(r.base_account_address, '') = COALESCE(m.base_account_address, '') + AND + COALESCE(r.base_module_name, '') = COALESCE(m.base_module_name, '') + AND + COALESCE(r.base_struct_name, '') = COALESCE(m.base_struct_name, '') + AND + COALESCE(r.base_name_generic, '') = COALESCE(m.base_name_generic, '') + AND + r.quote_account_address = m.quote_account_address + AND + r.quote_module_name = m.quote_module_name + AND + r.quote_struct_name = m.quote_struct_name + LEFT JOIN + aggregator.markets_24h_data AS v + ON + v.market_id = m.market_id +) +SELECT + market_id, + registration_time, + base_account_address, + base_module_name, + base_struct_name, + base_name_generic, + quote_account_address, + quote_module_name, + quote_struct_name, + lot_size, + tick_size, + min_size, + underwriter_id, + is_recognized, + last_fill_price_24hr, + CASE + WHEN last_fill_price_24hr IS NULL THEN NULL + ELSE (last_fill_price_24hr - price_24h_ago) / price_24h_ago * 100 + END AS price_change_as_percent_24hr, + CASE + WHEN last_fill_price_24hr IS NULL THEN NULL + ELSE last_fill_price_24hr - price_24h_ago + END AS price_change_24hr, + min_price_24h, + max_price_24h, + base_volume_24h, + quote_volume_24h, + base.name AS base_name, + base.decimals AS base_decimals, + base.symbol AS base_symbol, + "quote".name AS quote_name, + "quote".decimals AS quote_decimals, + "quote".symbol AS quote_symbol +FROM + x +LEFT JOIN + aggregator.coins AS base + ON base.address = COALESCE(x.base_account_address, '') + AND base.module = COALESCE(x.base_module_name, '') + AND base.struct = COALESCE(x.base_struct_name, '') +LEFT JOIN + aggregator.coins AS "quote" + ON "quote".address = COALESCE(x.quote_account_address, '') + AND "quote".module = COALESCE(x.quote_module_name, '') + AND "quote".struct = COALESCE(x.quote_struct_name, ''); + + +GRANT SELECT ON api.markets TO web_anon; diff --git a/src/rust/dbv2/migrations/2024-05-22-111841_fix_market_24h_price/up.sql b/src/rust/dbv2/migrations/2024-05-22-111841_fix_market_24h_price/up.sql new file mode 100644 index 00000000..90c1a317 --- /dev/null +++ b/src/rust/dbv2/migrations/2024-05-22-111841_fix_market_24h_price/up.sql @@ -0,0 +1,101 @@ +-- Your SQL goes here +CREATE OR REPLACE VIEW api.markets AS +WITH x AS ( + SELECT + m.market_id, + m.time AS registration_time, + m.base_account_address, + m.base_module_name, + m.base_struct_name, + m.base_name_generic, + m.quote_account_address, + m.quote_module_name, + m.quote_struct_name, + m.lot_size, + m.tick_size, + m.min_size, + m.underwriter_id, + CASE + WHEN r.market_id = m.market_id THEN true + ELSE false + END AS is_recognized, + (SELECT price FROM api.prices WHERE prices.market_id = m.market_id AND "start_time_1m_period" < CURRENT_TIMESTAMP - interval '24 hours' ORDER BY "start_time_1m_period" DESC LIMIT 1) AS price_24h_ago, + -- Begin changes + (SELECT price FROM fill_events WHERE fill_events.market_id = m.market_id AND "time" > CURRENT_TIMESTAMP - interval '24 hours' ORDER BY txn_version DESC, event_idx DESC LIMIT 1) AS last_fill_price_24hr, + -- End changes + v.min_price_24h, + v.max_price_24h, + v.base_volume_24h, + v.quote_volume_24h + FROM + market_registration_events AS m + LEFT JOIN + aggregator.recognized_markets AS r + ON + COALESCE(r.base_account_address, '') = COALESCE(m.base_account_address, '') + AND + COALESCE(r.base_module_name, '') = COALESCE(m.base_module_name, '') + AND + COALESCE(r.base_struct_name, '') = COALESCE(m.base_struct_name, '') + AND + COALESCE(r.base_name_generic, '') = COALESCE(m.base_name_generic, '') + AND + r.quote_account_address = m.quote_account_address + AND + r.quote_module_name = m.quote_module_name + AND + r.quote_struct_name = m.quote_struct_name + LEFT JOIN + aggregator.markets_24h_data AS v + ON + v.market_id = m.market_id +) +SELECT + market_id, + registration_time, + base_account_address, + base_module_name, + base_struct_name, + base_name_generic, + quote_account_address, + quote_module_name, + quote_struct_name, + lot_size, + tick_size, + min_size, + underwriter_id, + is_recognized, + last_fill_price_24hr, + CASE + WHEN last_fill_price_24hr IS NULL THEN NULL + ELSE (last_fill_price_24hr - price_24h_ago) / price_24h_ago * 100 + END AS price_change_as_percent_24hr, + CASE + WHEN last_fill_price_24hr IS NULL THEN NULL + ELSE last_fill_price_24hr - price_24h_ago + END AS price_change_24hr, + min_price_24h, + max_price_24h, + base_volume_24h, + quote_volume_24h, + base.name AS base_name, + base.decimals AS base_decimals, + base.symbol AS base_symbol, + "quote".name AS quote_name, + "quote".decimals AS quote_decimals, + "quote".symbol AS quote_symbol +FROM + x +LEFT JOIN + aggregator.coins AS base + ON base.address = COALESCE(x.base_account_address, '') + AND base.module = COALESCE(x.base_module_name, '') + AND base.struct = COALESCE(x.base_struct_name, '') +LEFT JOIN + aggregator.coins AS "quote" + ON "quote".address = COALESCE(x.quote_account_address, '') + AND "quote".module = COALESCE(x.quote_module_name, '') + AND "quote".struct = COALESCE(x.quote_struct_name, ''); + + +GRANT SELECT ON api.markets TO web_anon; From 2122ec24c8a3286cf3df4bb4aefd8aec2ac9e5e2 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Wed, 22 May 2024 15:01:36 +0200 Subject: [PATCH 33/37] update aptos website to get api keys --- doc/doc-site/docs/off-chain/dss/ci-cd.md | 2 +- doc/doc-site/docs/off-chain/dss/data-service-stack.md | 2 +- src/docker/example.env | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/doc-site/docs/off-chain/dss/ci-cd.md b/doc/doc-site/docs/off-chain/dss/ci-cd.md index 304e583b..464b2a28 100644 --- a/doc/doc-site/docs/off-chain/dss/ci-cd.md +++ b/doc/doc-site/docs/off-chain/dss/ci-cd.md @@ -45,7 +45,7 @@ This guide will help you set up continuous integration/continuous deployment (CI ``` :::tip - [You can get a gRPC auth token from Aptos Labs](https://aptos-api-gateway-prod.firebaseapp.com/) + [You can get a gRPC auth token from Aptos Labs](https://developers.aptoslabs.com/) ::: 1. Initialize the CI/CD project runner, which on startup will run a script that installs dependencies: diff --git a/doc/doc-site/docs/off-chain/dss/data-service-stack.md b/doc/doc-site/docs/off-chain/dss/data-service-stack.md index 0d5132f2..a6d614e2 100644 --- a/doc/doc-site/docs/off-chain/dss/data-service-stack.md +++ b/doc/doc-site/docs/off-chain/dss/data-service-stack.md @@ -37,7 +37,7 @@ The process is the same as running against testnet, just with a slightly differe ### Getting the API key Unless you are an infrastructure provider or want to run a fullnode yourself, the simplest way to get indexed transaction data is from the Aptos Labs gRPC endpoint (indexer v2 API). -To connect to this service, you'll need to get an API key [here](https://aptos-api-gateway-prod.firebaseapp.com/). +To connect to this service, you'll need to get an API key [here](https://developers.aptoslabs.com/). ### Generating a config diff --git a/src/docker/example.env b/src/docker/example.env index 1116269b..a4877882 100644 --- a/src/docker/example.env +++ b/src/docker/example.env @@ -24,7 +24,7 @@ ECONIA_ADDRESS="0xc0deb00c405f84c85dc13442e305df75d1288100cdd82675695f6148c7ece5 # For a local end-to-end testing chain: http://streamer:50051 GRPC_DATA_SERVICE_URL="https://grpc.mainnet.aptoslabs.com:443" -# For a public chain you have to get this token from https://aptos-api-gateway-prod.firebaseapp.com/. +# For a public chain you have to get this token from https://developers.aptoslabs.com/. # For a local end-to-end testing chain use: dummy_token GRPC_AUTH_TOKEN="" From 51793117e414938ea044f2ec1fd47b414081f396 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Thu, 23 May 2024 00:20:07 +0200 Subject: [PATCH 34/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index dc507053..9758109d 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -18,11 +18,11 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- 1. Merge `main` into `dss-stable`. 1. Push annotated tag to head of `dss-stable`. -## [v2.2.0-rc.1] (hot upgradable) +## [v2.2.0-rc.2] (hot upgradable) ### Changed -- Improve performance of `/markets` endpoint ([#760]). +- Improve performance of `/markets` endpoint ([#760], [#772]). ### Fixed @@ -258,6 +258,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#766]: https://github.com/econia-labs/econia/pull/766 [#767]: https://github.com/econia-labs/econia/pull/767 [#768]: https://github.com/econia-labs/econia/pull/768 +[#772]: https://github.com/econia-labs/econia/pull/772 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [processor #19]: https://github.com/econia-labs/aptos-indexer-processors/pull/19 From eb22160244a15b8c19fd89dff5b9fb392efa1f71 Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Thu, 23 May 2024 03:05:17 +0200 Subject: [PATCH 35/37] fix dss version link --- doc/doc-site/docs/off-chain/dss/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index 9758109d..bedac143 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -277,7 +277,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [v2.0.0]: https://github.com/econia-labs/econia/compare/dss-v1.6.1...dss-v2.0.0 [v2.0.1]: https://github.com/econia-labs/econia/compare/dss-v2.0.0...dss-v2.0.1 [v2.1.0]: https://github.com/econia-labs/econia/compare/dss-v2.0.1...dss-v2.1.0 -[v2.2.0-rc.1]: https://github.com/econia-labs/econia/compare/dss-v2.1.0...dss-v2.2.0-rc.1 +[v2.2.0-rc.2]: https://github.com/econia-labs/econia/compare/dss-v2.1.0...dss-v2.2.0-rc.2 [`dss-stable`]: https://github.com/econia-labs/econia/tree/dss-stable [`econia` repo]: https://github.com/econia-labs/econia/pulls?q=is%3Aclosed From f8bbe3852cedef9e0e3c2687549cc3763f0a2b5d Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Fri, 24 May 2024 00:05:25 +0200 Subject: [PATCH 36/37] update processor --- src/docker/processor/Dockerfile | 1 + src/rust/dependencies/aptos-indexer-processors | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/docker/processor/Dockerfile b/src/docker/processor/Dockerfile index e01701ac..faf3fea8 100644 --- a/src/docker/processor/Dockerfile +++ b/src/docker/processor/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get update && apt-get install -y \ curl \ git \ libpq-dev \ + libdw-dev \ libssl-dev \ lld \ pkg-config \ diff --git a/src/rust/dependencies/aptos-indexer-processors b/src/rust/dependencies/aptos-indexer-processors index 2bf374f5..91578f14 160000 --- a/src/rust/dependencies/aptos-indexer-processors +++ b/src/rust/dependencies/aptos-indexer-processors @@ -1 +1 @@ -Subproject commit 2bf374f574f8c1b88672ceedc655f7d69b5c4fd8 +Subproject commit 91578f1461523577b0017eb54343869d816175b0 From 2fc63ae68af5c43facef511eab634ff73c208e1b Mon Sep 17 00:00:00 2001 From: Bogdan Crisan Date: Mon, 27 May 2024 10:43:52 +0200 Subject: [PATCH 37/37] update changelog --- doc/doc-site/docs/off-chain/dss/changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/doc-site/docs/off-chain/dss/changelog.md b/doc/doc-site/docs/off-chain/dss/changelog.md index bedac143..d4466127 100644 --- a/doc/doc-site/docs/off-chain/dss/changelog.md +++ b/doc/doc-site/docs/off-chain/dss/changelog.md @@ -36,6 +36,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- - Added dynamic batch sizing to avoid crashes during high usage ([#762]). - Updated Rust dependencies ([#764]). - Optimize daily volume calculations wrapped query ([#768]). +- Fork base, to include upstream processor changes ([#775], [Processor #27]). ## [v2.1.0] (hot upgradable) @@ -259,6 +260,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [#767]: https://github.com/econia-labs/econia/pull/767 [#768]: https://github.com/econia-labs/econia/pull/768 [#772]: https://github.com/econia-labs/econia/pull/772 +[#775]: https://github.com/econia-labs/econia/pull/775 [docs site readme]: https://github.com/econia-labs/econia/blob/main/doc/doc-site/README.md [dss-v2.1.0-rc.1]: https://github.com/econia-labs/econia/releases/tag/dss-v2.1.0-rc.1 [processor #19]: https://github.com/econia-labs/aptos-indexer-processors/pull/19 @@ -268,6 +270,7 @@ Stable DSS builds are tracked on the [`dss-stable`] branch with tags like [`dss- [processor #23]: https://github.com/econia-labs/aptos-indexer-processors/pull/23 [processor #24]: https://github.com/econia-labs/aptos-indexer-processors/pull/24 [processor #25]: https://github.com/econia-labs/aptos-indexer-processors/pull/25 +[processor #27]: https://github.com/econia-labs/aptos-indexer-processors/pull/27 [processor submodule]: https://github.com/econia-labs/aptos-indexer-processors/pulls?q=is%3Aclosed [v1.3.0]: https://github.com/econia-labs/econia/releases/tag/dss-v1.3.0 [v1.4.0]: https://github.com/econia-labs/econia/compare/dss-v1.3.0...dss-v1.4.0