mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 15:11:03 +00:00
common: remove SimpleTimeFormat const for time package layout const DateTime (#1246)
* switch over to package defined const for time layout * bump appveyor playa * bumperino to latest while setting patherino * whoooops * bump VS version set GOROOT * puge build cache * Revert "puge build cache" This reverts commit 315bb578afc19529457f435e52af2172f5143bc5. * bumperino to test * purge setting of golang directory for version and allow default * purge cache state when file change * whoops * thrasher: nits * don't need to flusherino the cacherino --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
This commit is contained in:
@@ -73,8 +73,7 @@ const (
|
||||
withdrawHistory = "/sapi/v1/capital/withdraw/history"
|
||||
depositAddress = "/sapi/v1/capital/deposit/address"
|
||||
|
||||
defaultRecvWindow = 5 * time.Second
|
||||
binanceSAPITimeLayout = "2006-01-02 15:04:05"
|
||||
defaultRecvWindow = 5 * time.Second
|
||||
)
|
||||
|
||||
// GetInterestHistory gets interest history for currency/currencies provided
|
||||
|
||||
@@ -115,23 +115,6 @@ func TestWrapperGetServerTime(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseSAPITime(t *testing.T) {
|
||||
t.Parallel()
|
||||
tm, err := time.Parse(binanceSAPITimeLayout, "2021-05-27 03:56:46")
|
||||
if err != nil {
|
||||
t.Fatal(tm)
|
||||
}
|
||||
tm = tm.UTC()
|
||||
if tm.Year() != 2021 ||
|
||||
tm.Month() != 5 ||
|
||||
tm.Day() != 27 ||
|
||||
tm.Hour() != 3 ||
|
||||
tm.Minute() != 56 ||
|
||||
tm.Second() != 46 {
|
||||
t.Fatal("incorrect values")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateTicker(t *testing.T) {
|
||||
t.Parallel()
|
||||
r, err := b.UpdateTicker(context.Background(), testPairMapping, asset.Spot)
|
||||
|
||||
@@ -107,8 +107,7 @@ const (
|
||||
userAccountStream = "/api/v3/userDataStream"
|
||||
|
||||
// Other Consts
|
||||
defaultRecvWindow = 5 * time.Second
|
||||
binanceUSAPITimeLayout = "2006-01-02 15:04:05"
|
||||
defaultRecvWindow = 5 * time.Second
|
||||
|
||||
// recvWindowSize5000
|
||||
recvWindowSize5000 = 5000
|
||||
|
||||
@@ -502,7 +502,7 @@ func (bi *Binanceus) GetWithdrawalsHistory(ctx context.Context, c currency.Code,
|
||||
}
|
||||
resp := make([]exchange.WithdrawalHistory, len(withdrawals))
|
||||
for i := range withdrawals {
|
||||
tm, err := time.Parse(binanceUSAPITimeLayout, withdrawals[i].ApplyTime)
|
||||
tm, err := time.Parse(time.DateTime, withdrawals[i].ApplyTime)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ func (b *Bithumb) GetOrders(ctx context.Context, orderID, transactionType string
|
||||
}
|
||||
|
||||
if !after.IsZero() {
|
||||
params.Set("after", after.Format(common.SimpleTimeFormat))
|
||||
params.Set("after", after.Format(time.DateTime))
|
||||
}
|
||||
|
||||
return response,
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
const (
|
||||
wsEndpoint = "wss://pubwss.bithumb.com/pub/ws"
|
||||
tickerTimeLayout = "20060102150405"
|
||||
tradeTimeLayout = "2006-01-02 15:04:05.000000"
|
||||
tradeTimeLayout = time.DateTime + ".000000"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -478,7 +478,7 @@ func (b *Bithumb) GetRecentTrades(ctx context.Context, p currency.Pair, assetTyp
|
||||
return nil, err
|
||||
}
|
||||
var t time.Time
|
||||
t, err = time.Parse(common.SimpleTimeFormat, tradeData.Data[i].TransactionDate)
|
||||
t, err = time.Parse(time.DateTime, tradeData.Data[i].TransactionDate)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ func (b *Bitstamp) GetOrderInfo(ctx context.Context, orderID string, _ currency.
|
||||
Amount: o.Transactions[i].BTC,
|
||||
}
|
||||
}
|
||||
orderDate, err := time.Parse(common.SimpleTimeFormat, o.DateTime)
|
||||
orderDate, err := time.Parse(time.DateTime, o.DateTime)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -613,5 +613,5 @@ func (b *BTSE) calculateTradingFee(ctx context.Context, feeBuilder *exchange.Fee
|
||||
}
|
||||
|
||||
func parseOrderTime(timeStr string) (time.Time, error) {
|
||||
return time.Parse(common.SimpleTimeFormat, timeStr)
|
||||
return time.Parse(time.DateTime, timeStr)
|
||||
}
|
||||
|
||||
@@ -580,8 +580,8 @@ func (h *IntervalRangeHolder) createDateSummaryRange(start, end time.Time, hasDa
|
||||
|
||||
return fmt.Sprintf("%s data between %s and %s",
|
||||
dataString,
|
||||
start.Format(common.SimpleTimeFormat),
|
||||
end.Format(common.SimpleTimeFormat))
|
||||
start.Format(time.DateTime),
|
||||
end.Format(time.DateTime))
|
||||
}
|
||||
|
||||
// CreateIntervalTime is a simple helper function to set the time twice
|
||||
|
||||
@@ -892,7 +892,7 @@ func (p *Poloniex) processAccountOrderLimit(notification []interface{}) error {
|
||||
}
|
||||
|
||||
var timeParse time.Time
|
||||
timeParse, err = time.Parse(common.SimpleTimeFormat, ts)
|
||||
timeParse, err = time.Parse(time.DateTime, ts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1030,7 +1030,7 @@ func (p *Poloniex) processAccountTrades(notification []interface{}) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("%w time not string", errTypeAssertionFailure)
|
||||
}
|
||||
timeParse, err := time.Parse(common.SimpleTimeFormat, t)
|
||||
timeParse, err := time.Parse(time.DateTime, t)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ allTrades:
|
||||
}
|
||||
for i := range tradeData {
|
||||
var tt time.Time
|
||||
tt, err = time.Parse(common.SimpleTimeFormat, tradeData[i].Date)
|
||||
tt, err = time.Parse(time.DateTime, tradeData[i].Date)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -765,7 +765,7 @@ func (p *Poloniex) GetOrderInfo(ctx context.Context, orderID string, pair curren
|
||||
return nil, err
|
||||
}
|
||||
tradeHistory.TID = trades[i].GlobalTradeID
|
||||
tradeHistory.Timestamp, err = time.Parse(common.SimpleTimeFormat, trades[i].Date)
|
||||
tradeHistory.Timestamp, err = time.Parse(time.DateTime, trades[i].Date)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -801,7 +801,7 @@ func (p *Poloniex) GetOrderInfo(ctx context.Context, orderID string, pair curren
|
||||
return nil, err
|
||||
}
|
||||
|
||||
orderInfo.Date, err = time.Parse(common.SimpleTimeFormat, resp.Date)
|
||||
orderInfo.Date, err = time.Parse(time.DateTime, resp.Date)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -953,7 +953,7 @@ func (p *Poloniex) GetActiveOrders(ctx context.Context, req *order.MultiOrderReq
|
||||
return nil, err
|
||||
}
|
||||
var orderDate time.Time
|
||||
orderDate, err = time.Parse(common.SimpleTimeFormat, resp.Data[key][i].Date)
|
||||
orderDate, err = time.Parse(time.DateTime, resp.Data[key][i].Date)
|
||||
if err != nil {
|
||||
log.Errorf(log.ExchangeSys,
|
||||
"Exchange %v Func %v Order %v Could not parse date to unix with value of %v",
|
||||
@@ -1011,7 +1011,7 @@ func (p *Poloniex) GetOrderHistory(ctx context.Context, req *order.MultiOrderReq
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
orderDate, err := time.Parse(common.SimpleTimeFormat,
|
||||
orderDate, err := time.Parse(time.DateTime,
|
||||
resp.Data[key][i].Date)
|
||||
if err != nil {
|
||||
log.Errorf(log.ExchangeSys,
|
||||
|
||||
Reference in New Issue
Block a user