Cryptocurrency
Cryptocurrency market data uses SecType: "CC". Candlestick bars and current timelines are supported; historical cryptocurrency timelines are not supported.
GetKline
GetKlineSignature
func (c *QuoteClient) GetKline(req model.KlineRequest) ([]model.Kline, error)Parameters
model.KlineRequest
| SDK field | Type | Default | Constraints/description |
|---|---|---|---|
Symbols | []string | Omitted when nil | Cryptocurrency symbols |
Period | string | Omitted when empty | Candlestick period |
Right | string | Omitted when empty | Adjustment type |
BeginTime | int64 | Omitted when 0 | Millisecond timestamp; cannot be combined with BeginIndex or EndIndex |
EndTime | int64 | Omitted when 0 | Millisecond timestamp; cannot be combined with BeginIndex or EndIndex |
Limit | int | Omitted when 0 | Result count |
BeginIndex | int | Omitted when 0 | Index-range start; cannot be combined with BeginTime or EndTime |
EndIndex | int | Omitted when 0 | Index-range end; cannot be combined with BeginTime or EndTime |
PageToken | string | Omitted when empty | Pagination cursor |
TradeSession | string | Omitted when empty | Trading session |
Date | string | Omitted when empty | Date |
WithFundamental | *bool | nil | Whether to include fundamental data |
SecType | string | Omitted when empty | Must be CC |
Lang | string | Omitted when empty | Language |
Returns
([]model.Kline, error)
Each model.Kline:
| Field | Type | Description |
|---|---|---|
Symbol | string | Cryptocurrency symbol |
Period | string | Bar period |
NextPageToken | string | Next-page cursor |
Items | []model.KlineItem | Bars |
Each Items element (model.KlineItem):
| Field | Type | Description |
|---|---|---|
Time | int64 | Bar timestamp in milliseconds |
Volume | int64 | Integer volume; use when VolumeDecimal is nil |
VolumeDecimal | *float64 | Optional fractional cryptocurrency volume |
Open | float64 | Open price |
Close | float64 | Close price |
High | float64 | High price |
Low | float64 | Low price |
Amount | float64 | Turnover amount |
Invocation example
package main
import (
"fmt"
"log"
"github.com/tigerfintech/openapi-go-sdk/config"
"github.com/tigerfintech/openapi-go-sdk/model"
"github.com/tigerfintech/openapi-go-sdk/quote"
)
func main() {
cfg, err := config.NewClientConfig()
if err != nil {
log.Fatal(err)
}
qc := quote.NewQuoteClientFromConfig(cfg)
result, err := qc.GetKline(model.KlineRequest{
Symbols: []string{"BTC.USD"},
SecType: "CC",
Period: "day",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)
}Rate limit
The base rate limit is 60 requests/min.
GetKlineByPage
GetKlineByPageSignature
func (c *QuoteClient) GetKlineByPage(req model.KlineByPageRequest) ([]model.KlineItem, error)This client-side pagination method passes SecType to every page request and returns merged items in ascending time order.
Parameters
model.KlineByPageRequest
| SDK field | Type | Default | Description |
|---|---|---|---|
Symbol | string | Omitted when empty | Cryptocurrency symbol |
SecType | string | Omitted when empty | Must be CC |
Period | string | Omitted when empty | Candlestick period |
BeginTime | int64 | The SDK sends -1 when unset | Millisecond timestamp |
EndTime | int64 | The SDK sends -1 when unset | Millisecond timestamp |
TotalSize | int | 1000 when <= 0 | Total desired result count |
PageSize | int | 200 when <= 0 | Result count per page |
Right | string | Omitted when empty | Adjustment type |
Lang | string | Omitted when empty | Language |
TradeSession | string | Omitted when empty | Trading session |
Returns
([]model.KlineItem, error)
Each returned model.KlineItem:
| Field | Type | Description |
|---|---|---|
Time | int64 | Bar timestamp in milliseconds |
Volume | int64 | Integer volume; use when VolumeDecimal is nil |
VolumeDecimal | *float64 | Optional fractional cryptocurrency volume |
Open | float64 | Open price |
Close | float64 | Close price |
High | float64 | High price |
Low | float64 | Low price |
Amount | float64 | Turnover amount |
Invocation example
package main
import (
"fmt"
"log"
"github.com/tigerfintech/openapi-go-sdk/config"
"github.com/tigerfintech/openapi-go-sdk/model"
"github.com/tigerfintech/openapi-go-sdk/quote"
)
func main() {
cfg, err := config.NewClientConfig()
if err != nil {
log.Fatal(err)
}
qc := quote.NewQuoteClientFromConfig(cfg)
result, err := qc.GetKlineByPage(model.KlineByPageRequest{
Symbol: "BTC.USD",
SecType: "CC",
Period: "day",
TotalSize: 100,
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)
}GetTimelineByReq
GetTimelineByReqSignature
func (c *QuoteClient) GetTimelineByReq(req model.TimelineRequest) ([]model.Timeline, error)Retrieves current cryptocurrency timeline data only. It does not provide historical cryptocurrency timelines.
Parameters
| SDK field | Type | Description |
|---|---|---|
Symbols | []string | Cryptocurrency symbols |
SecType | string | Must be CC |
Returns
([]model.Timeline, error)
Each model.Timeline:
| Field | Type | Description |
|---|---|---|
Symbol | string | Cryptocurrency symbol |
Period | string | Timeline period |
PreClose | float64 | Previous close |
Intraday | *model.TimelineBucket | Optional intraday bucket |
PreHours | *model.TimelineBucket | Optional pre-market bucket |
AfterHours | *model.TimelineBucket | Optional after-hours bucket |
Each non-nil model.TimelineBucket:
| Field | Type | Description |
|---|---|---|
Items | []model.TimelineItem | Timeline points |
Each Items element (model.TimelineItem):
| Field | Type | Description |
|---|---|---|
Time | int64 | Point timestamp in milliseconds |
Volume | int64 | Integer volume; use when VolumeDecimal is nil |
VolumeDecimal | *float64 | Optional fractional cryptocurrency volume |
Price | float64 | Price |
AvgPrice | float64 | Average price |
Invocation example
package main
import (
"fmt"
"log"
"github.com/tigerfintech/openapi-go-sdk/config"
"github.com/tigerfintech/openapi-go-sdk/model"
"github.com/tigerfintech/openapi-go-sdk/quote"
)
func main() {
cfg, err := config.NewClientConfig()
if err != nil {
log.Fatal(err)
}
qc := quote.NewQuoteClientFromConfig(cfg)
result, err := qc.GetTimelineByReq(model.TimelineRequest{
Symbols: []string{"BTC.USD"},
SecType: "CC",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%#v\n", result)
}Rate limit
The base rate limit is 120 requests/min.
Updated about 14 hours ago
