Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nikeweke/binance-api-sdk
Binance API SDK
https://github.com/nikeweke/binance-api-sdk
binance binance-api bitcoins cryptocurrency typescript
Last synced: 5 days ago
JSON representation
Binance API SDK
- Host: GitHub
- URL: https://github.com/nikeweke/binance-api-sdk
- Owner: Nikeweke
- Created: 2022-06-17T08:18:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-06T10:55:23.000Z (over 1 year ago)
- Last Synced: 2024-09-24T04:02:27.470Z (9 days ago)
- Topics: binance, binance-api, bitcoins, cryptocurrency, typescript
- Language: TypeScript
- Homepage:
- Size: 280 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Binance API SDK
### Quick start
```js
// 1. init a keys
const keys = {
apiKey: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
secretKey: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
}// 2. get api and service
const binanceApi = require('binance-api-sdk').default(keys)// 3. use
binanceApi.getTicker('BTCEUR')
.then((data) => console.log(data))
.catch(err => console.log('Error: ', err.message))binanceApi.getTicker24h('BTCUSDC')
.then((data) => console.log(data))
.catch(err => console.log('Error: ', err.message))// set keys before use private functions
binanceApi.accountInfo()
.then((data) => console.log(data))
.catch(err => console.log('Error: ', err.message))binanceApi.getAccountTotalAndBalances()
.then((data) => console.log(data))
.catch(err => console.log(err))
```#### binanceApi.
* `.isKeysSet()` - check if keys are set (secret, api keys)
* `.getTicker('BTCEUR')` - last updates of market
* `.getTicker24h('BTCUSDC')` - last updates of market for 24h
* `.getTickers(['BTCUSDC', 'BTCEUR'])` - get a few tickers at once
* `.getCurrentAvgPrice('BTCUSDC')` - get current average price
* `.getOrderBook('BTCUSDC')` - order book for symbol
* `.accountInfo()` - (private) account info and assets' balances
* `.dailyAccountSnapshot(startTime: number, endTime: number, type: AccountBalanceType = 'SPOT')` - (private) snapshot of your account balances (startTime, endTime - it is unixtime in milliseconds)
* `.getAccountTotalAndBalances(displayCurrency: string = 'USDC')` - Get total of your assets in *displayCurrency*
* `.request(action: string, method: Method = 'get', data = null, options = {})` - make request to binance api---