{"id":16956101,"url":"https://github.com/codenix-sv/bitfinex-api-ws","last_synced_at":"2025-10-26T21:32:04.117Z","repository":{"id":56955578,"uuid":"126056853","full_name":"codenix-sv/bitfinex-api-ws","owner":"codenix-sv","description":"WebSocket client in PHP for the Bitfinex API","archived":false,"fork":false,"pushed_at":"2020-03-30T18:18:50.000Z","size":16,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T06:11:34.790Z","etag":null,"topics":["bitfinex-api","bitfinex-api-ws","websocket","ws"],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/codenix-sv.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}},"created_at":"2018-03-20T17:28:09.000Z","updated_at":"2020-04-22T14:03:46.000Z","dependencies_parsed_at":"2022-08-21T04:00:09.118Z","dependency_job_id":null,"html_url":"https://github.com/codenix-sv/bitfinex-api-ws","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codenix-sv/bitfinex-api-ws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenix-sv%2Fbitfinex-api-ws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenix-sv%2Fbitfinex-api-ws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenix-sv%2Fbitfinex-api-ws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenix-sv%2Fbitfinex-api-ws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codenix-sv","download_url":"https://codeload.github.com/codenix-sv/bitfinex-api-ws/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codenix-sv%2Fbitfinex-api-ws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281178955,"owners_count":26456678,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bitfinex-api","bitfinex-api-ws","websocket","ws"],"created_at":"2024-10-13T22:14:15.005Z","updated_at":"2025-10-26T21:32:04.092Z","avatar_url":"https://github.com/codenix-sv.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bitfinex-api-ws\n\n[![Build Status](https://travis-ci.com/codenix-sv/bitfinex-api-ws.svg?branch=master)](https://travis-ci.com/codenix-sv/bitfinex-api-ws)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/codenix-sv/bitfinex-api-ws/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/codenix-sv/bitfinex-api-ws/?branch=master)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/3b14372b014ab37bd848/test_coverage)](https://codeclimate.com/github/codenix-sv/bitfinex-api-ws/test_coverage)\n[![Maintainability](https://api.codeclimate.com/v1/badges/3b14372b014ab37bd848/maintainability)](https://codeclimate.com/github/codenix-sv/bitfinex-api-ws/maintainability)\n[![License: MIT](https://img.shields.io/github/license/codenix-sv/bitfinex-api-ws)](https://github.com/codenix-sv/bitfinex-api-ws/blob/master/LICENSE)\n\nWebSocket client, written with PHP for [bitfinex.com](https://www.bitfinex.com) API.\n\nBitfinex is a full-featured spot trading platform for major digital assets \u0026 cryptocurrencies, including Bitcoin, Ethereum, EOS, Litecoin, Ripple, NEO, Monero and many more. Bitfinex offers leveraged margin trading through a peer-to-peer funding market, allowing users to securely trade with up to 3.3x leverage.\n\nFor additional information about API visit [docs.bitfinex.com/docs/ws-general](https://docs.bitfinex.com/docs/ws-general)\n\n## Requirements\n\n* PHP \u003e= 7.3\n* ext-json\n\n## Installation\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```bash\n$ composer require codenix-sv/bitfinex-api-ws\n```\nor add\n\n```json\n\"codenix-sv/bitfinex-api-ws\": \"^0.1\"\n```\n## Basic usage\n\n### Example\n```php\nuse Codenixsv\\BitfinexWs\\BitfinexClient;\nuse Codenixsv\\BitfinexWs\\WsClient;\nuse Codenixsv\\BitfinexWs\\Request\\SubscribeTicker;\nuse Ratchet\\RFC6455\\Messaging\\Message;\n\n$client = new BitfinexClient();\n\n$onMessage = function (Message $message) {\n    echo $message-\u003e__toString() . PHP_EOL;\n};\n\n$onClose = function ($code = null, $reason = null) {\n    echo 'WebSocket Connection closed! Code: ' . $code . ' Reason: ' . $reason  . PHP_EOL;\n};\n\n$onError = function (\\Exception $e) {\n    echo 'Error: ' . $e-\u003egetMessage() . PHP_EOL;\n};\n\n$events =  [\n    WsClient::EVENT_MESSAGE =\u003e $onMessage,\n    WsClient::EVENT_CLOSE =\u003e $onClose,\n    WsClient::EVENT_ERROR =\u003e $onError\n];\n\n$client-\u003econnect([new SubscribeTicker('tBTCUSD'), new SubscribeTicker('tETHUSD')], $events);\n```\n\n## Available channels\n\n### Public\n\n#### [SubscribeTicker](https://docs.bitfinex.com/reference#ws-public-ticker)\n\nThe ticker endpoint provides a high level overview of the state of the market for a specified pair. It shows the current best bid and ask, the last traded price, as well as information on the daily volume and price movement over the last day.\n```php\n$client-\u003econnect([new SubscribeTicker('tBTCUSD')], $events);\n```\n\n#### [SubscribeTrades](https://docs.bitfinex.com/reference#ws-public-trades)\n\nThis channel sends a trade message whenever a trade occurs at Bitfinex. It includes all the pertinent details of the trade, such as price, size and the time of execution. The channel can send funding trade data as well.\n```php\n$client-\u003econnect([new SubscribeTrades('tBTCUSD')], $events);\n```\n\n#### [SubscribeBooks](https://docs.bitfinex.com/reference#ws-public-books)\n\nThe Order Books channel allows you to keep track of the state of the Bitfinex order book. It is provided on a price aggregated basis with customizable precision. Upon connecting, you will receive a snapshot of the book followed by updates for any changes to the state of the book.\n```php\n$symbol = 'tBTCUSD';\n$precision = 'P1';\n$frequency = 'F1';\n$length = '100';\n\n$client-\u003econnect([new SubscribeBooks($symbol, $precision, $frequency, $length)], $events);\n```\n\n#### [SubscribeRawBooks](https://docs.bitfinex.com/reference#ws-public-raw-books)\n\nThe Raw Books channel provides the most granular books.\n```php\n$symbol = 'tBTCUSD';\n$length = '100';\n\n$client-\u003econnect([new SubscribeRawBooks($symbol, $length)], $events);\n```\n\n#### [SubscribeCandles](https://docs.bitfinex.com/reference#ws-public-candles)\n\nThe Candles endpoint provides OCHL (Open, Close, High, Low) and volume data for the specified trading pair.\n```php\n$client-\u003econnect([new SubscribeCandles('trade:1m:tBTCUSD')], $events);\n```\n\n#### [SubscribeCandles](https://docs.bitfinex.com/reference#ws-public-status)\n\nSubscribe to and receive different types of platform information - currently supports derivatives pair status and liquidation feed.\n```php\n$client-\u003econnect([new SubscribeStatus('deriv:tBTCF0:USTF0')], $events);\n```\n\n## License\n\n`codenix-sv/bitfinex-api-ws` is released under the MIT License. See the bundled [LICENSE](./LICENSE) for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodenix-sv%2Fbitfinex-api-ws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodenix-sv%2Fbitfinex-api-ws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodenix-sv%2Fbitfinex-api-ws/lists"}