mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-28 15:10:32 +00:00
Currency package update (#247)
* Initial currency overhaul before service system implementation * Remove redundant currency string in orderbook.Base Unexport lastupdated field in orderbook.Base as it was being instantiated multiple times Add error handling for process orderbook * Remove redundant currency string in ticker.Price Unexport lastupdated field in ticker.Price Add error handling for process ticker function and fix tests * Phase Two Update * Update translations to use map type - thankyou to kempeng for spotting this * Change pair method name from Display -> Format for better readability * Fixes misspelling and tests * Implement requested changes from GloriousCode * Remove reduntant function and streamlined return in currency_translation.go * Revert pair method naming conventions * Change currency naming conventions * Changed code type to exported Item type with underlying string to reduce complexity * Added interim orderbook process method to orderbook.Base type * Changed feebuilder struct field to currency.Pair * Adds fall over system for backup fx providers * deprecate function and children and fix linter issue with btcmarkets * Fixed requested changes * Fix bug and move mtx for rates * Fixed after rebase oopsies * Fix linter issues * Fixes race conditions in testing functions * Final phase coinmarketcap update * fix linter issues * Implement requested changes * Adds configuration variables to increase/decrease time durations between updating currency file and fetching new currency rates * Add a collection of tests to improve codecov * After rebase oopsy fixes for btse * Fix requested changes * fix after rebase oopsies and add more efficient comparison checks within currency pair * Fix linter issues
This commit is contained in:
committed by
Adrian Gallagher
parent
ed760e184e
commit
0990f9d118
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
"github.com/thrasher-/gocryptotrader/currency"
|
||||
exchange "github.com/thrasher-/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/request"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
|
||||
@@ -87,9 +87,9 @@ func (a *ANX) Setup(exch config.ExchangeConfig) {
|
||||
a.SetHTTPClientUserAgent(exch.HTTPUserAgent)
|
||||
a.RESTPollingDelay = exch.RESTPollingDelay
|
||||
a.Verbose = exch.Verbose
|
||||
a.BaseCurrencies = common.SplitStrings(exch.BaseCurrencies, ",")
|
||||
a.AvailablePairs = common.SplitStrings(exch.AvailablePairs, ",")
|
||||
a.EnabledPairs = common.SplitStrings(exch.EnabledPairs, ",")
|
||||
a.BaseCurrencies = exch.BaseCurrencies
|
||||
a.AvailablePairs = exch.AvailablePairs
|
||||
a.EnabledPairs = exch.EnabledPairs
|
||||
err := a.SetCurrencyPairFormat()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -451,9 +451,9 @@ func (a *ANX) GetFee(feeBuilder exchange.FeeBuilder) (float64, error) {
|
||||
case exchange.CryptocurrencyTradeFee:
|
||||
fee = a.calculateTradingFee(feeBuilder.PurchasePrice, feeBuilder.Amount, feeBuilder.IsMaker)
|
||||
case exchange.CryptocurrencyWithdrawalFee:
|
||||
fee = getCryptocurrencyWithdrawalFee(feeBuilder.FirstCurrency)
|
||||
fee = getCryptocurrencyWithdrawalFee(feeBuilder.Pair.Base)
|
||||
case exchange.InternationalBankWithdrawalFee:
|
||||
fee = getInternationalBankWithdrawalFee(feeBuilder.CurrencyItem, feeBuilder.Amount)
|
||||
fee = getInternationalBankWithdrawalFee(feeBuilder.FiatCurrency, feeBuilder.Amount)
|
||||
}
|
||||
if fee < 0 {
|
||||
fee = 0
|
||||
@@ -473,15 +473,15 @@ func (a *ANX) calculateTradingFee(purchasePrice, amount float64, isMaker bool) f
|
||||
return fee
|
||||
}
|
||||
|
||||
func getCryptocurrencyWithdrawalFee(currency string) float64 {
|
||||
return WithdrawalFees[currency]
|
||||
func getCryptocurrencyWithdrawalFee(c currency.Code) float64 {
|
||||
return WithdrawalFees[c]
|
||||
}
|
||||
|
||||
func getInternationalBankWithdrawalFee(currency string, amount float64) float64 {
|
||||
func getInternationalBankWithdrawalFee(c currency.Code, amount float64) float64 {
|
||||
var fee float64
|
||||
|
||||
if currency == symbol.HKD {
|
||||
fee = 250 + (WithdrawalFees[currency] * amount)
|
||||
if c == currency.HKD {
|
||||
fee = 250 + (WithdrawalFees[c] * amount)
|
||||
}
|
||||
// TODO, other fiat currencies require consultation with ANXPRO
|
||||
return fee
|
||||
|
||||
@@ -5,8 +5,7 @@ import (
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
"github.com/thrasher-/gocryptotrader/currency"
|
||||
exchange "github.com/thrasher-/gocryptotrader/exchanges"
|
||||
)
|
||||
|
||||
@@ -131,13 +130,11 @@ func TestGetAPIKey(t *testing.T) {
|
||||
|
||||
func setFeeBuilder() exchange.FeeBuilder {
|
||||
return exchange.FeeBuilder{
|
||||
Amount: 1,
|
||||
Delimiter: "",
|
||||
FeeType: exchange.CryptocurrencyTradeFee,
|
||||
FirstCurrency: symbol.BTC,
|
||||
SecondCurrency: symbol.LTC,
|
||||
IsMaker: false,
|
||||
PurchasePrice: 1,
|
||||
Amount: 1,
|
||||
FeeType: exchange.CryptocurrencyTradeFee,
|
||||
Pair: currency.NewPair(currency.BTC, currency.LTC),
|
||||
IsMaker: false,
|
||||
PurchasePrice: 1,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +194,7 @@ func TestGetFee(t *testing.T) {
|
||||
// InternationalBankDepositFee Basic
|
||||
feeBuilder = setFeeBuilder()
|
||||
feeBuilder.FeeType = exchange.InternationalBankDepositFee
|
||||
feeBuilder.CurrencyItem = symbol.HKD
|
||||
feeBuilder.FiatCurrency = currency.HKD
|
||||
if resp, err := a.GetFee(feeBuilder); resp != float64(0) || err != nil {
|
||||
t.Errorf("Test Failed - GetFee() error. Expected: %f, Received: %f", float64(0), resp)
|
||||
t.Error(err)
|
||||
@@ -206,7 +203,7 @@ func TestGetFee(t *testing.T) {
|
||||
// InternationalBankWithdrawalFee Basic
|
||||
feeBuilder = setFeeBuilder()
|
||||
feeBuilder.FeeType = exchange.InternationalBankWithdrawalFee
|
||||
feeBuilder.CurrencyItem = symbol.HKD
|
||||
feeBuilder.FiatCurrency = currency.HKD
|
||||
if resp, err := a.GetFee(feeBuilder); resp != float64(250.01) || err != nil {
|
||||
t.Errorf("Test Failed - GetFee() error. Expected: %f, Received: %f", float64(250.01), resp)
|
||||
t.Error(err)
|
||||
@@ -275,10 +272,10 @@ func TestSubmitOrder(t *testing.T) {
|
||||
if areTestAPIKeysSet() && !canManipulateRealOrders {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
var p = pair.CurrencyPair{
|
||||
Delimiter: "_",
|
||||
FirstCurrency: symbol.BTC,
|
||||
SecondCurrency: symbol.USD,
|
||||
var p = currency.Pair{
|
||||
Delimiter: "_",
|
||||
Base: currency.BTC,
|
||||
Quote: currency.USD,
|
||||
}
|
||||
response, err := a.SubmitOrder(p, exchange.BuyOrderSide, exchange.MarketOrderType, 1, 1, "clientId")
|
||||
if areTestAPIKeysSet() && (err != nil || !response.IsOrderPlaced) {
|
||||
@@ -296,7 +293,7 @@ func TestCancelExchangeOrder(t *testing.T) {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
currencyPair := pair.NewCurrencyPair(symbol.BTC, symbol.LTC)
|
||||
currencyPair := currency.NewPair(currency.BTC, currency.LTC)
|
||||
|
||||
var orderCancellation = exchange.OrderCancellation{
|
||||
OrderID: "1",
|
||||
@@ -321,7 +318,7 @@ func TestCancelAllExchangeOrders(t *testing.T) {
|
||||
t.Skip("API keys set, canManipulateRealOrders false, skipping test")
|
||||
}
|
||||
|
||||
currencyPair := pair.NewCurrencyPair(symbol.BTC, symbol.LTC)
|
||||
currencyPair := currency.NewPair(currency.BTC, currency.LTC)
|
||||
|
||||
var orderCancellation = exchange.OrderCancellation{
|
||||
OrderID: "1",
|
||||
@@ -374,7 +371,7 @@ func TestWithdraw(t *testing.T) {
|
||||
|
||||
var withdrawCryptoRequest = exchange.WithdrawRequest{
|
||||
Amount: 100,
|
||||
Currency: symbol.BTC,
|
||||
Currency: currency.BTC,
|
||||
Address: "1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB",
|
||||
Description: "WITHDRAW IT ALL",
|
||||
AddressTag: "0123456789",
|
||||
@@ -422,12 +419,12 @@ func TestWithdrawInternationalBank(t *testing.T) {
|
||||
|
||||
func TestGetDepositAddress(t *testing.T) {
|
||||
if areTestAPIKeysSet() {
|
||||
_, err := a.GetDepositAddress(symbol.BTC, "")
|
||||
_, err := a.GetDepositAddress(currency.BTC, "")
|
||||
if err != nil {
|
||||
t.Error("Test Failed - GetDepositAddress() error", err)
|
||||
}
|
||||
} else {
|
||||
_, err := a.GetDepositAddress(symbol.BTC, "")
|
||||
_, err := a.GetDepositAddress(currency.BTC, "")
|
||||
if err == nil {
|
||||
t.Error("Test Failed - GetDepositAddress() error cannot be nil")
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package anx
|
||||
|
||||
import "github.com/thrasher-/gocryptotrader/currency/symbol"
|
||||
import "github.com/thrasher-/gocryptotrader/currency"
|
||||
|
||||
// List of strings
|
||||
const (
|
||||
@@ -9,8 +9,8 @@ const (
|
||||
CancelOrderWrongState string = "ORDER_CANCEL_WRONG_STATE"
|
||||
)
|
||||
|
||||
// Currency holds the currency information
|
||||
type Currency struct {
|
||||
// CurrencyData holds the currency information
|
||||
type CurrencyData struct {
|
||||
Decimals int `json:"decimals"`
|
||||
MinOrderSize float64 `json:"minOrderSize"`
|
||||
MaxOrderSize float64 `json:"maxOrderSize"`
|
||||
@@ -41,10 +41,10 @@ type Currency struct {
|
||||
}
|
||||
|
||||
// Currencies stores a list of currencies
|
||||
type Currencies map[string]Currency
|
||||
type Currencies map[string]CurrencyData
|
||||
|
||||
// CurrencyPair holds the currency information
|
||||
type CurrencyPair struct {
|
||||
// CurrencyPairData holds the currency information
|
||||
type CurrencyPairData struct {
|
||||
PriceDecimals int `json:"priceDecimals"`
|
||||
EngineSettings struct {
|
||||
TradingEnabled bool `json:"tradingEnabled"`
|
||||
@@ -88,7 +88,7 @@ type Amount struct {
|
||||
}
|
||||
|
||||
// CurrencyPairs stores currency pair info
|
||||
type CurrencyPairs map[string]CurrencyPair
|
||||
type CurrencyPairs map[string]CurrencyPairData
|
||||
|
||||
// CurrenciesStore stores the available cryptocurrencies
|
||||
// and fiat currencies
|
||||
@@ -195,13 +195,13 @@ type Depth struct {
|
||||
|
||||
// WithdrawalFees the large list of predefined withdrawal fees
|
||||
// Prone to change
|
||||
var WithdrawalFees = map[string]float64{
|
||||
symbol.BTC: 0.002,
|
||||
symbol.DOGE: 0.1,
|
||||
symbol.ETH: 0.005,
|
||||
symbol.GNT: 0.001,
|
||||
symbol.LTC: 0.02,
|
||||
symbol.OAX: 0.001,
|
||||
symbol.XRP: 1,
|
||||
symbol.HKD: 0.01,
|
||||
var WithdrawalFees = map[currency.Code]float64{
|
||||
currency.BTC: 0.002,
|
||||
currency.DOGE: 0.1,
|
||||
currency.ETH: 0.005,
|
||||
currency.GNT: 0.001,
|
||||
currency.LTC: 0.02,
|
||||
currency.OAX: 0.001,
|
||||
currency.XRP: 1,
|
||||
currency.HKD: 0.01,
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/currency/pair"
|
||||
"github.com/thrasher-/gocryptotrader/currency"
|
||||
exchange "github.com/thrasher-/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/orderbook"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/ticker"
|
||||
@@ -31,17 +31,25 @@ func (a *ANX) Run() {
|
||||
log.Debugf("%s %d currencies enabled: %s.\n", a.GetName(), len(a.EnabledPairs), a.EnabledPairs)
|
||||
}
|
||||
|
||||
exchangeProducts, err := a.GetTradablePairs()
|
||||
tradablePairs, err := a.GetTradablePairs()
|
||||
if err != nil {
|
||||
log.Debugf("%s Failed to get available symbols.\n", a.GetName())
|
||||
} else {
|
||||
forceUpgrade := false
|
||||
if !common.StringDataContains(a.EnabledPairs, "_") || !common.StringDataContains(a.AvailablePairs, "_") {
|
||||
if !common.StringDataContains(a.EnabledPairs.Strings(), "_") ||
|
||||
!common.StringDataContains(a.AvailablePairs.Strings(), "_") {
|
||||
forceUpgrade = true
|
||||
}
|
||||
|
||||
if forceUpgrade {
|
||||
enabledPairs := []string{"BTC_USD,BTC_HKD,BTC_EUR,BTC_CAD,BTC_AUD,BTC_SGD,BTC_JPY,BTC_GBP,BTC_NZD,LTC_BTC,DOG_EBTC,STR_BTC,XRP_BTC"}
|
||||
newPairs := []string{"BTC_USD,BTC_HKD,BTC_EUR,BTC_CAD,BTC_AUD,BTC_SGD,BTC_JPY,BTC_GBP,BTC_NZD,LTC_BTC,DOG_EBTC,STR_BTC,XRP_BTC"}
|
||||
|
||||
var enabledPairs currency.Pairs
|
||||
for _, p := range newPairs {
|
||||
enabledPairs = append(enabledPairs,
|
||||
currency.NewPairDelimiter(p, "_"))
|
||||
}
|
||||
|
||||
log.Warn("Enabled pairs for ANX reset due to config upgrade, please enable the ones you would like again.")
|
||||
|
||||
err = a.UpdateCurrencies(enabledPairs, true, true)
|
||||
@@ -49,6 +57,13 @@ func (a *ANX) Run() {
|
||||
log.Errorf("%s Failed to get config.\n", a.GetName())
|
||||
}
|
||||
}
|
||||
|
||||
var exchangeProducts currency.Pairs
|
||||
for _, p := range tradablePairs {
|
||||
exchangeProducts = append(exchangeProducts,
|
||||
currency.NewPairDelimiter(p, "_"))
|
||||
}
|
||||
|
||||
err = a.UpdateCurrencies(exchangeProducts, false, forceUpgrade)
|
||||
if err != nil {
|
||||
log.Errorf("%s Failed to get config.\n", a.GetName())
|
||||
@@ -72,7 +87,7 @@ func (a *ANX) GetTradablePairs() ([]string, error) {
|
||||
}
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
func (a *ANX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error) {
|
||||
func (a *ANX) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error) {
|
||||
var tickerPrice ticker.Price
|
||||
tick, err := a.GetTicker(exchange.FormatExchangeCurrency(a.GetName(), p).String())
|
||||
if err != nil {
|
||||
@@ -134,12 +149,17 @@ func (a *ANX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price,
|
||||
} else {
|
||||
tickerPrice.High = 0
|
||||
}
|
||||
ticker.ProcessTicker(a.GetName(), p, tickerPrice, assetType)
|
||||
|
||||
err = ticker.ProcessTicker(a.GetName(), tickerPrice, assetType)
|
||||
if err != nil {
|
||||
return tickerPrice, err
|
||||
}
|
||||
|
||||
return ticker.GetTicker(a.Name, p, assetType)
|
||||
}
|
||||
|
||||
// GetTickerPrice returns the ticker for a currency pair
|
||||
func (a *ANX) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error) {
|
||||
func (a *ANX) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error) {
|
||||
tickerNew, err := ticker.GetTicker(a.GetName(), p, assetType)
|
||||
if err != nil {
|
||||
return a.UpdateTicker(p, assetType)
|
||||
@@ -148,8 +168,8 @@ func (a *ANX) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Pric
|
||||
}
|
||||
|
||||
// GetOrderbookEx returns the orderbook for a currency pair
|
||||
func (a *ANX) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error) {
|
||||
ob, err := orderbook.GetOrderbook(a.GetName(), p, assetType)
|
||||
func (a *ANX) GetOrderbookEx(p currency.Pair, assetType string) (orderbook.Base, error) {
|
||||
ob, err := orderbook.Get(a.GetName(), p, assetType)
|
||||
if err != nil {
|
||||
return a.UpdateOrderbook(p, assetType)
|
||||
}
|
||||
@@ -157,7 +177,7 @@ func (a *ANX) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.B
|
||||
}
|
||||
|
||||
// UpdateOrderbook updates and returns the orderbook for a currency pair
|
||||
func (a *ANX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error) {
|
||||
func (a *ANX) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error) {
|
||||
var orderBook orderbook.Base
|
||||
orderbookNew, err := a.GetDepth(exchange.FormatExchangeCurrency(a.GetName(), p).String())
|
||||
if err != nil {
|
||||
@@ -178,8 +198,15 @@ func (a *ANX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.
|
||||
Amount: orderbookNew.Data.Bids[x].Amount})
|
||||
}
|
||||
|
||||
orderbook.ProcessOrderbook(a.GetName(), p, orderBook, assetType)
|
||||
return orderbook.GetOrderbook(a.Name, p, assetType)
|
||||
orderBook.Pair = p
|
||||
orderBook.ExchangeName = a.GetName()
|
||||
orderBook.AssetType = assetType
|
||||
err = orderBook.Process()
|
||||
if err != nil {
|
||||
return orderBook, err
|
||||
}
|
||||
|
||||
return orderbook.Get(a.Name, p, assetType)
|
||||
}
|
||||
|
||||
// GetAccountInfo retrieves balances for all enabled currencies on the
|
||||
@@ -193,9 +220,9 @@ func (a *ANX) GetAccountInfo() (exchange.AccountInfo, error) {
|
||||
}
|
||||
|
||||
var balance []exchange.AccountCurrencyInfo
|
||||
for currency, info := range raw.Wallets {
|
||||
for c, info := range raw.Wallets {
|
||||
balance = append(balance, exchange.AccountCurrencyInfo{
|
||||
CurrencyName: currency,
|
||||
CurrencyName: currency.NewCode(c),
|
||||
TotalValue: info.AvailableBalance.Value,
|
||||
Hold: info.Balance.Value,
|
||||
})
|
||||
@@ -217,14 +244,14 @@ func (a *ANX) GetFundingHistory() ([]exchange.FundHistory, error) {
|
||||
}
|
||||
|
||||
// GetExchangeHistory returns historic trade data since exchange opening.
|
||||
func (a *ANX) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error) {
|
||||
func (a *ANX) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error) {
|
||||
var resp []exchange.TradeHistory
|
||||
|
||||
return resp, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
// SubmitOrder submits a new order
|
||||
func (a *ANX) SubmitOrder(p pair.CurrencyPair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, _ string) (exchange.SubmitOrderResponse, error) {
|
||||
func (a *ANX) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, _ string) (exchange.SubmitOrderResponse, error) {
|
||||
var submitOrderResponse exchange.SubmitOrderResponse
|
||||
|
||||
var isBuying bool
|
||||
@@ -240,9 +267,9 @@ func (a *ANX) SubmitOrder(p pair.CurrencyPair, side exchange.OrderSide, orderTyp
|
||||
|
||||
response, err := a.NewOrder(orderType.ToString(),
|
||||
isBuying,
|
||||
p.FirstCurrency.String(),
|
||||
p.Base.String(),
|
||||
amount,
|
||||
p.SecondCurrency.String(),
|
||||
p.Quote.String(),
|
||||
amount,
|
||||
limitPriceInSettlementCurrency,
|
||||
false,
|
||||
@@ -309,7 +336,7 @@ func (a *ANX) GetOrderInfo(orderID string) (exchange.OrderDetail, error) {
|
||||
}
|
||||
|
||||
// GetDepositAddress returns a deposit address for a specified currency
|
||||
func (a *ANX) GetDepositAddress(cryptocurrency pair.CurrencyItem, _ string) (string, error) {
|
||||
func (a *ANX) GetDepositAddress(cryptocurrency currency.Code, _ string) (string, error) {
|
||||
return a.GetDepositAddressByCurrency(cryptocurrency.String(), "", false)
|
||||
}
|
||||
|
||||
@@ -356,21 +383,23 @@ func (a *ANX) GetActiveOrders(getOrdersRequest exchange.GetOrdersRequest) ([]exc
|
||||
orderType := exchange.OrderType(strings.ToUpper(order.OrderType))
|
||||
|
||||
orderDetail := exchange.OrderDetail{
|
||||
Amount: order.TradedCurrencyAmount,
|
||||
CurrencyPair: pair.NewCurrencyPairWithDelimiter(order.TradedCurrency, order.SettlementCurrency, a.ConfigCurrencyPairFormat.Delimiter),
|
||||
OrderDate: orderDate,
|
||||
Exchange: a.Name,
|
||||
ID: order.OrderID,
|
||||
OrderType: orderType,
|
||||
Price: order.SettlementCurrencyAmount,
|
||||
Status: order.OrderStatus,
|
||||
Amount: order.TradedCurrencyAmount,
|
||||
CurrencyPair: currency.NewPairWithDelimiter(order.TradedCurrency,
|
||||
order.SettlementCurrency, a.ConfigCurrencyPairFormat.Delimiter),
|
||||
OrderDate: orderDate,
|
||||
Exchange: a.Name,
|
||||
ID: order.OrderID,
|
||||
OrderType: orderType,
|
||||
Price: order.SettlementCurrencyAmount,
|
||||
Status: order.OrderStatus,
|
||||
}
|
||||
|
||||
orders = append(orders, orderDetail)
|
||||
}
|
||||
|
||||
exchange.FilterOrdersByType(&orders, getOrdersRequest.OrderType)
|
||||
exchange.FilterOrdersByTickRange(&orders, getOrdersRequest.StartTicks, getOrdersRequest.EndTicks)
|
||||
exchange.FilterOrdersByTickRange(&orders, getOrdersRequest.StartTicks,
|
||||
getOrdersRequest.EndTicks)
|
||||
exchange.FilterOrdersByCurrencies(&orders, getOrdersRequest.Currencies)
|
||||
|
||||
return orders, nil
|
||||
@@ -390,21 +419,24 @@ func (a *ANX) GetOrderHistory(getOrdersRequest exchange.GetOrdersRequest) ([]exc
|
||||
orderType := exchange.OrderType(strings.ToUpper(order.OrderType))
|
||||
|
||||
orderDetail := exchange.OrderDetail{
|
||||
Amount: order.TradedCurrencyAmount,
|
||||
OrderDate: orderDate,
|
||||
Exchange: a.Name,
|
||||
ID: order.OrderID,
|
||||
OrderType: orderType,
|
||||
Price: order.SettlementCurrencyAmount,
|
||||
Status: order.OrderStatus,
|
||||
CurrencyPair: pair.NewCurrencyPairWithDelimiter(order.TradedCurrency, order.SettlementCurrency, a.ConfigCurrencyPairFormat.Delimiter),
|
||||
Amount: order.TradedCurrencyAmount,
|
||||
OrderDate: orderDate,
|
||||
Exchange: a.Name,
|
||||
ID: order.OrderID,
|
||||
OrderType: orderType,
|
||||
Price: order.SettlementCurrencyAmount,
|
||||
Status: order.OrderStatus,
|
||||
CurrencyPair: currency.NewPairWithDelimiter(order.TradedCurrency,
|
||||
order.SettlementCurrency,
|
||||
a.ConfigCurrencyPairFormat.Delimiter),
|
||||
}
|
||||
|
||||
orders = append(orders, orderDetail)
|
||||
}
|
||||
|
||||
exchange.FilterOrdersByType(&orders, getOrdersRequest.OrderType)
|
||||
exchange.FilterOrdersByTickRange(&orders, getOrdersRequest.StartTicks, getOrdersRequest.EndTicks)
|
||||
exchange.FilterOrdersByTickRange(&orders, getOrdersRequest.StartTicks,
|
||||
getOrdersRequest.EndTicks)
|
||||
exchange.FilterOrdersByCurrencies(&orders, getOrdersRequest.Currencies)
|
||||
|
||||
return orders, nil
|
||||
|
||||
Reference in New Issue
Block a user