rafafrdz / binance4s   0.2.0

Apache License 2.0 GitHub

Binance4s is a lightweight functional, non blocking and type safe Scala library for interacting with the Binance API

Scala versions: 2.13

Binance API Scala

Binance API Scala is a lightweight Scala library for interacting with the Binance API in a funtional way, providing complete API coverage, and supporting synchronous and asynchronous requests.

Introduction

Binance offers access to Spot, Margin, Futures and Options API trading for over 300 Digital and Fiat currencies. API trading provides a testing environment, API documentation, and Sample Code in 6 languages. Suitable for HFT, Social Trader and Strategy trader.

Link: Binance API Doc

How to take a look in Postman

Binance offers several Postman Collections and Environments (JSON files) for a quicker and easier usage of our RESTful APIs. See documentation: Binance API Postman (Doc)

Getting started

Properties

binance.credential.access.key = ${?BINANCE_CREDENTIAL_ACCESS_KEY}
binance.credential.secret.key = ${?BINANCE_CREDENTIAL_SECRET_KEY}
binance.api.mode = ${?BINANCE_API_MODE}

Example of a simple Binance request

package io.github.rafafrdz.binance.examples

import io.github.rafafrdz.binance._
import io.github.rafafrdz.binance.api.options._
import io.github.rafafrdz.binance1.api.reqest.get._
import io.github.rafafrdz.binance.core.session._
import requests.Response

object BinanceAppEx {

  /** BinanceContext */
  val bcntx: BinanceContext =
    BinanceContext
      .build()
      .from("config/application.conf")
      .create()

  /** BinanceQuery */
  val query: BinanceQuery =
    QueryRequest
      .build()
      .timestamp()
      .signature

  /** BinanceRequest */
  val request: BinanceRequest =
    depositHistory(query)

  /** Response */
  val response: Option[Response] =
    request(bcntx)


}

More examples

You could find more examples in the example folder.

Link. [Repo] Binance Folder Examples

Link. [Repo] Binance App Example

Link. [Repo] Binance Context Example

Link. [Repo] Binance Query Example

Link. [Repo] Binance Request Example