### Example HTTP Request for Wallet PnL API Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/wallet-pnl-api Illustrates how to construct an HTTP GET request to the Wallet PnL API. This example includes the required query parameters for time and wallet address, along with the necessary Authorization header for API key authentication. ```HTTP GET /api/v1/dataset/wallet-pnl?time=24h&wallet=F18ibDvGaj4Yjzk1UfWCk5jE9zoy1JYkXNTCBwPuZpyf HTTP/1.1 Authorization: Bearer YOUR_API_KEY ``` -------------------------------- ### Sample OHLCV API GET Request Path Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/ohlcv-api An example of a GET request path for the OHLCV API, demonstrating how to specify a pool address, interval (1 minute), and a time range using 'from' and 'to' timestamps. ```HTTP GET /api/v1/dataset/trade/ohlcv/58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2?interval=1m&from=1736790000&to=1736793600 ``` -------------------------------- ### Sample HTTP Request for Token Price API Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/token-price-api An example HTTP GET request demonstrating how to query the Token Price API with a list of multiple specific token mint addresses. ```HTTP GET /api/v1/price-by-token?tokens=6Eh3zBrDPvGX3efeC4azjGy7zdKKrwGKuAwZQUzRpump,5heso9fVSTJ2vWwxBDuJUyKCeunTfvn5H5eV1kiJpump,H6EnL9x9ycxcNdQ8YnuxfE4iCnQFcKADC7eoGd9npump,DDEXoWMyDHpCNCyvg5Pakz5u9AmFzmBjjcs92Ux7pump,F9TgEJLLRUKDRF16HgjUCdJfJ5BK6ucyiW8uJxVPpump,So11111111111111111111111111111111111111112 ``` -------------------------------- ### Sample Historical Token Price API Request Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/historical-token-price-api An example HTTP GET request to the Historical Token Price API, demonstrating the use of 'token', 'from', and 'to' query parameters with sample values. ```HTTP GET /api/v1/dataset/price/history?token=So11111111111111111111111111111111111111112&from=1739577600&to=1739577620 ``` -------------------------------- ### Sample OHLCV API cURL Request Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/ohlcv-api A complete cURL command example for making a GET request to the OHLCV API. It includes the base URL, a sample pool address, an interval, and demonstrates how to pass the 'x-api-key' header for authentication. ```bash curl --location '' \ --header 'x-api-key: ' ``` -------------------------------- ### Start PnL Index Backfill API Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/pnl-indexer API endpoint and examples for initiating the backfill process for a specified PnL index, retrieving and processing historical data to populate records. ```APIDOC Method: POST Endpoint: {admin-base-url}/index/{index_id}/backfill Headers: x-api-key: URL Parameters: index_id: string Description: The ID of the index created in the previous step. Request Body Parameters: action: string Description: Specifies the action to perform. Value: "start" ``` ```json { "action": "start" } ``` ```json { "action_type": "start", "index_id": "ec5b37a2-c577-4e89-b5aa-077e10771419" } ``` -------------------------------- ### Example Response for Latest Dex Pools API Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/dex-pools-api/latest-dex-pools-api An example JSON response containing an array of the latest liquidity pools with their details, including block information, pool addresses, token mints, and token balances. ```JSON { "data": { "poolsData": [ { "block_slot": 303089869, "blockTime": null, "pool": "8dM6UzQAq2fNaEtfQr6nNzavpTtywcE1GNBXhmGGE8rd", "mint_a": "So11111111111111111111111111111111111111112", "mint_b": "31QC34eES9xy7BZmptDgeRy5Mi1iJ51FcXszTj49qwPX", "token_a_amount": 30.328900364, "token_b_amount": 165210214.980515 }, { "block_slot": 303089853, "blockTime": null, "pool": "2o6xd3dYguhofKBT6xUNXHQggiKbSEv5vZ9LMiuymquD", "mint_a": "So11111111111111111111111111111111111111112", "mint_b": "4yzCocQbtUpd6uanGPp4nxZYiAg8Yv3aCjEMysiMpump", "token_a_amount": 0.012082268, "token_b_amount": 23547.163168 } ] } ``` -------------------------------- ### Sample Wallet PnL API Response Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/profitable-wallets An example JSON array showing the structure of the data returned by the Wallet PnL API, including wallet identifier, trade volume, trade count, win rate, and profit/loss overview for a single wallet. ```JSON [ { "wallet": "HmD1XGGXLRnYvq537jmTUuhcRgecZF3NeNoFtnBv5ERX", "trade_volume": 15705.95985742, "trade_count": 149, "win_rate": 40, "pnl_overview": 478.16333295 } ] ``` -------------------------------- ### Fetch Top 50 Profitable Wallets (24h) Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/profitable-wallets An example HTTP GET request to retrieve the top 50 most profitable wallets over the last 24 hours from the Astralane Profitable Wallets API. ```HTTP GET https://graphql.astralane.io/api/v1/dataset/profitable-wallets?time=24h&page=1&limit=50 ``` -------------------------------- ### Create PnL Index API Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/pnl-indexer API endpoint and examples for initializing a new index to track Profit and Loss (PnL) data, allowing specification of account and time filters for precise data inclusion. ```APIDOC Method: POST Endpoint: {admin-base}/index/pnl Headers: x-api-key: Request Body Parameters: name: string Description: A user-defined identifier for the index, enabling easy reference and retrieval. Example: "My Main Wallet Portfolio" Purpose: Helps clearly label and organize indexes. filters: array of objects Description: An array of filter objects, each containing criteria to specify which transactions should be included. Purpose: Establishes specific conditions for data inclusion. Components: Each filter consists of a 'column' field and an array of 'predicates'. Filter 1: Account ID Filter column: "account_id" Description: Filters transactions by the account_id column. predicates: array Type: "eq" (equals) Value: array of string (User's specific Solana account ID, e.g., "4BjxyW2GTD1qBwUk96mAR7dV1A3Pq51hPx78WLqrXegX") User-Specific Element: The account ID uniquely identifies the user's Solana wallet address. Purpose: Limits the index to include data solely related to the user's designated account. Filter 2: Time Filter column: "time" Description: Applies to the time column, enabling users to specify an exact date and time range. predicates: array Condition 1: Greater Than (gt) Type: "gt" Description: The initial time of a range, given as a Unix timestamp (in seconds). User-Created Timestamp: User-defined start datetime. Example Value: "1718148102" Condition 2: Less Than (lt) Type: "lt" Description: The end time of the range, given as a Unix timestamp. User-Specific Element: User-defined, representing the upper limit of the desired time range. Example Value: "1718339227" Purpose: To include only transactions that fall within the user-defined time range. ``` ```json { "name": "My Main Wallet Porfolio", "filters": [ { "column": "account_id", "predicates": [ { "type": "eq", "value": [ "AmTRLjX9T8KktBBnw1F78DyDb17fr6L8BNpEgCPGs5eM" ] } ] }, { "column": "time", "predicates": [ { "type": "gt", "value": [ "1725148800" ] }, { "type": "lt", "value": [ "1730505600" ] } ] } ] } ``` ```json { "message": "Index was created", "id": "ec5b37a2-c577-4e89-b5aa-077e10771419" } ``` -------------------------------- ### View Example JSON Response for Dex Pools API Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/dex-pools-api This example illustrates the typical JSON structure returned by the Dex Pools API. It shows a single entry within the `poolsData` array, detailing a specific DEX pool's block information, addresses, and token balances. This format helps developers understand the expected output for integration. ```JSON { "data": { "poolsData": [ { "block_slot": 321249880, "block_time": "2025-02-17 12:17:04.741", "pool": "FcQRFJpQcdfyc4UHqMYMgzQTiy5wfxPvDcP9ywQN7SYR", "mint_a": "61V8vBaqAGMpgDQi4JcAwo1dmBGHsyhzodcPqnEVpump", "mint_b": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "token_a_amount": 86679.966529, "token_b_amount": 17380.573925 } ] } } ``` -------------------------------- ### Historical Token Price API Response Example Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/historical-token-price-api An example JSON response from the Historical Token Price API, showing the structure of the returned data including 'time' (Unix timestamp) and 'value' (price). ```JSON [ { "time": 1739577600, "value": 199.42621602747087 } ] ``` -------------------------------- ### Start Historical Data Backfill Job API Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/historical-token-portfolio Launches a backfill job to fetch and populate historical balance data for a specified index ID. This process initiates the collection of historical token balance data within the defined timeframe for the created index. ```APIDOC Endpoint: POST {admin-base}/backfill/{index_id} Headers: x-api-key: URL Parameters: index_id: The unique identifier of the index created in the previous step. ``` ```json { "action": "start" } ``` ```json { "action_type": "start", "index_id": "ea60d5d2-85d7-4bd2-82f3-c0d7fe934e33" } ``` -------------------------------- ### Sample JSON Response from Wallet PnL API Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/wallet-pnl-api Provides an example of the JSON object returned by the Wallet PnL API. This sample showcases the structure and types of key performance metrics such as wallet address, trade volume, trade count, win rate, and overall PnL. ```JSON { "wallet": "F18ibDvGaj4Yjzk1UfWCk5jE9zoy1JYkXNTCBwPuZpyf", "trade_volume": 12500.75, "trade_count": 98, "win_rate": 45, "pnl_overview": 650.32 } ``` -------------------------------- ### Example GraphQL Query for DEX Trades Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/trade-data-dex-trades An example GraphQL query to retrieve DEX trade data using the `dexTrades` method. This query filters trades by `start_block`, `end_block`, and `program` ID, and selects various trade-related fields such as transaction ID, block time, and token amounts. ```GraphQL query DexTradeResult { dexTrades( start_block: 317380000 end_block: 317380000 program: "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4" ) { tx_id block_time block_slot signer pool_address base_mint quote_mint base_vault quote_vault base_amount quote_amount is_inner_instruction instruction_index inner_instruction_index outer_program inner_program txn_fee_lamports } } ``` -------------------------------- ### Define Token Price API Endpoint and Parameters Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/token-price-api Comprehensive definition of the Token Price API, including its base URL, GET endpoint, and the required 'tokens' query parameter with its type, description, and constraints. ```APIDOC API: Token Price API Base URL: https://graphql.astralane.io Endpoint: GET /api/v1/price-by-token Description: Retrieves the latest prices for the specified tokens (up to 50). Query Parameters: tokens: string (Required) Description: A comma-separated list of token mint addresses for which to fetch the latest prices. Constraints: Maximum of 50 token mint addresses can be queried per request. Returns: Prices in both SOL and USD. ``` -------------------------------- ### Send Atomic Transaction Bundle in Golang Source: https://astralane.gitbook.io/docs/low-latency/submit-transactions This Golang example shows how to prepare and send an atomic transaction bundle. It covers loading a private key, fetching a recent blockhash, creating a transfer instruction, signing the transaction, encoding it to base64, and making an RPC call to the `sendBundle` endpoint. It also includes a helper function for the HTTP request. ```Golang package main import ( "bytes" "context" "encoding/base64" "encoding/json" "fmt" "github.com/davecgh/go-spew/spew" "github.com/gagliardetto/solana-go/programs/system" "log" "net/http" "time" "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" ) func main() { payerPrivateKeyBase58 := "YOUR_WALLET_PRIVATE_KEY" astralaneTipAddressBase58 := "astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm" rpcEndpoint := "DM_US_FOR_TRIAL_RPC_ENDPOINTS" astralaneEndpoint := "http://fr.gateway.astralane.io/iris?api-key=YOUR_ASTRALANE_API_KEY" signer, err := solana.PrivateKeyFromBase58(payerPrivateKeyBase58) if err != nil { log.Fatalf("Failed to load private key: %v", err) } client := rpc.New(rpcEndpoint) recentBlockhash, err := client.GetLatestBlockhash(context.Background(), rpc.CommitmentFinalized) if err != nil { log.Fatalf("Failed to get recent blockhash: %v", err) } astralaneTipAddress, err := solana.PublicKeyFromBase58(astralaneTipAddressBase58) if err != nil { log.Fatalf("Failed to decode astralane tip address: %v", err) } tx, err := solana.NewTransaction( []solana.Instruction{ system.NewTransferInstruction( 200_000, signer.PublicKey(), astralaneTipAddress, ).Build(), }, recentBlockhash.Value.Blockhash, solana.TransactionPayer(signer.PublicKey()), ) if err != nil { log.Fatalf("Failed to create transaction: %v", err) } if _, err := tx.Sign(func(key solana.PublicKey) *solana.PrivateKey { return &signer }); err != nil { log.Fatalf("Failed to sign transaction: %v", err) } spew.Dump(tx) out, err := tx.MarshalBinary() if err != nil { log.Fatalf("Marshaling to binary failed: %v", err) } encodedTx := base64.StdEncoding.EncodeToString(out) decoded, err := base64.StdEncoding.DecodeString(encodedTx) if err != nil { log.Fatalf("Sanity check decode failed: %v", err) } if !bytes.Equal(decoded, out) { log.Fatalf("Sanity check failed: decoded transaction does not match original binary") } payload := map[string]interface{}{ "jsonrpc": "2.0", "id": 1, "method": "sendBundle", "params": []interface{}{ []string{encodedTx}, }, } response, err := sendBundleRequest(astralaneEndpoint, payload) if err != nil { log.Fatalf("Bundle RPC failed: %v", err) } log.Printf("Bundle RPC response: %s", response) } func sendBundleRequest(endpoint string, payload map[string]interface{}) (string, error) { jsonData, err := json.Marshal(payload) if err != nil { return "", fmt.Errorf("Failed to marshal JSON: %w", err) } client := &http.Client{Timeout: 15 * time.Second} resp, err := client.Post(endpoint, "application/json", bytes.NewBuffer(jsonData)) if err != nil { return "", fmt.Errorf("Request to Bundle RPC failed: %w", err) } defer resp.Body.Close() var result map[string]interface{} if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { return "", fmt.Errorf("Failed to decode Bundle RPC response: %w", err) } responseBytes, _ := json.MarshalIndent(result, "", " ") return string(responseBytes), nil } ``` -------------------------------- ### API Error: Invalid Subscription Format Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/websocket-token-price-and-volume This JSON object illustrates an error response indicating that the provided subscription format is invalid. It includes a message guiding the user on the correct format to use for subscriptions. ```JSON { "message": "Invalid subscription format. Use {operation}-by-{token|pool}:{identifier}" } ``` -------------------------------- ### sendPaladin JSON Request Body Example Source: https://astralane.gitbook.io/docs/low-latency/submit-transactions This JSON object demonstrates the request structure for the `sendPaladin` RPC method. It includes the RPC version, a request ID, the method name, a base64-encoded transaction string, and an optional configuration object with parameters like `revertProtection` and `enableFallback`. ```json { "id": 1, "jsonrpc": "2.0", "method": "sendPaladin", "params": [ "", { "revertProtection": false, "enableFallback" : false } ] } ``` -------------------------------- ### PnL Indexer API Endpoints Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/pnl-indexer The PnL Indexer exposes a set of API endpoints designed to initialize indexing, backfill historical transaction data, and retrieve comprehensive cumulative and daily Profit and Loss (PnL) metrics for any specified account. The Admin API is available at https://indexer.astralane.io/api-docs#/ and the Index Data API at https://graphql.astralane.io/api-docs. Example base URLs are https://indexer.astralane.io/ for admin and https://graphql.astralane.io/ for dataset. ```APIDOC POST {admin-base-url}/index/pnl Purpose: Initializes a new index for tracking PnL data. ``` ```APIDOC POST {admin-base-url}/index/{index_id}/backfill Purpose: Starts a backfill job to populate historical PnL data based on the specified index ID. ``` ```APIDOC GET {admin-base-url}/index/{index_id}/backfill Purpose: Check the current status of the backfill job for the specified index. ``` ```APIDOC GET {index-dataset-url}/api/v1/dataset/cumulative-pnl/{index_id} Purpose: Retrieves the cumulative PnL data for the specified index ID over the specified time frame. ``` ```APIDOC GET {index-dataset-url}/api/v1/dataset/daily-pnl/{index_id} Purpose: Retrieves the daily PnL data for the specified index ID over the specified time frame. ``` -------------------------------- ### Example JSON Response for Token Price Data Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/token-price-api This JSON array illustrates the structure of a typical API response for token price and market capitalization data. Each object in the array represents a token, providing details such as timestamp, price in USD, token address, decimals, name, symbol, URI, market capitalization, and supply. ```JSON [ { "timestamp": "1737148622", "price_in_usd": 218.45145294, "token": "So11111111111111111111111111111111111111112", "decimals": 9, "name": "Wrapped SOL", "symbol": "SOL", "uri": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png", "marketCap": 0, "supply": 0 }, { "timestamp": "1737148622", "token": "H6EnL9x9ycxcNdQ8YnuxfE4iCnQFcKADC7eoGd9npump", "price_in_sol": 0.000005035749216120721, "price_in_usd": 0.0011000667329030378, "decimals": 6, "name": "Telegram Engine", "symbol": "AIGRAM", "uri": "https://ipfs.io/ipfs/QmTwymvcXWrDoseVU9PfHmE79e4FCdXi84CGEQprjRwgUn", "marketCap": 1100042.67698022, "supply": 999978132.305888 } ] ``` -------------------------------- ### Daily PnL Data Sample JSON Response Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/pnl-indexer Provides a detailed example of the JSON array returned by the daily PnL API. It illustrates the structure for each daily entry, including realized and unrealized PnL, and a nested array of "tokens_traded" with transaction details like timestamp, block slot, transaction ID, mint, shares, trade type, DEX name, price in USD, and running token balance. ```JSON [ { "date": "2024-10-24", "realized_pnl": -1594473.0642288465, "unrealized_pnl": -3018.3074229327203, "tokens_traded": [ { "timestamp": "2024-10-24 14:31:21", "block_slot": "297437409", "transaction_id": "4mQbHRRdDhFDkyTiFaTYets7ZNYLgCM53BmopS5hQvxeSLUZr3ZbcG1oxA2U62fXURbp4eiwCjNUdrmABd7SzTYc", "mint": "Bz4MhmVRQENiCou7ZpJ575wpjNFjBjVBSiVhuNg1pump", "shares": 45395648.422744, "trade_type": "BUY", "dex_name": " ", "price_in_usd": 0.0005947846472226818, "token_running_balance": 27000.63473256668 }, { "timestamp": "2024-10-24 14:31:21", "block_slot": "297437409", "transaction_id": "4mQbHRRdDhFDkyTiFaTYets7ZNYLgCM53BmopS5hQvxeSLUZr3ZbcG1oxA2U62fXURbp4eiwCjNUdrmABd7SzTYc", "mint": "So11111111111111111111111111111111111111112", "shares": 6, "trade_type": "SELL", "dex_name": " ", "price_in_usd": 175.5622513596877, "token_running_balance": 1053.373508158126 }, { "timestamp": "2024-10-24 16:11:04", "block_slot": "297450632", "transaction_id": "qSBkprVyGvKeA64rnNycFWDhQEvzt84FKHYC97JREgQwEBivF543zS78zxDaNipSyjEx2n6tRLZnk8KDkQKvdwy", "mint": "Bz4MhmVRQENiCou7ZpJ575wpjNFjBjVBSiVhuNg1pump", "shares": 8561619.292529, "trade_type": "SELL", "dex_name": " ", "price_in_usd": 0.0009076950968016275, "token_running_balance": 7771.339852510792 }, { "timestamp": "2024-10-24 16:11:04", "block_slot": "297450632", "transaction_id": "qSBkprVyGvKeA64rnNycFWDhQEvzt84FKHYC97JREgQwEBivF543zS78zxDaNipSyjEx2n6tRLZnk8KDkQKvdwy", "mint": "So11111111111111111111111111111111111111112", "shares": 79.18219076, "trade_type": "BUY", "dex_name": " ", "price_in_usd": 176.5638905707737, "token_running_balance": 13980.715664502766 } ], "tokens_cost_basis": [] }, { "date": "2024-10-25", "realized_pnl": -1764720.7775157518, "unrealized_pnl": 0, "tokens_traded": [ { "timestamp": "2024-10-25 00:36:13", "block_slot": "297517893", "transaction_id": "4v1wHSS92iahBveM8FhNXRhbkMvfEdWQ45o173MDJjkpNAbAZmMZeEkcgKoBp5raxkowtFirpCx26MBv2az4BiYU", "mint": "Bz4MhmVRQENiCou7ZpJ575wpjNFjBjVBSiVhuNg1pump", "shares": 2983556.359547, "trade_type": "SELL", "dex_name": " ", "price_in_usd": 0.014919479377863682, "token_running_balance": 44513.1075789555 }, { "timestamp": "2024-10-25 00:36:13", "block_slot": "297517893", "transaction_id": "4v1wHSS92iahBveM8FhNXRhbkMvfEdWQ45o173MDJjkpNAbAZmMZeEkcgKoBp5raxkowtFirpCx26MBv2az4BiYU", "mint": "So11111111111111111111111111111111111111112", "shares": 241.968258132, "trade_type": "BUY", "dex_name": " ", "price_in_usd": 176.6293329283558, "token_running_balance": 42738.69202369136 } ], "tokens_cost_basis": [] } ] ``` -------------------------------- ### Sample JSON Response for Blockchain Transaction Data Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/trade-data-dex-trades An example JSON object representing a single blockchain transaction, detailing various attributes like block time, transaction ID, signer, pool information, token amounts, and instruction details. ```json [ { "block_time": "2024-08-13T00:04:09", "block_slot": 283239907, "tx_id": "3heh6YsGgM8WK1U1hEF7c26RKpMui2ZyeopmmQEX4PtwzWFRAadahJaVGWX31is9ufTHkEGN9GWwR1mxqencUS8c", "signer": "3eEuBoFRznqL6DUCVZpuWdJWeg7AfRdJSY3732PDSBuP", "pool_address": "CEGPBQJ6nYkDCiBP8AQ1LsPTj3bqhw34PKskzJiJgt6H", "base_mint": "So11111111111111111111111111111111111111112", "quote_mint": "3yvwMGa3ap49DWquMEpf7Mrvq85N4gjXsdehFPRRpump", "base_vault": "BW8fXFoEGbhRf1LpdX53Ems3BHWdCNaTdyAR6XxmpNQa", "quote_vault": "7xynyUq3VVAKVgBbgnb4ssofcMpX3EiRsiadFWsc2XmR", "base_amount": -0.000016546, "quote_amount": 87.64461, "is_inner_instruction": false, "instruction_index": 4, "instruction_type": "SwapBaseIn", "inner_instruxtion_index": 0, "outer_program": "675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8", "inner_program": "", "txn_fee_lamports": 23990, "signer_lamports_change": -23990, "partition_0": "2024-08-13" } ] ``` -------------------------------- ### Fetch Daily PnL Data API Endpoint Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/pnl-indexer Documents the HTTP GET endpoint for retrieving daily Profit and Loss (PnL) data for a specified index. It outlines the full endpoint path, required authentication headers, and the specific URL parameter needed for the request. The description also clarifies the purpose of the API. ```APIDOC Method: GET Endpoint: {index-dataset-url}/api/v1/dataset/daily-pnl/{index_id} Headers: x-api-key: URL Parameters: index_id: The ID of the index to fetch daily PnL data. Description: Fetches the daily PnL data for the specified index within the provided date range. ``` -------------------------------- ### Example of a successful API response for token data Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/websocket-token-price-and-volume This JSON object represents a typical successful response from the API, providing detailed information about a token, including its timestamp, decimals, name, symbol, logo URI, market capitalization, supply, and prices in SOL and USD. ```JSON { "timestamp": "1741771359", "decimals": 9, "name": "Wrapped SOL", "symbol": "SOL", "logoURI": "https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png", "marketCap": 74104722584.46233, "supply": 509384498.1158462, "price_in_sol": 1, "price_in_usd": 124.3285941413753, "token": "So11111111111111111111111111111111111111112" } ``` -------------------------------- ### Example JSON Response for End of Month Token Balances Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/historical-token-portfolio This JSON snippet illustrates the structure of an API response providing end-of-month token balance data. It includes the total USD balance for a given date and a list of individual tokens with their balances, mint addresses, and USD values. The response is structured with a 'balanceData' array, where each object represents a specific month's data. ```JSON { "data": { "balanceData": [ { "date": "2024-09-30", "total_balance_usd": 102344.14134378362, "tokens": [ { "timestamp": "2024-09-30 00:00:00", "balance": 0.37321068900000004, "mint": "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn", "balance_usd": 64.911234431185 }, { "timestamp": "2024-09-30 00:00:00", "balance": 4.602259, "mint": "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm", "balance_usd": 11.330136288092994 } ] }, { "date": "2024-10-31", "total_balance_usd": 108291.15598369065, "tokens": [ { "timestamp": "2024-10-31 00:00:00", "balance": 0.199743006, "mint": "he1iusmfkpAdwvxLNGV8Y1iSbj4rUy6yMhEA3fotn9A", "balance_usd": 35.163866912937515 }, { "timestamp": "2024-10-31 00:00:00", "balance": 296.22111298, "mint": "hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux", "balance_usd": 1868.362032881505 } ] }, { "date": "2024-11-30", "total_balance_usd": 132234.13328501736, "tokens": [ { "timestamp": "2024-11-30 00:00:00", "balance": 4.602259, "mint": "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm", "balance_usd": 11.516714801692155 }, { "timestamp": "2024-11-30 00:00:00", "balance": 42168.796381, "mint": "GQdF6BctM9JsoUqxjgMBpnzRDhvVEBPJK9SG7ykopump", "balance_usd": 2.114111146960422 } ] } ] } } ``` ```JSON { "data": { "balanceData": [ { "date": "2024-12-31", "total_balance_usd": 132317.44254361294, "tokens": [ { "timestamp": "2024-12-31 00:00:00", "balance": 200, "mint": "3UfknvCm4No13GHBPwNvXqJt9kroZcPv3psWswqpzixt", "balance_usd": 0.042376126026558644 }, { "timestamp": "2024-12-31 00:00:00", "balance": 0.0064, "mint": "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3", "balance_usd": 0.0027155486819310844 }, { "timestamp": "2024-12-31 00:00:00", "balance": 537.444440265, "mint": "bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1", "balance_usd": 129025.68011636613 } ] } ] } } ``` -------------------------------- ### Wallet PnL API Endpoint Definition Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/wallet-pnl-api Defines the GET endpoint for retrieving Wallet PnL data, including its purpose, required query parameters, and supported values for the time window. It also specifies the expected response format. ```APIDOC Endpoint: GET /api/v1/dataset/wallet-pnl Description: Returns detailed Profit and Loss (PnL) metrics for a specified wallet over a selected time window. The response includes trade volume, trade count, win rate, and overall PnL, providing a comprehensive view of the wallet's trading performance. Query Parameters: time (required): The time window for calculating PnL metrics. Supported values: 2h, 3h, 5h, 10h, 24h, 3d, 1W wallet (required): The wallet address (public key) for which to retrieve PnL data. Response Format: The API returns a JSON object containing key performance metrics for the specified wallet. ``` -------------------------------- ### Send Ideal Transaction with Managed Nonce (TypeScript) Source: https://astralane.gitbook.io/docs/low-latency/submit-transactions This TypeScript asynchronous function `sendTransTest` illustrates how to fetch a managed nonce from Astralane's `getNonce` endpoint, then construct and partially sign Solana transactions. It demonstrates setting compute unit prices and transferring lamports, similar to the Rust example, but from a client-side perspective. It emphasizes the use of `partialSign` for transactions utilizing managed nonce accounts. ```TypeScript import { Connection, Keypair, PublicKey, SystemProgram, Transaction, LAMPORTS_PER_SOL, ComputeBudgetProgram, } from '@solana/web3.js'; import * as bs58 from 'bs58'; async sendTransTest() { try { const result = await fetch( `http://fr.gateway.astralane.io/iris?api-key=`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'getNonce', params: [ 'api-key', ], }), }, ); const res = await result.json(); const data = res as any; const nonceAccount = new PublicKey(data.result.nonceAccount); const nonceAuthority = new PublicKey(data.result.nonceAuthority); const nonce = data.result.nonce; const advanceNonce = SystemProgram.nonceAdvance({ noncePubkey: nonceAccount, authorizedPubkey: nonceAuthority, }); const secretKey = Keypair.fromSecretKey( bs58.default.decode( 'wallet-private-key', ), ); const wallet = secretKey; //Tip account const toPublicKey = new PublicKey( 'astra4uejePWneqNaJKuFFA8oonqCE1sqF6b45kDMZm', ); const MIN_TIP_AMOUNT = 100000; const lowTipHighFeeIx = [ advanceNonce, ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 * 100000, }), SystemProgram.transfer({ fromPubkey: wallet.publicKey, toPubkey: toPublicKey, lamports: MIN_TIP_AMOUNT, }), ]; const HighTipLowFeeIx = [ advanceNonce, ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1 * 100, }), SystemProgram.transfer({ fromPubkey: wallet.publicKey, toPubkey: toPublicKey, lamports: 100 * MIN_TIP_AMOUNT, }), ]; const htlfTransaction = new Transaction().add(...HighTipLowFeeIx); htlfTransaction.recentBlockhash = nonce; htlfTransaction.feePayer = wallet.publicKey; htlfTransaction.partialSign(wallet); const highTipLowFeeEncoded = Buffer.from( htlfTransaction.serialize({ ``` -------------------------------- ### Retrieve End of Day Token Balances JSON Example Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/historical-token-portfolio This JSON snippet demonstrates the expected format for an API response containing end-of-day token balance information. It includes a 'balanceData' array, where each entry represents a specific date with a total USD balance and a list of individual tokens, their balances, mint addresses, and USD values for that day. ```JSON { "data": { "balanceData": [ { "date": "2024-10-01", "total_balance_usd": 97442.96595799158, "tokens": [ { "timestamp": "2024-10-01 00:00:00", "balance": 912.255539, "mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo", "balance_usd": 912.1079505163582 }, { "timestamp": "2024-10-01 00:00:00", "balance": 350917.146019, "mint": "bobaM3u8QmqZhY1HwAtnvze9DLXvkgKYk3td3t8MLva", "balance_usd": 228.8904975123627 } ] }, { "date": "2024-10-02", "total_balance_usd": 94190.14343633992, "tokens": [ { "timestamp": "2024-10-02 00:00:00", "balance": 2611.5364, "mint": "HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3", "balance_usd": 840.5278588025184 }, { "timestamp": "2024-10-02 00:00:00", "balance": 0.19602522900000002, "mint": "jucy5XJ76pHVvtPZb5TKRcGQExkwit2P5s4vY8UzmpC", "balance_usd": 29.091447467872708 } ] }, { "date": "2024-10-03", "total_balance_usd": 91889.01628388994, "tokens": [ { "timestamp": "2024-10-03 00:00:00", "balance": 96000, "mint": "7atgF8KQo4wJrD5ATGX7t1V2zVvykPJbFfNeVf1icFv1", "balance_usd": 0.04259115659076336 }, { "timestamp": "2024-10-03 00:00:00", "balance": 2.579127254, "mint": "MNDEFzGvMt87ueuHvVU9VcTqsAP5b3fTGPsHuuPA5ey", "balance_usd": 0.27138132087748235 } ] } ] } } ``` -------------------------------- ### Query Dex Pool Data using GraphQL Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/dex-pools-api This GraphQL query retrieves detailed information for DEX pools. It specifies fields such as block slot, block time, pool address, mint addresses for tokens A and B, and their respective amounts, along with the program address. The query is paginated, starting from page 1. ```GraphQL query PoolsData { poolsData(page: 1) { block_slot block_time pool mint_a mint_b token_a_amount token_b_amount program } } ``` -------------------------------- ### Sample OHLCV API Request Header Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/ohlcv-api Illustrates the required 'x-api-key' header for authenticating requests to the OHLCV API. Replace `` with your actual API key. ```HTTP header:{ x-api-key: } ``` -------------------------------- ### Profitable Wallets API Query Parameters Source: https://astralane.gitbook.io/docs/data-pipelines/our-products/profitable-wallets Details the required and optional query parameters for the Profitable Wallets API, including time window for metric calculation, and pagination options for results. ```APIDOC Query Parameters: - time (required): Description: Specifies the time window for calculating wallet metrics. Supported values: 2h, 3h, 5h, 10h, 24h, 3d, 1W - page (optional): Description: Specifies the page number for paginated results. Default: 1 - limit (optional): Description: Number of records to return per page. Default: 100 ``` -------------------------------- ### Astralane Custom Data Indexing Pipelines Source: https://astralane.gitbook.io/docs/data-pipelines/our-products Build and configure bespoke indexing infrastructure using Astralane's modular components. These pipelines enable tailored program indexing, efficient ingestion of raw Solana transactions, and high-speed bulk account indexing to overcome RPC limitations. ```APIDOC Custom Data Indexing Pipelines: - Custom Program Indexer: Create tailored program indexers with optional external API enrichment. - Transaction Indexer: Ingest and index raw Solana transactions into hot storage for faster, cost-effective querying compared to standard RPCs. - Custom Account Indexes: Leverage high-speed bulk account indexing to bypass limitations of repeated getProgramAccounts and getMultipleAccounts calls. ```