This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Chainlink Data Streams API Request Script | |
| # Usage: ./chainlink_request.sh | |
| # Configuration | |
| API_KEY=${API_KEY:-"your_api_key_here"} | |
| API_SECRET="${API_SECRET:-"your_api_secret_here"} | |
| BASE_URL="https://api.testnet-dataengine.chain.link" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::time::{Instant}; | |
| use databento::{ | |
| dbn::{PitSymbolMap, SType, Schema, TradeMsg}, | |
| live::Subscription, | |
| LiveClient, | |
| }; | |
| use regex::Regex; | |
| use std::time::{Duration, SystemTime, UNIX_EPOCH}; | |
| use chrono; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mod idl; | |
| use std::{ | |
| collections::HashMap, | |
| sync::{atomic::AtomicU64, Arc}, | |
| }; | |
| use anyhow::{anyhow, Result}; | |
| use anyhow_ext::Context; | |
| use idl::*; | |
| use rust_decimal::Decimal; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Load all necessary accounts | |
| let accounts = self.load_swap_accounts().await?; | |
| // Get whirlpool data | |
| let whirlpool_data = accounts | |
| .get(&self.key) | |
| .ok_or_else(|| anyhow!("Whirlpool data not found"))?; | |
| let whirlpool = OrcaWhirlpool::new(self.key, self.inner.clone()); | |
| if in_token != whirlpool.inner.token_mint_a && in_token != whirlpool.inner.token_mint_b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use tokio_tungstenite::{connect_async, tungstenite::Message}; | |
| use futures_util::{StreamExt, SinkExt}; | |
| use serde::{Deserialize, Serialize}; | |
| #[derive(Debug, Deserialize)] | |
| struct PythPriceFeed { | |
| id: String, | |
| price: Option<PriceData>, | |
| ema_price: Option<PriceData>, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use switchboard_on_demand_client::gateway::Gateway; | |
| use switchboard_on_demand_client::FetchUpdateParams; | |
| use switchboard_on_demand_client::PullFeed; | |
| use switchboard_on_demand_client::SbContext; | |
| use std::sync::Arc; | |
| use std::str::FromStr; | |
| use solana_client::nonblocking::rpc_client::RpcClient; | |
| use solana_sdk::pubkey::Pubkey; | |
| use anyhow::Result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_liquidity Params: Object { | |
| "args": Object { | |
| "liquidity_parameter": Object { | |
| "amount_x": Number(1881591784), | |
| "amount_y": Number(0), | |
| "bin_liquidity_dist": Array [ | |
| Array [ | |
| Number(8785), | |
| Number(909), | |
| Number(0), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| initialize_position_by_operator ix_data: lower bind id: 9113, width 15 | |
| Bin array keys: 15CxRvzZyfFzCTNbnXgtMX1ivHvwdWi7UetFhgLFb6v - 6ocY6jLKPrfyxmN8Krzmc65dhtfyZhrGTxxsMmxkaCgc | |
| add_liquidity_by_strategy Params: AddLiquidityByStrategyIxArgs { liquidity_parameter: LiquidityParameterByStrategy { amount_x: 33763532, amount_y: 11185204144, active_id: 9126, max_active_bin_slippage: 3, strategy_parameters: StrategyParameters { min_bin_id: 9125, max_bin_id: 9128, strategy_type: SpotBalanced, parameteres: [] } } } | |
| Liquidity transaction simulation result: | |
| Error: Some(InstructionError(4, Custom(6008))) | |
| Logs: | |
| Program ComputeBudget111111111111111111111111111111 invoke [1] | |
| Program ComputeBudget111111111111111111111111111111 success | |
| Program 11111111111111111111111111111111 invoke [1] | |
| Program 11111111111111111111111111111111 success |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| running 1 test | |
| Initializing state | |
| Connecting to RPC: https://switchboard.rpcpool.com/5f7ec120-9628-40c4-997f-0cdb4135e059 | |
| Connected to RPC | |
| Loaded payer | |
| Markets: 19 | |
| ====== Market Details ====== | |
| Lifinity market ID: W5s3YFGHyMnWqYxkdfimB6AgMPiofDm5S5ndjqdvPuy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- ========== v1: May 2021 - Dec 2022 ========== | |
| WITH | |
| -- v1a: May 2021 - Oct 2021 | |
| v1a AS ( | |
| WITH tx_signers AS ( | |
| SELECT DISTINCT tx_id, address AS signer | |
| FROM solana.account_activity | |
| WHERE signed = TRUE | |
| AND block_time BETWEEN TIMESTAMP '2021-05-01' AND TIMESTAMP '2021-10-31' |