remove proxy
This commit is contained in:
parent
0a7f5c8fa2
commit
dd8d3b8a95
@ -17,7 +17,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func FetchOHLCV() {
|
||||
func FetchOHLCV(symbol string, timeframe string, since int64, limit int64, params map[string]interface{}) {
|
||||
|
||||
// 1. 创建 OKX 交易所实例
|
||||
okx := ccxt.NewOkx(map[string]interface{}{
|
||||
@ -50,21 +50,12 @@ func FetchOHLCV() {
|
||||
}
|
||||
|
||||
fmt.Println("OKX 初始化完成,已加载", len(okx.Markets), "个交易对")
|
||||
// 获取ticker数据
|
||||
symbol := "BTC/USDT"
|
||||
|
||||
tf := "1h"
|
||||
sc := int64(1672502400000)
|
||||
lm := int64(1000)
|
||||
pm := map[string]interface{}{
|
||||
"rateLimit": true, // Hypothetical parameter to enable rate limiting
|
||||
}
|
||||
|
||||
ohlcv, err := okx.FetchOHLCV(symbol,
|
||||
ccxt.WithFetchOHLCVSince(sc),
|
||||
ccxt.WithFetchOHLCVTimeframe(tf),
|
||||
ccxt.WithFetchOHLCVLimit(lm),
|
||||
ccxt.WithFetchOHLCVParams(pm))
|
||||
ccxt.WithFetchOHLCVSince(since),
|
||||
ccxt.WithFetchOHLCVTimeframe(timeframe),
|
||||
ccxt.WithFetchOHLCVLimit(limit),
|
||||
ccxt.WithFetchOHLCVParams(params))
|
||||
if err != nil {
|
||||
fmt.Println("Error fetching OHLCV:", err)
|
||||
return
|
||||
|
@ -5,5 +5,12 @@ import (
|
||||
)
|
||||
|
||||
func TestFetchOHLCV(t *testing.T) {
|
||||
FetchOHLCV()
|
||||
symbol := "BTC/USDT"
|
||||
timeframe := "1D"
|
||||
since := int64(1672502400000)
|
||||
limit := int64(100)
|
||||
params := map[string]interface{}{
|
||||
"rateLimit": true,
|
||||
}
|
||||
FetchOHLCV(symbol, timeframe, since, limit, params)
|
||||
}
|
||||
|
@ -54,19 +54,13 @@ func FetchTicker() {
|
||||
// 获取ticker数据
|
||||
symbol := "BTC/USDT"
|
||||
|
||||
// tf := "1h"
|
||||
// sc := int64(1672502400000)
|
||||
// lm := int64(1000)
|
||||
// pm := map[string]interface{}{
|
||||
// "rateLimit": true, // Hypothetical parameter to enable rate limiting
|
||||
// }
|
||||
ticker, err := okx.FetchTicker(symbol)
|
||||
// ticker, err := okx.FetchTicker(symbol,
|
||||
// ccxt.WithFetchTickerParams(map[string]interface{}{}))
|
||||
// opt里具体写什么,得需要看okx官方api的内容要求来定
|
||||
opt := map[string]interface{}{}
|
||||
ticker, err := okx.FetchTicker(symbol,
|
||||
ccxt.WithFetchTickerParams(opt))
|
||||
if err != nil {
|
||||
fmt.Println("获取ticker数据错误:", err)
|
||||
return
|
||||
}
|
||||
fmt.Println("ticker数据:", ticker)
|
||||
|
||||
}
|
||||
|
9
go.mod
9
go.mod
@ -2,10 +2,7 @@ module gitea.zjmud.xyz/phyer/blingo
|
||||
|
||||
go 1.24.0
|
||||
|
||||
require (
|
||||
gitea.zjmud.xyz/ext/ccxt-go v0.0.0-20250228023320-1a2ce7046aca
|
||||
github.com/stretchr/testify v1.9.0
|
||||
)
|
||||
require gitea.zjmud.xyz/ext/ccxt-go v0.0.0-20250228023320-1a2ce7046aca
|
||||
|
||||
require (
|
||||
github.com/bits-and-blooms/bitset v1.13.0 // indirect
|
||||
@ -13,7 +10,6 @@ require (
|
||||
github.com/consensys/gnark-crypto v0.12.1 // indirect
|
||||
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
|
||||
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
|
||||
github.com/ethereum/go-ethereum v1.14.13 // indirect
|
||||
@ -22,14 +18,11 @@ require (
|
||||
github.com/holiman/uint256 v1.3.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.4.1 // indirect
|
||||
github.com/mmcloughlin/addchain v0.4.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/supranational/blst v0.3.13 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
golang.org/x/crypto v0.31.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.28.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
rsc.io/tmplfunc v0.0.3 // indirect
|
||||
)
|
||||
|
11
go.sum
11
go.sum
@ -39,10 +39,6 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/holiman/uint256 v1.3.1 h1:JfTzmih28bittyHM8z360dCjIA9dbPIBlcTI6lmctQs=
|
||||
github.com/holiman/uint256 v1.3.1/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c=
|
||||
@ -60,12 +56,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
|
||||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk=
|
||||
@ -86,9 +78,6 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
|
Loading…
x
Reference in New Issue
Block a user