npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cryptocurrency-exchanges

v0.0.3

Published

Cryptocurrency Excahnges API Wrapper

Downloads

111

Readme

cryptocurrency-exchanges (Proceeding)

Cryptocurrency Excahnges API Wrapper

문서 (Documentation)

Proceeding

설치 (Installation)

npm install cryptocurrency-exchanges

지원 거래소 (Support Exchange)

  • Upbit
  • Bithumb
  • Coinone
  • Korbit

사용 (Usage)

import { Upbit } from "cryptocurrency-exchanges"

공개 (Public)

  • fetchMarkets: 거래소에서 지원하는 모든 종목 목록
const upbit = new Upbit()
const markets = await upbit.public.fetchMarkets()
{
  status: 'ok',
  result: [
    { 
      currency: 'BTC', 
      quote: 'KRW' 
    }, 
    ...
  ]
}
  • fetchTickers: 모든 종목 별 가격(open, last, high, low) 목록
const upbit = new Upbit()
const tickers = await upbit.public.fetchTickers()
{
  status: 'ok',
  result: [
    { 
      currency: 'BTC', 
      quote: 'KRW', 
      high: '97300000', 
      low: '94682000', 
      first: '96053000', 
      last: '95740000' 
    },
    ...
  ]
}

비공개 (Private)

  • fetchWalletStatus: 거래소의 모든 입출금 지갑 상태 목록
const upbit = new Upbit([AccessKey], [SecretKey]);
const walletStatus = await upbit.private.fetchWalletStatus();
{
  status: 'ok',
  result: [  
    { 
      currency: 'BTC', 
      network: 'BTC', 
      deposit: true, 
      withdraw: true, 
      withdrawFee: null, 
      withdrawMin: null 
    },
    ...
  ]
}
  • fetchBalance: 나의 지갑 잔고 조회
const upbit = new Upbit([AccessKey], [SecretKey]);
const walletStatus = await upbit.private.fetchBalance();
{
  status: 'ok',
  result: [  
    { 
      currency: 'BTC', 
      balance: '0.232', 
      lockedBalance: '0', 
      avgBuyPrice: '0'
    },
    ...
  ]
}
  • fetchDepositAddress([currency], [network]): 나의 입금 주소 조회
const upbit = new Upbit([AccessKey], [SecretKey]);
const depositAddress = await upbit.private.fetchDepositAddress('BTC', 'BTC');
{
  status: 'ok',
  result: {
    currency: 'BTC',
    network: 'BTC',
    address: '381oLSdWUW9vNBTFNQe9pjRXKPiwpUYedx',
    memo: null
  }
}
  • fetchDepositHistory([currency], [page], [limit]): 나의 입금 내역 조회
const upbit = new Upbit([AccessKey], [SecretKey]);
const depositAddress = await upbit.private.fetchDepositHistory('TRX');
{
  status: 'ok',
  result: [
    {
      type: 'deposit',
      txId: '4230748d66d504bdd803efdfd4f2f73a46ff629d2b8adf81ca53d43096fb1ad2',
      currency: 'TRX',
      network: 'TRX',
      amount: '100',
      fee: '0',
      state: 'accepted',
      fromAddress: null,
      fromAddressTag: null,
      toAddress: null,
      toAddressTag: null,
      createdAt: 1711530114000,
      confirmedAt: 1711530142000
    },
    ...
  ]
}
  • fetchWithdrawHistory([currency], [page], [limit]): 나의 출금 내역 조회
const upbit = new Upbit([AccessKey], [SecretKey]);
const depositAddress = await upbit.private.fetchWithdrawHistory('TRX');
{
  status: 'ok',
  result: [
    {
      type: 'withdraw',
      txId: 'e13946e92f11243c6dbdsafasd619c2243eda33777651591353b40ea24c2f1bc',
      currency: 'TRX',
      network: null,
      amount: '6797',
      fee: '1',
      state: 'accepted',
      fromAddress: null,
      fromAddressTag: null,
      toAddress: null,
      toAddressTag: null,
      createdAt: 1693584391000,
      confirmedAt: 1693584623000
    },
    ...
  ]
}

구독 (subscribe)

  • client: 구독 클라이언트 생성
const upbit = new Upbit([AccessKey], [SecretKey]);
const client = await upbit.private.subscribe('ticker', 'BTC', 'KRW');

const subscription =  {
  onData: function (data)  {
    console.log(data)
  },
  onError: function (error) {
    console.log('on error:', error)
  },
  onClose: function () {
    console.log('closed')
  }
}

client.subscribe(subscription)
{
  "currency":"BTC",
  "quote":"KRW",
  "high":"97300000",
  "low":"94682000",
  "first":"96053000",
  "last":"95796000",
  "change":"fall",
  "accTradeVolume":"2773.75263542",
  "accTradeVolume24h":"539033044149.2787",
  "accTradePrice":"266769593726.39584",
  "accTradePrice24h":"539033044149.2787",
  "timestamp":1712143721393
}