mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
pkg/exchange: rename OpenOrders to Orders
This commit is contained in:
parent
270283d027
commit
d8b8e7f2ac
|
@ -9,13 +9,13 @@ import (
|
|||
//go:generate -command GetRequest requestgen -method GET -responseType .APIResponse -responseDataField Result
|
||||
//go:generate -command PostRequest requestgen -method POST -responseType .APIResponse -responseDataField Result
|
||||
|
||||
type OpenOrdersResponse struct {
|
||||
List []OpenOrder `json:"list"`
|
||||
NextPageCursor string `json:"nextPageCursor"`
|
||||
Category string `json:"category"`
|
||||
type OrdersResponse struct {
|
||||
List []Order `json:"list"`
|
||||
NextPageCursor string `json:"nextPageCursor"`
|
||||
Category string `json:"category"`
|
||||
}
|
||||
|
||||
type OpenOrder struct {
|
||||
type Order struct {
|
||||
OrderId string `json:"orderId"`
|
||||
OrderLinkId string `json:"orderLinkId"`
|
||||
BlockTradeId string `json:"blockTradeId"`
|
||||
|
@ -59,7 +59,7 @@ type OpenOrder struct {
|
|||
UpdatedTime types.MillisecondTimestamp `json:"updatedTime"`
|
||||
}
|
||||
|
||||
//go:generate GetRequest -url "/v5/order/realtime" -type GetOpenOrdersRequest -responseDataType .OpenOrdersResponse
|
||||
//go:generate GetRequest -url "/v5/order/realtime" -type GetOpenOrdersRequest -responseDataType .OrdersResponse
|
||||
type GetOpenOrdersRequest struct {
|
||||
client requestgen.AuthenticatedAPIClient
|
||||
|
||||
|
@ -75,6 +75,8 @@ type GetOpenOrdersRequest struct {
|
|||
cursor *string `param:"cursor,query"`
|
||||
}
|
||||
|
||||
// NewGetOpenOrderRequest queries unfilled or partially filled orders in real-time. To query older order records,
|
||||
// please use the order history interface.
|
||||
func (c *RestClient) NewGetOpenOrderRequest() *GetOpenOrdersRequest {
|
||||
return &GetOpenOrdersRequest{
|
||||
client: c,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Code generated by "requestgen -method GET -responseType .APIResponse -responseDataField Result -url /v5/order/realtime -type GetOpenOrdersRequest -responseDataType .OpenOrdersResponse"; DO NOT EDIT.
|
||||
// Code generated by "requestgen -method GET -responseType .APIResponse -responseDataField Result -url /v5/order/realtime -type GetOpenOrdersRequest -responseDataType .OrdersResponse"; DO NOT EDIT.
|
||||
|
||||
package bybitapi
|
||||
|
||||
|
@ -258,7 +258,7 @@ func (g *GetOpenOrdersRequest) GetSlugsMap() (map[string]string, error) {
|
|||
return slugs, nil
|
||||
}
|
||||
|
||||
func (g *GetOpenOrdersRequest) Do(ctx context.Context) (*OpenOrdersResponse, error) {
|
||||
func (g *GetOpenOrdersRequest) Do(ctx context.Context) (*OrdersResponse, error) {
|
||||
|
||||
// no body params
|
||||
var params interface{}
|
||||
|
@ -283,7 +283,7 @@ func (g *GetOpenOrdersRequest) Do(ctx context.Context) (*OpenOrdersResponse, err
|
|||
if err := response.DecodeJSON(&apiResponse); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var data OpenOrdersResponse
|
||||
var data OrdersResponse
|
||||
if err := json.Unmarshal(apiResponse.Result, &data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ func toGlobalTicker(stats bybitapi.Ticker, time time.Time) types.Ticker {
|
|||
}
|
||||
}
|
||||
|
||||
func toGlobalOrder(order bybitapi.OpenOrder) (*types.Order, error) {
|
||||
func toGlobalOrder(order bybitapi.Order) (*types.Order, error) {
|
||||
side, err := toGlobalSideType(order.Side)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -178,7 +178,7 @@ func TestToGlobalOrder(t *testing.T) {
|
|||
// "UpdatedTime": "2023-07-25 17:12:57.868 +0800 CST"
|
||||
//}
|
||||
timeNow := time.Now()
|
||||
openOrder := bybitapi.OpenOrder{
|
||||
openOrder := bybitapi.Order{
|
||||
OrderId: "1472539279335923200",
|
||||
OrderLinkId: "1690276361150",
|
||||
BlockTradeId: "",
|
||||
|
|
Loading…
Reference in New Issue
Block a user