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

1644 lines
56 KiB
Go

package ccxt
type Woo struct {
*woo
Core *woo
}
func NewWoo(userConfig map[string]interface{}) Woo {
p := &woo{}
p.Init(userConfig)
return Woo{
woo: 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 woo#fetchStatus
* @description the latest known information on the availability of the exchange API
* @see https://docs.woox.io/#get-system-maintenance-status-public
* @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 *Woo) 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 woo#fetchTime
* @description fetches the current integer timestamp in milliseconds from the exchange server
* @see https://docs.woox.io/#get-system-maintenance-status-public
* @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 *Woo) FetchTime(params ...interface{}) ( int64, error) {
res := <- this.Core.FetchTime(params...)
if IsError(res) {
return -1, CreateReturnError(res)
}
return (res).(int64), nil
}
/**
* @method
* @name woo#fetchMarkets
* @description retrieves data on all markets for woo
* @see https://docs.woox.io/#exchange-information
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} an array of objects representing market data
*/
func (this *Woo) FetchMarkets(params ...interface{}) ([]MarketInterface, error) {
res := <- this.Core.FetchMarkets(params...)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewMarketInterfaceArray(res), nil
}
/**
* @method
* @name woo#fetchTrades
* @description get the list of most recent trades for a particular symbol
* @see https://docs.woox.io/#market-trades-public
* @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 *Woo) 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 woo#fetchTradingFees
* @description fetch the trading fees for multiple markets
* @see https://docs.woox.io/#get-account-information-new
* @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 *Woo) FetchTradingFees(params ...interface{}) (TradingFees, error) {
res := <- this.Core.FetchTradingFees(params...)
if IsError(res) {
return TradingFees{}, CreateReturnError(res)
}
return NewTradingFees(res), nil
}
/**
* @method
* @name woo#createMarketBuyOrderWithCost
* @description create a market buy order by providing the symbol and cost
* @see https://docs.woox.io/#send-order
* @param {string} symbol unified symbol of the market to create an order in
* @param {float} cost how much you want to trade in units of the quote currency
* @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 *Woo) CreateMarketBuyOrderWithCost(symbol string, cost float64, options ...CreateMarketBuyOrderWithCostOptions) (Order, error) {
opts := CreateMarketBuyOrderWithCostOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CreateMarketBuyOrderWithCost(symbol, cost, params)
if IsError(res) {
return Order{}, CreateReturnError(res)
}
return NewOrder(res), nil
}
/**
* @method
* @name woo#createMarketSellOrderWithCost
* @description create a market sell order by providing the symbol and cost
* @see https://docs.woox.io/#send-order
* @param {string} symbol unified symbol of the market to create an order in
* @param {float} cost how much you want to trade in units of the quote currency
* @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 *Woo) CreateMarketSellOrderWithCost(symbol string, cost float64, options ...CreateMarketSellOrderWithCostOptions) (Order, error) {
opts := CreateMarketSellOrderWithCostOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CreateMarketSellOrderWithCost(symbol, cost, params)
if IsError(res) {
return Order{}, CreateReturnError(res)
}
return NewOrder(res), nil
}
/**
* @method
* @name woo#createTrailingAmountOrder
* @description create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
* @see https://docs.woox.io/#send-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 you want to trade in units of the base currency, or number of contracts
* @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
* @param {float} trailingAmount the quote amount to trail away from the current market price
* @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
* @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 *Woo) CreateTrailingAmountOrder(symbol string, typeVar string, side string, amount float64, options ...CreateTrailingAmountOrderOptions) (Order, error) {
opts := CreateTrailingAmountOrderOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var price interface{} = nil
if opts.Price != nil {
price = *opts.Price
}
var trailingAmount interface{} = nil
if opts.TrailingAmount != nil {
trailingAmount = *opts.TrailingAmount
}
var trailingTriggerPrice interface{} = nil
if opts.TrailingTriggerPrice != nil {
trailingTriggerPrice = *opts.TrailingTriggerPrice
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CreateTrailingAmountOrder(symbol, typeVar, side, amount, price, trailingAmount, trailingTriggerPrice, params)
if IsError(res) {
return Order{}, CreateReturnError(res)
}
return NewOrder(res), nil
}
/**
* @method
* @name woo#createTrailingPercentOrder
* @description create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
* @see https://docs.woox.io/#send-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 you want to trade in units of the base currency, or number of contracts
* @param {float} [price] the price for the order to be filled at, in units of the quote currency, ignored in market orders
* @param {float} trailingPercent the percent to trail away from the current market price
* @param {float} trailingTriggerPrice the price to activate a trailing order, default uses the price argument
* @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 *Woo) CreateTrailingPercentOrder(symbol string, typeVar string, side string, amount float64, options ...CreateTrailingPercentOrderOptions) (Order, error) {
opts := CreateTrailingPercentOrderOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var price interface{} = nil
if opts.Price != nil {
price = *opts.Price
}
var trailingPercent interface{} = nil
if opts.TrailingPercent != nil {
trailingPercent = *opts.TrailingPercent
}
var trailingTriggerPrice interface{} = nil
if opts.TrailingTriggerPrice != nil {
trailingTriggerPrice = *opts.TrailingTriggerPrice
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CreateTrailingPercentOrder(symbol, typeVar, side, amount, price, trailingPercent, trailingTriggerPrice, params)
if IsError(res) {
return Order{}, CreateReturnError(res)
}
return NewOrder(res), nil
}
/**
* @method
* @name woo#createOrder
* @description create a trade order
* @see https://docs.woox.io/#send-order
* @see https://docs.woox.io/#send-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 {string} [params.marginMode] *for swap markets only* 'cross' or 'isolated', default 'cross'
* @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 'TRAILING_STOP' or 'OCO' or 'CLOSE_POSITION'
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
* @param {string} [params.trailingAmount] the quote amount to trail away from the current market price
* @param {string} [params.trailingPercent] the percent to trail away from the current market price
* @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
* @param {string} [params.position_side] 'SHORT' or 'LONG' - if position mode is HEDGE_MODE and the trading involves futures, then is required, otherwise this parameter is not required
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woo) 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 woo#editOrder
* @description edit a trade order
* @see https://docs.woox.io/#edit-order
* @see https://docs.woox.io/#edit-order-by-client_order_id
* @see https://docs.woox.io/#edit-algo-order
* @see https://docs.woox.io/#edit-algo-order-by-client_order_id
* @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
* @param {string} [params.trailingAmount] the quote amount to trail away from the current market price
* @param {string} [params.trailingPercent] the percent to trail away from the current market price
* @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woo) 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 woo#cancelOrder
* @see https://docs.woox.io/#cancel-algo-order
* @see https://docs.woox.io/#cancel-order
* @see https://docs.woox.io/#cancel-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 trigger/algo order
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woo) 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 woo#cancelAllOrders
* @see https://docs.woox.io/#cancel-all-pending-orders
* @see https://docs.woox.io/#cancel-orders
* @see https://docs.woox.io/#cancel-all-pending-algo-orders
* @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 trigger/algo order
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woo) 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 map[string]interface{}{}, CreateReturnError(res)
}
return res.(map[string]interface{}), nil
}
/**
* @method
* @name woo#cancelAllOrdersAfter
* @description dead man's switch, cancel all orders after the given timeout
* @see https://docs.woox.io/#cancel-all-after
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} the api result
*/
func (this *Woo) CancelAllOrdersAfter(timeout int64, options ...CancelAllOrdersAfterOptions) ([]Order, error) {
opts := CancelAllOrdersAfterOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CancelAllOrdersAfter(timeout, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewOrderArray(res), nil
}
/**
* @method
* @name woo#fetchOrder
* @see https://docs.woox.io/#get-algo-order
* @see https://docs.woox.io/#get-order
* @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 trigger/algo order
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
*/
func (this *Woo) 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 woo#fetchOrders
* @description fetches information on multiple orders made by the user
* @see https://docs.woox.io/#get-orders
* @see https://docs.woox.io/#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 trigger/algo order
* @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
* @param {string} [params.side] 'buy' or 'sell'
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
* @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 *Woo) 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 woo#fetchOpenOrders
* @description fetches information on multiple orders made by the user
* @see https://docs.woox.io/#get-orders
* @see https://docs.woox.io/#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 trigger/algo order
* @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
* @param {string} [params.side] 'buy' or 'sell'
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
* @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 *Woo) 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 woo#fetchClosedOrders
* @description fetches information on multiple orders made by the user
* @see https://docs.woox.io/#get-orders
* @see https://docs.woox.io/#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 trigger/algo order
* @param {boolean} [params.isTriggered] whether the order has been triggered (false by default)
* @param {string} [params.side] 'buy' or 'sell'
* @param {boolean} [params.trailing] set to true if you want to fetch trailing orders
* @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 *Woo) 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 woo#fetchOrderBook
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
* @see https://docs.woox.io/#orderbook-snapshot-public
* @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 *Woo) 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 woo#fetchOHLCV
* @see https://docs.woox.io/#kline-public
* @see https://docs.woox.io/#kline-historical-data-public
* @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 *Woo) 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 woo#fetchOrderTrades
* @description fetch all the trades made from a single order
* @see https://docs.woox.io/#get-trades
* @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 *Woo) 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 woo#fetchMyTrades
* @description fetch all trades made by the user
* @see https://docs.woox.io/#get-trade-history
* @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
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
*/
func (this *Woo) 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 woo#fetchAccounts
* @description fetch all the accounts associated with a profile
* @see https://docs.woox.io/#get-assets-of-subaccounts
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a dictionary of [account structures]{@link https://docs.ccxt.com/#/?id=account-structure} indexed by the account type
*/
func (this *Woo) FetchAccounts(params ...interface{}) ([]Account, error) {
res := <- this.Core.FetchAccounts(params...)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewAccountArray(res), nil
}
/**
* @method
* @name woo#fetchBalance
* @description query for balance and get the amount of funds available for trading or funds locked in orders
* @see https://docs.woox.io/#get-current-holding-get-balance-new
* @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 *Woo) FetchBalance(params ...interface{}) (Balances, error) {
res := <- this.Core.FetchBalance(params...)
if IsError(res) {
return Balances{}, CreateReturnError(res)
}
return NewBalances(res), nil
}
/**
* @method
* @name woo#fetchDepositAddress
* @description fetch the deposit address for a currency associated with this account
* @see https://docs.woox.io/#get-token-deposit-address
* @param {string} code unified currency code
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
*/
func (this *Woo) FetchDepositAddress(code string, options ...FetchDepositAddressOptions) (DepositAddress, error) {
opts := FetchDepositAddressOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchDepositAddress(code, params)
if IsError(res) {
return DepositAddress{}, CreateReturnError(res)
}
return NewDepositAddress(res), nil
}
/**
* @method
* @name woo#fetchLedger
* @description fetch the history of changes, actions done by the user or operations that altered balance of the user
* @see https://docs.woox.io/#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 *Woo) 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 woo#fetchDeposits
* @description fetch all deposits made to an account
* @see https://docs.woox.io/#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 *Woo) 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 woo#fetchWithdrawals
* @description fetch all withdrawals made from an account
* @see https://docs.woox.io/#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 *Woo) 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 woo#fetchDepositsWithdrawals
* @description fetch history of deposits and withdrawals
* @see https://docs.woox.io/#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 *Woo) 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 woo#transfer
* @description transfer currency internally between wallets on the same account
* @see https://docs.woox.io/#get-transfer-history
* @param {string} code unified currency code
* @param {float} amount amount to transfer
* @param {string} fromAccount account to transfer from
* @param {string} toAccount account to transfer to
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
*/
func (this *Woo) Transfer(code string, amount float64, fromAccount string, toAccount string, options ...TransferOptions) (TransferEntry, error) {
opts := TransferOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.Transfer(code, amount, fromAccount, toAccount, params)
if IsError(res) {
return TransferEntry{}, CreateReturnError(res)
}
return NewTransferEntry(res), nil
}
/**
* @method
* @name woo#fetchTransfers
* @description fetch a history of internal transfers made on an account
* @see https://docs.woox.io/#get-transfer-history
* @param {string} code unified currency code of the currency transferred
* @param {int} [since] the earliest time in ms to fetch transfers for
* @param {int} [limit] the maximum number of transfers structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {int} [params.until] the latest time in ms to fetch entries for
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
*/
func (this *Woo) FetchTransfers(options ...FetchTransfersOptions) ([]TransferEntry, error) {
opts := FetchTransfersOptionsStruct{}
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.FetchTransfers(code, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewTransferEntryArray(res), nil
}
/**
* @method
* @name woo#withdraw
* @description make a withdrawal
* @see https://docs.woox.io/#token-withdraw
* @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 *Woo) 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 woo#fetchFundingHistory
* @description fetch the history of funding payments paid and received on this account
* @see https://docs.woox.io/#get-funding-fee-history
* @param {string} [symbol] unified market symbol
* @param {int} [since] the earliest time in ms to fetch funding history for
* @param {int} [limit] the maximum number of funding history structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @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 [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
*/
func (this *Woo) FetchFundingHistory(options ...FetchFundingHistoryOptions) ([]FundingHistory, error) {
opts := FetchFundingHistoryOptionsStruct{}
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.FetchFundingHistory(symbol, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewFundingHistoryArray(res), nil
}
/**
* @method
* @name woo#fetchFundingInterval
* @description fetch the current funding rate interval
* @see https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
* @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 *Woo) 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 woo#fetchFundingRate
* @description fetch the current funding rate
* @see https://docs.woox.io/#get-predicted-funding-rate-for-one-market-public
* @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 *Woo) 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 woo#fetchFundingRates
* @description fetch the funding rate for multiple markets
* @see https://docs.woox.io/#get-predicted-funding-rate-for-all-markets-public
* @param {string[]|undefined} symbols list of unified market symbols
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rates-structure}, indexed by market symbols
*/
func (this *Woo) 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 woo#fetchFundingRateHistory
* @description fetches historical funding rate prices
* @see https://docs.woox.io/#get-funding-rate-history-for-one-market-public
* @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 *Woo) 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 woo#setPositionMode
* @description set hedged to true or false for a market
* @see https://docs.woox.io/#update-position-mode
* @param {bool} hedged set to true to use HEDGE_MODE, false for ONE_WAY
* @param {string} symbol not used by woo setPositionMode
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} response from the exchange
*/
func (this *Woo) SetPositionMode(hedged bool, options ...SetPositionModeOptions) (map[string]interface{}, error) {
opts := SetPositionModeOptionsStruct{}
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.SetPositionMode(hedged, symbol, params)
if IsError(res) {
return map[string]interface{}{}, CreateReturnError(res)
}
return res.(map[string]interface{}), nil
}
/**
* @method
* @name woo#fetchLeverage
* @description fetch the set leverage for a market
* @see https://docs.woox.io/#get-account-information-new
* @param {string} symbol unified market symbol
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {string} [params.marginMode] *for swap markets only* 'cross' or 'isolated'
* @param {string} [params.position_mode] *for swap markets only* 'ONE_WAY' or 'HEDGE_MODE'
* @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure}
*/
func (this *Woo) 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 woo#setLeverage
* @description set the level of leverage for a market
* @see https://docs.woox.io/#update-leverage-setting
* @see https://docs.woox.io/#update-futures-leverage-setting
* @param {float} leverage the rate of leverage (1, 2, 3, 4 or 5 for spot markets, 1, 2, 3, 4, 5, 10, 15, 20 for swap markets)
* @param {string} [symbol] unified market symbol (is mandatory for swap markets)
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {string} [params.marginMode] *for swap markets only* 'cross' or 'isolated'
* @param {string} [params.position_side] *for swap markets only* 'LONG' or 'SHORT' in hedge mode, 'BOTH' in one way mode.
* @returns {object} response from the exchange
*/
func (this *Woo) 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
}
func (this *Woo) 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
}
func (this *Woo) 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
}
/**
* @method
* @name woo#fetchConvertQuote
* @description fetch a quote for converting from one currency to another
* @see https://docs.woox.io/#get-quote-rfq
* @param {string} fromCode the currency that you want to sell and convert from
* @param {string} toCode the currency that you want to buy and convert into
* @param {float} [amount] how much you want to trade in units of the from currency
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
*/
func (this *Woo) FetchConvertQuote(fromCode string, toCode string, options ...FetchConvertQuoteOptions) (Conversion, error) {
opts := FetchConvertQuoteOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var amount interface{} = nil
if opts.Amount != nil {
amount = *opts.Amount
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchConvertQuote(fromCode, toCode, amount, params)
if IsError(res) {
return Conversion{}, CreateReturnError(res)
}
return NewConversion(res), nil
}
/**
* @method
* @name woo#createConvertTrade
* @description convert from one currency to another
* @see https://docs.woox.io/#send-quote-rft
* @param {string} id the id of the trade that you want to make
* @param {string} fromCode the currency that you want to sell and convert from
* @param {string} toCode the currency that you want to buy and convert into
* @param {float} [amount] how much you want to trade in units of the from currency
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
*/
func (this *Woo) CreateConvertTrade(id string, fromCode string, toCode string, options ...CreateConvertTradeOptions) (Conversion, error) {
opts := CreateConvertTradeOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var amount interface{} = nil
if opts.Amount != nil {
amount = *opts.Amount
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.CreateConvertTrade(id, fromCode, toCode, amount, params)
if IsError(res) {
return Conversion{}, CreateReturnError(res)
}
return NewConversion(res), nil
}
/**
* @method
* @name woo#fetchConvertTrade
* @description fetch the data for a conversion trade
* @see https://docs.woox.io/#get-quote-trade
* @param {string} id the id of the trade that you want to fetch
* @param {string} [code] the unified currency code of the conversion trade
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
*/
func (this *Woo) FetchConvertTrade(id string, options ...FetchConvertTradeOptions) (Conversion, error) {
opts := FetchConvertTradeOptionsStruct{}
for _, opt := range options {
opt(&opts)
}
var code interface{} = nil
if opts.Code != nil {
code = *opts.Code
}
var params interface{} = nil
if opts.Params != nil {
params = *opts.Params
}
res := <- this.Core.FetchConvertTrade(id, code, params)
if IsError(res) {
return Conversion{}, CreateReturnError(res)
}
return NewConversion(res), nil
}
/**
* @method
* @name woo#fetchConvertTradeHistory
* @description fetch the users history of conversion trades
* @see https://docs.woox.io/#get-quote-trades
* @param {string} [code] the unified currency code
* @param {int} [since] the earliest time in ms to fetch conversions for
* @param {int} [limit] the maximum number of conversion structures to retrieve
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
*/
func (this *Woo) FetchConvertTradeHistory(options ...FetchConvertTradeHistoryOptions) ([]Conversion, error) {
opts := FetchConvertTradeHistoryOptionsStruct{}
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.FetchConvertTradeHistory(code, since, limit, params)
if IsError(res) {
return nil, CreateReturnError(res)
}
return NewConversionArray(res), nil
}
/**
* @method
* @name woo#fetchConvertCurrencies
* @description fetches all available currencies that can be converted
* @see https://docs.woox.io/#get-quote-asset-info
* @param {object} [params] extra parameters specific to the exchange API endpoint
* @returns {object} an associative dictionary of currencies
*/
func (this *Woo) FetchConvertCurrencies(params ...interface{}) (Currencies, error) {
res := <- this.Core.FetchConvertCurrencies(params...)
if IsError(res) {
return Currencies{}, CreateReturnError(res)
}
return NewCurrencies(res), nil
}