ccxt-go/woofipro_wrapper.go
zhangkun9038@dingtalk.com 1a2ce7046a first add
2025-02-28 10:33:20 +08:00

1178 lines
42 KiB
Go

package ccxt
type Woofipro struct {
*woofipro
Core *woofipro
}
func NewWoofipro(userConfig map[string]interface{}) Woofipro {
p := &woofipro{}
p.Init(userConfig)
return Woofipro{
woofipro: p,
Core: p,
}
}
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
/**
* @method
* @name woofipro#fetchStatus
* @description the latest known information on the availability of the exchange API
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
*/
func (this *Woofipro) FetchStatus(params ...interface{}) (map[string]interface{}, error) {
res := <- this.Core.FetchStatus(params...)
if IsError(res) {
return map[string]interface{}{}, CreateReturnError(res)
}
return res.(map[string]interface{}), nil
}
/**
* @method
* @name woofipro#fetchTime
* @description fetches the current integer timestamp in milliseconds from the exchange server
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-system-maintenance-status
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {int} the current integer timestamp in milliseconds from the exchange server
*/
func (this *Woofipro) FetchTime(params ...interface{}) ( int64, error) {
res := <- this.Core.FetchTime(params...)
if IsError(res) {
return -1, CreateReturnError(res)
}
return (res).(int64), nil
}
/**
* @method
* @name woofipro#fetchMarkets
* @description retrieves data on all markets for woofipro
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-available-symbols
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} an array of objects representing market data
*/
func (this *Woofipro) FetchMarkets(params ...interface{}) ([]MarketInterface, error) {
res := <- this.Core.FetchMarkets(params...)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewMarketInterfaceArray(res), nil
}
/**
* @method
* @name woofipro#fetchTrades
* @description get the list of most recent trades for a particular symbol
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-market-trades
* @param {string} symbol unified symbol of the market to fetch trades for
* @param {int} [since] timestamp in ms of the earliest trade to fetch
* @param {int} [limit] the maximum amount of trades to fetch
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
*/
func (this *Woofipro) FetchTrades(symbol string, options ...FetchTradesOptions) ([]Trade, error) {
opts := FetchTradesOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchTrades(symbol, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewTradeArray(res), nil
}
/**
* @method
* @name woofipro#fetchFundingInterval
* @description fetch the current funding rate interval
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
* @param {string} symbol unified market symbol
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
*/
func (this *Woofipro) FetchFundingInterval(symbol string, options ...FetchFundingIntervalOptions) (FundingRate, error) {
opts := FetchFundingIntervalOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchFundingInterval(symbol, params)
if IsError(res) {
return FundingRate{}, CreateReturnError(res)
}
return NewFundingRate(res), nil
}
/**
* @method
* @name woofipro#fetchFundingRate
* @description fetch the current funding rate
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rate-for-one-market
* @param {string} symbol unified market symbol
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
*/
func (this *Woofipro) FetchFundingRate(symbol string, options ...FetchFundingRateOptions) (FundingRate, error) {
opts := FetchFundingRateOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchFundingRate(symbol, params)
if IsError(res) {
return FundingRate{}, CreateReturnError(res)
}
return NewFundingRate(res), nil
}
/**
* @method
* @name woofipro#fetchFundingRates
* @description fetch the current funding rate for multiple markets
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-predicted-funding-rates-for-all-markets
* @param {string[]} symbols unified market symbols
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
*/
func (this *Woofipro) FetchFundingRates(options ...FetchFundingRatesOptions) (FundingRates, error) {
opts := FetchFundingRatesOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbols interface{} = nil
if opts.Symbols != nil {
symbols = *opts.Symbols
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchFundingRates(symbols, params)
if IsError(res) {
return FundingRates{}, CreateReturnError(res)
}
return NewFundingRates(res), nil
}
/**
* @method
* @name woofipro#fetchFundingRateHistory
* @description fetches historical funding rate prices
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-funding-rate-history-for-one-market
* @param {string} symbol unified symbol of the market to fetch the funding rate history for
* @param {int} [since] timestamp in ms of the earliest funding rate to fetch
* @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {int} [params.until] timestamp in ms of the latest funding rate
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure}
*/
func (this *Woofipro) FetchFundingRateHistory(options ...FetchFundingRateHistoryOptions) ([]FundingRateHistory, error) {
opts := FetchFundingRateHistoryOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchFundingRateHistory(symbol, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewFundingRateHistoryArray(res), nil
}
/**
* @method
* @name woofipro#fetchTradingFees
* @description fetch the trading fees for multiple markets
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
*/
func (this *Woofipro) FetchTradingFees(params ...interface{}) (TradingFees, error) {
res := <- this.Core.FetchTradingFees(params...)
if IsError(res) {
return TradingFees{}, CreateReturnError(res)
}
return NewTradingFees(res), nil
}
/**
* @method
* @name woofipro#fetchOrderBook
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/orderbook-snapshot
* @param {string} symbol unified symbol of the market to fetch the order book for
* @param {int} [limit] the maximum amount of order book entries to return
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
*/
func (this *Woofipro) FetchOrderBook(symbol string, options ...FetchOrderBookOptions) (OrderBook, error) {
opts := FetchOrderBookOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchOrderBook(symbol, limit, params)
if IsError(res) {
return OrderBook{}, CreateReturnError(res)
}
return NewOrderBook(res), nil
}
/**
* @method
* @name woofipro#fetchOHLCV
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-kline
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
* @param {string} timeframe the length of time each candle represents
* @param {int} [since] timestamp in ms of the earliest candle to fetch
* @param {int} [limit] max=1000, max=100 when since is defined and is less than (now - (999 * (timeframe in ms)))
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
*/
func (this *Woofipro) FetchOHLCV(symbol string, options ...FetchOHLCVOptions) ([]OHLCV, error) {
opts := FetchOHLCVOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var timeframe interface{} = nil
if opts.Timeframe != nil {
timeframe = *opts.Timeframe
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchOHLCV(symbol, timeframe, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewOHLCVArray(res), nil
}
/**
* @method
* @name woofipro#createOrder
* @description create a trade order
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-order
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-algo-order
* @param {string} symbol unified symbol of the market to create an order in
* @param {string} type 'market' or 'limit'
* @param {string} side 'buy' or 'sell'
* @param {float} amount how much of currency you want to trade in units of base currency
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {float} [params.triggerPrice] The price a trigger order is triggered at
* @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered (perpetual swap markets only)
* @param {float} [params.takeProfit.triggerPrice] take profit trigger price
* @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered (perpetual swap markets only)
* @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
* @param {float} [params.algoType] 'STOP'or 'TP_SL' or 'POSITIONAL_TP_SL'
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
* @param {string} [params.clientOrderId] a unique id for the order
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) CreateOrder(symbol string, typeVar string, side string, amount float64, options ...CreateOrderOptions) (Order, error) {
opts := CreateOrderOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var price interface{} = nil
if opts.Price != nil {
price = *opts.Price
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CreateOrder(symbol, typeVar, side, amount, price, params)
if IsError(res) {
return Order{}, CreateReturnError(res)
}
return NewOrder(res), nil
}
/**
* @method
* @name woofipro#createOrders
* @description *contract only* create a list of trade orders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-create-order
* @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) CreateOrders(orders []OrderRequest, options ...CreateOrdersOptions) ([]Order, error) {
opts := CreateOrdersOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CreateOrders(orders, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewOrderArray(res), nil
}
/**
* @method
* @name woofipro#editOrder
* @description edit a trade order
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-order
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/edit-algo-order
* @param {string} id order id
* @param {string} symbol unified symbol of the market to create an order in
* @param {string} type 'market' or 'limit'
* @param {string} side 'buy' or 'sell'
* @param {float} amount how much of currency you want to trade in units of base currency
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {float} [params.triggerPrice] The price a trigger order is triggered at
* @param {float} [params.stopLossPrice] price to trigger stop-loss orders
* @param {float} [params.takeProfitPrice] price to trigger take-profit orders
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) EditOrder(id string, symbol string, typeVar string, side string, options ...EditOrderOptions) (Order, error) {
opts := EditOrderOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var amount interface{} = nil
if opts.Amount != nil {
amount = *opts.Amount
}
var price interface{} = nil
if opts.Price != nil {
price = *opts.Price
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.EditOrder(id, symbol, typeVar, side, amount, price, params)
if IsError(res) {
return Order{}, CreateReturnError(res)
}
return NewOrder(res), nil
}
/**
* @method
* @name woofipro#cancelOrder
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-order-by-client_order_id
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-algo-order-by-client_order_id
* @description cancels an open order
* @param {string} id order id
* @param {string} symbol unified symbol of the market the order was made in
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {boolean} [params.trigger] whether the order is a stop/algo order
* @param {string} [params.clientOrderId] a unique id for the order
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) CancelOrder(id string, options ...CancelOrderOptions) (map[string]interface{}, error) {
opts := CancelOrderOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CancelOrder(id, symbol, params)
if IsError(res) {
return map[string]interface{}{}, CreateReturnError(res)
}
return res.(map[string]interface{}), nil
}
/**
* @method
* @name woofipro#cancelOrders
* @description cancel multiple orders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/batch-cancel-orders-by-client_order_id
* @param {string[]} ids order ids
* @param {string} [symbol] unified market symbol
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {string[]} [params.client_order_ids] max length 10 e.g. ["my_id_1","my_id_2"], encode the double quotes. No space after comma
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) CancelOrders(ids []string, options ...CancelOrdersOptions) ([]Order, error) {
opts := CancelOrdersOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CancelOrders(ids, symbol, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewOrderArray(res), nil
}
/**
* @method
* @name woofipro#cancelAllOrders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-all-pending-algo-orders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/cancel-orders-in-bulk
* @description cancel all open orders in a market
* @param {string} symbol unified market symbol
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {boolean} [params.trigger] whether the order is a stop/algo order
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) CancelAllOrders(options ...CancelAllOrdersOptions) ([]map[string]interface{}, error) {
opts := CancelAllOrdersOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CancelAllOrders(symbol, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return res.([]map[string]interface{}), nil
}
/**
* @method
* @name woofipro#fetchOrder
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-order_id
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-order-by-client_order_id
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-order_id
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-order-by-client_order_id
* @description fetches information on an order made by the user
* @param {string} id the order id
* @param {string} symbol unified symbol of the market the order was made in
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {boolean} [params.trigger] whether the order is a stop/algo order
* @param {string} [params.clientOrderId] a unique id for the order
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) FetchOrder(id string, options ...FetchOrderOptions) (Order, error) {
opts := FetchOrderOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchOrder(id, symbol, params)
if IsError(res) {
return Order{}, CreateReturnError(res)
}
return NewOrder(res), nil
}
/**
* @method
* @name woofipro#fetchOrders
* @description fetches information on multiple orders made by the user
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
* @param {string} symbol unified market symbol of the market orders were made in
* @param {int} [since] the earliest time in ms to fetch orders for
* @param {int} [limit] the maximum number of order structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {boolean} [params.trigger] whether the order is a stop/algo order
* @param {boolean} [params.is_triggered] whether the order has been triggered (false by default)
* @param {string} [params.side] 'buy' or 'sell'
* @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
* @param {int} params.until timestamp in ms of the latest order to fetch
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) FetchOrders(options ...FetchOrdersOptions) ([]Order, error) {
opts := FetchOrdersOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchOrders(symbol, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewOrderArray(res), nil
}
/**
* @method
* @name woofipro#fetchOpenOrders
* @description fetches information on multiple orders made by the user
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
* @param {string} symbol unified market symbol of the market orders were made in
* @param {int} [since] the earliest time in ms to fetch orders for
* @param {int} [limit] the maximum number of order structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {boolean} [params.trigger] whether the order is a stop/algo order
* @param {boolean} [params.is_triggered] whether the order has been triggered (false by default)
* @param {string} [params.side] 'buy' or 'sell'
* @param {int} params.until timestamp in ms of the latest order to fetch
* @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) FetchOpenOrders(options ...FetchOpenOrdersOptions) ([]Order, error) {
opts := FetchOpenOrdersOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchOpenOrders(symbol, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewOrderArray(res), nil
}
/**
* @method
* @name woofipro#fetchClosedOrders
* @description fetches information on multiple orders made by the user
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-orders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-algo-orders
* @param {string} symbol unified market symbol of the market orders were made in
* @param {int} [since] the earliest time in ms to fetch orders for
* @param {int} [limit] the maximum number of order structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {boolean} [params.trigger] whether the order is a stop/algo order
* @param {boolean} [params.is_triggered] whether the order has been triggered (false by default)
* @param {string} [params.side] 'buy' or 'sell'
* @param {int} params.until timestamp in ms of the latest order to fetch
* @param {boolean} [params.paginate] set to true if you want to fetch orders with pagination
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woofipro) FetchClosedOrders(options ...FetchClosedOrdersOptions) ([]Order, error) {
opts := FetchClosedOrdersOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchClosedOrders(symbol, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewOrderArray(res), nil
}
/**
* @method
* @name woofipro#fetchOrderTrades
* @description fetch all the trades made from a single order
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-trades-of-specific-order
* @param {string} id order id
* @param {string} symbol unified market symbol
* @param {int} [since] the earliest time in ms to fetch trades for
* @param {int} [limit] the maximum number of trades to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
*/
func (this *Woofipro) FetchOrderTrades(id string, options ...FetchOrderTradesOptions) ([]Trade, error) {
opts := FetchOrderTradesOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchOrderTrades(id, symbol, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewTradeArray(res), nil
}
/**
* @method
* @name woofipro#fetchMyTrades
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-trades
* @description fetch all trades made by the user
* @param {string} symbol unified market symbol
* @param {int} [since] the earliest time in ms to fetch trades for
* @param {int} [limit] the maximum number of trades structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {boolean} [params.paginate] set to true if you want to fetch trades with pagination
* @param {int} params.until timestamp in ms of the latest trade to fetch
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
*/
func (this *Woofipro) FetchMyTrades(options ...FetchMyTradesOptions) ([]Trade, error) {
opts := FetchMyTradesOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchMyTrades(symbol, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewTradeArray(res), nil
}
/**
* @method
* @name woofipro#fetchBalance
* @description query for balance and get the amount of funds available for trading or funds locked in orders
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-current-holding
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
*/
func (this *Woofipro) FetchBalance(params ...interface{}) (Balances, error) {
res := <- this.Core.FetchBalance(params...)
if IsError(res) {
return Balances{}, CreateReturnError(res)
}
return NewBalances(res), nil
}
/**
* @method
* @name woofipro#fetchLedger
* @description fetch the history of changes, actions done by the user or operations that altered the balance of the user
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
* @param {string} [code] unified currency code, default is undefined
* @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined
* @param {int} [limit] max number of ledger entries to return, default is undefined
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger}
*/
func (this *Woofipro) FetchLedger(options ...FetchLedgerOptions) ([]LedgerEntry, error) {
opts := FetchLedgerOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var code interface{} = nil
if opts.Code != nil {
code = *opts.Code
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchLedger(code, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewLedgerEntryArray(res), nil
}
/**
* @method
* @name woofipro#fetchDeposits
* @description fetch all deposits made to an account
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
* @param {string} code unified currency code
* @param {int} [since] the earliest time in ms to fetch deposits for
* @param {int} [limit] the maximum number of deposits structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
*/
func (this *Woofipro) FetchDeposits(options ...FetchDepositsOptions) ([]Transaction, error) {
opts := FetchDepositsOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var code interface{} = nil
if opts.Code != nil {
code = *opts.Code
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchDeposits(code, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewTransactionArray(res), nil
}
/**
* @method
* @name woofipro#fetchWithdrawals
* @description fetch all withdrawals made from an account
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
* @param {string} code unified currency code
* @param {int} [since] the earliest time in ms to fetch withdrawals for
* @param {int} [limit] the maximum number of withdrawals structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
*/
func (this *Woofipro) FetchWithdrawals(options ...FetchWithdrawalsOptions) ([]Transaction, error) {
opts := FetchWithdrawalsOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var code interface{} = nil
if opts.Code != nil {
code = *opts.Code
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchWithdrawals(code, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewTransactionArray(res), nil
}
/**
* @method
* @name woofipro#fetchDepositsWithdrawals
* @description fetch history of deposits and withdrawals
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-asset-history
* @param {string} [code] unified currency code for the currency of the deposit/withdrawals, default is undefined
* @param {int} [since] timestamp in ms of the earliest deposit/withdrawal, default is undefined
* @param {int} [limit] max number of deposit/withdrawals to return, default is undefined
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a list of [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
*/
func (this *Woofipro) FetchDepositsWithdrawals(options ...FetchDepositsWithdrawalsOptions) ([]Transaction, error) {
opts := FetchDepositsWithdrawalsOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var code interface{} = nil
if opts.Code != nil {
code = *opts.Code
}
var since interface{} = nil
if opts.Since != nil {
since = *opts.Since
}
var limit interface{} = nil
if opts.Limit != nil {
limit = *opts.Limit
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchDepositsWithdrawals(code, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewTransactionArray(res), nil
}
/**
* @method
* @name woofipro#withdraw
* @description make a withdrawal
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request
* @param {string} code unified currency code
* @param {float} amount the amount to withdraw
* @param {string} address the address to withdraw to
* @param {string} tag
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
*/
func (this *Woofipro) Withdraw(code string, amount float64, address string, options ...WithdrawOptions) (Transaction, error) {
opts := WithdrawOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var tag interface{} = nil
if opts.Tag != nil {
tag = *opts.Tag
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.Withdraw(code, amount, address, tag, params)
if IsError(res) {
return Transaction{}, CreateReturnError(res)
}
return NewTransaction(res), nil
}
/**
* @method
* @name woofipro#fetchLeverage
* @description fetch the set leverage for a market
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-account-information
* @param {string} symbol unified market symbol
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
*/
func (this *Woofipro) FetchLeverage(symbol string, options ...FetchLeverageOptions) (Leverage, error) {
opts := FetchLeverageOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchLeverage(symbol, params)
if IsError(res) {
return Leverage{}, CreateReturnError(res)
}
return NewLeverage(res), nil
}
/**
* @method
* @name woofipro#setLeverage
* @description set the level of leverage for a market
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/update-leverage-setting
* @param {int} [leverage] the rate of leverage
* @param {string} [symbol] unified market symbol
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} response from the exchange
*/
func (this *Woofipro) SetLeverage(leverage int64, options ...SetLeverageOptions) (map[string]interface{}, error) {
opts := SetLeverageOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbol interface{} = nil
if opts.Symbol != nil {
symbol = *opts.Symbol
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.SetLeverage(leverage, symbol, params)
if IsError(res) {
return map[string]interface{}{}, CreateReturnError(res)
}
return res.(map[string]interface{}), nil
}
/**
* @method
* @name woofipro#fetchPosition
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-one-position-info
* @description fetch data on an open position
* @param {string} symbol unified market symbol of the market the position is held in
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
*/
func (this *Woofipro) FetchPosition(symbol string, options ...FetchPositionOptions) (Position, error) {
opts := FetchPositionOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchPosition(symbol, params)
if IsError(res) {
return Position{}, CreateReturnError(res)
}
return NewPosition(res), nil
}
/**
* @method
* @name woofipro#fetchPositions
* @description fetch all open positions
* @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/get-all-positions-info
* @param {string[]} [symbols] list of unified market symbols
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
*/
func (this *Woofipro) FetchPositions(options ...FetchPositionsOptions) ([]Position, error) {
opts := FetchPositionsOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var symbols interface{} = nil
if opts.Symbols != nil {
symbols = *opts.Symbols
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchPositions(symbols, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewPositionArray(res), nil
}