Commit Graph

5 Commits

Author SHA1 Message Date
Adrian Gallagher
3cc9a2b9e0 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
2025-07-01 09:11:55 +10:00
Adrian Gallagher
ce134a0a1d types/time, exchanges/kraken: Refactor spot/futures time types (#1936)
* types/time, exchanges/kraken: Refactor spot/futures time types

- Updated WSFuturesTickerData, WsFuturesTradeData, and other related structs to replace int64 timestamps with the new types.Time.
- Adjusted related test cases to accommodate changes in timestamp handling.
- Modified functions in kraken_wrapper and kraken_websocket to utilise the new Time type for better time management.
- Enhanced JSON unmarshalling in the Time type to handle various timestamp formats, including "0" and "0.0".

* refactor: Update JSON field name/types and improve perf

* types/time: revert to more precise check, just check for 'n'

* refactor: Ryan the F1 driver is so back 🏎️

* refactor: Enhance UnmarshalJSON error handling and simplify test cases

* ocd: Fix trigger
2025-06-11 08:43:36 +10:00
Ryan O'Hara-Reid
593644c20f types/time: Update UnmarshalJSON method to handle all timestamp permutations (#1912)
* types/time: handle decimal conversion to whole expected number

* Add padding on all pathways

* ch variable name

* update comment

* Update types/time_test.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* linter: fix

* Update types/time.go

Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>

* gk: nits

* improve; old code is a duplication of strconv.ParseInt

* Update types/time.go

Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>

* Update types/time.go

Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>

* rm extra back ticked back ticks

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
2025-05-19 22:50:25 +10:00
Ryan O'Hara-Reid
b98e82db54 types/time: filter string that cannot be a unix timestamp (#1715)
* types/time: strict usage of time type for usage with unix timestamps

* Update types/time_test.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* @cranktakular: nits

* glorious: nits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
2024-12-04 10:00:09 +11:00
Ryan O'Hara-Reid
d31fa3ff3d types: Add Time type from Gateio and share across codebase (#1648)
* consolidate type to types package and share across code base

* rm convert type and convert codebase

* rm irrelavant test cases

* Fix tests

* glorious nits

* Update exchanges/gateio/gateio_types.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* thrasher: nits

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
2024-10-01 10:46:55 +10:00