{"id":15021121,"url":"https://github.com/deliganli/binance4s","last_synced_at":"2026-03-09T10:02:37.369Z","repository":{"id":57718691,"uuid":"201672006","full_name":"Deliganli/binance4s","owner":"Deliganli","description":"Functional scala client for Binance exchange","archived":false,"fork":false,"pushed_at":"2020-05-09T10:58:20.000Z","size":77,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-27T13:36:34.650Z","etag":null,"topics":["binance","bitcoin","cats","fs2","http4s","rest","scala","websocket"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Deliganli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-10T19:05:38.000Z","updated_at":"2025-10-04T22:47:25.000Z","dependencies_parsed_at":"2022-09-26T21:40:29.645Z","dependency_job_id":null,"html_url":"https://github.com/Deliganli/binance4s","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Deliganli/binance4s","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deliganli%2Fbinance4s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deliganli%2Fbinance4s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deliganli%2Fbinance4s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deliganli%2Fbinance4s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Deliganli","download_url":"https://codeload.github.com/Deliganli/binance4s/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deliganli%2Fbinance4s/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30290929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T02:57:19.223Z","status":"ssl_error","status_checked_at":"2026-03-09T02:56:26.373Z","response_time":61,"last_error":"SSL_read: 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":["binance","bitcoin","cats","fs2","http4s","rest","scala","websocket"],"created_at":"2024-09-24T19:56:09.667Z","updated_at":"2026-03-09T10:02:37.334Z","avatar_url":"https://github.com/Deliganli.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Binance4s\n| Snapshot | Release |\n| --- | --- |\n| [![Sonatype Nexus (Releases)][Badge-SonatypeReleases]][Link-SonatypeReleases] | [![Sonatype Nexus (Snapshots)][Badge-SonatypeSnapshots]][Link-SonatypeSnapshots] |\n\nBinance4s is a lightweight functional scala library acts as a rest and websocket client for [Binance][Link-binance]\n\nBoth websocket and rest clients utilizes  [http4s][Link-http4s], [cats][Link-cats], [enumeratum][Link-enumeratum], [circe][Link-circe]\n\n## Install\nAdd the following to your `build.sbt` file. This will add both `rest` and `websocket` modules. \n\nBuilds are available for scala `2.13.x` and `2.12.x`\n```sbt\nlibraryDependencies ++= Seq(\n  \"com.deliganli\" %% \"binance4s-websocket\" % \"0.1.0\",\n  \"com.deliganli\" %% \"binance4s-rest\" % \"0.1.0\"\n)\n```\n## Examples\n\n### Rest\n\n```scala\nimport cats.effect.{Clock, ConcurrentEffect}\nimport com.deliganli.binance4s.common.Credentials\nimport com.deliganli.binance4s.common.http.JDKHttpClient\nimport com.deliganli.binance4s.rest.BinanceRestClient\nimport com.deliganli.binance4s.rest.response.base.{BinanceError, BinanceResponse}\nimport com.deliganli.binance4s.rest.response.general.ExchangeInfo\nimport com.typesafe.scalalogging.StrictLogging\nimport org.http4s.client.Client\nimport org.http4s.client.jdkhttpclient.JdkHttpClient\n\nclass RestExample[F[_]: ConcurrentEffect: Clock] extends StrictLogging {\n  val httpClient: Client[F] = JdkHttpClient[F](JDKHttpClient.default)\n\n  // Public client doesn't require neither api key nor secret\n  val publicClient: BinanceRestClient.PublicClient[F] = BinanceRestClient.public[F](\n    httpClient\n  )\n\n  // Metered client only requires api key\n  val meteredClient: BinanceRestClient.MeteredClient[F] = BinanceRestClient.metered[F](\n    httpClient,\n    \"\u003ckey\u003e\"\n  )\n\n  // Secure client requires both api key and secret\n  val secureClient: BinanceRestClient.SecureClient[F] = BinanceRestClient.secure[F](\n    httpClient,\n    Credentials(\"\u003ckey\u003e\", \"\u003csecret\u003e\")\n  )\n\n  val exchangeInfo: F[BinanceResponse[Either[BinanceError, ExchangeInfo]]] = publicClient.general.exchangeInfo\n}\n```\n\n### WebSocket\n\nUses [fs2][Link-fs2]\n\n```scala\nimport cats.data.NonEmptySet\nimport cats.effect.{ConcurrentEffect, ContextShift, Timer}\nimport com.deliganli.binance4s.common.consts.KlineInterval\nimport com.deliganli.binance4s.common.http.JDKHttpClient\nimport com.deliganli.binance4s.websocket.BinanceWSClient\nimport com.deliganli.binance4s.websocket.request.BinanceRequest\nimport com.deliganli.binance4s.websocket.response.Event\nimport com.typesafe.scalalogging.StrictLogging\nimport fs2.Stream\nimport io.circe.Error\nimport org.http4s.client.jdkhttpclient.JdkWSClient\n\nclass EventStreamExample[F[_]: ConcurrentEffect: ContextShift: Timer] extends StrictLogging {\n  val httpClient                   = JdkWSClient(JDKHttpClient.default)\n  val wsClient: BinanceWSClient[F] = BinanceWSClient.create[F](httpClient)\n\n  val requests: NonEmptySet[BinanceRequest] = NonEmptySet.of(\n    BinanceRequest.Kline(\"BTCUSDT\", KlineInterval.OneMinute),\n    BinanceRequest.Trade(\"BTCUSDT\"),\n    BinanceRequest.Ticker(\"BTCUSDT\")\n  )\n\n  val eventStream: Stream[F, Either[Error, Event]] = Stream\n    .resource(wsClient.connect(requests))\n    .flatMap(_.incoming)\n}\n```\n[Badge-SonatypeReleases]: https://img.shields.io/nexus/s/com.deliganli/binance4s-websocket_2.13?server=https%3A%2F%2Foss.sonatype.org \"Sonatype Releases\"\n[Link-SonatypeReleases]: https://oss.sonatype.org/content/repositories/snapshots/com/deliganli/binance4s-websocket_2.13/ \"Sonatype Releases\"\n\n[Badge-SonatypeSnapshots]: https://img.shields.io/nexus/r/https/oss.sonatype.org/com.deliganli/binance4s-websocket_2.13.svg \"Sonatype Releases\"\n[Link-SonatypeSnapshots]: https://oss.sonatype.org/content/repositories/snapshots/com/deliganli/binance4s-websocket_2.13/ \"Sonatype Releases\"\n\n[Link-binance]: https://github.com/binance-exchange/binance-official-api-docs\n[Link-http4s]: https://github.com/http4s/http4s\n[Link-cats]: https://github.com/typelevel/cats\n[Link-enumeratum]: https://github.com/lloydmeta/enumeratum\n[Link-circe]: https://github.com/circe/circe\n[Link-fs2]: https://github.com/functional-streams-for-scala/fs2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeliganli%2Fbinance4s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeliganli%2Fbinance4s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeliganli%2Fbinance4s/lists"}