-
-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathtestclient.go
More file actions
43 lines (37 loc) · 752 Bytes
/
testclient.go
File metadata and controls
43 lines (37 loc) · 752 Bytes
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
package bybit
import (
"net/http"
"os"
)
const (
// TestNetBaseURL :
TestNetBaseURL = "https://api-testnet.bybit.com"
)
// TestClient :
type TestClient struct {
*Client
}
// NewTestClient :
func NewTestClient() *TestClient {
return &TestClient{
Client: &Client{
httpClient: &http.Client{},
baseURL: TestNetBaseURL,
checkResponseBody: checkResponseBody,
},
}
}
// WithAuthFromEnv :
func (c *TestClient) WithAuthFromEnv() *TestClient {
key, ok := os.LookupEnv("BYBIT_TEST_KEY")
if !ok {
panic("need BYBIT_TEST_KEY as environment variable")
}
secret, ok := os.LookupEnv("BYBIT_TEST_SECRET")
if !ok {
panic("need BYBIT_TEST_SECRET as environment variable")
}
c.key = key
c.secret = secret
return c
}