mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-06 15:10:59 +00:00
exchanges: Refactor time handling and other minor improvements (#1948)
* exchanges: Refactor time handling and other minor improvements - Updated Kraken wrapper to utilise new time handling methods. - Simplified Kucoin types by removing unnecessary structures and using direct JSON unmarshalling. - Improved websocket handling in Kucoin to directly parse candlestick data. - Modified Lbank types to use the new time representation. - Adjusted Poloniex wrapper and types to utilise the new time handling. - Updated Yobit types and wrapper to reflect changes in time representation. - Introduced DateTime type for better handling of specific time formats. - Added tests for DateTime unmarshalling to ensure correctness. - Rid UTC().Unix and UTC().UnixMilli as it's not needed - Correct Huobi timestamp usage for some endpoints. - Rid RFC3339 time parsing since Go does that automatically. * exchanges: Refactor JSON unmarshalling for various types and improve test coverage * linter: Update error message in TestGetKlines * refactor: Simplify JSON unmarshalling in MovementHistory and improve test assertions in GetKlines * refactor: Improve JSON unmarshalling for channel name and clarify comment in wsProcessOpenOrders * refactor: Update time handling in Huobi types to use types.Time for createdAt fields and relax GetLiquidationOrders test * refactor: Move wsTicker, wsSpread, wsTrades, and wsCandle types to kraken_types.go for better organistion * refactor: Add validation for underlying parameter in GetExpirationTime and update tests
This commit is contained in:
@@ -177,9 +177,9 @@ const (
|
||||
|
||||
// PremiumInfo represents data on premiums for the past 6 months.
|
||||
type PremiumInfo struct {
|
||||
InstrumentID string `json:"instId"`
|
||||
Premium string `json:"premium"`
|
||||
Timestamp string `json:"ts"`
|
||||
InstrumentID string `json:"instId"`
|
||||
Premium string `json:"premium"`
|
||||
Timestamp types.Time `json:"ts"`
|
||||
}
|
||||
|
||||
// TickerResponse represents the detailed data from the market ticker endpoint.
|
||||
@@ -823,13 +823,13 @@ func (arg *PlaceOrderRequestParam) Validate() error {
|
||||
|
||||
// OrderData response message for place, cancel, and amend an order requests.
|
||||
type OrderData struct {
|
||||
OrderID string `json:"ordId"`
|
||||
RequestID string `json:"reqId"`
|
||||
ClientOrderID string `json:"clOrdId"`
|
||||
Tag string `json:"tag"`
|
||||
StatusCode int64 `json:"sCode,string"` // Anything above 0 is an error with an attached message
|
||||
StatusMessage string `json:"sMsg"`
|
||||
Timestamp string `json:"ts"`
|
||||
OrderID string `json:"ordId"`
|
||||
RequestID string `json:"reqId"`
|
||||
ClientOrderID string `json:"clOrdId"`
|
||||
Tag string `json:"tag"`
|
||||
StatusCode int64 `json:"sCode,string"` // Anything above 0 is an error with an attached message
|
||||
StatusMessage string `json:"sMsg"`
|
||||
Timestamp types.Time `json:"ts"`
|
||||
}
|
||||
|
||||
func (o *OrderData) Error() error {
|
||||
@@ -3050,7 +3050,7 @@ type SpreadTrade struct {
|
||||
State string `json:"state"`
|
||||
Side string `json:"side"`
|
||||
ExecType string `json:"execType"`
|
||||
Timestamp string `json:"ts"`
|
||||
Timestamp types.Time `json:"ts"`
|
||||
Legs []struct {
|
||||
InstrumentID string `json:"instId"`
|
||||
Price types.Number `json:"px"`
|
||||
|
||||
Reference in New Issue
Block a user