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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@xfilecom/gopax-client

v1.0.1

Published

GOPAX WebSocket API client for Node.js

Downloads

6

Readme

GOPAX API Client

GOPAX 거��소의 REST API와 WebSocket API를 위한 Node.js 클라이언트 라이브러리입니다.

설치

npm install @xfilecom/gopax-client

REST API 사용 방법

import GopaxClient from '@xfilecom/gopax-client';

// 클라이언트 인스턴스 생성
const client = new GopaxClient({
  apiKey: 'YOUR_API_KEY',      // Private API 사용 시 필요
  secretKey: 'YOUR_SECRET_KEY', // Private API 사용 시 필요
});

// Public API 예제
async function publicApiExample() {
  // 전체 거래쌍 조회
  const tradingPairs = await client.getTradingPairs();
  console.log('Trading Pairs:', tradingPairs);

  // 특정 거래쌍의 시세 조회
  const ticker = await client.getTicker('BTC-KRW');
  console.log('BTC-KRW Ticker:', ticker);

  // 호가창 조회
  const orderbook = await client.getOrderBook('BTC-KRW');
  console.log('BTC-KRW Orderbook:', orderbook);

  // 거래 내역 조회
  const trades = await client.getTradeHistory('BTC-KRW');
  console.log('BTC-KRW Trades:', trades);
}

// Private API 예제
async function privateApiExample() {
  // 계정 잔고 조회
  const balances = await client.getBalances();
  console.log('Balances:', balances);

  // 주문 생성
  const order = await client.createOrder({
    tradingPair: 'BTC-KRW',
    side: 'buy',
    type: 'limit',
    price: 50000000,
    amount: 0.1
  });
  console.log('Created Order:', order);

  // 주문 취소
  await client.cancelOrder('ORDER_ID');

  // 주문 조회
  const myOrder = await client.getOrder('ORDER_ID');
  console.log('Order Details:', myOrder);
}

WebSocket API 사용 방법

import GopaxClient, { EventType } from '@xfilecom/gopax-client';

// WebSocket 클라이언트 인스턴스 생성
const client = new GopaxClient({
  apiKey: 'YOUR_API_KEY',      // Private API 사용 시 필요
  secretKey: 'YOUR_SECRET_KEY', // Private API 사용 시 필요
  autoReconnect: true,
  callbacks: {
    onOpen: () => console.log('Connected'),
    onClose: () => console.log('Disconnected'),
    onMessage: (msg) => console.log('Message:', msg),
    onError: (error) => console.error('Error:', error),
    onOrderBook: (data) => console.log('OrderBook:', data),
    onTrade: (data) => console.log('Trade:', data),
    onOrder: (data) => console.log('Order:', data)
  }
});

// WebSocket 연결
await client.connect();

// 주문 구독
client.subscribeToOrders();

// 특정 거래쌍의 오더북 구독
client.subscribeToOrderBook('BTC-KRW');

// 특정 거래쌍의 체결 내역 구독
client.subscribeToTrades('BTC-KRW');

// 구독 취소
client.unsubscribeFromTrades('BTC-KRW');
client.unsubscribeFromOrderBook('BTC-KRW');

// 연결 종료
client.disconnect();

주요 기능

REST API

  • Public API

    • 거래쌍 조회
    • 시세 조회
    • 호가창 조회
    • 거래 내역 조회
    • 차트 데이터(OHLCV) 조회
  • Private API

    • 계정 잔고 조회
    • 주문 생성/취소/조회
    • 거래 내역 조회
    • 입출금 내역 조회

WebSocket API

  • 자동 재연결
  • 실시간 주문 구독
  • 실시간 오더북 구독
  • 실시간 체결 내역 구독
  • 이벤트 기반 메시지 처리
  • Private API 인증 지원

에러 처리

try {
  const ticker = await client.getTicker('INVALID-PAIR');
} catch (error) {
  if (error instanceof GopaxAPIError) {
    console.error('API Error:', error.message);
    console.error('Status Code:', error.statusCode);
    console.error('Response:', error.response);
  }
}

TypeScript 지원

이 라이브러리는 TypeScript로 작성되어 있어 타입 정의가 기본으로 제공됩니다.

라이선스

MIT