Python Solana bot transaction issues

I’m attempting to create a solana bot that has limit order to buy $MAGA using raydium. However everytime i run the code, the transaction does not go through.

<!– begin snippet: js hide: false console: true babel: false –>

# Returns the swap_transaction to be manipulated in sendTransaction()
async def create_transaction(quote: dict, input_token_mint, output_token_mint) -> dict:
    log_transaction.info(f"""Soltrade is creating transaction for the following quote: 
{quote}""")

    if 'error' in quote:
        log_transaction.error(f"Error in quote: {quote['error']}")
        raise Exception(f"Error in quote: {quote['error']}")

    pool_id = get_pool_id(input_token_mint)
    #pool_id = "9XsGAA3xHC6gqRgThRrcaUPU6jzerZacWgfyMb17579t"

    # Parameters used for the Raydium POST request
    parameters = {
        "quoteResponse": quote,
        "userPublicKey": str(configs['public_address']),
        "wrapUnwrapSOL": True,
        "computeUnitPriceMicroLamports": 20 * 3_000_000  # fee of roughly $.4  :shrug:
    }
    #9XsGAA3xHC6gqRgThRrcaUPU6jzerZacWgfyMb17579t
    # Returns the JSON parsed response of Jupiter
    async with httpx.AsyncClient() as client:
        response = await client.post(f"https://api.raydium.io/v2/swap?poolId={pool_id}", json=parameters)
        exchange_data = response.json()

        pprint(f"TRANSACTION CREATE:n{exchange_data}")
        return exchange_data


async def perform_swap(sent_amount: float, price_limit, sent_token_mint: str, mode : str):
    global position
    log_general.info("Soltrade is taking a limit position.")

    #TODO: fetch the current price and create a limit order
    current_price = get_price(sent_token_mint)

    base_token = await get_token_decimals(sent_token_mint)
    quote = trans = opts = txid = tx_error = None
    is_tx_successful = False

    for i in range(0,3):
        if not is_tx_successful:
            try:
                if (mode == "buy") or (mode == "sell"):
                    quote = await create_exchange(sent_amount, sent_token_mint, mode)
                    trans = await create_transaction(quote, sent_token_mint, SOL_MINT_ADDRESS)
                    print(f"TRANS:n{trans}")
                    opts = TxOpts(skip_preflight=False, preflight_commitment="confirmed", last_valid_block_height=find_last_valid_block_height())
                    txid = send_transaction(trans["swapTransaction"], opts)

                    for i in range(3):
                        await asyncio.sleep(35)
                        tx_error = find_transaction_error(txid)
                        if not tx_error:
                            is_tx_successful = True
                            break
                else:
                    log_general.info(f"Price hasn't reached {price_limit}. Waiting for the next opportunity.")
                    await asyncio.sleep(60)
                    continue
                    #current_price = get_price(sent_token_mint)

            except Exception as e:
                if RPCException:
                    print(traceback.format_exc())
                    log_general.warning(f"Soltrade failed to complete transaction {i}. Retrying.")
                    continue
                else:
                    raise
            for i in range(0, 3):
                try:
                    await asyncio.sleep(35)
                    tx_error = find_transaction_error(txid)
                    if not tx_error:
                        is_tx_successful = True
                        break
                except TypeError as e:
                    print(traceback.format_exc())
                    log_general.warning("Soltrade failed to verify the existence of the transaction. Retrying.")
                    continue
        else:
            break

<!– end snippet –>

<!– begin snippet: js hide: false console: true babel: false –>

2024-05-27 14:19:22       Soltrade has detected a buy signal.
2024-05-27 14:19:22       Soltrade is taking a limit position.
Response: SOL
2024-05-27 14:19:22       Soltrade is creating exchange for 12.103126943600001 dollars in ('', '')
Pool ID: 8sLbNZoA1cfnvMJLPfp98ZLAnFSYCFApfJKMbiXNLwxj
('EXCHANGE CREATED:n'
 "{'id': '03c2fd251bb64b3a85a3207deae7b010', 'success': False}")
2024-05-27 14:19:23       Soltrade is creating transaction for the following quote: 
{'id': '03c2fd251bb64b3a85a3207deae7b010', 'success': False}
('TRANSACTION CREATE:n'
 "{'id': '64218b3c90b943d0a1069e43248f406f', 'success': False}")
TRANS:
{'id': '64218b3c90b943d0a1069e43248f406f', 'success': False}
Traceback (most recent call last):
  File "/Users/dekahalane/soltrade-1/soltrade/transactions.py", line 204, in perform_swap
    txid = send_transaction(trans["swapTransaction"], opts)
KeyError: 'swapTransaction'

2024-05-27 14:19:24       Soltrade failed to complete transaction 0. Retrying.

<!– end snippet –>

I’ve tried debugging, increasing the slippage and the fees. I’ve researched any Solana python documentation and i couldn’t find any. I think the problem could be wrong links.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật