Files
gocryptotrader/exchanges/sharedtestvalues/customex.go
Ryan O'Hara-Reid a12cd3d733 orders: Add methods to derive SubmitResponse and Detail types (#955)
* orders: deprecate SubmitResponse return and change to *order.Detail construct detail from order.Submit struct

* orders: add coverage, fix tests

* coinut: rm test for checking

* orders: revert change for return and change field ID to a more explicit name OrderID

* orders: Add method to see if the order was placed

* order: change field name in Cancel type to be more explicit

* orders: standardize field -> OrderID

* backtester: populate change

* orders: add test

* gctscript: fix field name

* linter: fix issues

* linter: more fixes

* linter: forever

* exchanges_tests: populate order.Submit field exchange name

* Update exchanges/order/order_types.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* Update exchanges/order/orders.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

* glorious: nits

* thrasher: nits

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
2022-06-06 11:52:15 +10:00

288 lines
7.7 KiB
Go

package sharedtestvalues
import (
"context"
"sync"
"time"
"github.com/thrasher-corp/gocryptotrader/config"
"github.com/thrasher-corp/gocryptotrader/currency"
exchange "github.com/thrasher-corp/gocryptotrader/exchanges"
"github.com/thrasher-corp/gocryptotrader/exchanges/account"
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
"github.com/thrasher-corp/gocryptotrader/exchanges/deposit"
"github.com/thrasher-corp/gocryptotrader/exchanges/kline"
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
"github.com/thrasher-corp/gocryptotrader/exchanges/orderbook"
"github.com/thrasher-corp/gocryptotrader/exchanges/stream"
"github.com/thrasher-corp/gocryptotrader/exchanges/ticker"
"github.com/thrasher-corp/gocryptotrader/exchanges/trade"
"github.com/thrasher-corp/gocryptotrader/portfolio/withdraw"
)
type CustomEx struct {
exchange.Base
}
func (c *CustomEx) Setup(exch *config.Exchange) error {
return nil
}
func (c *CustomEx) Start(wg *sync.WaitGroup) error {
return nil
}
func (c *CustomEx) SetDefaults() {
}
func (c *CustomEx) GetName() string {
return "customex"
}
func (c *CustomEx) IsEnabled() bool {
return true
}
func (c *CustomEx) SetEnabled(bool) {
}
func (c *CustomEx) ValidateCredentials(ctx context.Context, a asset.Item) error {
return nil
}
func (c *CustomEx) FetchTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) {
return nil, nil
}
func (c *CustomEx) UpdateTickers(ctx context.Context, a asset.Item) error {
return nil
}
func (c *CustomEx) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) {
return nil, nil
}
func (c *CustomEx) FetchOrderbook(ctx context.Context, p currency.Pair, a asset.Item) (*orderbook.Base, error) {
return nil, nil
}
func (c *CustomEx) UpdateOrderbook(ctx context.Context, p currency.Pair, a asset.Item) (*orderbook.Base, error) {
return nil, nil
}
func (c *CustomEx) FetchTradablePairs(ctx context.Context, a asset.Item) ([]string, error) {
return nil, nil
}
func (c *CustomEx) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error {
return nil
}
func (c *CustomEx) GetEnabledPairs(a asset.Item) (currency.Pairs, error) {
return nil, nil
}
func (c *CustomEx) GetAvailablePairs(a asset.Item) (currency.Pairs, error) {
return nil, nil
}
func (c *CustomEx) FetchAccountInfo(ctx context.Context, a asset.Item) (account.Holdings, error) {
return account.Holdings{}, nil
}
func (c *CustomEx) UpdateAccountInfo(ctx context.Context, a asset.Item) (account.Holdings, error) {
return account.Holdings{}, nil
}
func (c *CustomEx) SetPairs(pairs currency.Pairs, a asset.Item, enabled bool) error {
return nil
}
func (c *CustomEx) GetAssetTypes(enabled bool) asset.Items {
return nil
}
func (c *CustomEx) GetRecentTrades(ctx context.Context, p currency.Pair, a asset.Item) ([]trade.Data, error) {
return nil, nil
}
func (c *CustomEx) GetHistoricTrades(ctx context.Context, p currency.Pair, a asset.Item, startTime, endTime time.Time) ([]trade.Data, error) {
return nil, nil
}
func (c *CustomEx) SupportsAutoPairUpdates() bool {
return false
}
func (c *CustomEx) SupportsRESTTickerBatchUpdates() bool {
return false
}
func (c *CustomEx) GetFeeByType(ctx context.Context, f *exchange.FeeBuilder) (float64, error) {
return 0.0, nil
}
func (c *CustomEx) GetLastPairsUpdateTime() int64 {
return 0
}
func (c *CustomEx) GetWithdrawPermissions() uint32 {
return 0
}
func (c *CustomEx) FormatWithdrawPermissions() string {
return ""
}
func (c *CustomEx) SupportsWithdrawPermissions(permissions uint32) bool {
return false
}
func (c *CustomEx) GetFundingHistory(ctx context.Context) ([]exchange.FundHistory, error) {
return nil, nil
}
func (c *CustomEx) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error) {
return nil, nil
}
func (c *CustomEx) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error) {
return nil, nil
}
func (c *CustomEx) CancelOrder(ctx context.Context, o *order.Cancel) error {
return nil
}
func (c *CustomEx) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error) {
return order.CancelBatchResponse{}, nil
}
func (c *CustomEx) CancelAllOrders(ctx context.Context, orders *order.Cancel) (order.CancelAllResponse, error) {
return order.CancelAllResponse{}, nil
}
func (c *CustomEx) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error) {
return order.Detail{}, nil
}
func (c *CustomEx) GetDepositAddress(ctx context.Context, cryptocurrency currency.Code, accountID, chain string) (*deposit.Address, error) {
return nil, nil
}
func (c *CustomEx) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error) {
return nil, nil
}
func (c *CustomEx) GetWithdrawalsHistory(ctx context.Context, code currency.Code) ([]exchange.WithdrawalHistory, error) {
return []exchange.WithdrawalHistory{}, nil
}
func (c *CustomEx) GetActiveOrders(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error) {
return []order.Detail{}, nil
}
func (c *CustomEx) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) {
return nil, nil
}
func (c *CustomEx) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) {
return nil, nil
}
func (c *CustomEx) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error) {
return nil, nil
}
func (c *CustomEx) SetHTTPClientUserAgent(ua string) error {
return nil
}
func (c *CustomEx) GetHTTPClientUserAgent() (string, error) {
return "", nil
}
func (c *CustomEx) SetClientProxyAddress(addr string) error {
return nil
}
func (c *CustomEx) SupportsREST() bool {
return true
}
func (c *CustomEx) GetSubscriptions() ([]stream.ChannelSubscription, error) {
return nil, nil
}
func (c *CustomEx) GetDefaultConfig() (*config.Exchange, error) {
return nil, nil
}
func (c *CustomEx) GetBase() *exchange.Base {
return nil
}
func (c *CustomEx) SupportsAsset(assetType asset.Item) bool {
return false
}
func (c *CustomEx) GetHistoricCandles(ctx context.Context, p currency.Pair, a asset.Item, timeStart, timeEnd time.Time, interval kline.Interval) (kline.Item, error) {
return kline.Item{}, nil
}
func (c *CustomEx) GetHistoricCandlesExtended(ctx context.Context, p currency.Pair, a asset.Item, timeStart, timeEnd time.Time, interval kline.Interval) (kline.Item, error) {
return kline.Item{}, nil
}
func (c *CustomEx) DisableRateLimiter() error {
return nil
}
func (c *CustomEx) EnableRateLimiter() error {
return nil
}
func (c *CustomEx) GetWebsocket() (*stream.Websocket, error) {
return nil, nil
}
func (c *CustomEx) IsWebsocketEnabled() bool {
return false
}
func (c *CustomEx) SupportsWebsocket() bool {
return false
}
func (c *CustomEx) SubscribeToWebsocketChannels(channels []stream.ChannelSubscription) error {
return nil
}
func (c *CustomEx) UnsubscribeToWebsocketChannels(channels []stream.ChannelSubscription) error {
return nil
}
func (c *CustomEx) IsAssetWebsocketSupported(aType asset.Item) bool {
return false
}
func (c *CustomEx) FlushWebsocketChannels() error {
return nil
}
func (c *CustomEx) AuthenticateWebsocket(ctx context.Context) error {
return nil
}
func (c *CustomEx) GetOrderExecutionLimits(a asset.Item, cp currency.Pair) (order.MinMaxLevel, error) {
return order.MinMaxLevel{}, nil
}
func (c *CustomEx) CheckOrderExecutionLimits(a asset.Item, cp currency.Pair, price, amount float64, orderType order.Type) error {
return nil
}
func (c *CustomEx) UpdateOrderExecutionLimits(ctx context.Context, a asset.Item) error {
return nil
}