From 8886579ae1261bdf4ccf890eacfb914483735431 Mon Sep 17 00:00:00 2001 From: nntaoli <2767415655@qq.com> Date: Fri, 13 Nov 2020 15:59:33 +0800 Subject: [PATCH] fix bug --- hitbtc/Hitbtc.go | 4 ++-- hitbtc/Hitbtc_test.go | 2 +- zb/Zb.go | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hitbtc/Hitbtc.go b/hitbtc/Hitbtc.go index ff731b88..4c0c8d63 100644 --- a/hitbtc/Hitbtc.go +++ b/hitbtc/Hitbtc.go @@ -33,7 +33,7 @@ const ( var ( YCC = goex.Currency{"YCC", "Yuan Chain New"} BTC = goex.Currency{"BTC", "Bitcoin"} - YCC_BTC = goex.CurrencyPair{YCC, BTC} + YCC_BTC = goex.CurrencyPair{CurrencyA: YCC, CurrencyB: BTC} ) type Hitbtc struct { @@ -587,7 +587,7 @@ func parseStatus(s string) goex.TradeStatus { } func (hitbtc *Hitbtc) adaptCurrencyPair(pair goex.CurrencyPair) goex.CurrencyPair { - return pair.AdaptUsdtToUsd().AdaptBccToBch() + return pair.AdaptUsdtToUsd() } func (hitbtc *Hitbtc) adaptSymbolToCurrencyPair(pair string) goex.CurrencyPair { diff --git a/hitbtc/Hitbtc_test.go b/hitbtc/Hitbtc_test.go index 9cfe5042..c66794af 100644 --- a/hitbtc/Hitbtc_test.go +++ b/hitbtc/Hitbtc_test.go @@ -31,7 +31,7 @@ func TestHitbtc_adaptSymbolToCurrencyPair(t *testing.T) { } func TestGetTicker(t *testing.T) { - res, err := htb.GetTicker(goex.BCC_USD) + res, err := htb.GetTicker(goex.BCH_USD) require := require.New(t) require.Nil(err) t.Log(res) diff --git a/zb/Zb.go b/zb/Zb.go index 55d2da85..28de51ea 100644 --- a/zb/Zb.go +++ b/zb/Zb.go @@ -43,7 +43,7 @@ func (zb *Zb) GetExchangeName() string { } func (zb *Zb) GetTicker(currency CurrencyPair) (*Ticker, error) { - symbol := currency.AdaptBchToBcc().AdaptUsdToUsdt().ToSymbol("_") + symbol := currency.ToSymbol("_") resp, err := HttpGet(zb.httpClient, MARKET_URL+fmt.Sprintf(TICKER_API, symbol)) if err != nil { return nil, err @@ -65,7 +65,7 @@ func (zb *Zb) GetTicker(currency CurrencyPair) (*Ticker, error) { } func (zb *Zb) GetDepth(size int, currency CurrencyPair) (*Depth, error) { - symbol := currency.AdaptBchToBcc().AdaptUsdToUsdt().ToSymbol("_") + symbol := currency.ToSymbol("_") resp, err := HttpGet(zb.httpClient, MARKET_URL+fmt.Sprintf(DEPTH_API, symbol, size)) if err != nil { return nil, err @@ -170,7 +170,7 @@ func (zb *Zb) GetAccount() (*Account, error) { } func (zb *Zb) placeOrder(amount, price string, currency CurrencyPair, tradeType int) (*Order, error) { - symbol := currency.AdaptBchToBcc().AdaptUsdToUsdt().ToSymbol("_") + symbol := currency.ToSymbol("_") params := url.Values{} params.Set("method", "order") params.Set("price", price) @@ -229,7 +229,7 @@ func (zb *Zb) LimitSell(amount, price string, currency CurrencyPair, opt ...Limi } func (zb *Zb) CancelOrder(orderId string, currency CurrencyPair) (bool, error) { - symbol := currency.AdaptBchToBcc().AdaptUsdToUsdt().ToSymbol("_") + symbol := currency.ToSymbol("-") params := url.Values{} params.Set("method", "cancelOrder") params.Set("id", orderId) @@ -301,7 +301,7 @@ func parseOrder(order *Order, ordermap map[string]interface{}) { } func (zb *Zb) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error) { - symbol := currency.AdaptBchToBcc().AdaptUsdToUsdt().ToSymbol("_") + symbol := currency.ToSymbol("_") params := url.Values{} params.Set("method", "getOrder") params.Set("id", orderId) @@ -331,7 +331,7 @@ func (zb *Zb) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error) func (zb *Zb) GetUnfinishOrders(currency CurrencyPair) ([]Order, error) { params := url.Values{} - symbol := currency.AdaptBchToBcc().AdaptUsdToUsdt().ToSymbol("_") + symbol := currency.ToSymbol("_") params.Set("method", "getUnfinishedOrdersIgnoreTradeType") params.Set("currency", symbol) params.Set("pageIndex", "1")