get_quote_raw

Installation

pip install karrotcapital.spiderswap

Usage

Initialization

First, initialize the 'Spiderswap' class with your API key.

from karrotcapital.spiderswap import Spiderswap

spiderswap = Spiderswap(ApiKey);

Method: get_quote_raw

Description

The 'get_quote_raw' method retrieves a quote for a token swap by fetching raw quote data from the SpiderSwap API.

Parameters

  • 'from_mint' (string): The mint address of the token being swapped from.

  • 'to_mint' (string): The mint address of the token being swapped to.

  • 'amount' (number): The amount of the 'from_mint' token to swap, in lamports.

  • 'slippage' (number): The acceptable slippage percentage for the swap, in basis points (bps).

  • 'provider' (string): The liquidity provider.

Returns

'QuoteMap': A object containing the quote data.

'QuoteMap' Class

Example

Implementation Details

This method constructs a request body with the provided parameters and makes an API call to fetch the quote data. If the API call fails, it logs the error and throws an exception.

Last updated