Skip to content

Commit

Permalink
fixing ci issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel1984 committed Jan 1, 2021
1 parent 7f99dd2 commit 42afd45
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 126 deletions.
78 changes: 39 additions & 39 deletions pkg/models/ticker/ticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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]),
}
}

Expand Down
174 changes: 87 additions & 87 deletions pkg/models/ticker/ticker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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,
},
},
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
},
},
}
Expand Down

0 comments on commit 42afd45

Please sign in to comment.