Initial implementation of interface function for getting exchange history.

This commit is contained in:
Ryan O'Hara-Reid
2018-02-26 09:00:30 +11:00
parent 2ca907c341
commit 10d5abacb3
28 changed files with 220 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
package alphapoint
import (
"errors"
"github.com/thrasher-/gocryptotrader/currency/pair"
"github.com/thrasher-/gocryptotrader/exchanges"
"github.com/thrasher-/gocryptotrader/exchanges/orderbook"
@@ -86,3 +88,10 @@ func (a *Alphapoint) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orde
}
return ob, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (a *Alphapoint) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package anx
import (
"errors"
"log"
"strconv"
@@ -134,3 +135,10 @@ func (a *ANX) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
response.ExchangeName = a.GetName()
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (a *ANX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package binance
import (
"log"
"testing"
"github.com/thrasher-/gocryptotrader/config"
@@ -59,10 +60,12 @@ func TestGetRecentTrades(t *testing.T) {
func TestGetHistoricalTrades(t *testing.T) {
t.Parallel()
_, err := b.GetHistoricalTrades("BTCUSDT", 5, 1337)
b.Verbose = true
v, err := b.GetHistoricalTrades("BTCUSDT", 5, 1337)
if err == nil {
t.Error("Test Failed - Binance GetHistoricalTrades() error", err)
}
log.Println(v)
}
func TestGetAggregatedTrades(t *testing.T) {

View File

@@ -120,3 +120,10 @@ func (b *Binance) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
var response exchange.AccountInfo
return response, errors.New("not implemented")
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (b *Binance) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package bitfinex
import (
"errors"
"log"
"net/url"
@@ -156,3 +157,10 @@ func (b *Bitfinex) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (b *Bitfinex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -132,3 +132,10 @@ func (b *Bitflyer) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (b *Bitflyer) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -92,3 +92,10 @@ func (b *Bithumb) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
var response exchange.AccountInfo
return response, errors.New("not implemented")
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (b *Bithumb) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package bitstamp
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -122,3 +123,10 @@ func (b *Bitstamp) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
})
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (b *Bitstamp) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package bittrex
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -147,3 +148,10 @@ func (b *Bittrex) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderb
orderbook.ProcessOrderbook(b.GetName(), p, orderBook, assetType)
return orderbook.GetOrderbook(b.Name, p, assetType)
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (b *Bittrex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package btcc
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -126,3 +127,10 @@ func (b *BTCC) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
response.ExchangeName = b.GetName()
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (b *BTCC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package btcmarkets
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -126,3 +127,10 @@ func (b *BTCMarkets) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
}
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (b *BTCMarkets) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package coinut
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -123,3 +124,10 @@ func (c *COINUT) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbo
orderbook.ProcessOrderbook(c.GetName(), p, orderBook, assetType)
return orderbook.GetOrderbook(c.Name, p, assetType)
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (c *COINUT) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -35,6 +35,16 @@ type AccountCurrencyInfo struct {
Hold float64
}
// TradeHistory holds exchange history data
type TradeHistory struct {
Timestamp int64
TID int64
Price float64
Amount float64
Exchange string
Type string
}
// Base stores the individual exchange information
type Base struct {
Name string
@@ -74,6 +84,7 @@ type IBotExchange interface {
GetExchangeAccountInfo() (AccountInfo, error)
GetAuthenticatedAPISupport() bool
SetCurrencies(pairs []pair.CurrencyPair, enabledPairs bool) error
GetExchangeHistory(pair.CurrencyPair, string) ([]TradeHistory, error)
}
// SetAssetTypes checks the exchange asset types (whether it supports SPOT,

View File

@@ -1,6 +1,7 @@
package exmo
import (
"errors"
"log"
"strconv"
@@ -154,3 +155,10 @@ func (e *EXMO) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
}
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (e *EXMO) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package gdax
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -126,3 +127,10 @@ func (g *GDAX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook
orderbook.ProcessOrderbook(g.GetName(), p, orderBook, assetType)
return orderbook.GetOrderbook(g.Name, p, assetType)
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (g *GDAX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package gemini
import (
"errors"
"log"
"net/url"
@@ -105,3 +106,10 @@ func (g *Gemini) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbo
orderbook.ProcessOrderbook(g.GetName(), p, orderBook, assetType)
return orderbook.GetOrderbook(g.Name, p, assetType)
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (g *Gemini) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package hitbtc
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -137,3 +138,10 @@ func (p *HitBTC) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
}
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (h *HitBTC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package huobi
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -142,3 +143,10 @@ func (h *HUOBI) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
response.ExchangeName = h.GetName()
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (h *HUOBI) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package itbit
import (
"errors"
"log"
"strconv"
@@ -107,3 +108,10 @@ func (i *ItBit) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
response.ExchangeName = i.GetName()
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (i *ItBit) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package kraken
import (
"errors"
"fmt"
"log"
"net/url"
@@ -178,3 +179,10 @@ func (k *Kraken) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
response.ExchangeName = k.GetName()
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (k *Kraken) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package lakebtc
import (
"errors"
"log"
"strconv"
@@ -107,3 +108,10 @@ func (l *LakeBTC) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
}
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (l *LakeBTC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package liqui
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -125,3 +126,10 @@ func (l *Liqui) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (l *Liqui) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package localbitcoins
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/currency/pair"
@@ -98,3 +99,10 @@ func (l *LocalBitcoins) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
response.Currencies = append(response.Currencies, exchangeCurrency)
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (l *LocalBitcoins) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package okcoin
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -140,3 +141,10 @@ func (o *OKCoin) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (o *OKCoin) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -146,3 +146,10 @@ func (o *OKEX) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
var response exchange.AccountInfo
return response, errors.New("not implemented")
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (o *OKEX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package poloniex
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -137,3 +138,10 @@ func (p *Poloniex) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
}
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (po *Poloniex) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package wex
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -112,3 +113,10 @@ func (w *WEX) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (w *WEX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}

View File

@@ -1,6 +1,7 @@
package yobit
import (
"errors"
"log"
"github.com/thrasher-/gocryptotrader/common"
@@ -118,3 +119,10 @@ func (y *Yobit) GetExchangeAccountInfo() (exchange.AccountInfo, error) {
return response, nil
}
// GetExchangeHistory returns historic trade data since exchange opening.
func (y *Yobit) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
var resp []exchange.TradeHistory
return resp, errors.New("trade history not yet implemented")
}