{"id":17500735,"url":"https://github.com/shimondoodkin/bitfinexws1","last_synced_at":"2025-03-20T06:48:19.828Z","repository":{"id":137788215,"uuid":"106803765","full_name":"shimondoodkin/bitfinexws1","owner":"shimondoodkin","description":"bitfinex websocket, v1 , a better , self reconnecting, parsing all responses.","archived":false,"fork":false,"pushed_at":"2017-11-06T10:49:26.000Z","size":68,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T02:47:17.934Z","etag":null,"topics":["bitfinex","bitfinex-websocket-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shimondoodkin.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":"2017-10-13T09:18:41.000Z","updated_at":"2017-12-12T17:32:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"2d339d5b-a27d-4134-845e-dd2f27b49784","html_url":"https://github.com/shimondoodkin/bitfinexws1","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimondoodkin%2Fbitfinexws1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimondoodkin%2Fbitfinexws1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimondoodkin%2Fbitfinexws1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shimondoodkin%2Fbitfinexws1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shimondoodkin","download_url":"https://codeload.github.com/shimondoodkin/bitfinexws1/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244566931,"owners_count":20473451,"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":["bitfinex","bitfinex-websocket-api"],"created_at":"2024-10-19T18:51:42.123Z","updated_at":"2025-03-20T06:48:19.823Z","avatar_url":"https://github.com/shimondoodkin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bitfinexws1\nbitfinex websocket, v1 , a better , self reconnecting, parsing all responses.\n\nthis websocket handels reconnection, and heartbeat, parses and handles all events, \nallows authentication. parses all messages into objects,\n\nyou use send method to subscribe to chnnels as described in the bitfinex api v1 manual, \n\nand this library handles and parses the response, on events you specified it returnes the parsed responses in easy to use objects.\n\n\ni did my best to parse all messages.\n\ndonate bitcoins to: 1QJybGtq3wA3vz8izWvDMRTsrQL3RVDK9T\n\n\n## BitfinexWS1(API_KEY,API_SECRET,channels_and_events,subscribe,parsers)\n\nthis is a factory method it returns an object with some access to settings and other things. one useful thing is the status of it `bitfinexws.ready (bool)`\n\nto use without authentication put \"\" in API_KEY and in API_SECRET.\n\nthe main channel (0) called account.\n\nthe event names are as described in the documentation\n\nthe api described at https://docs.bitfinex.com/v1/reference\n\nlook at the parsers to know the names of the parameters or just try it...\n\n\n```javascript\n\n// example:\n\nvar BitfinexWS1=require('bitfinexws1');\nvar bitfinexws=BitfinexWS1('PUT_KEY_HERE','PUT_SECRET_HERE',\n{\n\taccount:\n\t{\n\t pn : function(a){ console.log(\"account pn\",a)},\n\t pu : function(a){ console.log(\"account pu\",a)},\n\t pc : function(a){ console.log(\"account pc\",a)},\n\t ps : function(a){ console.log(\"account ps\",a)},\n\t wu : function(a){ console.log(\"account wu\",a)},\n\t ws : function(a){ console.log(\"account ws\",a)},\n\t on : function(a){ console.log(\"account on\",a)},\n\t ou : function(a){ console.log(\"account ou\",a)},\n\t oc : function(a){ console.log(\"account oc\",a)},\n\t os : function(a){ console.log(\"account os\",a)},\n\t ts : function(a){ console.log(\"account ts\",a)},\n\t te : function(a){ console.log(\"account te\",a)},\n\t tu : function(a){ console.log(\"account tu\",a)},\n\t hb : function(a){ console.log(\"account hb\",a)}\n    },\n\tbook:\n\t{\n\t BTCUSD:\n\t {\n\t\t snapshot : function(a){ console.log(\"book BTCUSD snapshot\",a)},\n\t\t update   : function(a){ console.log(\"book BTCUSD update\",a)},\n\t     hb       : function(a){ console.log(\"book BTCUSD hb\",a)}\n\t }\t\n\t},\n\tbookR0:\n\t{\n\t BTCUSD:\n\t {\n\t\t snapshot : function(a){ console.log(\"bookR0 BTCUSD snapshot\",a)},\n\t\t update   : function(a){ console.log(\"bookR0 BTCUSD update\",a)},\n\t     hb       : function(a){ console.log(\"bookR0 BTCUSD hb\",a)}\n\t }\t\n\t},\n\tbookP3F2:\n\t{\n\t BTCUSD:\n\t {\n\t\t snapshot : function(a){ console.log(\"bookP3F2 BTCUSD snapshot\",a)},\n\t\t update   : function(a){ console.log(\"bookP3F2 BTCUSD update\",a)},\n\t     hb       : function(a){ console.log(\"bookP3F2 BTCUSD hb\",a)}\n\t }\t\n\t},\n\ttrades:\n\t{\n\t BTCUSD:\n\t {\n\t\t snapshot : function(a){ console.log(\"trades BTCUSD snapshot\",a)},\n\t\t te       : function(a){ console.log(\"trades BTCUSD te\",a)},\n\t\t tu       : function(a){ console.log(\"trades BTCUSD tu\",a)},\n\t     hb       : function(a){ console.log(\"trades BTCUSD hb\",a)}\n\t }\t\n\t},\n\tticker:\n\t{\n\t BTCUSD:\n\t {\n\t\t update  : function(a){ console.log(\"ticker BTCUSD update\",a)},\n\t     hb      : function(a){ console.log(\"ticker BTCUSD hb\",a)}\n\t }\t\n\t},\n\tonpong   : function(){ console.log(\"onpong\")},\n\tonready  : function(){ console.log(\"onready\")},\n\tonauth   : function(){ console.log(\"onauth\")},\n\tonunauth : function(){ console.log(\"onunauth\")},\n\tonerror  : function(e){console.log('BitfinexWS1 error', e.stack)}\n},\nfunction subscribe(send) // need to be specified because on self reconnect, happens and channels need to be resubscribed;\n{\n\tsend({ \"event\":\"subscribe\", \"channel\":\"ticker\", \"pair\":\"tBTCUSD\"});\n\tsend({ \"event\":\"subscribe\", \"channel\":\"trades\", \"pair\":\"tBTCUSD\"});\n\tsend({ \"event\":\"subscribe\", \"channel\":\"book\",   \"pair\":\"tBTCUSD\", \"prec\":\"P3\", \"freq\":\"F1\" });\n\tsend({ \"event\":\"subscribe\", \"channel\":\"book\",   \"pair\":\"tBTCUSD\", \"prec\":\"P3\", \"freq\":\"F2\" });\n\tsend({ \"event\":\"subscribe\", \"channel\":\"book\",   \"pair\":\"tBTCUSD\", \"prec\":\"R0\" });\n},\n BitfinexWS1.better_parsers // (optional argument, parsers to replace ) my prefered set of parsers, little different from the docs, you can define your own if you like different configuration. without this, it matches the official docs. the difference from the docs is not an issue. rather good.\n);\n\n```\n\n\nidea: \n\nis possible to inherit from BitfinexWS1.better_parsers to modify just a part of it:  \n\n```javascript\nvar myparsers={\n book_snapshot: BitfinexWS1.parsers.no_parse\n};\nmyparsers.__proto__=BitfinexWS1.better_parsers;\n```\n\n\n## parser\n\nupdate parser receives an array of arguments.\n\nsnapshot parser  recevies the array of objects.\n \n\n\nit is possible to put reference to your parser methods.\nlike i did, as i made with better parsers.\n\nin the examplpe it uses all the parses i like.\nit is defined here: (look for line ' module.exports.better_parsers={  ' )\nhttps://github.com/shimondoodkin/bitfinexws1/blob/master/index.js#L1123 \n\n\nto see all the parsers look in the code.\neach function parser function is defined here: (look for line ' ///parsers  ' )\nhttps://github.com/shimondoodkin/bitfinexws1/blob/master/index.js#L508\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimondoodkin%2Fbitfinexws1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshimondoodkin%2Fbitfinexws1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshimondoodkin%2Fbitfinexws1/lists"}