Skip to content

Latest commit

 

History

History
executable file
·
206 lines (146 loc) · 9.17 KB

README.md

File metadata and controls

executable file
·
206 lines (146 loc) · 9.17 KB

Wazirx-go example workflow

A go client library for wazirx REST APIs

Description

wazirx-go is a go library for Wazirx Rest API integration.

Available APIs

  • Common API

  • Trading Endpoints ---------------- docs

    • New Order ------------------- docs
    • Test New Order -------------- docs
    • Query Order ----------------- docs
    • Query Open Orders ----------docs
    • Query All Orders -------------docs
    • Cancel Order -----------------docs
    • Cancel All Orders ------------docs
  • Account API ----------------------- docs

    • Account Info ----------------- docs, code
    • Funds ------------------------ docs, code
  • Websocket Auth Token API ------ docs

    • Create Auth Token ---------- docs, code
  • Websocket Market Streams ------ docs

    • Live Subscribing & Unsubscribing ------------------- docs
    • Trade Streams -------------- docs
    • All Market Tickers Stream ----------------- docs
    • Depth Stream ----------docs
    • Account Update -------------docs
    • Order Update -----------------docs
    • Trade Update ------------docs

Getting Started

Prerequisites

It is prerequisite to have Go installed on your machine. Steps to install Go

API Key Setup

  • Some API requires an API key to verify the client request. For API Key creation,check here.
  • Sign in to the wazirx account and go to the settings and then click API KEY MANAGER at the bottom.
  • Here, you can create your api key 😃

image

Installing

git clone https://github.com/yuvan11/wazirx-go.git

Structure

Executing program

cd wazirx-go/cmd
go run main.go

Note:

Don't forget to add API_KEY and SECRET_KEY in the code here, as these are expected by some APIs for code & test execution. Otherwise, error will be thrown

  • Starting a client

// Initializing client for accessing all API endpoints
client := wazirx.Client{}
    
// Initializing context
ctx := context.TODO()
  • General API

    • Server Time

        // Server service initiates
        fmt.Println(client.NewServerTimeService().FetchServerTime(ctx))
      
    • System Status

          // System status service initiates
        fmt.Println(client.NewSystemStatusService().FetchSystemStatus(ctx))
      
    • Exchange Info

         // Exchange status service initiates
        fmt.Println(client.NewExchangeInfoService().FetchExchangeInfo(ctx))
      
  • Market Data API

    • Tickers

         // Tickers service initiates
        fmt.Println(client.NewTickersService().DisplayTickersData(ctx))
      
    • Ticker

           // Ticker service initiates
           fmt.Println(client.NewTickerService().SetSymbol("manausdt").TickerData(ctx))
      
    • OrderBook Depth

       // Market depth service initiates
       fmt.Println(client.NewOrderBookDepthService().SetLimit(10).SetSymbol("manausdt").DisplayOrdersBookDepth(ctx))
      
    • Recent Trades

        // Market trade service initiates
        fmt.Println(client.NewRecentTradesService().SetLimit(10).SetSymbol("manausdt").DisplayRecentMarketTrade(ctx))
      
    • Historical Trades

        // Historical trade service initiates
        fmt.Println(client.NewHistoricalTradesService().SetSymbol("manausdt").DisplayHistoricalTrade(ctx))
      
  • Websocket Auth Token API

    • Create Auth Token

        // Generate auth token service initiates
        fmt.Println(client.NewAuthInfoService().CreateAuthToken(ctx))
      
  • Account API

    • Account Info

        // Account display service initiates
        fmt.Println(client.NewAccountInfoService().FetchAccountInfo(ctx))
      
    • Funds

         // Account funds service initiates
        fmt.Println(client.NewFundInfoService().FetchFundsInfo(ctx))
      
    • Example to fetch asset price greater than "0.0" and its asset name

      for _, a := range *client.NewFundInfoService().FetchFundsInfo(ctx) {
      
          if a.Free > "0.00" {
              fmt.Println("asset", a.Asset, "free", a.Free)
          }
      
      }

Unit Testing

  • For running unit tests,

    cd wazrix-client
    go test -v or go test
    

image

Contributing

For contribution, have a look at contributing.md

License

This project is licensed under the MIT License - see the LICENSE file for details

Authors

Yuvaraj @yuvan11