exchange/okex/api/trade/trade.gen.go

3878 lines
129 KiB
Go
Raw Permalink Normal View History

2024-06-25 16:59:56 +00:00
// Package trade provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/deepmap/oapi-codegen version v1.9.0 DO NOT EDIT.
package trade
import (
"bytes"
"compress/gzip"
"context"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"path"
"strings"
"github.com/deepmap/oapi-codegen/pkg/runtime"
"github.com/getkin/kin-openapi/openapi3"
)
// CancelAlgoOrder defines model for CancelAlgoOrder.
type CancelAlgoOrder struct {
// 必填<br>策略委托单ID
AlgoId string `json:"algoId"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
}
// CancelBatchOrder defines model for CancelBatchOrder.
type CancelBatchOrder struct {
// 可选<br>客户自定义订单ID<br>字母区分大小写与数字的组合可以是纯字母、纯数字且长度要在1-32位之间。
ClOrdId *string `json:"clOrdId,omitempty"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
// 可选<br>订单ID ordId和clOrdId必须传一个若传两个以ordId为主。
OrdId *string `json:"ordId,omitempty"`
}
// PostApiV5TradeAmendBatchOrdersJSONBody defines parameters for PostApiV5TradeAmendBatchOrders.
type PostApiV5TradeAmendBatchOrdersJSONBody struct {
// 可选<br>客户自定义订单ID<br>字母区分大小写与数字的组合可以是纯字母、纯数字且长度要在1-32位之间。
ClOrdId *string `json:"clOrdId,omitempty"`
// 非必填<br>`false`:不自动撤单 `true`:自动撤单 当订单修改失败时,该订单是否需要自动撤销。默认为`false`
CxlOnFail *bool `json:"cxlOnFail,omitempty"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
// 可选<br>修改的新价格
NewPx *string `json:"newPx,omitempty"`
// 可选<br>修改的新数量newSz和newPx不可同时为空。对于部分成交订单该数量应包含已成交数量。
NewSz *string `json:"newSz,omitempty"`
// 可选<br>订单ID ordId和clOrdId必须传一个若传两个以ordId为主。
OrdId *string `json:"ordId,omitempty"`
// 非必填<br>用户自定义修改事件ID字母区分大小写与数字的组合可以是纯字母、纯数字且长度要在1-32位之间。
ReqId *string `json:"reqId,omitempty"`
}
// PostApiV5TradeAmendOrderJSONBody defines parameters for PostApiV5TradeAmendOrder.
type PostApiV5TradeAmendOrderJSONBody struct {
// 可选<br>客户自定义订单ID<br>字母区分大小写与数字的组合可以是纯字母、纯数字且长度要在1-32位之间。
ClOrdId *string `json:"clOrdId,omitempty"`
// 非必填<br>`false`:不自动撤单 `true`:自动撤单 当订单修改失败时,该订单是否需要自动撤销。默认为`false`
CxlOnFail *bool `json:"cxlOnFail,omitempty"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
// 可选<br>修改的新价格
NewPx *string `json:"newPx,omitempty"`
// 可选<br>修改的新数量newSz和newPx不可同时为空。对于部分成交订单该数量应包含已成交数量。
NewSz *string `json:"newSz,omitempty"`
// 可选<br>订单ID ordId和clOrdId必须传一个若传两个以ordId为主。
OrdId *string `json:"ordId,omitempty"`
// 非必填<br>用户自定义修改事件ID字母区分大小写与数字的组合可以是纯字母、纯数字且长度要在1-32位之间。
ReqId *string `json:"reqId,omitempty"`
}
// PostApiV5TradeBatchOrdersJSONBody defines parameters for PostApiV5TradeBatchOrders.
type PostApiV5TradeBatchOrdersJSONBody struct {
// 非必填<br>保证金币种USDT<br>仅适用于单币种保证金模式下的全仓杠杆订单
Ccy *string `json:"ccy,omitempty"`
// 非必填<br>客户自定义订单ID<br>字母区分大小写与数字的组合可以是纯字母、纯数字且长度要在1-32位之间。
ClOrdId *string `json:"clOrdId,omitempty"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
// 必填<br>订单类型。<br>市价单:`market`<br>限价单:`limit`<br>只做maker单`post_only`<br>全部成交或立即取消:`fok`<br>立即成交并取消剩余:`ioc`<br>市价委托立即成交并取消剩余:`optimal_limit_ioc`(仅适用交割、永续)
OrdType string `json:"ordType"`
// 可选<br>持仓方向<br>在双向持仓模式下必填,且仅可选择 `long` 或 `short`
PosSide *string `json:"posSide,omitempty"`
// 可选<br>委托价格<br>仅适用于`limit`、`post_only`、`fok`、`ioc`类型的订单
Px *string `json:"px,omitempty"`
// 非必填<br>是否只减仓,`true` 或 `false`,默认`false`<br>仅适用于币币杠杆订单
ReduceOnly *bool `json:"reduceOnly,omitempty"`
// 必填<br>订单方向。买:`buy` 卖:`sell`
Side string `json:"side"`
// 必填<br>委托数量
Sz string `json:"sz"`
// 非必填<br>订单标签<br>字母区分大小写与数字的组合可以是纯字母、纯数字且长度在1-8位之间。
Tag *string `json:"tag,omitempty"`
// 必填<br>交易模式<br>保证金模式:`isolated`:逐仓 `cross`<br>全仓非保证金模式:`cash`:非保证金
TdMode string `json:"tdMode"`
// 非必填<br>市价单委托数量的类型<br>交易货币:`base_ccy`<br>计价货币:`quote_ccy`<br>仅适用于币币订单
TgtCcy *string `json:"tgtCcy,omitempty"`
}
// PostApiV5TradeCancelAdvanceAlgosJSONBody defines parameters for PostApiV5TradeCancelAdvanceAlgos.
type PostApiV5TradeCancelAdvanceAlgosJSONBody struct {
// 必填<br>策略委托单ID
AlgoId string `json:"algoId"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
}
// PostApiV5TradeCancelAlgosJSONBody defines parameters for PostApiV5TradeCancelAlgos.
type PostApiV5TradeCancelAlgosJSONBody []CancelAlgoOrder
// PostApiV5TradeCancelBatchOrdersJSONBody defines parameters for PostApiV5TradeCancelBatchOrders.
type PostApiV5TradeCancelBatchOrdersJSONBody []CancelBatchOrder
// PostApiV5TradeCancelOrderJSONBody defines parameters for PostApiV5TradeCancelOrder.
type PostApiV5TradeCancelOrderJSONBody struct {
// 可选<br>客户自定义订单ID<br>字母区分大小写与数字的组合可以是纯字母、纯数字且长度要在1-32位之间。
ClOrdId *string `json:"clOrdId,omitempty"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
// 可选<br>订单ID ordId和clOrdId必须传一个若传两个以ordId为主。
OrdId *string `json:"ordId,omitempty"`
}
// PostApiV5TradeClosePositionJSONBody defines parameters for PostApiV5TradeClosePosition.
type PostApiV5TradeClosePositionJSONBody struct {
// 可选<br>保证金币种,如:`USDT`。单币种保证金模式的全仓币币杠杆平仓必填
Ccy *string `json:"ccy,omitempty"`
// 必填<br>产品ID`BTC-USDT-SWAP`
InstId string `json:"instId"`
// 必填<br>保证金模式。全仓:`cross`;逐仓:`isolated`
MgnMode string `json:"mgnMode"`
// 可选<br>持仓方向<br>单向持仓模式下:可不填写此参数,默认值`net`,如果填写,仅可以填写`net`<br>双向持仓模式下: 必须填写此参数,且仅可以填写 `long`:平多 `short`:平空
PosSide *string `json:"posSide,omitempty"`
}
// GetApiV5TradeFillsParams defines parameters for GetApiV5TradeFills.
type GetApiV5TradeFillsParams struct {
// 产品类型<br>`SPOT`:币币<br>`MARGIN`:币币杠杆<br>`SWAP`:永续合约<br>`FUTURES`:交割合约<br>`OPTION`:期权
InstType string `json:"instType"`
// 合约标的指数,如`BTC-USD`
Uly *string `json:"uly,omitempty"`
// 产品ID如`BTC-USDT-SWAP`
InstId *string `json:"instId,omitempty"`
// 订单ID
OrdId *string `json:"ordId,omitempty"`
// 请求此ID之前更旧的数据的分页内容传的值为对应接口的`billId`
After *string `json:"after,omitempty"`
// 请求此ID之后更新的数据的分页内容传的值为对应接口的`billId`
Before *string `json:"before,omitempty"`
// 返回结果的数量默认100条
Limit *string `json:"limit,omitempty"`
}
// GetApiV5TradeFillsHistoryParams defines parameters for GetApiV5TradeFillsHistory.
type GetApiV5TradeFillsHistoryParams struct {
// 产品类型<br>`SPOT`:币币<br>`MARGIN`:币币杠杆<br>`SWAP`:永续合约<br>`FUTURES`:交割合约<br>`OPTION`:期权
InstType string `json:"instType"`
// 合约标的指数,如`BTC-USD`
Uly *string `json:"uly,omitempty"`
// 产品ID如`BTC-USDT-SWAP`
InstId *string `json:"instId,omitempty"`
// 订单ID
OrdId *string `json:"ordId,omitempty"`
// 请求此ID之前更旧的数据的分页内容传的值为对应接口的`billId`
After *string `json:"after,omitempty"`
// 请求此ID之后更新的数据的分页内容传的值为对应接口的`billId`
Before *string `json:"before,omitempty"`
// 返回结果的数量默认100条
Limit *string `json:"limit,omitempty"`
}
// GetApiV5TradeOrderParams defines parameters for GetApiV5TradeOrder.
type GetApiV5TradeOrderParams struct {
// 产品ID如 `BTC-USDT`
InstId string `json:"instId"`
// 订单IDordId和clOrdId必须传一个若传两个以ordId为主
OrdId *string `json:"ordId,omitempty"`
// 用户自定义ID
ClOrdId *string `json:"clOrdId,omitempty"`
}
// PostApiV5TradeOrderJSONBody defines parameters for PostApiV5TradeOrder.
type PostApiV5TradeOrderJSONBody struct {
// 非必填<br>保证金币种USDT<br>仅适用于单币种保证金模式下的全仓杠杆订单
Ccy *string `json:"ccy,omitempty"`
// 非必填<br>客户自定义订单ID<br>字母区分大小写与数字的组合可以是纯字母、纯数字且长度要在1-32位之间。
ClOrdId *string `json:"clOrdId,omitempty"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
// 必填<br>订单类型。<br>市价单:`market`<br>限价单:`limit`<br>只做maker单`post_only`<br>全部成交或立即取消:`fok`<br>立即成交并取消剩余:`ioc`<br>市价委托立即成交并取消剩余:`optimal_limit_ioc`(仅适用交割、永续)
OrdType string `json:"ordType"`
// 可选<br>持仓方向<br>在双向持仓模式下必填,且仅可选择 `long` 或 `short`
PosSide *string `json:"posSide,omitempty"`
// 可选<br>委托价格<br>仅适用于`limit`、`post_only`、`fok`、`ioc`类型的订单
Px *string `json:"px,omitempty"`
// 非必填<br>是否只减仓,`true` 或 `false`,默认`false`<br>仅适用于币币杠杆订单
ReduceOnly *bool `json:"reduceOnly,omitempty"`
// 必填<br>订单方向。买:`buy` 卖:`sell`
Side string `json:"side"`
// 必填<br>委托数量
Sz string `json:"sz"`
// 非必填<br>订单标签<br>字母区分大小写与数字的组合可以是纯字母、纯数字且长度在1-8位之间。
Tag *string `json:"tag,omitempty"`
// 必填<br>交易模式<br>保证金模式:`isolated`:逐仓 `cross`<br>全仓非保证金模式:`cash`:非保证金
TdMode string `json:"tdMode"`
// 非必填<br>市价单委托数量的类型<br>交易货币:`base_ccy`<br>计价货币:`quote_ccy`<br>仅适用于币币订单
TgtCcy *string `json:"tgtCcy,omitempty"`
}
// PostApiV5TradeOrderAlgoJSONBody defines parameters for PostApiV5TradeOrderAlgo.
type PostApiV5TradeOrderAlgoJSONBody struct {
// 非必填<br>保证金币种USDT<br>仅适用于单币种保证金模式下的全仓杠杆订单
Ccy *string `json:"ccy,omitempty"`
// 必填<br>产品ID`BTC-USDT`
InstId string `json:"instId"`
// 必填<br>订单类型。<br>`conditional`:单向止盈止损<br>`oco`:双向止盈止损<br>`trigger`:计划委托<br>`iceberg`:冰山委托<br>`twap`:时间加权委托
OrdType string `json:"ordType"`
// 非必填<br>委托价格<br>委托价格为-1时执行市价委托<br>适用于`计划委托`
OrderPx *string `json:"orderPx,omitempty"`
// 可选<br>持仓方向<br>在双向持仓模式下必填,且仅可选择 `long` 或 `short`
PosSide *string `json:"posSide,omitempty"`
// 非必填<br>挂单限制价<br>适用于`冰山委托`和`时间加权委托`
PxLimit *string `json:"pxLimit,omitempty"`
// 非必填<br>距离盘口的比例价距<br>适用于`冰山委托`和`时间加权委托`
PxSpread *string `json:"pxSpread,omitempty"`
// 非必填<br>距离盘口的比例<br>pxVar和pxSpread只能传入一个<br>适用于`冰山委托`和`时间加权委托`
PxVar *string `json:"pxVar,omitempty"`
// 非必填<br>是否只减仓,`true` 或 `false`,默认`false`<br>仅适用于币币杠杆订单
ReduceOnly *bool `json:"reduceOnly,omitempty"`
// 必填<br>订单方向。买:`buy` 卖:`sell`
Side string `json:"side"`
// 非必填<br>止损委托价,如果填写此参数,必须填写止损触发价<br>委托价格为-1时执行市价止损<br>适用于`止盈止损委托`
SlOrdPx *string `json:"slOrdPx,omitempty"`
// 非必填<br>止损触发价,如果填写此参数,必须填写止损委托价<br>适用于`止盈止损委托`
SlTriggerPx *string `json:"slTriggerPx,omitempty"`
// 必填<br>委托数量
Sz string `json:"sz"`
// 非必填<br>单笔数量<br>适用于`冰山委托`和`时间加权委托`
SzLimit *string `json:"szLimit,omitempty"`
// 必填<br>交易模式<br>保证金模式:`isolated`:逐仓 `cross`<br>全仓非保证金模式:`cash`:非保证金
TdMode string `json:"tdMode"`
// 非必填<br>市价单委托数量的类型<br>交易货币:`base_ccy`<br>计价货币:`quote_ccy`<br>仅适用于币币订单
TgtCcy *string `json:"tgtCcy,omitempty"`
// 非必填<br>挂单限制价<br>适用于`时间加权委托`
TimeInterval *string `json:"timeInterval,omitempty"`
// 非必填<br>止盈委托价,如果填写此参数,必须填写止盈触发价<br>委托价格为-1时执行市价止盈<br>适用于`止盈止损委托`
TpOrdPx *string `json:"tpOrdPx,omitempty"`
// 非必填<br>止盈触发价,如果填写此参数,必须填写止盈委托价<br>适用于`止盈止损委托`
TpTriggerPx *string `json:"tpTriggerPx,omitempty"`
// 非必填<br>计划委托触发价格<br>适用于`计划委托`
TriggerPx *string `json:"triggerPx,omitempty"`
}
// GetApiV5TradeOrdersAlgoHistoryParams defines parameters for GetApiV5TradeOrdersAlgoHistory.
type GetApiV5TradeOrdersAlgoHistoryParams struct {
// 订单类型<br>`conditional`:单向止盈止损,`oco`:双向止盈止损,`trigger`:计划委托,`iceberg`:冰山委托,`twap`:时间加权委托
OrdType string `json:"ordType"`
// 策略委托单ID<br>`state`和`algoId`必填且只能填其一
AlgoId *string `json:"algoId,omitempty"`
// 订单状态<br>`effective`:已生效,`canceled`:已经撤销,`order_failed`:委托失败<br>`state`和`algoId`必填且只能填其一
State *string `json:"state,omitempty"`
// 产品类型<br>`SPOT`:币币<br>`MARGIN`:币币杠杆<br>`SWAP`:永续合约<br>`FUTURES`:交割合约<br>`OPTION`:期权
InstType *string `json:"instType,omitempty"`
// 产品ID如`BTC-USDT-SWAP`
InstId *string `json:"instId,omitempty"`
// 请求此ID之前更旧的数据的分页内容传的值为对应接口的ordId
After *string `json:"after,omitempty"`
// 请求此ID之后更新的数据的分页内容传的值为对应接口的`ordId`
Before *string `json:"before,omitempty"`
// 返回结果的数量默认100条
Limit *string `json:"limit,omitempty"`
}
// GetApiV5TradeOrdersAlgoPendingParams defines parameters for GetApiV5TradeOrdersAlgoPending.
type GetApiV5TradeOrdersAlgoPendingParams struct {
// 订单类型<br>`conditional`:单向止盈止损<br>`oco`:双向止盈止损<br>`trigger`:计划委托<br>`iceberg`:冰山委托<br>`twap`:时间加权委托
OrdType string `json:"ordType"`
// 策略委托单ID
AlgoId *string `json:"algoId,omitempty"`
// 产品类型<br>`SPOT`:币币<br>`MARGIN`:币币杠杆<br>`SWAP`:永续合约<br>`FUTURES`:交割合约<br>`OPTION`:期权
InstType *string `json:"instType,omitempty"`
// 产品ID如`BTC-USDT-SWAP`
InstId *string `json:"instId,omitempty"`
// 请求此ID之前更旧的数据的分页内容传的值为对应接口的ordId
After *string `json:"after,omitempty"`
// 请求此ID之后更新的数据的分页内容传的值为对应接口的ordId
Before *string `json:"before,omitempty"`
// 返回结果的数量默认100条
Limit *string `json:"limit,omitempty"`
}
// GetApiV5TradeOrdersHistoryParams defines parameters for GetApiV5TradeOrdersHistory.
type GetApiV5TradeOrdersHistoryParams struct {
// 产品类型<br>`SPOT`:币币<br>`MARGIN`:币币杠杆<br>`SWAP`:永续合约<br>`FUTURES`:交割合约<br>`OPTION`:期权
InstType string `json:"instType"`
// 合约标的指数,如`BTC-USD`
Uly *string `json:"uly,omitempty"`
// 产品ID如`BTC-USDT-SWAP`
InstId *string `json:"instId,omitempty"`
// 订单类型<br>`market`:市价单<br>`limit`:限价单<br>`post_only`只做maker单<br>`fok`:全部成交或立即取消<br>`ioc`:立即成交并取消剩余<br>`optimal_limit_ioc`:市价委托立即成交并取消剩余(仅适用交割、永续)
OrdType *string `json:"ordType,omitempty"`
// 订单状态<br>`canceled`:撤单成功<br>`filled`:完全成交
State *string `json:"state,omitempty"`
// 订单种类<br>`twap`TWAP自动换币<br>`adl`ADL自动减仓<br>`full_liquidation`:强制平仓<br>`partial_liquidation`:强制减仓<br>`delivery`:交割
Category *string `json:"category,omitempty"`
// 请求此ID之前更旧的数据的分页内容传的值为对应接口的ordId
After *string `json:"after,omitempty"`
// 请求此ID之后更新的数据的分页内容传的值为对应接口的ordId
Before *string `json:"before,omitempty"`
// 返回结果的数量默认100条
Limit *string `json:"limit,omitempty"`
}
// GetApiV5TradeOrdersHistoryArchiveParams defines parameters for GetApiV5TradeOrdersHistoryArchive.
type GetApiV5TradeOrdersHistoryArchiveParams struct {
// 产品类型<br>`SPOT`:币币<br>`MARGIN`:币币杠杆<br>`SWAP`:永续合约<br>`FUTURES`:交割合约<br>`OPTION`:期权
InstType string `json:"instType"`
// 合约标的指数,如`BTC-USD`
Uly *string `json:"uly,omitempty"`
// 产品ID如`BTC-USDT-SWAP`
InstId *string `json:"instId,omitempty"`
// 订单类型<br>`market`:市价单<br>`limit`:限价单<br>`post_only`只做maker单<br>`fok`:全部成交或立即取消<br>`ioc`:立即成交并取消剩余<br>`optimal_limit_ioc`:市价委托立即成交并取消剩余(仅适用交割、永续)
OrdType *string `json:"ordType,omitempty"`
// 订单状态<br>`canceled`:撤单成功<br>`filled`:完全成交
State *string `json:"state,omitempty"`
// 订单种类<br>`twap`TWAP自动换币<br>`adl`ADL自动减仓<br>`full_liquidation`:强制平仓<br>`partial_liquidation`:强制减仓<br>`delivery`:交割
Category *string `json:"category,omitempty"`
// 请求此ID之前更旧的数据的分页内容传的值为对应接口的ordId
After *string `json:"after,omitempty"`
// 请求此ID之后更新的数据的分页内容传的值为对应接口的ordId
Before *string `json:"before,omitempty"`
// 返回结果的数量默认100条
Limit *string `json:"limit,omitempty"`
}
// GetApiV5TradeOrdersPendingParams defines parameters for GetApiV5TradeOrdersPending.
type GetApiV5TradeOrdersPendingParams struct {
// 产品ID如`BTC-USDT-SWAP`
InstId *string `json:"instId,omitempty"`
// 产品类型。<br>`SPOT`:币币<br>`MARGIN`:币币杠杆<br>`SWAP`:永续合约<br>`FUTURES`:交割合约<br>`OPTION`:期权
InstType *string `json:"instType,omitempty"`
// 合约标的指数,如`BTC-USD`
Uly *string `json:"uly,omitempty"`
// 订单类型<br>`market`:市价单<br>`limit`:限价单<br>`post_only`只做maker单<br>`fok`:全部成交或立即取消<br>`ioc`:立即成交并取消剩余<br>`optimal_limit_ioc`:市价委托立即成交并取消剩余(仅适用交割、永续)
OrdType *string `json:"ordType,omitempty"`
}
// PostApiV5TradeAmendBatchOrdersJSONRequestBody defines body for PostApiV5TradeAmendBatchOrders for application/json ContentType.
type PostApiV5TradeAmendBatchOrdersJSONRequestBody = PostApiV5TradeAmendBatchOrdersJSONBody
// PostApiV5TradeAmendOrderJSONRequestBody defines body for PostApiV5TradeAmendOrder for application/json ContentType.
type PostApiV5TradeAmendOrderJSONRequestBody = PostApiV5TradeAmendOrderJSONBody
// PostApiV5TradeBatchOrdersJSONRequestBody defines body for PostApiV5TradeBatchOrders for application/json ContentType.
type PostApiV5TradeBatchOrdersJSONRequestBody = PostApiV5TradeBatchOrdersJSONBody
// PostApiV5TradeCancelAdvanceAlgosJSONRequestBody defines body for PostApiV5TradeCancelAdvanceAlgos for application/json ContentType.
type PostApiV5TradeCancelAdvanceAlgosJSONRequestBody = PostApiV5TradeCancelAdvanceAlgosJSONBody
// PostApiV5TradeCancelAlgosJSONRequestBody defines body for PostApiV5TradeCancelAlgos for application/json ContentType.
type PostApiV5TradeCancelAlgosJSONRequestBody = PostApiV5TradeCancelAlgosJSONBody
// PostApiV5TradeCancelBatchOrdersJSONRequestBody defines body for PostApiV5TradeCancelBatchOrders for application/json ContentType.
type PostApiV5TradeCancelBatchOrdersJSONRequestBody = PostApiV5TradeCancelBatchOrdersJSONBody
// PostApiV5TradeCancelOrderJSONRequestBody defines body for PostApiV5TradeCancelOrder for application/json ContentType.
type PostApiV5TradeCancelOrderJSONRequestBody = PostApiV5TradeCancelOrderJSONBody
// PostApiV5TradeClosePositionJSONRequestBody defines body for PostApiV5TradeClosePosition for application/json ContentType.
type PostApiV5TradeClosePositionJSONRequestBody = PostApiV5TradeClosePositionJSONBody
// PostApiV5TradeOrderJSONRequestBody defines body for PostApiV5TradeOrder for application/json ContentType.
type PostApiV5TradeOrderJSONRequestBody = PostApiV5TradeOrderJSONBody
// PostApiV5TradeOrderAlgoJSONRequestBody defines body for PostApiV5TradeOrderAlgo for application/json ContentType.
type PostApiV5TradeOrderAlgoJSONRequestBody = PostApiV5TradeOrderAlgoJSONBody
// RequestEditorFn is the function signature for the RequestEditor callback function
type RequestEditorFn func(ctx context.Context, req *http.Request) error
// Doer performs HTTP requests.
//
// The standard http.Client implements this interface.
type HttpRequestDoer interface {
Do(req *http.Request) (*http.Response, error)
}
// Client which conforms to the OpenAPI3 specification for this service.
type Client struct {
// The endpoint of the server conforming to this interface, with scheme,
// https://api.deepmap.com for example. This can contain a path relative
// to the server, such as https://api.deepmap.com/dev-test, and all the
// paths in the swagger spec will be appended to the server.
Server string
// Doer for performing requests, typically a *http.Client with any
// customized settings, such as certificate chains.
Client HttpRequestDoer
// A list of callbacks for modifying requests which are generated before sending over
// the network.
RequestEditors []RequestEditorFn
}
// ClientOption allows setting custom parameters during construction
type ClientOption func(*Client) error
// Creates a new Client, with reasonable defaults
func NewClient(server string, opts ...ClientOption) (*Client, error) {
// create a client with sane default values
client := Client{
Server: server,
}
// mutate client and add all optional params
for _, o := range opts {
if err := o(&client); err != nil {
return nil, err
}
}
// ensure the server URL always has a trailing slash
if !strings.HasSuffix(client.Server, "/") {
client.Server += "/"
}
// create httpClient, if not already present
if client.Client == nil {
client.Client = &http.Client{}
}
return &client, nil
}
// WithHTTPClient allows overriding the default Doer, which is
// automatically created using http.Client. This is useful for tests.
func WithHTTPClient(doer HttpRequestDoer) ClientOption {
return func(c *Client) error {
c.Client = doer
return nil
}
}
// WithRequestEditorFn allows setting up a callback function, which will be
// called right before sending the request. This can be used to mutate the request.
func WithRequestEditorFn(fn RequestEditorFn) ClientOption {
return func(c *Client) error {
c.RequestEditors = append(c.RequestEditors, fn)
return nil
}
}
// The interface specification for the client above.
type ClientInterface interface {
// PostApiV5TradeAmendBatchOrders request with any body
PostApiV5TradeAmendBatchOrdersWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeAmendBatchOrders(ctx context.Context, body PostApiV5TradeAmendBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeAmendOrder request with any body
PostApiV5TradeAmendOrderWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeAmendOrder(ctx context.Context, body PostApiV5TradeAmendOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeBatchOrders request with any body
PostApiV5TradeBatchOrdersWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeBatchOrders(ctx context.Context, body PostApiV5TradeBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeCancelAdvanceAlgos request with any body
PostApiV5TradeCancelAdvanceAlgosWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeCancelAdvanceAlgos(ctx context.Context, body PostApiV5TradeCancelAdvanceAlgosJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeCancelAlgos request with any body
PostApiV5TradeCancelAlgosWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeCancelAlgos(ctx context.Context, body PostApiV5TradeCancelAlgosJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeCancelBatchOrders request with any body
PostApiV5TradeCancelBatchOrdersWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeCancelBatchOrders(ctx context.Context, body PostApiV5TradeCancelBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeCancelOrder request with any body
PostApiV5TradeCancelOrderWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeCancelOrder(ctx context.Context, body PostApiV5TradeCancelOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeClosePosition request with any body
PostApiV5TradeClosePositionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeClosePosition(ctx context.Context, body PostApiV5TradeClosePositionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetApiV5TradeFills request
GetApiV5TradeFills(ctx context.Context, params *GetApiV5TradeFillsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetApiV5TradeFillsHistory request
GetApiV5TradeFillsHistory(ctx context.Context, params *GetApiV5TradeFillsHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetApiV5TradeOrder request
GetApiV5TradeOrder(ctx context.Context, params *GetApiV5TradeOrderParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeOrder request with any body
PostApiV5TradeOrderWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeOrder(ctx context.Context, body PostApiV5TradeOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// PostApiV5TradeOrderAlgo request with any body
PostApiV5TradeOrderAlgoWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
PostApiV5TradeOrderAlgo(ctx context.Context, body PostApiV5TradeOrderAlgoJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetApiV5TradeOrdersAlgoHistory request
GetApiV5TradeOrdersAlgoHistory(ctx context.Context, params *GetApiV5TradeOrdersAlgoHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetApiV5TradeOrdersAlgoPending request
GetApiV5TradeOrdersAlgoPending(ctx context.Context, params *GetApiV5TradeOrdersAlgoPendingParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetApiV5TradeOrdersHistory request
GetApiV5TradeOrdersHistory(ctx context.Context, params *GetApiV5TradeOrdersHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetApiV5TradeOrdersHistoryArchive request
GetApiV5TradeOrdersHistoryArchive(ctx context.Context, params *GetApiV5TradeOrdersHistoryArchiveParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// GetApiV5TradeOrdersPending request
GetApiV5TradeOrdersPending(ctx context.Context, params *GetApiV5TradeOrdersPendingParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}
func (c *Client) PostApiV5TradeAmendBatchOrdersWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeAmendBatchOrdersRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeAmendBatchOrders(ctx context.Context, body PostApiV5TradeAmendBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeAmendBatchOrdersRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeAmendOrderWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeAmendOrderRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeAmendOrder(ctx context.Context, body PostApiV5TradeAmendOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeAmendOrderRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeBatchOrdersWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeBatchOrdersRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeBatchOrders(ctx context.Context, body PostApiV5TradeBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeBatchOrdersRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeCancelAdvanceAlgosWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeCancelAdvanceAlgosRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeCancelAdvanceAlgos(ctx context.Context, body PostApiV5TradeCancelAdvanceAlgosJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeCancelAdvanceAlgosRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeCancelAlgosWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeCancelAlgosRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeCancelAlgos(ctx context.Context, body PostApiV5TradeCancelAlgosJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeCancelAlgosRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeCancelBatchOrdersWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeCancelBatchOrdersRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeCancelBatchOrders(ctx context.Context, body PostApiV5TradeCancelBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeCancelBatchOrdersRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeCancelOrderWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeCancelOrderRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeCancelOrder(ctx context.Context, body PostApiV5TradeCancelOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeCancelOrderRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeClosePositionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeClosePositionRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeClosePosition(ctx context.Context, body PostApiV5TradeClosePositionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeClosePositionRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetApiV5TradeFills(ctx context.Context, params *GetApiV5TradeFillsParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetApiV5TradeFillsRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetApiV5TradeFillsHistory(ctx context.Context, params *GetApiV5TradeFillsHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetApiV5TradeFillsHistoryRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetApiV5TradeOrder(ctx context.Context, params *GetApiV5TradeOrderParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetApiV5TradeOrderRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeOrderWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeOrderRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeOrder(ctx context.Context, body PostApiV5TradeOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeOrderRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeOrderAlgoWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeOrderAlgoRequestWithBody(c.Server, contentType, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) PostApiV5TradeOrderAlgo(ctx context.Context, body PostApiV5TradeOrderAlgoJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewPostApiV5TradeOrderAlgoRequest(c.Server, body)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetApiV5TradeOrdersAlgoHistory(ctx context.Context, params *GetApiV5TradeOrdersAlgoHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetApiV5TradeOrdersAlgoHistoryRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetApiV5TradeOrdersAlgoPending(ctx context.Context, params *GetApiV5TradeOrdersAlgoPendingParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetApiV5TradeOrdersAlgoPendingRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetApiV5TradeOrdersHistory(ctx context.Context, params *GetApiV5TradeOrdersHistoryParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetApiV5TradeOrdersHistoryRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetApiV5TradeOrdersHistoryArchive(ctx context.Context, params *GetApiV5TradeOrdersHistoryArchiveParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetApiV5TradeOrdersHistoryArchiveRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
func (c *Client) GetApiV5TradeOrdersPending(ctx context.Context, params *GetApiV5TradeOrdersPendingParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewGetApiV5TradeOrdersPendingRequest(c.Server, params)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
return nil, err
}
return c.Client.Do(req)
}
// NewPostApiV5TradeAmendBatchOrdersRequest calls the generic PostApiV5TradeAmendBatchOrders builder with application/json body
func NewPostApiV5TradeAmendBatchOrdersRequest(server string, body PostApiV5TradeAmendBatchOrdersJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeAmendBatchOrdersRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeAmendBatchOrdersRequestWithBody generates requests for PostApiV5TradeAmendBatchOrders with any type of body
func NewPostApiV5TradeAmendBatchOrdersRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/amend-batch-orders")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewPostApiV5TradeAmendOrderRequest calls the generic PostApiV5TradeAmendOrder builder with application/json body
func NewPostApiV5TradeAmendOrderRequest(server string, body PostApiV5TradeAmendOrderJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeAmendOrderRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeAmendOrderRequestWithBody generates requests for PostApiV5TradeAmendOrder with any type of body
func NewPostApiV5TradeAmendOrderRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/amend-order")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewPostApiV5TradeBatchOrdersRequest calls the generic PostApiV5TradeBatchOrders builder with application/json body
func NewPostApiV5TradeBatchOrdersRequest(server string, body PostApiV5TradeBatchOrdersJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeBatchOrdersRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeBatchOrdersRequestWithBody generates requests for PostApiV5TradeBatchOrders with any type of body
func NewPostApiV5TradeBatchOrdersRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/batch-orders")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewPostApiV5TradeCancelAdvanceAlgosRequest calls the generic PostApiV5TradeCancelAdvanceAlgos builder with application/json body
func NewPostApiV5TradeCancelAdvanceAlgosRequest(server string, body PostApiV5TradeCancelAdvanceAlgosJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeCancelAdvanceAlgosRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeCancelAdvanceAlgosRequestWithBody generates requests for PostApiV5TradeCancelAdvanceAlgos with any type of body
func NewPostApiV5TradeCancelAdvanceAlgosRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/cancel-advance-algos")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewPostApiV5TradeCancelAlgosRequest calls the generic PostApiV5TradeCancelAlgos builder with application/json body
func NewPostApiV5TradeCancelAlgosRequest(server string, body PostApiV5TradeCancelAlgosJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeCancelAlgosRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeCancelAlgosRequestWithBody generates requests for PostApiV5TradeCancelAlgos with any type of body
func NewPostApiV5TradeCancelAlgosRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/cancel-algos")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewPostApiV5TradeCancelBatchOrdersRequest calls the generic PostApiV5TradeCancelBatchOrders builder with application/json body
func NewPostApiV5TradeCancelBatchOrdersRequest(server string, body PostApiV5TradeCancelBatchOrdersJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeCancelBatchOrdersRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeCancelBatchOrdersRequestWithBody generates requests for PostApiV5TradeCancelBatchOrders with any type of body
func NewPostApiV5TradeCancelBatchOrdersRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/cancel-batch-orders")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewPostApiV5TradeCancelOrderRequest calls the generic PostApiV5TradeCancelOrder builder with application/json body
func NewPostApiV5TradeCancelOrderRequest(server string, body PostApiV5TradeCancelOrderJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeCancelOrderRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeCancelOrderRequestWithBody generates requests for PostApiV5TradeCancelOrder with any type of body
func NewPostApiV5TradeCancelOrderRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/cancel-order")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewPostApiV5TradeClosePositionRequest calls the generic PostApiV5TradeClosePosition builder with application/json body
func NewPostApiV5TradeClosePositionRequest(server string, body PostApiV5TradeClosePositionJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeClosePositionRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeClosePositionRequestWithBody generates requests for PostApiV5TradeClosePosition with any type of body
func NewPostApiV5TradeClosePositionRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/close-position")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewGetApiV5TradeFillsRequest generates requests for GetApiV5TradeFills
func NewGetApiV5TradeFillsRequest(server string, params *GetApiV5TradeFillsParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/fills")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
queryValues := queryURL.Query()
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
if params.Uly != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.OrdId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ordId", runtime.ParamLocationQuery, *params.OrdId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.After != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Before != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Limit != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetApiV5TradeFillsHistoryRequest generates requests for GetApiV5TradeFillsHistory
func NewGetApiV5TradeFillsHistoryRequest(server string, params *GetApiV5TradeFillsHistoryParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/fills-history")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
queryValues := queryURL.Query()
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
if params.Uly != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.OrdId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ordId", runtime.ParamLocationQuery, *params.OrdId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.After != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Before != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Limit != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetApiV5TradeOrderRequest generates requests for GetApiV5TradeOrder
func NewGetApiV5TradeOrderRequest(server string, params *GetApiV5TradeOrderParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/order")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
queryValues := queryURL.Query()
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, params.InstId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
if params.OrdId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ordId", runtime.ParamLocationQuery, *params.OrdId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.ClOrdId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "clOrdId", runtime.ParamLocationQuery, *params.ClOrdId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewPostApiV5TradeOrderRequest calls the generic PostApiV5TradeOrder builder with application/json body
func NewPostApiV5TradeOrderRequest(server string, body PostApiV5TradeOrderJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeOrderRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeOrderRequestWithBody generates requests for PostApiV5TradeOrder with any type of body
func NewPostApiV5TradeOrderRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/order")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewPostApiV5TradeOrderAlgoRequest calls the generic PostApiV5TradeOrderAlgo builder with application/json body
func NewPostApiV5TradeOrderAlgoRequest(server string, body PostApiV5TradeOrderAlgoJSONRequestBody) (*http.Request, error) {
var bodyReader io.Reader
buf, err := json.Marshal(body)
if err != nil {
return nil, err
}
bodyReader = bytes.NewReader(buf)
return NewPostApiV5TradeOrderAlgoRequestWithBody(server, "application/json", bodyReader)
}
// NewPostApiV5TradeOrderAlgoRequestWithBody generates requests for PostApiV5TradeOrderAlgo with any type of body
func NewPostApiV5TradeOrderAlgoRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/order-algo")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
req, err := http.NewRequest("POST", queryURL.String(), body)
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", contentType)
return req, nil
}
// NewGetApiV5TradeOrdersAlgoHistoryRequest generates requests for GetApiV5TradeOrdersAlgoHistory
func NewGetApiV5TradeOrdersAlgoHistoryRequest(server string, params *GetApiV5TradeOrdersAlgoHistoryParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/orders-algo-history")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
queryValues := queryURL.Query()
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ordType", runtime.ParamLocationQuery, params.OrdType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
if params.AlgoId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "algoId", runtime.ParamLocationQuery, *params.AlgoId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.State != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstType != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, *params.InstType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.After != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Before != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Limit != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetApiV5TradeOrdersAlgoPendingRequest generates requests for GetApiV5TradeOrdersAlgoPending
func NewGetApiV5TradeOrdersAlgoPendingRequest(server string, params *GetApiV5TradeOrdersAlgoPendingParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/orders-algo-pending")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
queryValues := queryURL.Query()
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ordType", runtime.ParamLocationQuery, params.OrdType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
if params.AlgoId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "algoId", runtime.ParamLocationQuery, *params.AlgoId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstType != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, *params.InstType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.After != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Before != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Limit != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetApiV5TradeOrdersHistoryRequest generates requests for GetApiV5TradeOrdersHistory
func NewGetApiV5TradeOrdersHistoryRequest(server string, params *GetApiV5TradeOrdersHistoryParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/orders-history")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
queryValues := queryURL.Query()
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
if params.Uly != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.OrdType != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ordType", runtime.ParamLocationQuery, *params.OrdType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.State != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Category != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "category", runtime.ParamLocationQuery, *params.Category); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.After != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Before != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Limit != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetApiV5TradeOrdersHistoryArchiveRequest generates requests for GetApiV5TradeOrdersHistoryArchive
func NewGetApiV5TradeOrdersHistoryArchiveRequest(server string, params *GetApiV5TradeOrdersHistoryArchiveParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/orders-history-archive")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
queryValues := queryURL.Query()
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, params.InstType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
if params.Uly != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.OrdType != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ordType", runtime.ParamLocationQuery, *params.OrdType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.State != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Category != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "category", runtime.ParamLocationQuery, *params.Category); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.After != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Before != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "before", runtime.ParamLocationQuery, *params.Before); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Limit != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
// NewGetApiV5TradeOrdersPendingRequest generates requests for GetApiV5TradeOrdersPending
func NewGetApiV5TradeOrdersPendingRequest(server string, params *GetApiV5TradeOrdersPendingParams) (*http.Request, error) {
var err error
serverURL, err := url.Parse(server)
if err != nil {
return nil, err
}
operationPath := fmt.Sprintf("/api/v5/trade/orders-pending")
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
queryURL, err := serverURL.Parse(operationPath)
if err != nil {
return nil, err
}
queryValues := queryURL.Query()
if params.InstId != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instId", runtime.ParamLocationQuery, *params.InstId); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.InstType != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "instType", runtime.ParamLocationQuery, *params.InstType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.Uly != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "uly", runtime.ParamLocationQuery, *params.Uly); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
if params.OrdType != nil {
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ordType", runtime.ParamLocationQuery, *params.OrdType); err != nil {
return nil, err
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
return nil, err
} else {
for k, v := range parsed {
for _, v2 := range v {
queryValues.Add(k, v2)
}
}
}
}
queryURL.RawQuery = queryValues.Encode()
req, err := http.NewRequest("GET", queryURL.String(), nil)
if err != nil {
return nil, err
}
return req, nil
}
func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error {
for _, r := range c.RequestEditors {
if err := r(ctx, req); err != nil {
return err
}
}
for _, r := range additionalEditors {
if err := r(ctx, req); err != nil {
return err
}
}
return nil
}
// ClientWithResponses builds on ClientInterface to offer response payloads
type ClientWithResponses struct {
ClientInterface
}
// NewClientWithResponses creates a new ClientWithResponses, which wraps
// Client with return type handling
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) {
client, err := NewClient(server, opts...)
if err != nil {
return nil, err
}
return &ClientWithResponses{client}, nil
}
// WithBaseURL overrides the baseURL.
func WithBaseURL(baseURL string) ClientOption {
return func(c *Client) error {
newBaseURL, err := url.Parse(baseURL)
if err != nil {
return err
}
c.Server = newBaseURL.String()
return nil
}
}
// ClientWithResponsesInterface is the interface specification for the client with responses above.
type ClientWithResponsesInterface interface {
// PostApiV5TradeAmendBatchOrders request with any body
PostApiV5TradeAmendBatchOrdersWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeAmendBatchOrdersResponse, error)
PostApiV5TradeAmendBatchOrdersWithResponse(ctx context.Context, body PostApiV5TradeAmendBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeAmendBatchOrdersResponse, error)
// PostApiV5TradeAmendOrder request with any body
PostApiV5TradeAmendOrderWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeAmendOrderResponse, error)
PostApiV5TradeAmendOrderWithResponse(ctx context.Context, body PostApiV5TradeAmendOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeAmendOrderResponse, error)
// PostApiV5TradeBatchOrders request with any body
PostApiV5TradeBatchOrdersWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeBatchOrdersResponse, error)
PostApiV5TradeBatchOrdersWithResponse(ctx context.Context, body PostApiV5TradeBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeBatchOrdersResponse, error)
// PostApiV5TradeCancelAdvanceAlgos request with any body
PostApiV5TradeCancelAdvanceAlgosWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelAdvanceAlgosResponse, error)
PostApiV5TradeCancelAdvanceAlgosWithResponse(ctx context.Context, body PostApiV5TradeCancelAdvanceAlgosJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelAdvanceAlgosResponse, error)
// PostApiV5TradeCancelAlgos request with any body
PostApiV5TradeCancelAlgosWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelAlgosResponse, error)
PostApiV5TradeCancelAlgosWithResponse(ctx context.Context, body PostApiV5TradeCancelAlgosJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelAlgosResponse, error)
// PostApiV5TradeCancelBatchOrders request with any body
PostApiV5TradeCancelBatchOrdersWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelBatchOrdersResponse, error)
PostApiV5TradeCancelBatchOrdersWithResponse(ctx context.Context, body PostApiV5TradeCancelBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelBatchOrdersResponse, error)
// PostApiV5TradeCancelOrder request with any body
PostApiV5TradeCancelOrderWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelOrderResponse, error)
PostApiV5TradeCancelOrderWithResponse(ctx context.Context, body PostApiV5TradeCancelOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelOrderResponse, error)
// PostApiV5TradeClosePosition request with any body
PostApiV5TradeClosePositionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeClosePositionResponse, error)
PostApiV5TradeClosePositionWithResponse(ctx context.Context, body PostApiV5TradeClosePositionJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeClosePositionResponse, error)
// GetApiV5TradeFills request
GetApiV5TradeFillsWithResponse(ctx context.Context, params *GetApiV5TradeFillsParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeFillsResponse, error)
// GetApiV5TradeFillsHistory request
GetApiV5TradeFillsHistoryWithResponse(ctx context.Context, params *GetApiV5TradeFillsHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeFillsHistoryResponse, error)
// GetApiV5TradeOrder request
GetApiV5TradeOrderWithResponse(ctx context.Context, params *GetApiV5TradeOrderParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrderResponse, error)
// PostApiV5TradeOrder request with any body
PostApiV5TradeOrderWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeOrderResponse, error)
PostApiV5TradeOrderWithResponse(ctx context.Context, body PostApiV5TradeOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeOrderResponse, error)
// PostApiV5TradeOrderAlgo request with any body
PostApiV5TradeOrderAlgoWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeOrderAlgoResponse, error)
PostApiV5TradeOrderAlgoWithResponse(ctx context.Context, body PostApiV5TradeOrderAlgoJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeOrderAlgoResponse, error)
// GetApiV5TradeOrdersAlgoHistory request
GetApiV5TradeOrdersAlgoHistoryWithResponse(ctx context.Context, params *GetApiV5TradeOrdersAlgoHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersAlgoHistoryResponse, error)
// GetApiV5TradeOrdersAlgoPending request
GetApiV5TradeOrdersAlgoPendingWithResponse(ctx context.Context, params *GetApiV5TradeOrdersAlgoPendingParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersAlgoPendingResponse, error)
// GetApiV5TradeOrdersHistory request
GetApiV5TradeOrdersHistoryWithResponse(ctx context.Context, params *GetApiV5TradeOrdersHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersHistoryResponse, error)
// GetApiV5TradeOrdersHistoryArchive request
GetApiV5TradeOrdersHistoryArchiveWithResponse(ctx context.Context, params *GetApiV5TradeOrdersHistoryArchiveParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersHistoryArchiveResponse, error)
// GetApiV5TradeOrdersPending request
GetApiV5TradeOrdersPendingWithResponse(ctx context.Context, params *GetApiV5TradeOrdersPendingParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersPendingResponse, error)
}
type PostApiV5TradeAmendBatchOrdersResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeAmendBatchOrdersResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeAmendBatchOrdersResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeAmendOrderResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeAmendOrderResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeAmendOrderResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeBatchOrdersResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeBatchOrdersResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeBatchOrdersResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeCancelAdvanceAlgosResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeCancelAdvanceAlgosResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeCancelAdvanceAlgosResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeCancelAlgosResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeCancelAlgosResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeCancelAlgosResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeCancelBatchOrdersResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeCancelBatchOrdersResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeCancelBatchOrdersResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeCancelOrderResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeCancelOrderResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeCancelOrderResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeClosePositionResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeClosePositionResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeClosePositionResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetApiV5TradeFillsResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]interface{}
}
// Status returns HTTPResponse.Status
func (r GetApiV5TradeFillsResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetApiV5TradeFillsResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetApiV5TradeFillsHistoryResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]interface{}
}
// Status returns HTTPResponse.Status
func (r GetApiV5TradeFillsHistoryResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetApiV5TradeFillsHistoryResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetApiV5TradeOrderResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]interface{}
}
// Status returns HTTPResponse.Status
func (r GetApiV5TradeOrderResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetApiV5TradeOrderResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeOrderResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeOrderResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeOrderResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type PostApiV5TradeOrderAlgoResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
}
// Status returns HTTPResponse.Status
func (r PostApiV5TradeOrderAlgoResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r PostApiV5TradeOrderAlgoResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetApiV5TradeOrdersAlgoHistoryResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]interface{}
}
// Status returns HTTPResponse.Status
func (r GetApiV5TradeOrdersAlgoHistoryResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetApiV5TradeOrdersAlgoHistoryResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetApiV5TradeOrdersAlgoPendingResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]interface{}
}
// Status returns HTTPResponse.Status
func (r GetApiV5TradeOrdersAlgoPendingResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetApiV5TradeOrdersAlgoPendingResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetApiV5TradeOrdersHistoryResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]interface{}
}
// Status returns HTTPResponse.Status
func (r GetApiV5TradeOrdersHistoryResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetApiV5TradeOrdersHistoryResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetApiV5TradeOrdersHistoryArchiveResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]interface{}
}
// Status returns HTTPResponse.Status
func (r GetApiV5TradeOrdersHistoryArchiveResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetApiV5TradeOrdersHistoryArchiveResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type GetApiV5TradeOrdersPendingResponse struct {
Body []byte
HTTPResponse *http.Response
JSON200 *map[string]interface{}
}
// Status returns HTTPResponse.Status
func (r GetApiV5TradeOrdersPendingResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r GetApiV5TradeOrdersPendingResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
// PostApiV5TradeAmendBatchOrdersWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeAmendBatchOrdersResponse
func (c *ClientWithResponses) PostApiV5TradeAmendBatchOrdersWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeAmendBatchOrdersResponse, error) {
rsp, err := c.PostApiV5TradeAmendBatchOrdersWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeAmendBatchOrdersResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeAmendBatchOrdersWithResponse(ctx context.Context, body PostApiV5TradeAmendBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeAmendBatchOrdersResponse, error) {
rsp, err := c.PostApiV5TradeAmendBatchOrders(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeAmendBatchOrdersResponse(rsp)
}
// PostApiV5TradeAmendOrderWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeAmendOrderResponse
func (c *ClientWithResponses) PostApiV5TradeAmendOrderWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeAmendOrderResponse, error) {
rsp, err := c.PostApiV5TradeAmendOrderWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeAmendOrderResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeAmendOrderWithResponse(ctx context.Context, body PostApiV5TradeAmendOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeAmendOrderResponse, error) {
rsp, err := c.PostApiV5TradeAmendOrder(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeAmendOrderResponse(rsp)
}
// PostApiV5TradeBatchOrdersWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeBatchOrdersResponse
func (c *ClientWithResponses) PostApiV5TradeBatchOrdersWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeBatchOrdersResponse, error) {
rsp, err := c.PostApiV5TradeBatchOrdersWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeBatchOrdersResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeBatchOrdersWithResponse(ctx context.Context, body PostApiV5TradeBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeBatchOrdersResponse, error) {
rsp, err := c.PostApiV5TradeBatchOrders(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeBatchOrdersResponse(rsp)
}
// PostApiV5TradeCancelAdvanceAlgosWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeCancelAdvanceAlgosResponse
func (c *ClientWithResponses) PostApiV5TradeCancelAdvanceAlgosWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelAdvanceAlgosResponse, error) {
rsp, err := c.PostApiV5TradeCancelAdvanceAlgosWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeCancelAdvanceAlgosResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeCancelAdvanceAlgosWithResponse(ctx context.Context, body PostApiV5TradeCancelAdvanceAlgosJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelAdvanceAlgosResponse, error) {
rsp, err := c.PostApiV5TradeCancelAdvanceAlgos(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeCancelAdvanceAlgosResponse(rsp)
}
// PostApiV5TradeCancelAlgosWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeCancelAlgosResponse
func (c *ClientWithResponses) PostApiV5TradeCancelAlgosWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelAlgosResponse, error) {
rsp, err := c.PostApiV5TradeCancelAlgosWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeCancelAlgosResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeCancelAlgosWithResponse(ctx context.Context, body PostApiV5TradeCancelAlgosJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelAlgosResponse, error) {
rsp, err := c.PostApiV5TradeCancelAlgos(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeCancelAlgosResponse(rsp)
}
// PostApiV5TradeCancelBatchOrdersWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeCancelBatchOrdersResponse
func (c *ClientWithResponses) PostApiV5TradeCancelBatchOrdersWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelBatchOrdersResponse, error) {
rsp, err := c.PostApiV5TradeCancelBatchOrdersWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeCancelBatchOrdersResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeCancelBatchOrdersWithResponse(ctx context.Context, body PostApiV5TradeCancelBatchOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelBatchOrdersResponse, error) {
rsp, err := c.PostApiV5TradeCancelBatchOrders(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeCancelBatchOrdersResponse(rsp)
}
// PostApiV5TradeCancelOrderWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeCancelOrderResponse
func (c *ClientWithResponses) PostApiV5TradeCancelOrderWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelOrderResponse, error) {
rsp, err := c.PostApiV5TradeCancelOrderWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeCancelOrderResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeCancelOrderWithResponse(ctx context.Context, body PostApiV5TradeCancelOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeCancelOrderResponse, error) {
rsp, err := c.PostApiV5TradeCancelOrder(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeCancelOrderResponse(rsp)
}
// PostApiV5TradeClosePositionWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeClosePositionResponse
func (c *ClientWithResponses) PostApiV5TradeClosePositionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeClosePositionResponse, error) {
rsp, err := c.PostApiV5TradeClosePositionWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeClosePositionResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeClosePositionWithResponse(ctx context.Context, body PostApiV5TradeClosePositionJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeClosePositionResponse, error) {
rsp, err := c.PostApiV5TradeClosePosition(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeClosePositionResponse(rsp)
}
// GetApiV5TradeFillsWithResponse request returning *GetApiV5TradeFillsResponse
func (c *ClientWithResponses) GetApiV5TradeFillsWithResponse(ctx context.Context, params *GetApiV5TradeFillsParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeFillsResponse, error) {
rsp, err := c.GetApiV5TradeFills(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetApiV5TradeFillsResponse(rsp)
}
// GetApiV5TradeFillsHistoryWithResponse request returning *GetApiV5TradeFillsHistoryResponse
func (c *ClientWithResponses) GetApiV5TradeFillsHistoryWithResponse(ctx context.Context, params *GetApiV5TradeFillsHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeFillsHistoryResponse, error) {
rsp, err := c.GetApiV5TradeFillsHistory(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetApiV5TradeFillsHistoryResponse(rsp)
}
// GetApiV5TradeOrderWithResponse request returning *GetApiV5TradeOrderResponse
func (c *ClientWithResponses) GetApiV5TradeOrderWithResponse(ctx context.Context, params *GetApiV5TradeOrderParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrderResponse, error) {
rsp, err := c.GetApiV5TradeOrder(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetApiV5TradeOrderResponse(rsp)
}
// PostApiV5TradeOrderWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeOrderResponse
func (c *ClientWithResponses) PostApiV5TradeOrderWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeOrderResponse, error) {
rsp, err := c.PostApiV5TradeOrderWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeOrderResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeOrderWithResponse(ctx context.Context, body PostApiV5TradeOrderJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeOrderResponse, error) {
rsp, err := c.PostApiV5TradeOrder(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeOrderResponse(rsp)
}
// PostApiV5TradeOrderAlgoWithBodyWithResponse request with arbitrary body returning *PostApiV5TradeOrderAlgoResponse
func (c *ClientWithResponses) PostApiV5TradeOrderAlgoWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostApiV5TradeOrderAlgoResponse, error) {
rsp, err := c.PostApiV5TradeOrderAlgoWithBody(ctx, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeOrderAlgoResponse(rsp)
}
func (c *ClientWithResponses) PostApiV5TradeOrderAlgoWithResponse(ctx context.Context, body PostApiV5TradeOrderAlgoJSONRequestBody, reqEditors ...RequestEditorFn) (*PostApiV5TradeOrderAlgoResponse, error) {
rsp, err := c.PostApiV5TradeOrderAlgo(ctx, body, reqEditors...)
if err != nil {
return nil, err
}
return ParsePostApiV5TradeOrderAlgoResponse(rsp)
}
// GetApiV5TradeOrdersAlgoHistoryWithResponse request returning *GetApiV5TradeOrdersAlgoHistoryResponse
func (c *ClientWithResponses) GetApiV5TradeOrdersAlgoHistoryWithResponse(ctx context.Context, params *GetApiV5TradeOrdersAlgoHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersAlgoHistoryResponse, error) {
rsp, err := c.GetApiV5TradeOrdersAlgoHistory(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetApiV5TradeOrdersAlgoHistoryResponse(rsp)
}
// GetApiV5TradeOrdersAlgoPendingWithResponse request returning *GetApiV5TradeOrdersAlgoPendingResponse
func (c *ClientWithResponses) GetApiV5TradeOrdersAlgoPendingWithResponse(ctx context.Context, params *GetApiV5TradeOrdersAlgoPendingParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersAlgoPendingResponse, error) {
rsp, err := c.GetApiV5TradeOrdersAlgoPending(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetApiV5TradeOrdersAlgoPendingResponse(rsp)
}
// GetApiV5TradeOrdersHistoryWithResponse request returning *GetApiV5TradeOrdersHistoryResponse
func (c *ClientWithResponses) GetApiV5TradeOrdersHistoryWithResponse(ctx context.Context, params *GetApiV5TradeOrdersHistoryParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersHistoryResponse, error) {
rsp, err := c.GetApiV5TradeOrdersHistory(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetApiV5TradeOrdersHistoryResponse(rsp)
}
// GetApiV5TradeOrdersHistoryArchiveWithResponse request returning *GetApiV5TradeOrdersHistoryArchiveResponse
func (c *ClientWithResponses) GetApiV5TradeOrdersHistoryArchiveWithResponse(ctx context.Context, params *GetApiV5TradeOrdersHistoryArchiveParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersHistoryArchiveResponse, error) {
rsp, err := c.GetApiV5TradeOrdersHistoryArchive(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetApiV5TradeOrdersHistoryArchiveResponse(rsp)
}
// GetApiV5TradeOrdersPendingWithResponse request returning *GetApiV5TradeOrdersPendingResponse
func (c *ClientWithResponses) GetApiV5TradeOrdersPendingWithResponse(ctx context.Context, params *GetApiV5TradeOrdersPendingParams, reqEditors ...RequestEditorFn) (*GetApiV5TradeOrdersPendingResponse, error) {
rsp, err := c.GetApiV5TradeOrdersPending(ctx, params, reqEditors...)
if err != nil {
return nil, err
}
return ParseGetApiV5TradeOrdersPendingResponse(rsp)
}
// ParsePostApiV5TradeAmendBatchOrdersResponse parses an HTTP response from a PostApiV5TradeAmendBatchOrdersWithResponse call
func ParsePostApiV5TradeAmendBatchOrdersResponse(rsp *http.Response) (*PostApiV5TradeAmendBatchOrdersResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeAmendBatchOrdersResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeAmendOrderResponse parses an HTTP response from a PostApiV5TradeAmendOrderWithResponse call
func ParsePostApiV5TradeAmendOrderResponse(rsp *http.Response) (*PostApiV5TradeAmendOrderResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeAmendOrderResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeBatchOrdersResponse parses an HTTP response from a PostApiV5TradeBatchOrdersWithResponse call
func ParsePostApiV5TradeBatchOrdersResponse(rsp *http.Response) (*PostApiV5TradeBatchOrdersResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeBatchOrdersResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeCancelAdvanceAlgosResponse parses an HTTP response from a PostApiV5TradeCancelAdvanceAlgosWithResponse call
func ParsePostApiV5TradeCancelAdvanceAlgosResponse(rsp *http.Response) (*PostApiV5TradeCancelAdvanceAlgosResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeCancelAdvanceAlgosResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeCancelAlgosResponse parses an HTTP response from a PostApiV5TradeCancelAlgosWithResponse call
func ParsePostApiV5TradeCancelAlgosResponse(rsp *http.Response) (*PostApiV5TradeCancelAlgosResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeCancelAlgosResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeCancelBatchOrdersResponse parses an HTTP response from a PostApiV5TradeCancelBatchOrdersWithResponse call
func ParsePostApiV5TradeCancelBatchOrdersResponse(rsp *http.Response) (*PostApiV5TradeCancelBatchOrdersResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeCancelBatchOrdersResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeCancelOrderResponse parses an HTTP response from a PostApiV5TradeCancelOrderWithResponse call
func ParsePostApiV5TradeCancelOrderResponse(rsp *http.Response) (*PostApiV5TradeCancelOrderResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeCancelOrderResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeClosePositionResponse parses an HTTP response from a PostApiV5TradeClosePositionWithResponse call
func ParsePostApiV5TradeClosePositionResponse(rsp *http.Response) (*PostApiV5TradeClosePositionResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeClosePositionResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParseGetApiV5TradeFillsResponse parses an HTTP response from a GetApiV5TradeFillsWithResponse call
func ParseGetApiV5TradeFillsResponse(rsp *http.Response) (*GetApiV5TradeFillsResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetApiV5TradeFillsResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]interface{}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParseGetApiV5TradeFillsHistoryResponse parses an HTTP response from a GetApiV5TradeFillsHistoryWithResponse call
func ParseGetApiV5TradeFillsHistoryResponse(rsp *http.Response) (*GetApiV5TradeFillsHistoryResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetApiV5TradeFillsHistoryResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]interface{}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParseGetApiV5TradeOrderResponse parses an HTTP response from a GetApiV5TradeOrderWithResponse call
func ParseGetApiV5TradeOrderResponse(rsp *http.Response) (*GetApiV5TradeOrderResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetApiV5TradeOrderResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]interface{}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeOrderResponse parses an HTTP response from a PostApiV5TradeOrderWithResponse call
func ParsePostApiV5TradeOrderResponse(rsp *http.Response) (*PostApiV5TradeOrderResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeOrderResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParsePostApiV5TradeOrderAlgoResponse parses an HTTP response from a PostApiV5TradeOrderAlgoWithResponse call
func ParsePostApiV5TradeOrderAlgoResponse(rsp *http.Response) (*PostApiV5TradeOrderAlgoResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &PostApiV5TradeOrderAlgoResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest struct {
AdditionalProperties map[string]map[string]interface{} `json:"-"`
}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParseGetApiV5TradeOrdersAlgoHistoryResponse parses an HTTP response from a GetApiV5TradeOrdersAlgoHistoryWithResponse call
func ParseGetApiV5TradeOrdersAlgoHistoryResponse(rsp *http.Response) (*GetApiV5TradeOrdersAlgoHistoryResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetApiV5TradeOrdersAlgoHistoryResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]interface{}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParseGetApiV5TradeOrdersAlgoPendingResponse parses an HTTP response from a GetApiV5TradeOrdersAlgoPendingWithResponse call
func ParseGetApiV5TradeOrdersAlgoPendingResponse(rsp *http.Response) (*GetApiV5TradeOrdersAlgoPendingResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetApiV5TradeOrdersAlgoPendingResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]interface{}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParseGetApiV5TradeOrdersHistoryResponse parses an HTTP response from a GetApiV5TradeOrdersHistoryWithResponse call
func ParseGetApiV5TradeOrdersHistoryResponse(rsp *http.Response) (*GetApiV5TradeOrdersHistoryResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetApiV5TradeOrdersHistoryResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]interface{}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParseGetApiV5TradeOrdersHistoryArchiveResponse parses an HTTP response from a GetApiV5TradeOrdersHistoryArchiveWithResponse call
func ParseGetApiV5TradeOrdersHistoryArchiveResponse(rsp *http.Response) (*GetApiV5TradeOrdersHistoryArchiveResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetApiV5TradeOrdersHistoryArchiveResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]interface{}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// ParseGetApiV5TradeOrdersPendingResponse parses an HTTP response from a GetApiV5TradeOrdersPendingWithResponse call
func ParseGetApiV5TradeOrdersPendingResponse(rsp *http.Response) (*GetApiV5TradeOrdersPendingResponse, error) {
bodyBytes, err := ioutil.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &GetApiV5TradeOrdersPendingResponse{
Body: bodyBytes,
HTTPResponse: rsp,
}
switch {
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
var dest map[string]interface{}
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
return nil, err
}
response.JSON200 = &dest
}
return response, nil
}
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
"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",
"qlX5hrQ8VxEIPGXk9sj/BwAA///A/WQcF48AAA==",
}
// GetSwagger returns the content of the embedded swagger specification file
// or error if failed to decode
func decodeSpec() ([]byte, error) {
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
if err != nil {
return nil, fmt.Errorf("error base64 decoding spec: %s", err)
}
zr, err := gzip.NewReader(bytes.NewReader(zipped))
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %s", err)
}
var buf bytes.Buffer
_, err = buf.ReadFrom(zr)
if err != nil {
return nil, fmt.Errorf("error decompressing spec: %s", err)
}
return buf.Bytes(), nil
}
var rawSpec = decodeSpecCached()
// a naive cached of a decoded swagger spec
func decodeSpecCached() func() ([]byte, error) {
data, err := decodeSpec()
return func() ([]byte, error) {
return data, err
}
}
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
var res = make(map[string]func() ([]byte, error))
if len(pathToFile) > 0 {
res[pathToFile] = rawSpec
}
return res
}
// GetSwagger returns the Swagger specification corresponding to the generated code
// in this file. The external references of Swagger specification are resolved.
// The logic of resolving external references is tightly connected to "import-mapping" feature.
// Externally referenced files must be embedded in the corresponding golang packages.
// Urls can be supported but this task was out of the scope.
func GetSwagger() (swagger *openapi3.T, err error) {
var resolvePath = PathToRawSpec("")
loader := openapi3.NewLoader()
loader.IsExternalRefsAllowed = true
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
var pathToFile = url.String()
pathToFile = path.Clean(pathToFile)
getSpec, ok := resolvePath[pathToFile]
if !ok {
err1 := fmt.Errorf("path not found: %s", pathToFile)
return nil, err1
}
return getSpec()
}
var specData []byte
specData, err = rawSpec()
if err != nil {
return
}
swagger, err = loader.LoadFromData(specData)
if err != nil {
return
}
return
}