exchanges: Add OKX support (#1005)

* public endpoints methods added

* Completing mapping REST endpoints

* Binanceus Wrapper methods -Partially

* Binanceus Wrapper methods -Partially

* BinaWra functions with test funs; Not Completed

* Finalizing wrapper methods & test

* Fix & Complete wrapper functions

* Finalizing wrapper methods & test

* Adding Stream Datas

* WS Test functions

* CI: Fix golangci-lint linter issues

* CI: Fix reverting unnessesary changes and type conversion issues

* CI: Fix reverting unnessesary changes and type conversion issues

* Adding Public endpoints and tests

* Adding Market and Public Endpoints

* Adding Public endoints

* Public Trading Endpoints & Authenticated Trade order methods

* Adding Authenticated Methods and Tests

* Adding algo and Funding Authenticated endpoints

* Adding funding trading endpoints and correspondint tests

* adding authenticated endpoints

* Completing Block Trading endpoints and added subaccount endpoints

* Completing sub account and grid Trading endpoints

* Adding Rate Limit and missing endpoints

* Wrapper and Websocket handlers

* Fixing Websocket Test and Push Data Handler Issues

* Fixing Websocket Test and Push Data Handler Issues

* Fixing linter issues, package dependency, and other slight tempos

* Fixing linter and slight tempos

* Update on test functions, and Rest and Websocket Endpoint handlers

* Remove okex, adding comments, and slight fixes on endpoints.

* Fixing linter issues and adding comments

* Slight code changes, updating documentation, and n and linter issues

* Fix context and configuration endpoint issues

* slight fixes on config and test files

* adding some missing test and fix linter issues

* fix linter issue

* Slight fixes on code structure, shorthand exp,and ot and other

* Fix slight linter issue

* Slight code fixes and fixing linter issues

* fixing linter iissues

* fixing linter iissues

* slight linter issue fix

* slight linter issue fix

* Fix on models, type convert funcs and endpoints

* Adding Error messages map and update of models

* Fix on error message string and linter issues

* Fix slight linter issue

* Fix slight linter issue

* Fixing type converts, models, and linter issues

* Adding Ws fixes

* Slight fix on websocket and other issues

* Adding slight websocket fixes

* Remove 'books5' channel default subscription

* Small changes on default subscription and checksum

* Fix slight websocket tempos

* Fix Wrapper function tempost and linter issues

* Resolving slight naming and other issues

* Resolve slight pointer issues

* resolve slight linter issues

* Resolve config files issue

* Update websocket and wrapper funcs with test and docs

* fixs on websocket multiplexer, types, and other slight issues

* fix slight linter issues

* slight update on web-socket orderbook and tickers

* fix slight issues and websocket runtime errors

* Slight unit test fix and assing simple semaphore

* FIx race issue

* Update on authenticated endpoints

* Fix wsSetupRun check in websocket 'setupWsAuth' func

* Update wsSetupRun check in websocket 'setupWsAuth' func

* Slight update on websocket handling

* Fix some race conditions

* fix slight tempos

* fix authenticated test issues

* Update on conditional statements

* slight update on unit test

* fix unit test tempos

* Fix slight tempos

* Change check map from struct valued to bool valued

* slight fix trial

* Slight unit test update

* Fix websocket timeout error

* Updating websocket subscription endpoints, and unit tests

* update unit tests

* Slight issue on wrapper method 'GetActiveOrders'

* Overall code update

* Addressing missing review comments

* Fix unit test tempo and linter issue

* Monor fix

* Slight update

* Slight unit test fix

* Slight fixes

* Slight fixes

* Fixing on missing review comments

* Adding WS Fixes

* slight fix

* Monor fix on unit test

* Minor convert issue

* Minor change on WS

* Monor logic fix

* Fix code structure and logic issues

* Fixing small typos

* fix slight data format issue

* Update on trade and order wrapper methods

* Adding slight update

* fix on order detail

* Slight update on FetchTradablePairs wrapper method

* Slight update on wrapper

* Update on deserialization and other slight issues

* Final update

* Resolve missing review comments

* Slight update on config and unit test

* minor fix on GetDepositAddress param

* Minor fix
This commit is contained in:
Samuael A
2022-12-09 03:44:29 +03:00
committed by GitHub
parent d7d4933f93
commit 2ac165a477
54 changed files with 16943 additions and 3977 deletions

View File

@@ -287,6 +287,11 @@ func main() {
URL: "https://github.com/lozdog245",
Contributions: 2,
},
{
Login: "if1live",
URL: "https://github.com/if1live",
Contributions: 2,
},
}...)
if verbose {

View File

@@ -66,7 +66,7 @@ _b in this context is an `IBotExchange` implemented struct_
| Lbank | Yes | No | Yes |
| LocalBitcoins | Yes | NA | No |
| OKCoin International | Yes | Yes | No |
| OKEX | Yes | Yes | No |
| Okx | Yes | Yes | Yes |
| Poloniex | Yes | Yes | Yes |
| Yobit | Yes | NA | No |
| ZB.COM | Yes | Yes | No |

View File

@@ -1,14 +1,15 @@
{{define "exchanges okex" -}}
{{define "exchanges okx" -}}
{{template "header" .}}
## OKex Exchange
## Okx Exchange
### Current Features
+ REST Support
+ Websocket Support
### How to enable
+ [Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-exchange-via-config-example)
[Enable via configuration](https://github.com/thrasher-corp/gocryptotrader/tree/master/config#enable-exchange-via-config-example)
+ Individual package example below:
@@ -27,10 +28,10 @@ below:
main.go
```go
var o exchange.IBotExchange
var ok exchange.IBotExchange
for i := range bot.Exchanges {
if bot.Exchanges[i].GetName() == "OKex" {
if bot.Exchanges[i].GetName() == "Okx" {
y = bot.Exchanges[i]
}
}
@@ -38,22 +39,22 @@ for i := range bot.Exchanges {
// Public calls - wrapper functions
// Fetches current ticker information
tick, err := o.FetchTicker()
tick, err := ok.FetchTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := o.FetchOrderbook()
ob, err := ok.FetchOrderbook()
if err != nil {
// Handle error
}
// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// Private calls - wrapper functions - make sure your APIKEY, APISECRET, and API_CLIENT_ID are
// set and AuthenticatedAPISupport is set to true
// Fetches current account information
accountInfo, err := o.GetAccountInfo()
accountInfo, err := ok.GetAccountInfo()
if err != nil {
// Handle error
}
@@ -65,13 +66,26 @@ if err != nil {
// Public calls
// Fetches current ticker information
ticker, err := o.GetSpotTicker()
ticker, err := ok.GetTicker()
if err != nil {
// Handle error
}
// Fetches current orderbook information
ob, err := o.GetSpotMarketDepth()
ob, err := ok.GetOrderBook()
if err != nil {
// Handle error
}
// Fetches historic trade data within the timeframe provided
tradeDatas, err := ok.GetHistoricTrades(...)
if err != nil {
// Handle error
}
// Returns an estimate of fee based on the type of transaction
fee, err := ok.GetFeeByType(...)
if err != nil {
// Handle error
}
@@ -79,20 +93,28 @@ if err != nil {
// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true
// GetContractPosition returns contract positioning
accountInfo, err := o.GetContractPosition(...)
// Submits an order and the exchange and returns its tradeID
orderID, err := ok.SubmitOrder(...)
if err != nil {
// Handle error
}
// Submits an order and the exchange and returns its tradeID
tradeID, err := o.PlaceContractOrders(...)
// ModifyOrder will allow of changing orderbook placement and limit to market conversion
updatedOrder, err := ok.ModifyOrder(...)
if err != nil {
// Handle error
}
```
### How to do Websocket public/private calls
```go
// Exchanges will be abstracted out in further updates and examples will be
// supplied then
```
### Please click GoDocs chevron above to view current GoDoc information for this package
{{template "contributions"}}
{{template "donations" .}}
{{end}}
{{end}}

View File

@@ -44,7 +44,7 @@ Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader
| Lbank | Yes | No | NA |
| LocalBitcoins | Yes | NA | NA |
| OKCoin International | Yes | Yes | No |
| OKEX | Yes | Yes | No |
| Okx | Yes | Yes | NA |
| Poloniex | Yes | Yes | NA |
| Yobit | Yes | NA | NA |
| ZB.COM | Yes | Yes | NA |