-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp_test.go
88 lines (68 loc) · 1.82 KB
/
http_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package marketbit
import (
"fmt"
"testing"
)
func TestTickerMustBeReturnMockedValues(t *testing.T) {
cli := New("https://www.mercadobitcoin.net/api")
tickerItem, err := cli.GetTicker("btc")
if err != nil {
panic(err)
}
fmt.Println(tickerItem.Buy)
fmt.Println(tickerItem.Last)
fmt.Println(tickerItem.Sell)
fmt.Println(tickerItem.Vol)
}
func TestOrderBookMustBeReturnMockedValues(t *testing.T) {
cli := New("https://www.mercadobitcoin.net/api")
orderItem, err := cli.GetOrderBook("btc")
if err != nil {
panic(err)
}
for _, askItem := range orderItem.Asks {
fmt.Println(askItem.Amount())
fmt.Println(askItem.Price())
}
for _, bidsItem := range orderItem.Bids {
fmt.Println(bidsItem.Amount())
fmt.Println(bidsItem.Price())
}
}
func TestTradesMustBeReturnMockedValues(t *testing.T) {
cli := New("https://www.mercadobitcoin.net/api")
tradesResponse, err := cli.GetLastTrades("btc")
if err != nil {
panic(err)
}
for _, tradeItens := range tradesResponse.Trades {
fmt.Println(tradeItens.Price)
fmt.Println(tradeItens.Amount)
fmt.Println(tradeItens.Date)
fmt.Println(tradeItens.Tid)
fmt.Println(tradeItens.Type)
}
}
func TestTradesRangeMustBeReturnMockedValues(t *testing.T) {
cli := New("https://www.mercadobitcoin.net/api")
tradesResponse, err := cli.GetTradesRange("btc", "2017/12/29", "2017/12/30")
if err != nil {
panic(err)
}
for _, tradeItens := range tradesResponse.Trades {
fmt.Println(tradeItens.Price)
fmt.Println(tradeItens.Amount)
fmt.Println(tradeItens.Date)
fmt.Println(tradeItens.Tid)
fmt.Println(tradeItens.Type)
}
}
func TestSummaryMustBeReturnMockedValues(t *testing.T) {
cli := New("https://www.mercadobitcoin.net/api")
summary, err := cli.GetSummaryAt("btc", "2017-12-30")
if err != nil {
panic(err)
}
fmt.Println(summary.Opening)
fmt.Println(summary.Closing)
}