[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116844":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":33,"updatedAt":34,"readmeContent":35,"aiSummary":10,"trendingCount":15,"starSnapshotCount":15,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},116844,"bytx","byttrade\u002Fbytx","byttrade","bytx — typed async Python SDK for crypto exchanges by BYTtrade","https:\u002F\u002Fbyttrade.com",null,"Python",206,30,87,0,49,121,219,94.47,"Other",false,"main",[24,25,26,27,28,29,30,31,32],"asyncio","binance","bybit","crypto","exchange","okx","python","sdk","trading","2026-11-23 20:02:09","2026-11-23 19:53:09","# bytx — by [BYTtrade](https:\u002F\u002Fbyttrade.com)\n\n**English** | [Русский](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FREADME.ru.md) | [中文](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FREADME.zh-CN.md) | [Español](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FREADME.es.md) | [Português](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FREADME.pt-BR.md) | [日本語](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FREADME.ja.md) | [한국어](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FREADME.ko.md) | [Türkçe](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FREADME.tr.md)\n\n[![PyPI](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fbytx)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fbytx\u002F)\n[![Python](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fbytx)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fbytx\u002F)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-source--available-blue)](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002FLICENSE)\n\nA typed **async** Python SDK for crypto exchanges. One interface for spot and perpetual futures on\nBinance, Bybit, OKX, BingX, Hyperliquid, KuCoin, Bitget; in beta: Gate, MEXC, HTX, BloFin (spot and USDT-M futures).\n\n![One API for every exchange](https:\u002F\u002Fraw.githubusercontent.com\u002Fbyttrade\u002Fbytx\u002Fmain\u002Fdocs\u002Fmedia\u002Fone_api.gif)\n\n```bash\npip install bytx            # + extras: [ws] [fast]\n```\n\n## Quick start\n\n```python\nimport asyncio\nfrom bytx import create_exchange\n\nasync def main():\n    async with create_exchange('bybit', api_key='…', secret='…', demo=True) as ex:\n        print(await ex.ticker('BTC\u002FUSDT'))                      # BTC\u002FUSDT:USDT, swap by default\n        order = await ex.buy('BTC\u002FUSDT', notional=100, price=60_000, post_only=True)\n        print(order.status, order.size)                         # size in BTC, not in contracts\n        await ex.cancel_order('BTC\u002FUSDT', order.id)\n\nasyncio.run(main())\n```\n\n`demo=True` uses the exchange's demo\u002Ftestnet; no real money involved. Market data needs no keys at all:\n`create_exchange('okx')`.\n\n**Take-profit and stop-loss** — one call on every exchange:\n\n```python\nawait ex.set_tp_sl('BTC\u002FUSDT', take_profit=72_000, stop_loss=58_000)\n```\n\n**A live order book** that survives disconnects:\n\n```python\nasync for book in ex.stream.order_book('BTC\u002FUSDT', depth=20):\n    print(book.best_bid, book.best_ask, book.spread_bps, book.imbalance(5))\n```\n\n![Live order book](https:\u002F\u002Fraw.githubusercontent.com\u002Fbyttrade\u002Fbytx\u002Fmain\u002Fdocs\u002Fmedia\u002Forder_book.gif)\n\n**Paper trading** on the live order book — no keys, no real money:\n\n```python\nfrom bytx.paper import PaperConfig\n\nex = create_exchange('binance', paper=True, paper_config=PaperConfig(balance={'USDT': 1000}))\norder = await ex.buy('BTC\u002FUSDT', notional=100)     # walks the book, real taker fee\n```\n\n![Paper trading](https:\u002F\u002Fraw.githubusercontent.com\u002Fbyttrade\u002Fbytx\u002Fmain\u002Fdocs\u002Fmedia\u002Fpaper.gif)\n\n**Spot**, **execution algorithms**, **risk-based sizing**:\n\n```python\nspot = create_exchange('okx', market='spot', api_key=…, secret=…, password=…, demo=True)\nawait spot.buy('DOGE\u002FUSDT', notional=10)                              # market buy for 10 USDT, one request\nawait ex.algos.twap('BTC\u002FUSDT', 'buy', size=0.5, duration=600)       # also chase, iceberg, bracket, trailing_stop\nawait ex.open_position('BTC\u002FUSDT', 'long', risk_usdt=50, stop=58_000) # size from the stop distance\n```\n\nMore in [`examples\u002F`](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Ftree\u002Fmain\u002Fexamples): market data, backtest, arbitrage\nscanner, grid, DCA, Telegram alerts, scalper, multi-account, strategy with restart recovery.\n\n## Why bytx\n\nbytx is built on [ccxt](https:\u002F\u002Fgithub.com\u002Fccxt\u002Fccxt) and turns it into a trading SDK you don't have to fight.\n\n- **One line instead of a page.** `buy('BTC\u002FUSDT', notional=100)` — no contract sizes, precision or\n  minimums to compute by hand; size in the base coin on every exchange.\n- **No double entries.** On a timeout bytx finds the order by `client_id` and tells you exactly what\n  happened (`OrderStatusUnknown` only when the exchange really can't say).\n- **Same call everywhere.** TP\u002FSL, leverage, margin and position mode, dead-man switch, transfers — one\n  method instead of each exchange's private endpoints.\n- **WebSocket that stays up.** Reconnect with backoff, silence watchdog, resubscribe, order book gap\n  checks and resync from a snapshot.\n- **Checked against the exchange docs.** Every exchange rule is tested against response examples from the\n  official documentation; ccxt bugs found this way are fixed in the SDK.\n- **Typed models and clear errors.** `Order`, `Position`, `OrderBook` dataclasses; one `BytxError`\n  hierarchy with a `.retryable` flag; keys never appear in error text or logs.\n- **Ready for production.** A proxy per account, one market cache per process, paper trading and replay,\n  a position journal, API-key permission checks and exchange health.\n\n\u003Cdetails>\n\u003Csummary>Raw ccxt vs bytx: buy BTC for 100 USDT on OKX perpetuals\u003C\u002Fsummary>\n\n```python\n# raw ccxt\nex = ccxt.okx({'apiKey': key, 'secret': secret, 'password': passphrase})\nawait ex.load_markets()\nm = ex.market('BTC\u002FUSDT:USDT')\nprice = (await ex.fetch_ticker(m['symbol']))['last']\ncontracts = 100 \u002F price \u002F m['contractSize']               # OKX: 1 contract = 0.01 BTC\namount = float(ex.amount_to_precision(m['symbol'], contracts))\nif amount \u003C m['limits']['amount']['min']:\n    raise ValueError('order too small')\norder = await ex.create_order(m['symbol'], 'market', 'buy', amount)   # dict, amount in contracts\n```\n\n```python\n# bytx\nasync with bytx.create_exchange('okx', api_key=key, secret=secret, password=passphrase,\n                                margin_mode='cross') as ex:\n    order = await ex.buy('BTC\u002FUSDT', notional=100)        # Order model, size in BTC\n```\n\n\u003C\u002Fdetails>\n\n> No-code bots, backtests and trade confirmations in Telegram — at [byttrade.com](https:\u002F\u002Fbyttrade.com).\n\n## Documentation\n\nThe full guide — every method, exchange specifics, errors, recovery after a restart:\n**[docs\u002FGUIDE.md](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md)**\n([на русском](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.ru.md)).\n\n[Features](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#features) ·\n[Spot](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#spot) ·\n[WebSocket](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#websocket) ·\n[Scalping](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#scalping) ·\n[Paper trading](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#paper-trading-and-replay) ·\n[Algorithms](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#execution-algorithms) ·\n[Risk sizing](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#risk-based-position-sizing) ·\n[Restart recovery](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#restart-recovery-and-strategies) ·\n[Proxies](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#proxies-and-multiple-accounts) ·\n[Integrations](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#integrations-tradingview-telegramdiscord-prometheus-opentelemetry) ·\n[Errors](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002Fdocs\u002FGUIDE.md#errors)\n\n## License\n\nFree to use under the [BYTtrade Source-Available License](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002FLICENSE),\nincluding commercially; copying the code into other libraries, modified versions and hosted services are not\npermitted. Uses ccxt (MIT), see [`NOTICE`](https:\u002F\u002Fgithub.com\u002Fbyttrade\u002Fbytx\u002Fblob\u002Fmain\u002FNOTICE).\nNot financial advice; trading cryptocurrency carries a risk of loss.\n",2,"2026-11-24 04:54:20","CREATED_QUERY"]