mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 15:10:49 +00:00
Asset update to fix minor stutter (#316)
This commit is contained in:
committed by
Adrian Gallagher
parent
b901c4b670
commit
20c24601fb
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/currency"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/assets"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/asset"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -121,8 +121,8 @@ func main() {
|
||||
newExchConfig.API.Credentials.Secret = "Secret"
|
||||
|
||||
newExchConfig.CurrencyPairs = ¤cy.PairsManager{
|
||||
AssetTypes: assets.AssetTypes{
|
||||
assets.AssetTypeSpot,
|
||||
AssetTypes: asset.Items{
|
||||
asset.Spot,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ func ({{.Variable}} *{{.CapitalName}}) SetDefaults() {
|
||||
{{.Variable}}.RequestCurrencyPairFormat.Uppercase = true
|
||||
{{.Variable}}.ConfigCurrencyPairFormat.Delimiter = ""
|
||||
{{.Variable}}.ConfigCurrencyPairFormat.Uppercase = true
|
||||
{{.Variable}}.AssetTypes = assets.AssetTypes{assets.AssetTypeSpot}
|
||||
{{.Variable}}.AssetTypes = asset.Items{asset.Spot}
|
||||
{{.Variable}}.SupportsAutoPairUpdating = false
|
||||
{{.Variable}}.SupportsRESTTickerBatching = false
|
||||
{{.Variable}}.Requester = request.New({{.Variable}}.Name,
|
||||
|
||||
@@ -31,7 +31,7 @@ func ({{.Variable}} *{{.CapitalName}}) Run() {
|
||||
}
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
func ({{.Variable}} *{{.CapitalName}}) UpdateTicker(p currency.Pair, assetType assets.AssetType) (ticker.Price, error) {
|
||||
func ({{.Variable}} *{{.CapitalName}}) UpdateTicker(p currency.Pair, assetType asset.Item) (ticker.Price, error) {
|
||||
var tickerPrice ticker.Price
|
||||
// NOTE EXAMPLE FOR GETTING TICKER PRICE
|
||||
//tick, err := {{.Variable}}.GetTickers()
|
||||
@@ -59,7 +59,7 @@ func ({{.Variable}} *{{.CapitalName}}) UpdateTicker(p currency.Pair, assetType a
|
||||
}
|
||||
|
||||
// FetchTicker returns the ticker for a currency pair
|
||||
func ({{.Variable}} *{{.CapitalName}}) FetchTicker(p currency.Pair, assetType assets.AssetType) (ticker.Price, error) {
|
||||
func ({{.Variable}} *{{.CapitalName}}) FetchTicker(p currency.Pair, assetType asset.Item) (ticker.Price, error) {
|
||||
tickerNew, err := ticker.GetTicker({{.Variable}}.GetName(), p, assetType)
|
||||
if err != nil {
|
||||
return {{.Variable}}.UpdateTicker(p, assetType)
|
||||
@@ -68,7 +68,7 @@ func ({{.Variable}} *{{.CapitalName}}) FetchTicker(p currency.Pair, assetType as
|
||||
}
|
||||
|
||||
// FetchOrderbook returns orderbook base on the currency pair
|
||||
func ({{.Variable}} *{{.CapitalName}}) FetchOrderbook(currency currency.Pair, assetType assets.AssetType) (orderbook.Base, error) {
|
||||
func ({{.Variable}} *{{.CapitalName}}) FetchOrderbook(currency currency.Pair, assetType asset.Item) (orderbook.Base, error) {
|
||||
ob, err := orderbook.Get({{.Variable}}.GetName(), currency, assetType)
|
||||
if err != nil {
|
||||
return {{.Variable}}.UpdateOrderbook(currency, assetType)
|
||||
@@ -77,7 +77,7 @@ func ({{.Variable}} *{{.CapitalName}}) FetchOrderbook(currency currency.Pair, as
|
||||
}
|
||||
|
||||
// UpdateOrderbook updates and returns the orderbook for a currency pair
|
||||
func ({{.Variable}} *{{.CapitalName}}) UpdateOrderbook(p currency.Pair, assetType assets.AssetType) (orderbook.Base, error) {
|
||||
func ({{.Variable}} *{{.CapitalName}}) UpdateOrderbook(p currency.Pair, assetType asset.Item) (orderbook.Base, error) {
|
||||
var orderBook orderbook.Base
|
||||
//NOTE UPDATE ORDERBOOK EXAMPLE
|
||||
//orderbookNew, err := {{.Variable}}.GetOrderBook(exchange.FormatExchangeCurrency({{.Variable}}.Name, p).String(), 1000)
|
||||
@@ -111,7 +111,7 @@ func ({{.Variable}} *{{.CapitalName}}) GetFundingHistory() ([]exchange.FundHisto
|
||||
}
|
||||
|
||||
// GetExchangeHistory returns historic trade data since exchange opening.
|
||||
func ({{.Variable}} *{{.CapitalName}}) GetExchangeHistory(p currency.Pair, assetType assets.AssetType) ([]exchange.TradeHistory, error) {
|
||||
func ({{.Variable}} *{{.CapitalName}}) GetExchangeHistory(p currency.Pair, assetType asset.Item) ([]exchange.TradeHistory, error) {
|
||||
return nil, common.ErrNotYetImplemented
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/thrasher-/gocryptotrader/currency"
|
||||
"github.com/thrasher-/gocryptotrader/engine"
|
||||
exchange "github.com/thrasher-/gocryptotrader/exchanges"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/assets"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/asset"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -68,7 +68,7 @@ func main() {
|
||||
|
||||
func testWrappers(e exchange.IBotExchange) []string {
|
||||
p := currency.NewPair(currency.BTC, currency.USD)
|
||||
assetType := assets.AssetTypeSpot
|
||||
assetType := asset.Spot
|
||||
var funcs []string
|
||||
|
||||
_, err := e.FetchTicker(p, assetType)
|
||||
@@ -91,7 +91,7 @@ func testWrappers(e exchange.IBotExchange) []string {
|
||||
funcs = append(funcs, "UpdateOrderbook")
|
||||
}
|
||||
|
||||
_, err = e.FetchTradablePairs(assets.AssetTypeSpot)
|
||||
_, err = e.FetchTradablePairs(asset.Spot)
|
||||
if err == common.ErrNotYetImplemented {
|
||||
funcs = append(funcs, "FetchTradablePairs")
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/thrasher-/gocryptotrader/common"
|
||||
"github.com/thrasher-/gocryptotrader/common/crypto"
|
||||
"github.com/thrasher-/gocryptotrader/config"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/assets"
|
||||
"github.com/thrasher-/gocryptotrader/exchanges/asset"
|
||||
)
|
||||
|
||||
// Vars for the websocket client
|
||||
@@ -44,7 +44,7 @@ type WebsocketEventResponse struct {
|
||||
type WebsocketOrderbookTickerRequest struct {
|
||||
Exchange string `json:"exchangeName"`
|
||||
Currency string `json:"currency"`
|
||||
AssetType assets.AssetType `json:"assetType"`
|
||||
AssetType asset.Item `json:"assetType"`
|
||||
}
|
||||
|
||||
// SendWebsocketEvent sends a websocket event message
|
||||
@@ -157,7 +157,7 @@ func main() {
|
||||
dataReq := WebsocketOrderbookTickerRequest{
|
||||
Exchange: "Bitfinex",
|
||||
Currency: "BTCUSD",
|
||||
AssetType: assets.AssetTypeSpot,
|
||||
AssetType: asset.Spot,
|
||||
}
|
||||
|
||||
err = SendWebsocketEvent("GetTicker", dataReq, &wsResp)
|
||||
|
||||
Reference in New Issue
Block a user