{"id":38440609,"url":"https://github.com/aoki-h-jp/funding-rate-arbitrage","last_synced_at":"2026-01-17T04:34:43.718Z","repository":{"id":143030085,"uuid":"613944836","full_name":"aoki-h-jp/funding-rate-arbitrage","owner":"aoki-h-jp","description":"Funding rate arbitrage on cryptocurrency.","archived":false,"fork":false,"pushed_at":"2023-11-05T09:38:41.000Z","size":114,"stargazers_count":24,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-11-05T10:27:44.928Z","etag":null,"topics":["arbitrage","binance","bitget","bybit","coinex","crypto","cryptocurrency","fundingrate","gateio","okx"],"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/aoki-h-jp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-14T15:24:16.000Z","updated_at":"2023-10-28T08:53:16.000Z","dependencies_parsed_at":"2023-04-10T15:32:38.783Z","dependency_job_id":"13054b5b-50f3-4962-9827-eb8cb89c31ff","html_url":"https://github.com/aoki-h-jp/funding-rate-arbitrage","commit_stats":null,"previous_names":[],"tags_count":4,"template":null,"template_full_name":null,"purl":"pkg:github/aoki-h-jp/funding-rate-arbitrage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoki-h-jp%2Ffunding-rate-arbitrage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoki-h-jp%2Ffunding-rate-arbitrage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoki-h-jp%2Ffunding-rate-arbitrage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoki-h-jp%2Ffunding-rate-arbitrage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aoki-h-jp","download_url":"https://codeload.github.com/aoki-h-jp/funding-rate-arbitrage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoki-h-jp%2Ffunding-rate-arbitrage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28495200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T04:31:57.058Z","status":"ssl_error","status_checked_at":"2026-01-17T04:31:45.816Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["arbitrage","binance","bitget","bybit","coinex","crypto","cryptocurrency","fundingrate","gateio","okx"],"created_at":"2026-01-17T04:34:43.086Z","updated_at":"2026-01-17T04:34:43.692Z","avatar_url":"https://github.com/aoki-h-jp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# funding-rate-arbitrage\n[![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3110//)\n\n## Python library for funding rate arbitrage\n\nA framework to help you easily perform funding rate arbitrage on the following major centralized cryptocurrency exchanges (CEX).\n\n- binance\n- bybit\n- OKX\n- gate.io\n- CoinEx\n- Bitget\n\nThis library can detect perpetual contract with a large divergence in funding rates between CEXs.\n\n**NOTE: This library does not include the feature to perform automatic funding rate arbitrage.**\n\n## What's FR Arbitrage?\nArbitrage of different funding rates among different exchanges is another trading strategy that takes advantage of the disparity in funding rates for the same cryptocurrency perpetual contracts between exchanges. It involves combining long positions with low funding rates from one exchange with short positions from another exchange with higher funding rates to generate profits. Funding rates are periodic payments between long and short traders to ensure that the perpetual contract price remains close to the underlying asset price.\n\n## Installation\n\n\n```bash\npip install git+https://github.com/aoki-h-jp/funding-rate-arbitrage\n```\n\n## Usage\n### Fetch FR \u0026 commission\n\n```python\nfrom funding_rate_arbitrage.frarb import FundingRateArbitrage\n\nfr = FundingRateArbitrage()\n\n# fetch all perp funding rate on binance\nfr_binance = fr.fetch_all_funding_rate(exchange='binance')\n\n# get commission on binance with futures, maker\ncm_binance = fr.get_commission(exchange='binance', trade='futures', taker=False)\n```\n\n### Fetch FR history\n\n```python\nfrom funding_rate_arbitrage.frarb import FundingRateArbitrage\n\nfr = FundingRateArbitrage()\n\n# figure funding rate history\nfr.fetch_funding_rate_history(exchange='binance', symbol='BTC/USDT:USDT')\n```\n!['funding rate history example'](./img/readme_funding_rate_history.png)\n\n\n### Display large FR divergence on single CEX\n```bash\n# display large funding rate divergence on bybit\n\u003e\u003e\u003e fr.display_large_divergence_single_exchange(exchange='bybit', display_num=5)\n                 Funding Rate [%]  Commission [%]  Revenue [/100 USDT]\nCTC/USDT:USDT              0.1794            0.32              -0.1406\nCREAM/USDT:USDT            0.0338            0.32              -0.2862\nTWT/USDT:USDT              0.0295            0.32              -0.2905\nTLM/USDT:USDT              0.0252            0.32              -0.2948\nJASMY/USDT:USDT            0.0100            0.32              -0.3100\n\n# display Top 5 large funding rate divergence on bybit one by one.\n\u003e\u003e\u003e fr.display_one_by_one_single_exchange(exchange='bybit', display_num=5)\n------------------------------------------------\nRevenue: -0.1663 / 100USDT\nSELL: CTC/USDT:USDT Perp\nBUY: CTC/USDT:USDT Spot\nFunding Rate: 0.1537 %\nCommission: 0.32 %\n------------------------------------------------\nRevenue: -0.17200000000000001 / 100USDT\nSELL: CREAM/USDT:USDT Perp\nBUY: CREAM/USDT:USDT Spot\nFunding Rate: 0.1480 %\nCommission: 0.32 %\n------------------------------------------------\nRevenue: -0.2107 / 100USDT\nSELL: BOBA/USDT:USDT Perp\nBUY: BOBA/USDT:USDT Spot\nFunding Rate: 0.1093 %\nCommission: 0.32 %\n------------------------------------------------\nRevenue: -0.2854 / 100USDT\nSELL: TLM/USDT:USDT Perp\nBUY: TLM/USDT:USDT Spot\nFunding Rate: 0.0346 %\nCommission: 0.32 %\n------------------------------------------------\nRevenue: -0.2953 / 100USDT\nSELL: TOMO/USDT:USDT Perp\nBUY: TOMO/USDT:USDT Spot\nFunding Rate: 0.0247 %\nCommission: 0.32 %\n\n# display Top 5 large funding rate divergence on bybit one by one (minus FR).\n\u003e\u003e\u003e fr.display_one_by_one_single_exchange(exchange='bybit', display_num=5, minus=True)\n------------------------------------------------\nRevenue: -0.1458 / 100USDT\nSELL: ARPA/USDT:USDT Options\nBUY: ARPA/USDT:USDT Perp\nFunding Rate: -0.2342 %\nCommission: 0.38 %\n------------------------------------------------\nRevenue: -0.2569 / 100USDT\nSELL: MASK/USDT:USDT Options\nBUY: MASK/USDT:USDT Perp\nFunding Rate: -0.1231 %\nCommission: 0.38 %\n------------------------------------------------\nRevenue: -0.3056 / 100USDT\nSELL: APE/USD:USDC Options\nBUY: APE/USD:USDC Perp\nFunding Rate: -0.0744 %\nCommission: 0.38 %\n------------------------------------------------\nRevenue: -0.3158 / 100USDT\nSELL: SWEAT/USD:USDC Options\nBUY: SWEAT/USD:USDC Perp\nFunding Rate: -0.0642 %\nCommission: 0.38 %\n------------------------------------------------\nRevenue: -0.3166 / 100USDT\nSELL: APE/USDT:USDT Options\nBUY: APE/USDT:USDT Perp\nFunding Rate: -0.0634 %\nCommission: 0.38 %\n```\n\n### Display large FR divergence between CEX\n```bash\n# display large funding rate divergence between CEX.\n\u003e\u003e\u003e fr.display_large_divergence_multi_exchange(display_num=5, sorted_by='divergence')\n                 binance   bybit       okx  bitget    gate    coinex  Divergence [%]  Commission [%]  Revenue [/100 USDT]\nFIL/USDT:USDT  -0.008948 -0.0229 -0.334535 -0.0084 -0.0240 -0.737473        0.729073           0.202             0.527073\nHNT/USDT:USDT  -0.023885 -0.0125       NaN     NaN  0.0056  0.304442        0.328327           0.180             0.148327\nWAXP/USDT:USDT       NaN     NaN       NaN     NaN  0.0100  0.205733        0.195733           0.500            -0.304267\nAXS/USDT:USDT  -0.021292 -0.0385 -0.205174 -0.0212 -0.0282 -0.215217        0.194017           0.202            -0.007983\nOP/USDT:USDT   -0.060397 -0.0228 -0.206011 -0.0601 -0.0147 -0.148713        0.191311           0.200            -0.008689\n\n# sorted by revenue. \n\u003e\u003e\u003e fr.display_large_divergence_multi_exchange(display_num=5, sorted_by='revenue')\n                binance   bybit       okx  bitget    gate    coinex  Divergence [%]  Commission [%]  Revenue [/100 USDT]\nFIL/USDT:USDT -0.004703 -0.0232 -0.334535 -0.0047 -0.0245 -0.737473        0.732773           0.202             0.530773\nHNT/USDT:USDT -0.030722 -0.0141       NaN     NaN  0.0051  0.304442        0.335164           0.180             0.155164\nOP/USDT:USDT  -0.057856 -0.0235 -0.206011 -0.0589 -0.0162 -0.148713        0.189811           0.200            -0.010189\nMKR/USDT:USDT  0.010000  0.0100 -0.056437  0.0104  0.0100  0.075530        0.131967           0.200            -0.068033\nTON/USDT:USDT       NaN     NaN -0.023741     NaN  0.0100 -0.116483        0.126483           0.200            -0.073517\n\n# Display Top 5 large funding rate divergence between multi exchange.\n\u003e\u003e\u003e fr.display_one_by_one_multi_exchanges(display_num=5)\n------------------------------------------------\nRevenue: 0.2184 USDT / 100USDT\nSELL: coinex IOTA/USDT:USDT Perp (Funding Rate 0.3478 %)\nBUY: okx IOTA/USDT:USDT Perp (Funding Rate -0.0706 %)\nDivergence: 0.4184 %\nCommission: 0.2000 %\n------------------------------------------------\nRevenue: 0.1191 USDT / 100USDT\nSELL: coinex DASH/USDT:USDT Perp (Funding Rate 0.4267 %)\nBUY: okx DASH/USDT:USDT Spot\nDivergence: 0.4191 %\nCommission: 0.3000 %\n------------------------------------------------\nRevenue: 0.1080 USDT / 100USDT\nSELL: okx TON/USDT:USDT Perp (Funding Rate 0.0482 %)\nBUY: coinex TON/USDT:USDT Perp (Funding Rate -0.2598 %)\nDivergence: 0.3080 %\nCommission: 0.2000 %\n------------------------------------------------\nRevenue: 0.0842 USDT / 100USDT\nSELL: binance GMX/USDT:USDT Perp (Funding Rate 0.0100 %)\nBUY: coinex GMX/USDT:USDT Perp (Funding Rate -0.2542 %)\nDivergence: 0.2642 %\nCommission: 0.1800 %\n------------------------------------------------\nRevenue: 0.0447 USDT / 100USDT\nSELL: okx FIL/USDT:USDT Perp (Funding Rate 0.2416 %)\nBUY: gate FIL/USDT:USDT Perp (Funding Rate -0.0031 %)\nDivergence: 0.2447 %\nCommission: 0.2000 %\n```\n\n## Disclaimer\nThis project is for educational purposes only. You should not construe any such information or other material as legal,\ntax, investment, financial, or other advice. Nothing contained here constitutes a solicitation, recommendation,\nendorsement, or offer by me or any third party service provider to buy or sell any securities or other financial\ninstruments in this or in any other jurisdiction in which such solicitation or offer would be unlawful under the\nsecurities laws of such jurisdiction.\n\nUnder no circumstances will I be held responsible or liable in any way for any claims, damages, losses, expenses, costs,\nor liabilities whatsoever, including, without limitation, any direct or indirect damages for loss of profits.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faoki-h-jp%2Ffunding-rate-arbitrage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faoki-h-jp%2Ffunding-rate-arbitrage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faoki-h-jp%2Ffunding-rate-arbitrage/lists"}