[![Downloads](https://static.pepy.tech/badge/bpx-py)](https://pepy.tech/project/bpx-py)
# Backpack SDK
## Installation
bpx-py is stable on _python_ >= 3.8
```bash
pip install bpx-py
```
## Usage
Make an account and generate API keys on [Backpack](https://backpack.exchange/settings/api-keys)
### Account example
```python
from bpx.account import Account
public_key = "<KEY>"
secret_key = "<KEY>"
account = Account(public_key,
secret_key,
window=6000, # default value is 5000
proxy={"http":"132.142.132.12:3128"}) # you can use any requests proxy supported by requests
deposit_address_sol = account.get_deposit_address("Solana")
account_fills = account.get_fill_history_query("SOL_USDC",
limit=10,
window=10000) # window only for this order
print(deposit_address_sol)
print(account_fills)
```
bpx-py supports **async** code:
```python
from bpx.__async.account import Account
import asyncio
async def main():
public_key = "<KEY>"
secret_key = "<KEY>"
account = Account(public_key, secret_key, proxy="http://your_proxy-address:1234")
deposit_address_sol = await account.get_deposit_address("Solana")
await asyncio.sleep(1)
account_fills = await account.get_fill_history_query("SOL_USDC",
limit=10,
window=10000)
print(deposit_address_sol)
print(account_fills)
asyncio.run(main())
```
### Public
Backpack has public endpoints that don't need API keys:
```python
from bpx.public import Public
public = Public()
server_time = public.get_time()
markets = public.get_markets()
print(server_time)
print(markets)
```
**Async** code:
```python
from bpx.__async.public import Public
import asyncio
async def main():
public = Public()
assets = await public.get_assets()
await asyncio.sleep(1)
klines = await public.get_klines("SOL_USDC", "1d")
print(assets)
print(klines)
asyncio.run(main())
```
## Useful sources
[Discord channel to get help](https://discord.gg/backpack)
[Backpack API DOCS](https://docs.backpack.exchange)
[PYPI](https://pypi.org/project/bpx-py/)
[Backpack help center](https://support.backpack.exchange)
Raw data
{
"_id": null,
"home_page": "https://backpack.exchange",
"name": "bpx-py",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "api, sdk, backpack, client, wrapper",
"author": "sndmndss",
"author_email": "yanfedorov120505@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/bf/b2/1dbb0af97452bb71406c096815f7cec255178e80dc6b74b18b54fcdd7ebc/bpx_py-1.1.4.tar.gz",
"platform": null,
"description": "[![Downloads](https://static.pepy.tech/badge/bpx-py)](https://pepy.tech/project/bpx-py)\n\n# Backpack SDK\n\n## Installation\n\nbpx-py is stable on _python_ >= 3.8\n\n```bash\npip install bpx-py\n```\n\n## Usage\n\nMake an account and generate API keys on [Backpack](https://backpack.exchange/settings/api-keys)\n\n### Account example\n\n```python\nfrom bpx.account import Account\n\npublic_key = \"<KEY>\"\nsecret_key = \"<KEY>\"\naccount = Account(public_key, \n secret_key,\n window=6000, # default value is 5000\n proxy={\"http\":\"132.142.132.12:3128\"}) # you can use any requests proxy supported by requests\ndeposit_address_sol = account.get_deposit_address(\"Solana\")\naccount_fills = account.get_fill_history_query(\"SOL_USDC\", \n limit=10,\n window=10000) # window only for this order\nprint(deposit_address_sol)\nprint(account_fills)\n```\n\nbpx-py supports **async** code:\n```python\nfrom bpx.__async.account import Account\nimport asyncio\n\nasync def main():\n public_key = \"<KEY>\"\n secret_key = \"<KEY>\"\n account = Account(public_key, secret_key, proxy=\"http://your_proxy-address:1234\")\n deposit_address_sol = await account.get_deposit_address(\"Solana\")\n await asyncio.sleep(1)\n account_fills = await account.get_fill_history_query(\"SOL_USDC\", \n limit=10,\n window=10000)\n print(deposit_address_sol)\n print(account_fills)\n\nasyncio.run(main())\n```\n\n### Public\n\nBackpack has public endpoints that don't need API keys:\n\n```python\nfrom bpx.public import Public\n\npublic = Public() \nserver_time = public.get_time()\nmarkets = public.get_markets()\nprint(server_time)\nprint(markets)\n```\n**Async** code:\n\n```python\nfrom bpx.__async.public import Public\nimport asyncio\n\nasync def main():\n public = Public()\n assets = await public.get_assets()\n await asyncio.sleep(1)\n klines = await public.get_klines(\"SOL_USDC\", \"1d\")\n print(assets)\n print(klines)\n \nasyncio.run(main())\n```\n\n## Useful sources\n\n[Discord channel to get help](https://discord.gg/backpack)\n\n[Backpack API DOCS](https://docs.backpack.exchange)\n\n[PYPI](https://pypi.org/project/bpx-py/)\n\n[Backpack help center](https://support.backpack.exchange)\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Backpack API SDK tool",
"version": "1.1.4",
"project_urls": {
"Bug Tracker": "https://github.com/sndmndss/bpx-py/issues",
"Get help in discord": "https://discord.gg/backpack",
"Homepage": "https://backpack.exchange",
"Repository": "https://github.com/sndmndss/bpx-py/"
},
"split_keywords": [
"api",
" sdk",
" backpack",
" client",
" wrapper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c1221d7613f5e11c6fd8fb2c909a3852fb0b0816527ee80f272e4e59d39d7829",
"md5": "0bfb22e1172da301b8690b83aedf9de8",
"sha256": "713fc47de109f0117a694f71d2e93320c1d66cccfca943f669abf8185a551721"
},
"downloads": -1,
"filename": "bpx_py-1.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0bfb22e1172da301b8690b83aedf9de8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 15525,
"upload_time": "2024-05-15T15:40:57",
"upload_time_iso_8601": "2024-05-15T15:40:57.668655Z",
"url": "https://files.pythonhosted.org/packages/c1/22/1d7613f5e11c6fd8fb2c909a3852fb0b0816527ee80f272e4e59d39d7829/bpx_py-1.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bfb21dbb0af97452bb71406c096815f7cec255178e80dc6b74b18b54fcdd7ebc",
"md5": "c6a2fc981c1a7100d4473563d069978d",
"sha256": "253114dad3d05b7349dd1b95a9065c284c4fba663817a646bd73196acd3c29a2"
},
"downloads": -1,
"filename": "bpx_py-1.1.4.tar.gz",
"has_sig": false,
"md5_digest": "c6a2fc981c1a7100d4473563d069978d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 11919,
"upload_time": "2024-05-15T15:40:59",
"upload_time_iso_8601": "2024-05-15T15:40:59.207084Z",
"url": "https://files.pythonhosted.org/packages/bf/b2/1dbb0af97452bb71406c096815f7cec255178e80dc6b74b18b54fcdd7ebc/bpx_py-1.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-15 15:40:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sndmndss",
"github_project": "bpx-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohttp",
"specs": [
[
"==",
"3.9.5"
]
]
},
{
"name": "aiosignal",
"specs": [
[
"==",
"1.3.1"
]
]
},
{
"name": "attrs",
"specs": [
[
"==",
"23.2.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.2.2"
]
]
},
{
"name": "cffi",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.3.2"
]
]
},
{
"name": "cryptography",
"specs": [
[
"==",
"42.0.5"
]
]
},
{
"name": "frozenlist",
"specs": [
[
"==",
"1.4.1"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.7"
]
]
},
{
"name": "iniconfig",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "multidict",
"specs": [
[
"==",
"6.0.5"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.0"
]
]
},
{
"name": "pluggy",
"specs": [
[
"==",
"1.5.0"
]
]
},
{
"name": "pycparser",
"specs": [
[
"==",
"2.22"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.2.1"
]
]
},
{
"name": "yarl",
"specs": [
[
"==",
"1.9.4"
]
]
}
],
"lcname": "bpx-py"
}