Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimal fee structure estimate based on trading pair and securities class #736

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ impl Clickhouse {
range_or_arbitrary: &CexRangeOrArbitrary,
) -> eyre::Result<Vec<BestCexPerPair>, DatabaseError> {
if block_times.is_empty() {

return Err(DatabaseError::from(clickhouse::error::Error::Custom(
"Nothing to query, block times are empty".to_string(),
)))
Expand Down
44 changes: 44 additions & 0 deletions crates/brontes-types/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,50 @@ pub const EURT_ADDRESS: Address = Address::new(hex!("c581b735a1688071a1746c968e0
pub const LINK_ADDRESS: Address = Address::new(hex!("514910771af9ca656af840dff83e8264ecf986ca"));
pub const UNI_TOKEN: Address = Address::new(hex!("1f9840a85d5af5bf1d1762f925bdaddc4201f984"));
pub const XAUT_ADDRESS: Address = Address::new(hex!("68749665ff8d2d112fa859aa293f07a622782f38"));
pub const ACE_ADDRESS: Address = Address::new(hex!("ec5483804e637d45cde22fa0869656b64b5ab1ab"));
pub const ADA_ADDRESS: Address = Address::new(hex!("43110D4f2113D50574412E852EBD96F1593179e4"));
pub const AEVO_ADDRESS: Address = Address::new(hex!("b528edbef013aff855ac3c50b381f253af13b997"));
pub const AI_ADDRESS: Address = Address::new(hex!("c91b523a59acc63a64f61fc7bbfb4bfc82dd25f2"));
pub const ALT_ADDRESS: Address = Address::new(hex!("8457ca5040ad67fdebbcc8edce889a335bc0fbfb"));
pub const ARB_ADDRESS: Address = Address::new(hex!("b50721bcf8d664c30412cfbc6cf7a15145234ad1"));
pub const ARKM_ADDRESS: Address = Address::new(hex!("6e2a43be0b1d33b726f0ca3b8de60b3482b8b050"));
pub const AUCTION_ADDRESS: Address = Address::new(hex!("a9b1eb5908cfc3cdf91f9b8b3a74108598009096"));
pub const AXL_ADDRESS: Address = Address::new(hex!("467719ad09025fcc6cf6f8311755809d45a5e5f3"));
pub const BLZ_ADDRESS: Address = Address::new(hex!("5732046a883704404f284ce41ffadd5b007fd668"));
pub const CHZ_ADDRESS: Address = Address::new(hex!("3506424f91fd33084466f402d5d97f05f8e3b4af"));
pub const CYBER_ADDRESS: Address = Address::new(hex!("14778860e937f509e651192a90589de711fb88a9"));
pub const DYDX_ADDRESS: Address = Address::new(hex!("92d6c1e31e14520e676a687f0a93788b716beff5"));
pub const ENA_ADDRESS: Address = Address::new(hex!("57e114b691db790c35207b2e685d4a43181e6061"));
pub const ENS_ADDRESS: Address = Address::new(hex!("c18360217d8f7ab5e7c516566761ea12ce7f9d72"));
pub const ETHFI_ADDRESS: Address = Address::new(hex!("fe0c30065b384f05761f15d0cc899d4f9f9cc0eb"));
pub const FET_ADDRESS: Address = Address::new(hex!("aea46a60368a7bd060eec7df8cba43b7ef41ad85"));
pub const FLOKI_ADDRESS: Address = Address::new(hex!("cf0c122c6b73ff809c693db761e7baebe62b6a2e"));
pub const FTM_ADDRESS: Address = Address::new(hex!("4e15361fd6b4bb609fa63c81a2be19d873717870"));
pub const GALA_ADDRESS: Address = Address::new(hex!("d1d2eb1b1e90b638588728b4130137d262c87cae"));
pub const GRT_ADDRESS: Address = Address::new(hex!("c944e90c64b2c07662a292be6244bdf05cda44a7"));
pub const INJ_ADDRESS: Address = Address::new(hex!("e28b3b32b6c345a34ff64674606124dd5aceca30"));
pub const JUP_ADDRESS: Address = Address::new(hex!("4b1e80cac91e2216eeb63e29b957eb91ae9c2be8"));
pub const LDO_ADDRESS: Address = Address::new(hex!("5a98fcbea516cf06857215779fd812ca3bef1b32"));
pub const MATIC_ADDRESS: Address = Address::new(hex!("7d1afa7b718fb893db30a3abc0cfc608aacfebb0"));
pub const MEME_ADDRESS: Address = Address::new(hex!("b131f4a55907b10d1f0a50d8ab8fa09ec342cd74"));
pub const OMNI_ADDRESS: Address = Address::new(hex!("36e66fbbce51e4cd5bd3c62b637eb411b18949d4"));
pub const PENDLE_ADDRESS: Address = Address::new(hex!("808507121b80c02388fad14726482e061b8da827"));
pub const PEOPLE_ADDRESS: Address = Address::new(hex!("7a58c0be72be218b41c608b7fe7c5bb630736c71"));
pub const PEPE_ADDRESS: Address = Address::new(hex!("6982508145454ce325ddbe47a25d4ec3d2311933"));
pub const PIXEL_ADDRESS: Address = Address::new(hex!("3429d03c6f7521aec737a0bbf2e5ddcef2c3ae31"));
pub const PORTAL_ADDRESS: Address = Address::new(hex!("1bbe973bef3a977fc51cbed703e8ffdefe001fed"));
pub const REZ_ADDRESS: Address = Address::new(hex!("3b50805453023a91a8bf641e279401a0b23fa6f9"));
pub const RNDR_ADDRESS: Address = Address::new(hex!("6de037ef9ad2725eb40118bb1702ebb27e4aeb24"));
pub const SAND_ADDRESS: Address = Address::new(hex!("3845badade8e6dff049820680d1f14bd3903a5d0"));
pub const SHIB_ADDRESS: Address = Address::new(hex!("95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce"));
pub const STRK_ADDRESS: Address = Address::new(hex!("ca14007eff0db1f8135f4c25b34de49ab0d42766"));
pub const SUPER_ADDRESS: Address = Address::new(hex!("e53ec727dbdeb9e2d5456c3be40cff031ab40a55"));
pub const UNI_ADDRESS: Address = Address::new(hex!("1f9840a85d5af5bf1d1762f925bdaddc4201f984"));
pub const W_ADDRESS: Address = Address::new(hex!("b0ffa8000886e57f86dd5264b9582b2ad87b2b91"));
pub const WLD_ADDRESS: Address = Address::new(hex!("163f8c2467924be0ae7b5347228cabf260318753"));
pub const AEUR_ADDRESS: Address = Address::new(hex!("a40640458fbc27b6eefedea1e9c9e17d4cee7a21"));
pub const MAV_ADDRESS: Address = Address::new(hex!("7448c7456a97769f6cd04f1e83a4a23ccdc46abd"));
pub const USDP_ADDRESS: Address = Address::new(hex!("8e870d67f660d95d5be530380d0ec0bd388289e1"));

/// The first block where the chainbound mempool data is available.
pub const START_OF_CHAINBOUND_MEMPOOL_DATA: u64 = 17193367;
Expand Down
48 changes: 44 additions & 4 deletions crates/brontes-types/src/db/cex/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,50 @@
use std::{fmt::Debug, hash::Hash};

use strum::Display;
pub mod cex_symbols;
pub mod quotes;
pub mod trades;
mod best_cex_per_pair;
mod cex_symbols;
mod exchanges;

pub use best_cex_per_pair::*;
pub use cex_symbols::*;
pub use exchanges::*;
pub use quotes::*;
pub use trades::*;

pub mod quotes;
pub mod trades;
#[derive(
Copy,
Display,
Debug,
Clone,
Default,
Eq,
PartialEq,
Hash,
serde::Serialize,
// serde::Deserialize,
rkyv::Serialize,
rkyv::Deserialize,
rkyv::Archive,
)]
#[archive_attr(derive(Eq, PartialEq, Hash))]
pub enum CexExchange {
Binance,
Bitmex,
Deribit,
Okex,
Coinbase,
Kraken,
BybitSpot,
Kucoin,
Upbit,
Huobi,
GateIo,
Bitstamp,
Gemini,
Average,
VWAP,
OptimisticVWAP,
#[default]
Unknown,
}
Loading
Loading