Giter Club home page Giter Club logo

hitbtc's Introduction

HitBTC API in GO

GoDoc

Install

$ go get -u github.com/iowar/hitbtc

Public Api

No need authentication to use it.

package main

import (
        "fmt"

        hbtc "github.com/iowar/hitbtc"
)

func main() {
        hitbtc, err := hbtc.NewClient("", "")
        if err != nil {
                panic(err)
        }

        r, _ := hitbtc.GetCurrency("ipl")
        //r, _ := hitbtc.GetCurrencies()
        //r, _ := hitbtc.GetSymbol("iplbtc")
        //r, _ := hitbtc.GetSymbols()
        //r, _ := hitbtc.GetTicker("iplbtc")
        //r, _ := hitbtc.GetTickers()
        //r, _ := hitbtc.GetTrades("iplbtc")
        //r, _ := hitbtc.GetOrderBook("iplbtc", 10)
        //r, _ := hitbtc.GetCandles("iplbtc", "M3", 10)

        fmt.Println(r)
}

Trading Api

Api keys must be set.

package main

import (
        "fmt"

        hbtc "github.com/iowar/hitbtc"
)

const (
        api_key    = ""
        api_secret = ""
)

func main() {
        hitbtc, err := hbtc.NewClient(api_key, api_secret)
        if err != nil {
                panic(err)
        }

        r, err := hitbtc.GetBalances()
        //r, err := hitbtc.GetOrder("<valid_orderid>")
        //r, err := hitbtc.GetOrders("iplbtc")
        //r, err := hitbtc.GetOrderStatus("clientOrderId")
        //r, err := hitbtc.Buy("iplbtc", 0.00000001, 10000)
	//r, err := hitbtc.BuyStop("usdtbtc", 5500, 5400, 1)
        //r, err := hitbtc.Sell("iplbtc", 1, 1000)
	//r, err := hitbtc.SellStop("usdtbtc", 4500, 4600, 1)
        //r, err := hitbtc.CancelOrder("<valid_orderid>")
        //r, err := hitbtc.CancelOrders("iplbtc")
        //r, err := hitbtc.GetFee("iplbtc")
        //r, err := hitbtc.GetOrderHistory("iplbtc", 10)
        //r, err := hitbtc.GetTradeHistory("iplbtc", 10)
        //r, err := hitbtc.GetTradesByOrder(orderid_type_uint64)
        //r, err := hitbtc.GetAccountBalances()
        //r, err := hitbtc.GetDepositAddress("BTC")
        //r, err := hitbtc.NewDepositAddress("BTC")

        if err != nil {
                panic(err)
        }

        fmt.Println(r)
}

Some Notes

  • Orders may be delayed by the hitbtc when used buy and sell options.
  • Throttle set as 9 req/s.
  • There is no ws support.

License

MIT

hitbtc's People

Contributors

iowar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mentech

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.