switch package name

This commit is contained in:
yyasha 2024-06-03 23:07:14 +03:00
parent 8a4f616e98
commit 978ab02672
25 changed files with 41 additions and 86 deletions

View File

@ -1,28 +0,0 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...

8
.idea/.gitignore vendored
View File

@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/bybit.go.api.iml" filepath="$PROJECT_DIR$/.idea/bybit.go.api.iml" />
</modules>
</component>
</project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -2,8 +2,9 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type AccountClient struct { type AccountClient struct {

View File

@ -2,8 +2,9 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type AssetClient struct { type AssetClient struct {
@ -471,6 +472,7 @@ func (s *AssetClient) GetWithdrawalAmount(ctx context.Context, opts ...RequestOp
} }
return res, nil return res, nil
} }
func (s *AssetClient) GetWithdrawalRecords(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) { func (s *AssetClient) GetWithdrawalRecords(ctx context.Context, opts ...RequestOption) (res *ServerResponse, err error) {
r := &request{ r := &request{
method: http.MethodGet, method: http.MethodGet,

View File

@ -2,8 +2,9 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type BrokerServiceClient struct { type BrokerServiceClient struct {

View File

@ -14,9 +14,9 @@ import (
"strconv" "strconv"
"time" "time"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
"github.com/bitly/go-simplejson" "github.com/bitly/go-simplejson"
jsoniter "github.com/json-iterator/go" jsoniter "github.com/json-iterator/go"
"github.com/wuhewuhe/bybit.go.api/handlers"
) )
var json = jsoniter.ConfigCompatibleWithStandardLibrary var json = jsoniter.ConfigCompatibleWithStandardLibrary
@ -199,9 +199,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption)
c.debug("response status code: %d", res.StatusCode) c.debug("response status code: %d", res.StatusCode)
if res.StatusCode >= http.StatusBadRequest { if res.StatusCode >= http.StatusBadRequest {
var ( apiErr := new(handlers.APIError)
apiErr = new(handlers.APIError)
)
e := json.Unmarshal(data, apiErr) e := json.Unmarshal(data, apiErr)
if e != nil { if e != nil {
c.debug("failed to unmarshal json: %s", e) c.debug("failed to unmarshal json: %s", e)
@ -310,7 +308,6 @@ func (c *Client) NewPositionService(params map[string]interface{}) *PositionClie
c: c, c: c,
params: params, params: params,
} }
} }
func (c *Client) NewPreUpgradeService(params map[string]interface{}) *PreUpgradeClient { func (c *Client) NewPreUpgradeService(params map[string]interface{}) *PreUpgradeClient {

View File

@ -3,7 +3,8 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
bybit "github.com/wuhewuhe/bybit.go.api"
bybit "gitea.computernetthings.ru/yash/bybit.go.api"
) )
func main() { func main() {

View File

@ -3,7 +3,8 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
bybit "github.com/wuhewuhe/bybit.go.api"
bybit "gitea.computernetthings.ru/yash/bybit.go.api"
) )
func main() { func main() {

View File

@ -3,7 +3,8 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
bybit "github.com/wuhewuhe/bybit.go.api"
bybit "gitea.computernetthings.ru/yash/bybit.go.api"
) )
func main() { func main() {

View File

@ -3,7 +3,8 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
bybit "github.com/wuhewuhe/bybit.go.api"
bybit "gitea.computernetthings.ru/yash/bybit.go.api"
) )
func main() { func main() {
@ -12,7 +13,8 @@ func main() {
func PlaceBatchTrade() { func PlaceBatchTrade() {
client := bybit.NewBybitHttpClient("8wYkmpLsMg10eNQyPm", "Ouxc34myDnXvei54XsBZgoQzfGxO4bkr2Zsj", bybit.WithBaseURL(bybit.TESTNET)) client := bybit.NewBybitHttpClient("8wYkmpLsMg10eNQyPm", "Ouxc34myDnXvei54XsBZgoQzfGxO4bkr2Zsj", bybit.WithBaseURL(bybit.TESTNET))
params := map[string]interface{}{"category": "option", params := map[string]interface{}{
"category": "option",
"request": []map[string]interface{}{ "request": []map[string]interface{}{
{ {
"category": "option", "category": "option",

View File

@ -3,7 +3,8 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
bybit "github.com/wuhewuhe/bybit.go.api"
bybit "gitea.computernetthings.ru/yash/bybit.go.api"
) )
func main() { func main() {

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/wuhewuhe/bybit.go.api module gitea.computernetthings.ru/yash/bybit.go.api
go 1.21 go 1.21

1
go.sum
View File

@ -10,7 +10,6 @@ github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=

View File

@ -2,8 +2,9 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type LendingServiceClient struct { type LendingServiceClient struct {

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"github.com/wuhewuhe/bybit.go.api/models" "gitea.computernetthings.ru/yash/bybit.go.api/models"
) )
// MarketKlinesService Market Kline (GET /v5/market/kline) // MarketKlinesService Market Kline (GET /v5/market/kline)

View File

@ -4,8 +4,8 @@ import (
"net/http" "net/http"
"testing" "testing"
"gitea.computernetthings.ru/yash/bybit.go.api/models"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/wuhewuhe/bybit.go.api/models"
) )
type marketTestSuite struct { type marketTestSuite struct {
@ -128,6 +128,7 @@ func (s *marketTestSuite) assertMarketKlineEqual(expected, actual *models.Market
r.Equal(len(expected.List), len(actual.List), "List") r.Equal(len(expected.List), len(actual.List), "List")
r.Equal(expected.List, actual.List) r.Equal(expected.List, actual.List)
} }
func (s *marketTestSuite) TestMarketMarkPriceKline() { func (s *marketTestSuite) TestMarketMarkPriceKline() {
data := []byte(`{ data := []byte(`{
"retCode": 0, "retCode": 0,
@ -1296,6 +1297,7 @@ func (s *marketTestSuite) assertMarketLongShortRatioInfoEqual(expected, actual *
r := s.r() r := s.r()
r.Equal(expected.List, actual.List, "List") r.Equal(expected.List, actual.List, "List")
} }
func (s *marketTestSuite) TestGetServerTime() { func (s *marketTestSuite) TestGetServerTime() {
data := []byte(`{ data := []byte(`{
"retCode": 0, "retCode": 0,

View File

@ -2,8 +2,9 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type PositionClient struct { type PositionClient struct {

View File

@ -2,8 +2,9 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type PreUpgradeClient struct { type PreUpgradeClient struct {

View File

@ -2,8 +2,9 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type SpotLeverageClient struct { type SpotLeverageClient struct {

View File

@ -3,8 +3,9 @@ package bybit_connector
import ( import (
"context" "context"
"errors" "errors"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type SpotMarginClient struct { type SpotMarginClient struct {

View File

@ -2,9 +2,10 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"github.com/wuhewuhe/bybit.go.api/models"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
"gitea.computernetthings.ru/yash/bybit.go.api/models"
) )
type TradeClient struct { type TradeClient struct {

View File

@ -2,8 +2,9 @@ package bybit_connector
import ( import (
"context" "context"
"github.com/wuhewuhe/bybit.go.api/handlers"
"net/http" "net/http"
"gitea.computernetthings.ru/yash/bybit.go.api/handlers"
) )
type UserServiceClient struct { type UserServiceClient struct {