{"id":24911842,"url":"https://github.com/0xTaoDev/jupiter-python-sdk","last_synced_at":"2025-10-16T22:31:04.408Z","repository":{"id":213565596,"uuid":"730789323","full_name":"0xTaoDev/jupiter-python-sdk","owner":"0xTaoDev","description":"Jupiter Python SDK is a Python library that allows you to use most of Jupiter features.","archived":false,"fork":false,"pushed_at":"2024-04-08T15:49:56.000Z","size":4178,"stargazers_count":198,"open_issues_count":18,"forks_count":55,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-01-26T10:04:55.869Z","etag":null,"topics":["dex","jupiter","python","sdk","solana","swap","trade","web3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/jupiter-python-sdk/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xTaoDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-12T17:14:51.000Z","updated_at":"2025-01-25T05:30:47.000Z","dependencies_parsed_at":"2024-01-05T00:16:07.798Z","dependency_job_id":"95b2cd77-d684-4d0f-baee-961ec9eb1139","html_url":"https://github.com/0xTaoDev/jupiter-python-sdk","commit_stats":{"total_commits":59,"total_committers":3,"mean_commits":"19.666666666666668","dds":"0.44067796610169496","last_synced_commit":"343f0037bc74fc3bd1a21c06bfb4c95eca0301cb"},"previous_names":["0xtaodev/jupiter-python-sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xTaoDev%2Fjupiter-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xTaoDev%2Fjupiter-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xTaoDev%2Fjupiter-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xTaoDev%2Fjupiter-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xTaoDev","download_url":"https://codeload.github.com/0xTaoDev/jupiter-python-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236752311,"owners_count":19199229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dex","jupiter","python","sdk","solana","swap","trade","web3"],"created_at":"2025-02-02T04:30:02.849Z","updated_at":"2025-10-16T22:30:56.928Z","avatar_url":"https://github.com/0xTaoDev.png","language":"Python","funding_links":[],"categories":["Awesome Jupiter"],"sub_categories":["Community projects \u0026 Code examples"],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003ch1\u003e🐍 JUPITER PYTHON SDK 🪐\u003c/h1\u003e\n    \u003cimg src=\"https://github.com/0xTaoDev/jupiter-python-sdk/blob/main/images/jupiter-python-sdk-banner.png?raw=true\" width=\"75%\" height=\"75%\"\u003e\n\u003c/div\u003e\n\n---\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/0xtaodev/jupiter-python-sdk\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/forks/0xtaodev/jupiter-python-sdk\"\u003e\n    \u003cbr\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues/0xtaodev/jupiter-python-sdk\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues-closed/0xtaodev/jupiter-python-sdk\"\u003e\n    \u003cbr\u003e\n    \u003cimg src=\"https://img.shields.io/github/languages/top/0xtaodev/jupiter-python-sdk\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/last-commit/0xtaodev/jupiter-python-sdk\"\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n# 📖 Introduction\n**Jupiter Python SDK** is a Python library that allows you to use most of **[Jupiter](https://jup.ag/) features**.\u003cbr\u003e\nIt enables executing swaps, limit orders, DCA, swap pairs, tokens prices, fetching wallet infos, stats, data and more!\u003cbr\u003e\nThis library is using packages like: [solana-py](https://github.com/michaelhly/solana-py), [solders](https://github.com/kevinheavey/solders), [anchorpy](https://github.com/kevinheavey/anchorpy).\u003cbr\u003e\nThere is documentation inside each function, however, you can access to the [official Jupiter API](https://docs.jup.ag/docs) for more information.\n\n# ⚠️ Disclaimer\n**Please note that I'm not responsible for any loss of funds, damages, or other libailities resulting from the use of this software or any associated services.\u003cbr\u003e\nThis tool is provided for educational purposes only and should not be used as financial advice, it is still in expiremental phase so use it at your own risk.**\n\n# ✨ Quickstart\n\n### 🛠️ Installation\n\n```sh\npip install jupiter-python-sdk\n```\n\n### 📃 General Usage\n**Providing the private key and RPC client is not mandatory if you only intend to execute functions for retrieving data.\u003cbr\u003e\nOtherwise, this is required, for instance, to open a DCA account or to close one.**\n\n**You can set custom URLs for any self-hosted Jupiter APIs. Like the [V6 Swap API](https://station.jup.ag/docs/apis/self-hosted) or [QuickNode's Metis API](https://marketplace.quicknode.com/add-on/metis-jupiter-v6-swap-api).**\n\nIf you encounter ```ImportError: cannot import name 'sync_native' from 'spl.token.instructions``` error when trying to import Jupiter, Jupiter_DCA from jupiter_python_sdk.jupiter, follow these steps:\n1. Go to https://github.com/michaelhly/solana-py/tree/master/src/spl/token and download ```instructions.py```\n2. In your packages folder, replace ```spl/token/instructions.py``` with the one you just downloaded.\n\n### Here is a code snippet on how to use the SDK\n```py\nimport base58\nimport base64\nimport json\n\nfrom solders import message\nfrom solders.pubkey import Pubkey\nfrom solders.keypair import Keypair\nfrom solders.transaction import VersionedTransaction\n\nfrom solana.rpc.types import TxOpts\nfrom solana.rpc.async_api import AsyncClient\nfrom solana.rpc.commitment import Processed\n\nfrom jupiter_python_sdk.jupiter import Jupiter, Jupiter_DCA\n\n\nprivate_key = Keypair.from_bytes(base58.b58decode(os.getenv(\"PRIVATE-KEY\"))) # Replace PRIVATE-KEY with your private key as string\nasync_client = AsyncClient(\"SOLANA-RPC-ENDPOINT-URL\") # Replace SOLANA-RPC-ENDPOINT-URL with your Solana RPC Endpoint URL\njupiter = Jupiter(\n    async_client=async_client,\n    keypair=private_key,\n    quote_api_url=\"https://quote-api.jup.ag/v6/quote?\",\n    swap_api_url=\"https://quote-api.jup.ag/v6/swap\",\n    open_order_api_url=\"https://jup.ag/api/limit/v1/createOrder\",\n    cancel_orders_api_url=\"https://jup.ag/api/limit/v1/cancelOrders\",\n    query_open_orders_api_url=\"https://jup.ag/api/limit/v1/openOrders?wallet=\",\n    query_order_history_api_url=\"https://jup.ag/api/limit/v1/orderHistory\",\n    query_trade_history_api_url=\"https://jup.ag/api/limit/v1/tradeHistory\"\n)\n\n\n\"\"\"\nEXECUTE A SWAP\n\"\"\"\ntransaction_data = await jupiter.swap(\n    input_mint=\"So11111111111111111111111111111111111111112\",\n    output_mint=\"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n    amount=5_000_000,\n    slippage_bps=1,\n)\n# Returns str: serialized transactions to execute the swap.\n\nraw_transaction = VersionedTransaction.from_bytes(base64.b64decode(transaction_data))\nsignature = private_key.sign_message(message.to_bytes_versioned(raw_transaction.message))\nsigned_txn = VersionedTransaction.populate(raw_transaction.message, [signature])\nopts = TxOpts(skip_preflight=False, preflight_commitment=Processed)\nresult = await async_client.send_raw_transaction(txn=bytes(signed_txn), opts=opts)\ntransaction_id = json.loads(result.to_json())['result']\nprint(f\"Transaction sent: https://explorer.solana.com/tx/{transaction_id}\")\n\n\n\"\"\"\nOPEN LIMIT ORDER\n\"\"\"\ntransaction_data = await jupiter.open_order(\n    input_mint=So11111111111111111111111111111111111111112\",\n    output_mint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\",\n    in_amount=5_000_000,\n    out_amount=100_000,\n)\n# Returns dict: {'transaction_data': serialized transactions to create the limit order, 'signature2': signature of the account that will be opened}\n\nraw_transaction = VersionedTransaction.from_bytes(base64.b64decode(transaction_data['transaction_data']))\nsignature = private_key.sign_message(message.to_bytes_versioned(raw_transaction.message))\nsigned_txn = VersionedTransaction.populate(raw_transaction.message, [signature, transaction_data['signature2']])\nopts = TxOpts(skip_preflight=False, preflight_commitment=Processed)\nresult = await async_client.send_raw_transaction(txn=bytes(signed_txn), opts=opts)\ntransaction_id = json.loads(result.to_json())['result']\nprint(f\"Transaction sent: https://explorer.solana.com/tx/{transaction_id}\")\n\n\n\"\"\"\nCREATE DCA ACCOUNT\n\"\"\"\ncreate_dca_account = await jupiter.dca.create_dca(\n    input_mint=Pubkey.from_string(\"So11111111111111111111111111111111111111112\"),\n    output_mint=Pubkey.from_string(\"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\"),\n    total_in_amount=5_000_000,\n    in_amount_per_cycle=100_000,\n    cycle_frequency=60,\n    min_out_amount_per_cycle=0,\n    max_out_amount_per_cycle=0,\n    start=0\n)\n# Returns DCA Account Pubkey and transaction hash.\n\n\n\"\"\"\nCLOSE DCA ACCOUNT\n\"\"\"\nclose_dca_account = await jupiter.dca.close_dca(\n    dca_pubkey=Pubkey.from_string(\"45iYdjmFUHSJCQHnNpWNFF9AjvzRcsQUP9FDBvJCiNS1\")\n)\n# Returns transaction hash.\n```\n\n### 📜 All available features\n```py\n- quote\n- swap\n- open_order\n- cancel_orders\n- create_dca\n- close_dca\n- fetch_user_dca_accounts\n- fetch_dca_account_fills_history\n- get_available_dca_tokens\n- fetch_dca_data\n- query_open_orders\n- query_orders_history\n- query_trades_history\n- get_jupiter_stats\n- get_token_price\n- get_indexed_route_map\n- get_tokens_list\n- get_all_tickers\n- get_all_swap_pairs\n- get_swap_pairs\n- get_token_stats_by_date\n- program_id_to_label\n```\n\n# 📝 TO-DO\n- [ ] Bridge 🌉\n- [ ] Perpetual 💸\n- [ ] Price API\n- [ ] Wallet Transactions History\n\n# 🤝 Contributions\nIf you are interesting in contributing, fork the repository and submit a pull request in order to merge your improvements into the main repository.\u003cbr\u003e\nContact me for any inquiry, I will reach you as soon as possible.\u003cbr\u003e\n[![Discord](https://img.shields.io/badge/Discord-%237289DA.svg?logo=discord\u0026logoColor=white)](https://discord.gg/QxwPGcXDp7)\n[![Twitter](https://img.shields.io/badge/Twitter-%231DA1F2.svg?logo=Twitter\u0026logoColor=white)](https://twitter.com/_TaoDev_)\n\n# 👑 Donations\nThis project doesn't include platform fees. If you find value in it and would like to support its development, your donations are greatly appreciated.\u003cbr\u003e\n**SOLANA ADDRESS**\n```sh\nAyWu89SjZBW1MzkxiREmgtyMKxSkS1zVy8Uo23RyLphX\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xTaoDev%2Fjupiter-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xTaoDev%2Fjupiter-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xTaoDev%2Fjupiter-python-sdk/lists"}