* Remove pointer reference * Fix portfolio withdraw tests * Add nil protection in validator method to reduce prospective panics and for future outbound checking * Updated tests * ch order var to not ref package * rm comparison * Add order ID validation check * Add exchange name validation check * Add in test details * fix tests * fix linter issues * linter issues strikes again * linter rabbit hole * Addr nitterinos * Add validation variadic interface to define sets of functionality check POC * didn't want to add an amount other than 0, didn't want to add address to exchange withdraw, didn't want to whitlist, can change if need be * add coverage * Add validation method options for exchange wrappers and abstracted validation into its own package * Add validation code for structs in exchange template generation * remove extra validation call as this is done in wrapper * fix niterinos for examplerinos * Add template to documentation tool and regenerated documentation * Addr niticles * Fix tests due to validation update * Add more validation checks for modify/submit orders * update tests * fix more tests * Add asset type to submit variable in tests and rpc call. Regen funcs. * Add field to modify struct in tests * applied field asset to cancel struct across project * fix woopsy
3.3 KiB
GoCryptoTrader Unified API
A cryptocurrency trading bot supporting multiple exchanges written in Golang.
Please note that this bot is under development and is not ready for production!
Community
Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack
Unified API
GoCryptoTrader supports a unified API for dealing with exchanges. Each exchange has its own wrapper file which maps the exchanges own RESTful endpoints into a standardised way for bot and standalone application usage.
A full breakdown of all the supported wrapper funcs can be found here. Please note that these change on a regular basis as GoCryptoTrader is undergoing rapid development.
Each exchange supports public API endpoints which don't require any authentication
(fetching ticker, orderbook, trade data) and also private API endpoints (which
require authentication). Some examples include submitting, cancelling and fetching
open orders). To use the authenticated API endpoints, you'll need to set your API
credentials in either the config.json file or when you initialise an exchange in
your application, and also have the appropriate key permissions set for the exchange.
Each exchange has a credentials validator which ensures that the API credentials
supplied meet the requirements to make an authenticated request.
Public API Ticker Example
var b bitstamp.Bitstamp
b.SetDefaults()
ticker, err := b.FetchTicker(currency.NewPair(currency.BTC, currency.USD), asset.Spot)
if err != nil {
// Handle error
}
fmt.Println(ticker.Last)
Private API Submit Order Example
var b bitstamp.Bitstamp
b.SetDefaults()
b.API.Credentials.Key = "your_key"
b.API.Credentials.Secret = "your_secret"
b.API.Credentials.ClientID = "your_clientid"
o := &order.Submit{
Pair: currency.NewPair(currency.BTC, currency.USD),
OrderSide: order.Sell,
OrderType: order.Limit,
Price: 1000000,
Amount: 0.1,
AssetType: asset.Spot,
}
resp, err := b.SubmitOrder(o)
if err != nil {
// Handle error
}
fmt.Println(resp.OrderID)