1001 lines
35 KiB
Go
1001 lines
35 KiB
Go
package ccxt
|
|
|
|
type Oxfun struct {
|
|
*oxfun
|
|
Core *oxfun
|
|
}
|
|
|
|
func NewOxfun(userConfig map[string]interface{}) Oxfun {
|
|
p := &oxfun{}
|
|
p.Init(userConfig)
|
|
return Oxfun{
|
|
oxfun: 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 oxfun#fetchMarkets
|
|
* @description retrieves data on all markets for bitmex
|
|
* @see https://docs.ox.fun/?json#get-v3-markets
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @returns {object[]} an array of objects representing market data
|
|
*/
|
|
func (this *Oxfun) FetchMarkets(params ...interface{}) ([]MarketInterface, error) {
|
|
res := <- this.Core.FetchMarkets(params...)
|
|
if IsError(res) {
|
|
return nil, CreateReturnError(res)
|
|
}
|
|
return NewMarketInterfaceArray(res), nil
|
|
}
|
|
/**
|
|
* @method
|
|
* @name oxfun#fetchTickers
|
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
* @see https://docs.ox.fun/?json#get-v3-tickers
|
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
*/
|
|
func (this *Oxfun) FetchTickers(options ...FetchTickersOptions) (Tickers, error) {
|
|
|
|
opts := FetchTickersOptionsStruct{}
|
|
|
|
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.FetchTickers(symbols, params)
|
|
if IsError(res) {
|
|
return Tickers{}, CreateReturnError(res)
|
|
}
|
|
return NewTickers(res), nil
|
|
}
|
|
/**
|
|
* @method
|
|
* @name oxfun#fetchTicker
|
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
* @see https://docs.ox.fun/?json#get-v3-tickers
|
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
*/
|
|
func (this *Oxfun) FetchTicker(symbol string, options ...FetchTickerOptions) (Ticker, error) {
|
|
|
|
opts := FetchTickerOptionsStruct{}
|
|
|
|
for _, opt := range options {
|
|
opt(&opts)
|
|
}
|
|
|
|
var params interface{} = nil
|
|
if opts.Params != nil {
|
|
params = *opts.Params
|
|
}
|
|
res := <- this.Core.FetchTicker(symbol, params)
|
|
if IsError(res) {
|
|
return Ticker{}, CreateReturnError(res)
|
|
}
|
|
return NewTicker(res), nil
|
|
}
|
|
/**
|
|
* @method
|
|
* @name oxfun#fetchOHLCV
|
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
* @see https://docs.ox.fun/?json#get-v3-candles
|
|
* @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 (default 24 hours ago)
|
|
* @param {int} [limit] the maximum amount of candles to fetch (default 200, max 500)
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.until] timestamp in ms of the latest candle to fetch (default now)
|
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchOrderBook
|
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
* @see https://docs.ox.fun/?json#get-v3-depth
|
|
* @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 (default 5, max 100)
|
|
* @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 *Oxfun) 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 oxfun#fetchFundingRates
|
|
* @description fetch the current funding rates for multiple markets
|
|
* @see https://docs.ox.fun/?json#get-v3-funding-estimates
|
|
* @param {string[]} symbols unified market symbols
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @returns {Order[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchFundingRateHistory
|
|
* @description Fetches the history of funding rates
|
|
* @see https://docs.ox.fun/?json#get-v3-funding-rates
|
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch (default 24 hours ago)
|
|
* @param {int} [limit] the maximum amount of trades to fetch (default 200, max 500)
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.until] timestamp in ms of the latest trade to fetch (default now)
|
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchFundingHistory
|
|
* @description fetches the history of funding payments
|
|
* @see https://docs.ox.fun/?json#get-v3-funding
|
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch (default 24 hours ago)
|
|
* @param {int} [limit] the maximum amount of trades to fetch (default 200, max 500)
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.until] timestamp in ms of the latest trade to fetch (default now)
|
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchLeverageTiers
|
|
* @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes, if a market has a leverage tier of 0, then the leverage tiers cannot be obtained for this market
|
|
* @see https://docs.ox.fun/?json#get-v3-leverage-tiers
|
|
* @param {string[]} [symbols] list of unified market symbols
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
|
|
*/
|
|
func (this *Oxfun) FetchLeverageTiers(options ...FetchLeverageTiersOptions) (LeverageTiers, error) {
|
|
|
|
opts := FetchLeverageTiersOptionsStruct{}
|
|
|
|
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.FetchLeverageTiers(symbols, params)
|
|
if IsError(res) {
|
|
return LeverageTiers{}, CreateReturnError(res)
|
|
}
|
|
return NewLeverageTiers(res), nil
|
|
}
|
|
/**
|
|
* @method
|
|
* @name oxfun#fetchTrades
|
|
* @description get the list of most recent trades for a particular symbol
|
|
* @see https://docs.ox.fun/?json#get-v3-exchange-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 (default 24 hours ago)
|
|
* @param {int} [limit] the maximum amount of trades to fetch (default 200, max 500)
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.until] timestamp in ms of the latest trade to fetch (default now)
|
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchMyTrades
|
|
* @description fetch all trades made by the user
|
|
* @see https://docs.ox.fun/?json#get-v3-trades
|
|
* @param {string} symbol unified market symbol
|
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
* @param {int} [limit] the maximum amount of trades to fetch (default 200, max 500)
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.until] timestamp in ms of the latest trade to fetch (default now)
|
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchBalance
|
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
* @see https://docs.ox.fun/?json#get-v3-balances
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {string} [params.asset] currency id, if empty the exchange returns info about all currencies
|
|
* @param {string} [params.subAcc] Name of sub account. If no subAcc is given, then the response contains only the account linked to the API-Key.
|
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
*/
|
|
func (this *Oxfun) FetchBalance(params ...interface{}) (Balances, error) {
|
|
res := <- this.Core.FetchBalance(params...)
|
|
if IsError(res) {
|
|
return Balances{}, CreateReturnError(res)
|
|
}
|
|
return NewBalances(res), nil
|
|
}
|
|
/**
|
|
* @method
|
|
* @name oxfun#fetchAccounts
|
|
* @description fetch subaccounts associated with a profile
|
|
* @see https://docs.ox.fun/?json#get-v3-account-names
|
|
* @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 *Oxfun) FetchAccounts(params ...interface{}) ([]Account, error) {
|
|
res := <- this.Core.FetchAccounts(params...)
|
|
if IsError(res) {
|
|
return nil, CreateReturnError(res)
|
|
}
|
|
return NewAccountArray(res), nil
|
|
}
|
|
/**
|
|
* @method
|
|
* @name oxfun#transfer
|
|
* @description transfer currency internally between wallets on the same account
|
|
* @see https://docs.ox.fun/?json#post-v3-transfer
|
|
* @param {string} code unified currency code
|
|
* @param {float} amount amount to transfer
|
|
* @param {string} fromAccount account id to transfer from
|
|
* @param {string} toAccount account id 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 *Oxfun) 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 oxfun#fetchTransfers
|
|
* @description fetch a history of internal transfers made on an account
|
|
* @see https://docs.ox.fun/?json#get-v3-transfer
|
|
* @param {string} code unified currency code of the currency transferred
|
|
* @param {int} [since] the earliest time in ms to fetch transfers for (default 24 hours ago)
|
|
* @param {int} [limit] the maximum number of transfer structures to retrieve (default 50, max 200)
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.until] the latest time in ms to fetch transfers for (default time now)
|
|
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchDepositAddress
|
|
* @description fetch the deposit address for a currency associated with this account
|
|
* @see https://docs.ox.fun/?json#get-v3-deposit-addresses
|
|
* @param {string} code unified currency code
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {string} [params.network] network for fetch deposit address
|
|
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchDeposits
|
|
* @description fetch all deposits made to an account
|
|
* @see https://docs.ox.fun/?json#get-v3-deposit
|
|
* @param {string} code unified currency code of the currency transferred
|
|
* @param {int} [since] the earliest time in ms to fetch transfers for (default 24 hours ago)
|
|
* @param {int} [limit] the maximum number of transfer structures to retrieve (default 50, max 200)
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.until] the latest time in ms to fetch transfers for (default time now)
|
|
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchWithdrawals
|
|
* @description fetch all withdrawals made from an account
|
|
* @see https://docs.ox.fun/?json#get-v3-withdrawal
|
|
* @param {string} code unified currency code of the currency transferred
|
|
* @param {int} [since] the earliest time in ms to fetch transfers for (default 24 hours ago)
|
|
* @param {int} [limit] the maximum number of transfer structures to retrieve (default 50, max 200)
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.until] the latest time in ms to fetch transfers for (default time now)
|
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#withdraw
|
|
* @description make a withdrawal
|
|
* @see https://docs.ox.fun/?json#post-v3-withdrawal
|
|
* @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
|
|
* @param {string} [params.network] network for withdraw
|
|
* @param {bool} [params.externalFee] if false, then the fee is taken from the quantity, also with the burn fee for asset SOLO
|
|
*
|
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
* @param {string} [params.tfaType] GOOGLE, or AUTHY_SECRET, or YUBIKEY, for 2FA
|
|
* @param {string} [params.code] 2FA code
|
|
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchPositions
|
|
* @description fetch all open positions
|
|
* @see https://docs.ox.fun/?json#get-v3-positions
|
|
* @param {string[]|undefined} symbols list of unified market symbols
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {boolean} [params.subAcc]
|
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#createOrder
|
|
* @description create a trade order
|
|
* @see https://docs.ox.fun/?json#post-v3-orders-place
|
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
* @param {string} type 'market', 'limit', 'STOP_LIMIT' or 'STOP_MARKET'
|
|
* @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 {int} [params.clientOrderId] a unique id for the order
|
|
* @param {int} [params.timestamp] in milliseconds. If an order reaches the matching engine and the current timestamp exceeds timestamp + recvWindow, then the order will be rejected.
|
|
* @param {int} [params.recvWindow] in milliseconds. If an order reaches the matching engine and the current timestamp exceeds timestamp + recvWindow, then the order will be rejected. If timestamp is provided without recvWindow, then a default recvWindow of 1000ms is used.
|
|
* @param {string} [params.responseType] FULL or ACK
|
|
* @param {float} [params.cost] the quote quantity that can be used as an alternative for the amount for market buy orders
|
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
* @param {float} [params.limitPrice] Limit price for the STOP_LIMIT order
|
|
* @param {bool} [params.postOnly] if true, the order will only be posted if it will be a maker order
|
|
* @param {string} [params.timeInForce] GTC (default), IOC, FOK, PO, MAKER_ONLY or MAKER_ONLY_REPRICE (reprices order to the best maker only price if the specified price were to lead to a taker trade)
|
|
* @param {string} [params.selfTradePreventionMode] NONE, EXPIRE_MAKER, EXPIRE_TAKER or EXPIRE_BOTH for more info check here {@link https://docs.ox.fun/?json#self-trade-prevention-modes}
|
|
* @param {string} [params.displayQuantity] for an iceberg order, pass both quantity and displayQuantity fields in the order request
|
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#createOrders
|
|
* @description create a list of trade orders
|
|
* @see https://docs.ox.fun/?json#post-v3-orders-place
|
|
* @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
|
|
* @param {int} [params.timestamp] *for all orders* in milliseconds. If orders reach the matching engine and the current timestamp exceeds timestamp + recvWindow, then all orders will be rejected.
|
|
* @param {int} [params.recvWindow] *for all orders* in milliseconds. If orders reach the matching engine and the current timestamp exceeds timestamp + recvWindow, then all orders will be rejected. If timestamp is provided without recvWindow, then a default recvWindow of 1000ms is used.
|
|
* @param {string} [params.responseType] *for all orders* FULL or ACK
|
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#createMarketBuyOrderWithCost
|
|
* @description create a market buy order by providing the symbol and cost
|
|
* @see https://open.big.one/docs/spot_orders.html#create-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 *Oxfun) 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 oxfun#fetchOrder
|
|
* @see https://docs.ox.fun/?json#get-v3-orders-status
|
|
* @description fetches information on an order made by the user
|
|
* @param {string} id a unique id for the order
|
|
* @param {string} [symbol] not used by oxfun fetchOrder
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.clientOrderId] the client order id of the order
|
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#fetchOpenOrders
|
|
* @description fetch all unfilled currently open orders
|
|
* @see https://docs.ox.fun/?json#get-v3-orders-working
|
|
* @param {string} symbol unified market symbol
|
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.orderId] a unique id for the order
|
|
* @param {int} [params.clientOrderId] the client order id of the order
|
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#cancelOrder
|
|
* @description cancels an open order
|
|
* @see https://docs.ox.fun/?json#delete-v3-orders-cancel
|
|
* @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 {int} [params.clientOrderId] a unique id for the order
|
|
* @param {int} [params.timestamp] in milliseconds
|
|
* @param {int} [params.recvWindow] in milliseconds
|
|
* @param {string} [params.responseType] 'FULL' or 'ACK'
|
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
*/
|
|
func (this *Oxfun) CancelOrder(id string, options ...CancelOrderOptions) (Order, 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 Order{}, CreateReturnError(res)
|
|
}
|
|
return NewOrder(res), nil
|
|
}
|
|
/**
|
|
* @method
|
|
* @name oxfun#cancelAllOrders
|
|
* @description cancel all open orders
|
|
* @see https://docs.ox.fun/?json#delete-v3-orders-cancel-all
|
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @returns {object} response from exchange
|
|
*/
|
|
func (this *Oxfun) 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 oxfun#cancelOrders
|
|
* @description cancel multiple orders
|
|
* @see https://docs.ox.fun/?json#delete-v3-orders-cancel
|
|
* @param {string[]} ids order ids
|
|
* @param {string} [symbol] unified market symbol
|
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
* @param {int} [params.timestamp] in milliseconds
|
|
* @param {int} [params.recvWindow] in milliseconds
|
|
* @param {string} [params.responseType] 'FULL' or 'ACK'
|
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
*/
|
|
func (this *Oxfun) 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
|
|
} |