From 42afd451d41066a09cd5d979c3d3a344aac3b64a Mon Sep 17 00:00:00 2001 From: Daniel1984 Date: Sat, 2 Jan 2021 01:52:27 +0200 Subject: [PATCH] fixing ci issue --- pkg/models/ticker/ticker.go | 78 +++++++------- pkg/models/ticker/ticker_test.go | 174 +++++++++++++++---------------- 2 files changed, 126 insertions(+), 126 deletions(-) diff --git a/pkg/models/ticker/ticker.go b/pkg/models/ticker/ticker.go index 8398edea7..1160bce8f 100644 --- a/pkg/models/ticker/ticker.go +++ b/pkg/models/ticker/ticker.go @@ -9,20 +9,20 @@ import ( ) type Ticker struct { - Symbol string - Frr float64 - Bid float64 - BidPeriod int64 - BidSize float64 - Ask float64 - AskPeriod int64 - AskSize float64 - DailyChange float64 - DailyChangeRelative float64 - LastPrice float64 - Volume float64 - High float64 - Low float64 + Symbol string + Frr float64 + Bid float64 + BidPeriod int64 + BidSize float64 + Ask float64 + AskPeriod int64 + AskSize float64 + DailyChange float64 + DailyChangePerc float64 + LastPrice float64 + Volume float64 + High float64 + Low float64 // PLACEHOLDER, // PLACEHOLDER, FrrAmountAvailable float64 @@ -54,17 +54,17 @@ func FromRaw(symbol string, raw []interface{}) (t *Ticker, err error) { // trading pair update / snapshot if strings.HasPrefix(symbol, "t") && len(raw) >= 10 { t = &Ticker{ - Symbol: symbol, - Bid: convert.F64ValOrZero(raw[0]), - BidSize: convert.F64ValOrZero(raw[1]), - Ask: convert.F64ValOrZero(raw[2]), - AskSize: convert.F64ValOrZero(raw[3]), - DailyChange: convert.F64ValOrZero(raw[4]), - DailyChangeRelative: convert.F64ValOrZero(raw[5]), - LastPrice: convert.F64ValOrZero(raw[6]), - Volume: convert.F64ValOrZero(raw[7]), - High: convert.F64ValOrZero(raw[8]), - Low: convert.F64ValOrZero(raw[9]), + Symbol: symbol, + Bid: convert.F64ValOrZero(raw[0]), + BidSize: convert.F64ValOrZero(raw[1]), + Ask: convert.F64ValOrZero(raw[2]), + AskSize: convert.F64ValOrZero(raw[3]), + DailyChange: convert.F64ValOrZero(raw[4]), + DailyChangePerc: convert.F64ValOrZero(raw[5]), + LastPrice: convert.F64ValOrZero(raw[6]), + Volume: convert.F64ValOrZero(raw[7]), + High: convert.F64ValOrZero(raw[8]), + Low: convert.F64ValOrZero(raw[9]), } return } @@ -73,20 +73,20 @@ func FromRaw(symbol string, raw []interface{}) (t *Ticker, err error) { // funding pair update if len(raw) >= 13 { t = &Ticker{ - Symbol: symbol, - Frr: convert.F64ValOrZero(raw[0]), - Bid: convert.F64ValOrZero(raw[1]), - BidPeriod: convert.I64ValOrZero(raw[2]), - BidSize: convert.F64ValOrZero(raw[3]), - Ask: convert.F64ValOrZero(raw[4]), - AskPeriod: convert.I64ValOrZero(raw[5]), - AskSize: convert.F64ValOrZero(raw[6]), - DailyChange: convert.F64ValOrZero(raw[7]), - DailyChangeRelative: convert.F64ValOrZero(raw[8]), - LastPrice: convert.F64ValOrZero(raw[9]), - Volume: convert.F64ValOrZero(raw[10]), - High: convert.F64ValOrZero(raw[11]), - Low: convert.F64ValOrZero(raw[12]), + Symbol: symbol, + Frr: convert.F64ValOrZero(raw[0]), + Bid: convert.F64ValOrZero(raw[1]), + BidPeriod: convert.I64ValOrZero(raw[2]), + BidSize: convert.F64ValOrZero(raw[3]), + Ask: convert.F64ValOrZero(raw[4]), + AskPeriod: convert.I64ValOrZero(raw[5]), + AskSize: convert.F64ValOrZero(raw[6]), + DailyChange: convert.F64ValOrZero(raw[7]), + DailyChangePerc: convert.F64ValOrZero(raw[8]), + LastPrice: convert.F64ValOrZero(raw[9]), + Volume: convert.F64ValOrZero(raw[10]), + High: convert.F64ValOrZero(raw[11]), + Low: convert.F64ValOrZero(raw[12]), } } diff --git a/pkg/models/ticker/ticker_test.go b/pkg/models/ticker/ticker_test.go index b531c00b2..29dbd8ec4 100644 --- a/pkg/models/ticker/ticker_test.go +++ b/pkg/models/ticker/ticker_test.go @@ -36,20 +36,20 @@ func TestNewTickerFromRestRaw(t *testing.T) { require.Nil(t, err) expected := &ticker.Ticker{ - Symbol: "tBTCUSD", - Frr: 0, - Bid: 10654, - BidPeriod: 0, - BidSize: 53.62425959, - Ask: 10655, - AskPeriod: 0, - AskSize: 76.68743116, - DailyChange: 745.1, - DailyChangeRelative: 0.0752, - LastPrice: 10655, - Volume: 14420.34271146, - High: 10766, - Low: 9889.1449809, + Symbol: "tBTCUSD", + Frr: 0, + Bid: 10654, + BidPeriod: 0, + BidSize: 53.62425959, + Ask: 10655, + AskPeriod: 0, + AskSize: 76.68743116, + DailyChange: 745.1, + DailyChangePerc: 0.0752, + LastPrice: 10655, + Volume: 14420.34271146, + High: 10766, + Low: 9889.1449809, } assert.Equal(t, expected, got) @@ -83,17 +83,17 @@ func TestFromRaw(t *testing.T) { require.Nil(t, err) expected := &ticker.Ticker{ - Symbol: "tBTCUSD", - Bid: 7616.5, - BidSize: 31.89055171, - Ask: 7617.5, - AskSize: 43.358118629999986, - DailyChange: -550.8, - DailyChangeRelative: -0.0674, - LastPrice: 7617.1, - Volume: 8314.71200815, - High: 8257.8, - Low: 7500, + Symbol: "tBTCUSD", + Bid: 7616.5, + BidSize: 31.89055171, + Ask: 7617.5, + AskSize: 43.358118629999986, + DailyChange: -550.8, + DailyChangePerc: -0.0674, + LastPrice: 7617.1, + Volume: 8314.71200815, + High: 8257.8, + Low: 7500, } assert.Equal(t, expected, got) @@ -123,21 +123,21 @@ func TestFromRaw(t *testing.T) { require.Nil(t, err) expected := &ticker.Ticker{ - Symbol: "fUSD", - Frr: 0.0003447013698630137, - Bid: 0.000316, - BidPeriod: 30, - BidSize: 1682003.0922634401, - Ask: 0.00031783, - AskPeriod: 4, - AskSize: 23336.958053110004, - DailyChange: 0.00000707, - DailyChangeRelative: 0.0209, - LastPrice: 0.0003446, - Volume: 156123478.78447533, - High: 0.000347, - Low: 0.00009, - FrrAmountAvailable: 146247919.52883354, + Symbol: "fUSD", + Frr: 0.0003447013698630137, + Bid: 0.000316, + BidPeriod: 30, + BidSize: 1682003.0922634401, + Ask: 0.00031783, + AskPeriod: 4, + AskSize: 23336.958053110004, + DailyChange: 0.00000707, + DailyChangePerc: 0.0209, + LastPrice: 0.0003446, + Volume: 156123478.78447533, + High: 0.000347, + Low: 0.00009, + FrrAmountAvailable: 146247919.52883354, } assert.Equal(t, expected, got) @@ -164,20 +164,20 @@ func TestFromRaw(t *testing.T) { require.Nil(t, err) expected := &ticker.Ticker{ - Symbol: "fUSD", - Frr: 0.0003447013698630137, - Bid: 0.000316, - BidPeriod: 30, - BidSize: 1682003.0922634401, - Ask: 0.00031783, - AskPeriod: 4, - AskSize: 23336.958053110004, - DailyChange: 0.00000707, - DailyChangeRelative: 0.0209, - LastPrice: 0.0003446, - Volume: 156123478.78447533, - High: 0.000347, - Low: 0.00009, + Symbol: "fUSD", + Frr: 0.0003447013698630137, + Bid: 0.000316, + BidPeriod: 30, + BidSize: 1682003.0922634401, + Ask: 0.00031783, + AskPeriod: 4, + AskSize: 23336.958053110004, + DailyChange: 0.00000707, + DailyChangePerc: 0.0209, + LastPrice: 0.0003446, + Volume: 156123478.78447533, + High: 0.000347, + Low: 0.00009, } assert.Equal(t, expected, got) @@ -237,17 +237,17 @@ func TestSnapshotFromRaw(t *testing.T) { expected := &ticker.Snapshot{ Snapshot: []*ticker.Ticker{ { - Symbol: "tBTCUSD", - Bid: 9206.8, - BidSize: 21.038892079999997, - Ask: 9205.9, - AskSize: 31.41755015, - DailyChange: 38.97852525, - DailyChangeRelative: 0.0043, - LastPrice: 9205.87852525, - Volume: 1815.68824558, - High: 9299, - Low: 9111.8, + Symbol: "tBTCUSD", + Bid: 9206.8, + BidSize: 21.038892079999997, + Ask: 9205.9, + AskSize: 31.41755015, + DailyChange: 38.97852525, + DailyChangePerc: 0.0043, + LastPrice: 9205.87852525, + Volume: 1815.68824558, + High: 9299, + Low: 9111.8, }, }, } @@ -289,17 +289,17 @@ func TestFromWSRaw(t *testing.T) { require.Nil(t, err) expected := &ticker.Ticker{ - Symbol: "tBTCUSD", - Bid: 7616.5, - BidSize: 31.89055171, - Ask: 7617.5, - AskSize: 43.358118629999986, - DailyChange: -550.8, - DailyChangeRelative: -0.0674, - LastPrice: 7617.1, - Volume: 8314.71200815, - High: 8257.8, - Low: 7500, + Symbol: "tBTCUSD", + Bid: 7616.5, + BidSize: 31.89055171, + Ask: 7617.5, + AskSize: 43.358118629999986, + DailyChange: -550.8, + DailyChangePerc: -0.0674, + LastPrice: 7617.1, + Volume: 8314.71200815, + High: 8257.8, + Low: 7500, } assert.Equal(t, expected, got) @@ -327,17 +327,17 @@ func TestFromWSRaw(t *testing.T) { expected := &ticker.Snapshot{ Snapshot: []*ticker.Ticker{ { - Symbol: "tBTCUSD", - Bid: 9206.8, - BidSize: 21.038892079999997, - Ask: 9205.9, - AskSize: 31.41755015, - DailyChange: 38.97852525, - DailyChangeRelative: 0.0043, - LastPrice: 9205.87852525, - Volume: 1815.68824558, - High: 9299, - Low: 9111.8, + Symbol: "tBTCUSD", + Bid: 9206.8, + BidSize: 21.038892079999997, + Ask: 9205.9, + AskSize: 31.41755015, + DailyChange: 38.97852525, + DailyChangePerc: 0.0043, + LastPrice: 9205.87852525, + Volume: 1815.68824558, + High: 9299, + Low: 9111.8, }, }, }