package okexapi import ( "github.com/c9s/requestgen" "github.com/c9s/bbgo/pkg/fixedpoint" "github.com/c9s/bbgo/pkg/types" ) //go:generate -command GetRequest requestgen -method GET -responseType .APIResponse -responseDataField Data //go:generate -command PostRequest requestgen -method POST -responseType .APIResponse -responseDataField Data type MarketTicker struct { InstrumentType string `json:"instType"` InstrumentID string `json:"instId"` // last traded price Last fixedpoint.Value `json:"last"` // last traded size LastSize fixedpoint.Value `json:"lastSz"` AskPrice fixedpoint.Value `json:"askPx"` AskSize fixedpoint.Value `json:"askSz"` BidPrice fixedpoint.Value `json:"bidPx"` BidSize fixedpoint.Value `json:"bidSz"` Open24H fixedpoint.Value `json:"open24h"` High24H fixedpoint.Value `json:"high24H"` Low24H fixedpoint.Value `json:"low24H"` Volume24H fixedpoint.Value `json:"vol24h"` VolumeCurrency24H fixedpoint.Value `json:"volCcy24h"` // Millisecond timestamp Timestamp types.MillisecondTimestamp `json:"ts"` } //go:generate GetRequest -url "/api/v5/market/tickers" -type GetTickersRequest -responseDataType []MarketTicker type GetTickersRequest struct { client requestgen.APIClient instType InstrumentType `param:"instType,query" validValues:"SPOT"` } func (c *RestClient) NewGetTickersRequest() *GetTickersRequest { return &GetTickersRequest{ client: c, instType: InstrumentTypeSpot, } }