banbox / banexg

A Go library for cryptocurrency trading, whose most interfaces are consistent with [CCXT](https://github.com/ccxt/ccxt).
MIT License
4 stars 0 forks source link

Mac M1 issue #1

Open matigumma opened 3 weeks ago

matigumma commented 3 weeks ago
package main

import (
    "fmt"
    "time"

    binance "github.com/banbox/banexg/binance"
)

func main() {
    symbol := "SOLUSDT"
    timeframe := "5m"
    options := map[string]interface{}{}

    app, err := binance.NewExchange(options)
    if err != nil {
        fmt.Println(err)
    }

    since := time.Now().Add(-30*time.Minute).Unix() * 1000

    ohlcv, err := app.FetchOHLCV(symbol, timeframe, since, 0, nil)
    if err != nil {
        fmt.Println(err)
    }
    fmt.Println(ohlcv)
}

go run main.go
# github.com/banbox/banexg/utils
../go/pkg/mod/github.com/banbox/banexg@v0.2.0/utils/misc.go:248:5: dc.UseInt64 undefined (type *json.Decoder has no field or method UseInt64)

related to this: https://github.com/bytedance/sonic/issues/449

anyongjin commented 3 weeks ago

Thanks for the feedback. I noticed that 449 mentioned that UseInt64 is only valid for the amd64 architecture, so I added the judgment now. UseInt64 is called because Sonic uses float64 when deserializing int64 long integers, resulting in precision loss. So banexg call UseInt64 to force the use of int64 to parse long integers to avoid precision loss. You can test whether there is such behavior under the mac m1 architecture. If you have an optimization solution, you are welcome to submit a merge request. I have added a reminder in the readme

matigumma commented 2 weeks ago

some tests:

image

image

image

image

commented: image

anyongjin commented 2 weeks ago

It seems to be an incompatibility caused by changes in the new version of sonic. It has been fixed. Thanks for the feedback!