-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfuture_test.go
58 lines (51 loc) · 1.13 KB
/
future_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
package trade
import (
"github.com/nntaoli-project/GoEx"
"github.com/nntaoli-project/GoEx/builder"
"net"
"net/http"
"net/url"
"testing"
"time"
)
var httpProxyClient = &http.Client{
Transport: &http.Transport{
Proxy: func(req *http.Request) (*url.URL, error) {
return &url.URL{
Scheme: "socks5",
Host: "127.0.0.1:1080"}, nil
},
Dial: (&net.Dialer{
Timeout: 10 * time.Second,
}).Dial,
},
Timeout: 10 * time.Second,
}
var futureExchange = builder.NewCustomAPIBuilder(httpProxyClient).APIKey("xxxx").APISecretkey("xxxx").FutureBuild(goex.BITMEX)
var futureMgr = NewFutureTradeManager(
futureExchange,
goex.NewCurrencyPair2("XBT_USD"),
"",
OPMODE_MAKE,
1.0,
0.01,
0.05,
0.05,
500,
nil,
2,
1,
)
func TestNewFutureTradeManager(t *testing.T) {
t.Log(futureExchange.GetExchangeName())
}
func TestNewFutureTradeManager2(t *testing.T) {
t.Log(futureExchange.GetFuturePosition(futureMgr.pair, ""))
t.Log(futureMgr.getPosition(goex.SELL))
}
func TestFutureTradeManager_GetAccount(t *testing.T) {
t.Log(futureMgr.GetAccount())
}
func TestFutureTradeManager_Profit(t *testing.T) {
t.Log(futureMgr.Profit(10, 10))
}