-
Notifications
You must be signed in to change notification settings - Fork 2
/
funds_candles_test.go
47 lines (40 loc) · 1.54 KB
/
funds_candles_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
package client
import (
"context"
"fmt"
)
func ExampleFundCandlesRequest_raw() {
ctx := context.TODO()
fcr, err := FundCandles().Resolution("D").Symbol("VFINX").From("2023-01-01").To("2023-01-06").Raw(ctx)
if err != nil {
fmt.Print(err)
return
}
fmt.Println(fcr)
// Output: {"s":"ok","t":[1672722000,1672808400,1672894800,1672981200],"o":[352.76,355.43,351.35,359.38],"h":[352.76,355.43,351.35,359.38],"l":[352.76,355.43,351.35,359.38],"c":[352.76,355.43,351.35,359.38]}
}
func ExampleFundCandlesRequest_packed() {
ctx := context.TODO()
fcr, err := FundCandles().Resolution("D").Symbol("VFINX").From("2023-01-01").To("2023-01-06").Packed(ctx)
if err != nil {
fmt.Print(err)
return
}
fmt.Println(fcr)
// Output: FundCandlesResponse{Date: [1672722000 1672808400 1672894800 1672981200], Open: [352.76 355.43 351.35 359.38], High: [352.76 355.43 351.35 359.38], Low: [352.76 355.43 351.35 359.38], Close: [352.76 355.43 351.35 359.38]}
}
func ExampleFundCandlesRequest_get() {
ctx := context.TODO()
fcr, err := FundCandles().Resolution("D").Symbol("VFINX").From("2023-01-01").To("2023-01-06").Get(ctx)
if err != nil {
fmt.Print(err)
return
}
for _, candle := range fcr {
fmt.Println(candle)
}
// Output: Candle{Date: 2023-01-03, Open: 352.76, High: 352.76, Low: 352.76, Close: 352.76}
// Candle{Date: 2023-01-04, Open: 355.43, High: 355.43, Low: 355.43, Close: 355.43}
// Candle{Date: 2023-01-05, Open: 351.35, High: 351.35, Low: 351.35, Close: 351.35}
// Candle{Date: 2023-01-06, Open: 359.38, High: 359.38, Low: 359.38, Close: 359.38}
}