{"id":21616611,"url":"https://github.com/poloniex/polo-futures-sdk-python","last_synced_at":"2025-07-17T08:30:30.787Z","repository":{"id":39669479,"uuid":"275230121","full_name":"poloniex/polo-futures-sdk-python","owner":"poloniex","description":null,"archived":true,"fork":false,"pushed_at":"2024-07-15T12:46:29.000Z","size":30,"stargazers_count":6,"open_issues_count":6,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-21T11:48:42.893Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/poloniex.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":"2020-06-26T19:15:24.000Z","updated_at":"2025-03-22T11:22:52.000Z","dependencies_parsed_at":"2024-06-28T10:38:44.820Z","dependency_job_id":"4972b9f8-64d2-4e5c-a82a-214c4e324662","html_url":"https://github.com/poloniex/polo-futures-sdk-python","commit_stats":{"total_commits":4,"total_committers":3,"mean_commits":"1.3333333333333333","dds":0.5,"last_synced_commit":"baf56b9097fb2ae0d607819edefba7781fdf4187"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/poloniex/polo-futures-sdk-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poloniex%2Fpolo-futures-sdk-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poloniex%2Fpolo-futures-sdk-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poloniex%2Fpolo-futures-sdk-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poloniex%2Fpolo-futures-sdk-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poloniex","download_url":"https://codeload.github.com/poloniex/polo-futures-sdk-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poloniex%2Fpolo-futures-sdk-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265585271,"owners_count":23792711,"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":[],"created_at":"2024-11-24T22:14:52.100Z","updated_at":"2025-07-17T08:30:30.496Z","avatar_url":"https://github.com/poloniex.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\npolo-futures\n--------\n--------\n\nPython 3 Wrapper for Poloniex Futures Exchange\n\nDISCLAIMER: \n```\nUSE AT YOUR OWN RISK. You should not use this code in production unless you fully understand its limitations. \nEven if you understand the code and its limitations, you may incur losses when using this code for trading. \nWhen used in combination with your own code, the combination may not function as intended, and as a result you may incur losses. \nPoloniex is not responsible for any losses you may incur when using this code.\n```\nFeatures\n--------\n\n- Support for REST and websocket endpoints\n- Simple handling of authentication\n- Response exception handling\n\nGetting Started\n--------\n\n- Register an account with [Poloniex](\u003chttps://www.poloniex.com/signup\u003e).\n- [Enable Futures Trading](https://www.poloniex.com/futures) for your account.\n- Generate an [API Key](\u003chttps://www.poloniex.com/settings/futures-api-keys\u003e).\n- Set environment variables that contain your API Key values: `PF_API_KEY`, `PF_SECRET`, and `PF_PASS`.\n- [Get the source files](#source).\n- [Run one of the sample scripts](#samples).\n\n\u003ca name=\"source\"\u003e\u003c/a\u003eGet the code files with git.\n\nClone the repo into the path you will be using\n```bash\ngit clone https://github.com/poloniex/polo-futures-sdk-python\n```\n\n\u003ca name=\"samples\"\u003e\u003c/a\u003eSamples of the wrappers' usage are found in `rest_sample.py` and `ws_sample.py`. These can be run directly from python.\nWith, \n```bash\npython rest_sample.py\n```\nOR\n```bash\npython ws_sample.py\n```\n\nCode Samples\n--------\n\nREST API\n--------\n\n```python\nimport os\n\nfrom polofutures import RestClient\n\n\n# Account Keys\nAPI_KEY = os.environ['PF_API_KEY']\nSECRET = os.environ['PF_SECRET']\nAPI_PASS = os.environ['PF_PASS']\n\nrest_client = RestClient(API_KEY, SECRET, API_PASS)\n\nSYMBOL = 'BTCUSDTPERP'\n\n# Fetch MarketData\nmarket = rest_client.market_api()\n\nserver_time = market.get_server_timestamp()\nl3_depth = market.get_l3_order_book(SYMBOL)\nl2_depth = market.get_l2_order_book(SYMBOL)\nklines = market.get_ticker(SYMBOL)\n\n# Trade Functions\ntrade = rest_client.trade_api()\n\norder_id = trade.create_limit_order(SYMBOL, 'buy', '1', '30', '8600')\ncancel_id = trade.cancel_order(order_id['orderId'])\norder_id = trade.create_limit_order(SYMBOL, 'buy', '1', '30', '8600')\ncancel_all = trade.cancel_all_limit_orders(SYMBOL)\n\n\n# User Account Functions\nuser = rest_client.user_api()\n\naccount_overview = user.get_account_overview()\n```\n\nWebsockets\n-----------\n\n\n```python\nimport asyncio\nimport os\n\nfrom polofutures import WsClient\n\n\n# Account Keys\nAPI_KEY = os.environ['PF_API_KEY']\nSECRET = os.environ['PF_SECRET']\nAPI_PASS = os.environ['PF_PASS']\n\nSYMBOL = 'BTCUSDTPERP'\n\nasync def ws_stream():\n    def on_message(msg):\n        if msg['topic'] == f'/contract/instrument:{SYMBOL}':\n            print(f'Get {SYMBOL} Index Price: {msg[\"data\"]}')\n        elif msg['topic'] == f'/contractMarket/execution:{SYMBOL}':\n            print(f'Last Execution: {msg[\"data\"]}')\n        elif msg['topic'] == f'/contractMarket/level2:{SYMBOL}':\n            print(f'Get {SYMBOL} Level 2 :{msg[\"data\"]}')\n\n    ws_client = WsClient(on_message, API_KEY, SECRET, API_PASS)\n\n    await ws_client.connect()\n\n    await ws_client.subscribe(f'/contract/instrument:{SYMBOL}')\n    await ws_client.subscribe(f'/contractMarket/execution:{SYMBOL}')\n    await ws_client.subscribe(f'/contractMarket/level2:{SYMBOL}')\n\n    await asyncio.sleep(30)\n\n    await ws_client.disconnect()\n\n\nif __name__ == \"__main__\":\n    asyncio.run(ws_stream())\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoloniex%2Fpolo-futures-sdk-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoloniex%2Fpolo-futures-sdk-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoloniex%2Fpolo-futures-sdk-python/lists"}