{"id":22608984,"url":"https://github.com/bitfinexcom/bitfinex-api-go","last_synced_at":"2025-05-15T09:05:31.338Z","repository":{"id":45961142,"uuid":"44109333","full_name":"bitfinexcom/bitfinex-api-go","owner":"bitfinexcom","description":"BITFINEX Go trading API - Bitcoin, Litecoin, and Ether exchange","archived":false,"fork":false,"pushed_at":"2023-11-02T13:20:55.000Z","size":3676,"stargazers_count":311,"open_issues_count":80,"forks_count":220,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-05-15T06:44:56.110Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.bitfinex.com/","language":"Go","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/bitfinexcom.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2015-10-12T13:33:20.000Z","updated_at":"2025-05-15T03:42:12.000Z","dependencies_parsed_at":"2024-06-18T12:30:27.232Z","dependency_job_id":null,"html_url":"https://github.com/bitfinexcom/bitfinex-api-go","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbitfinex-api-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbitfinex-api-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbitfinex-api-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fbitfinex-api-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfinexcom","download_url":"https://codeload.github.com/bitfinexcom/bitfinex-api-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310513,"owners_count":22049468,"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-12-08T15:10:29.150Z","updated_at":"2025-05-15T09:05:31.317Z","avatar_url":"https://github.com/bitfinexcom.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitfinex Trading Library for GoLang  - Bitcoin, Ethereum, Ripple and more\n\n![https://api.travis-ci.org/bitfinexcom/bitfinex-api-go.svg?branch=master](https://api.travis-ci.org/bitfinexcom/bitfinex-api-go.svg?branch=master)\n\nA Golang reference implementation of the Bitfinex API for both REST and websocket interaction.\n\n### Features\n* Official implementation\n* REST V1/V2 and Websocket\n* Connection multiplexing\n* Types for all data schemas\n\n## Installation\n\n``` bash\ngo get github.com/bitfinexcom/bitfinex-api-go\n```\n\nOptional - run the 'trade-feed' example to begin receiving realtime trade updates via the websocket\n\n```bash\ncd $GOPATH/src/github.com/bitfinexcom/bitfinex-api-go\ngo run examples/v2/trade-feed/main.go\n```\n\n## Quickstart\n\n``` go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/bitfinexcom/bitfinex-api-go/v2\"\n)\n\nfunc main() {\n    client := bitfinex.NewClient().Credentials(\"API_KEY\", \"API_SEC\")\n\t\n    // create order\n    response, err := c.Orders.SubmitOrder(\u0026order.NewRequest{\n        Symbol: \"tBTCUSD\",\n        CID:    time.Now().Unix() / 1000,\n        Amount: 0.02,\n        Type: \t\"EXCHANGE LIMIT\",\n        Price:  5000,\n    })\n    if err != nil {\n        panic(err)\n    }\n}\n```\n\n## Docs\n\n* \u003cb\u003e[V1](docs/v1.md)\u003c/b\u003e - Documentation (depreciated)\n* \u003cb\u003e[V2 Rest](docs/rest_v2.md)\u003c/b\u003e - Documentation\n* \u003cb\u003e[V2 Websocket](docs/ws_v2.md)\u003c/b\u003e - Documentation\n\n## Examples\n\n#### Authentication\n\n``` go\nfunc main() {\n    client := bitfinex.NewClient().Credentials(\"API_KEY\", \"API_SEC\")\n}\n```\n\n#### Subscribe to Trades\n\n``` go\n// using github.com/bitfinexcom/bitfinex-api-go/v2/websocket as client\n_, err := client.SubscribeTrades(context.Background(), \"tBTCUSD\")\nif err != nil {\n    log.Printf(\"Could not subscribe to trades: %s\", err.Error())\n}\n```\n\n#### Get candles via REST\n\n```go\n// using github.com/bitfinexcom/bitfinex-api-go/v2/rest as client\nos, err := client.Orders.AllHistory()\nif err != nil {\n    log.Fatalf(\"getting orders: %s\", err)\n}\n```\n\nSee the \u003cb\u003e[examples](https://github.com/bitfinexcom/bitfinex-api-go/tree/master/examples)\u003c/b\u003e directory for more, like:\n\n- [Creating/updating an order](https://github.com/bitfinexcom/bitfinex-api-go/blob/master/examples/v2/ws-update-order/main.go)\n- [Subscribing to orderbook updates](https://github.com/bitfinexcom/bitfinex-api-go/blob/master/examples/v2/book-feed/main.go)\n- [Integrating a custom logger](https://github.com/bitfinexcom/bitfinex-api-go/blob/master/examples/v2/ws-custom-logger/main.go)\n- [Submitting funding offers](https://github.com/bitfinexcom/bitfinex-api-go/blob/master/examples/v2/rest-funding/main.go)\n- [Retrieving active positions](https://github.com/bitfinexcom/bitfinex-api-go/blob/master/examples/v2/rest-positions/main.go)\n\n## FAQ\n\n### Is there any rate limiting?\n\nFor a Websocket connection there is no limit to the number of requests sent down the connection (unlimited order operations) however an account can only create 15 new connections every 5 mins and each connection is only able to subscribe to 30 inbound data channels. Fortunately this library handles all of the load balancing/multiplexing for channels and will automatically create/destroy new connections when needed, however the user may still encounter the max connections rate limiting error.\n\nFor rest the base limit per-user is 1,000 orders per 5 minute interval, and is shared between all account API connections. It increases proportionally to your trade volume based on the following formula:\n\n1000 + (TOTAL_PAIRS_PLATFORM * 60 * 5) / (250000000 / USER_VOL_LAST_30d)\n\nWhere TOTAL_PAIRS_PLATFORM is the number of pairs on the Bitfinex platform (currently ~101) and USER_VOL_LAST_30d is in USD.\n\n### Will I always receive an `on` packet?\n\nNo; if your order fills immediately, the first packet referencing the order will be an `oc` signaling the order has closed. If the order fills partially immediately after creation, an `on` packet will arrive with a status of `PARTIALLY FILLED...`\n\nFor example, if you submit a `LIMIT` buy for 0.2 BTC and it is added to the order book, an `on` packet will arrive via ws2. After a partial fill of 0.1 BTC, an `ou` packet will arrive, followed by a final `oc` after the remaining 0.1 BTC fills.\n\nOn the other hand, if the order fills immediately for 0.2 BTC, you will only receive an `oc` packet.\n\n### My websocket won't connect!\n\nDid you call `client.Connect()`? :)\n\n### nonce too small\n\nI make multiple parallel request and I receive an error that the nonce is too small. What does it mean?\n\nNonces are used to guard against replay attacks. When multiple HTTP requests arrive at the API with the wrong nonce, e.g. because of an async timing issue, the API will reject the request.\n\nIf you need to go parallel, you have to use multiple API keys right now.\n\n### How do `te` and `tu` messages differ?\n\nA `te` packet is sent first to the client immediately after a trade has been matched \u0026 executed, followed by a `tu` message once it has completed processing. During times of high load, the `tu` message may be noticably delayed, and as such only the `te` message should be used for a realtime feed.\n\n### What are the sequence numbers for?\n\nIf you enable sequencing on v2 of the WS API, each incoming packet will have a public sequence number at the end, along with an auth sequence number in the case of channel `0` packets. The public seq numbers increment on each packet, and the auth seq numbers increment on each authenticated action (new orders, etc). These values allow you to verify that no packets have been missed/dropped, since they always increase monotonically.\n\n### What is the difference between R* and P* order books?\n\nOrder books with precision `R0` are considered 'raw' and contain entries for each order submitted to the book, whereas `P*` books contain entries for each price level (which aggregate orders).\n\n## Contributing\n\n1. Fork it (https://github.com/bitfinexcom/bitfinex-api-go/fork)\n2. Create your feature branch (`git checkout -b my-new-feature)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fbitfinex-api-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfinexcom%2Fbitfinex-api-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fbitfinex-api-go/lists"}