forked from ccxt/go-binance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmark_service.go
55 lines (50 loc) · 1.26 KB
/
mark_service.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
package eoptions
import (
"context"
"encoding/json"
"net/http"
)
type Mark struct {
Symbol string `json:"symbol"`
MarkPrice string `json:"markPrice"`
BidIV string `json:"bidIV"`
AskIV string `json:"askIV"`
MarkIV string `json:"markIV"`
Delta string `json:"delta"`
Theta string `json:"theta"`
Gamma string `json:"gamma"`
Vega string `json:"vega"`
HighPriceLimit string `json:"highPriceLimit"`
LowPriceLimit string `json:"lowPriceLimit"`
RiskFreeInterest string `json:"riskFreeInterest"`
}
// MarkService list recent trades in orderbook
type MarkService struct {
c *Client
symbol *string
}
// Symbol set symbol
func (s *MarkService) Symbol(symbol string) *MarkService {
s.symbol = &symbol
return s
}
// Do send request
func (s *MarkService) Do(ctx context.Context, opts ...RequestOption) (res []*Mark, err error) {
r := &request{
method: http.MethodGet,
endpoint: "/eapi/v1/mark",
}
if s.symbol != nil {
r.setParam("symbol", *s.symbol)
}
data, _, err := s.c.callAPI(ctx, r, opts...)
if err != nil {
return []*Mark{}, err
}
res = make([]*Mark, 0)
err = json.Unmarshal(data, &res)
if err != nil {
return []*Mark{}, err
}
return res, nil
}