mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 15:10:49 +00:00
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:
@@ -1,16 +1,16 @@
|
||||
# GoCryptoTrader package Okex
|
||||
# GoCryptoTrader package Okgroup
|
||||
|
||||
<img src="https://github.com/thrasher-corp/gocryptotrader/blob/master/web/src/assets/page-logo.png?raw=true" width="350px" height="350px" hspace="70">
|
||||
|
||||
|
||||
[](https://github.com/thrasher-corp/gocryptotrader/actions/workflows/tests.yml)
|
||||
[](https://github.com/thrasher-corp/gocryptotrader/blob/master/LICENSE)
|
||||
[](https://godoc.org/github.com/thrasher-corp/gocryptotrader/exchanges/okex)
|
||||
[](https://godoc.org/github.com/thrasher-corp/gocryptotrader/exchanges/okgroup)
|
||||
[](http://codecov.io/github/thrasher-corp/gocryptotrader?branch=master)
|
||||
[](https://goreportcard.com/report/github.com/thrasher-corp/gocryptotrader)
|
||||
|
||||
|
||||
This okex package is part of the GoCryptoTrader codebase.
|
||||
This OKCoin package is part of the GoCryptoTrader codebase.
|
||||
|
||||
## This is still in active development
|
||||
|
||||
@@ -18,7 +18,7 @@ You can track ideas, planned features and what's in progress on this Trello boar
|
||||
|
||||
Join our slack to discuss all things related to GoCryptoTrader! [GoCryptoTrader Slack](https://gocryptotrader.herokuapp.com/)
|
||||
|
||||
## OKex Exchange
|
||||
## OKCoin Exchange
|
||||
|
||||
### Current Features
|
||||
|
||||
@@ -48,8 +48,8 @@ main.go
|
||||
var o exchange.IBotExchange
|
||||
|
||||
for i := range Bot.Exchanges {
|
||||
if Bot.Exchanges[i].GetName() == "OKex" {
|
||||
y = Bot.Exchanges[i]
|
||||
if Bot.Exchanges[i].GetName() == "OKCoin" {
|
||||
o = Bot.Exchanges[i]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,11 +82,11 @@ const (
|
||||
okGroupGetRepayment = "repayment"
|
||||
)
|
||||
|
||||
// OKGroup is the overaching type across the all of OKEx's exchange methods
|
||||
// OKGroup is the overaching type across the all of OKCoin's exchange methods
|
||||
type OKGroup struct {
|
||||
exchange.Base
|
||||
ExchangeName string
|
||||
// Spot and contract market error codes as per https://www.okex.com/rest_request.html
|
||||
// Spot and contract market error codes
|
||||
ErrorCodes map[string]error
|
||||
// Stores for corresponding variable checks
|
||||
ContractTypes []string
|
||||
@@ -121,7 +121,7 @@ func (o *OKGroup) TransferAccountFunds(ctx context.Context, request TransferAcco
|
||||
return resp, o.SendHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, okGroupAccountSubsection, okGroupFundsTransfer, request, &resp, true)
|
||||
}
|
||||
|
||||
// AccountWithdraw withdrawal of tokens to OKCoin International, other OKEx accounts or other addresses.
|
||||
// AccountWithdraw withdrawal of tokens to OKCoin International or other addresses.
|
||||
func (o *OKGroup) AccountWithdraw(ctx context.Context, request AccountWithdrawRequest) (resp AccountWithdrawResponse, _ error) {
|
||||
return resp, o.SendHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, okGroupAccountSubsection, okGroupWithdraw, request, &resp, true)
|
||||
}
|
||||
@@ -435,8 +435,7 @@ func (o *OKGroup) RepayMarginLoan(ctx context.Context, request RepayMarginLoanRe
|
||||
return resp, o.SendHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, okGroupMarginTradingSubsection, requestURL, request, &resp, true)
|
||||
}
|
||||
|
||||
// PlaceMarginOrder OKEx API only supports limit and market orders (more orders will become available in the future).
|
||||
// You can place an order only if you have enough funds. Once your order is placed, the amount will be put on hold.
|
||||
// PlaceMarginOrder You can place an order only if you have enough funds. Once your order is placed, the amount will be put on hold.
|
||||
func (o *OKGroup) PlaceMarginOrder(ctx context.Context, request *PlaceOrderRequest) (resp PlaceOrderResponse, _ error) {
|
||||
return resp, o.SendHTTPRequest(ctx, exchange.RestSpot, http.MethodPost, okGroupMarginTradingSubsection, OKGroupOrders, request, &resp, true)
|
||||
}
|
||||
@@ -529,7 +528,7 @@ func (o *OKGroup) GetMarginTransactionDetails(ctx context.Context, request GetSp
|
||||
return resp, o.SendHTTPRequest(ctx, exchange.RestSpot, http.MethodGet, okGroupMarginTradingSubsection, requestURL, nil, &resp, true)
|
||||
}
|
||||
|
||||
// FormatParameters Formats URL parameters, useful for optional parameters due to OKEX signature check
|
||||
// FormatParameters Formats URL parameters, useful for optional parameters due to OKCoin signature check
|
||||
func FormatParameters(request interface{}) (parameters string) {
|
||||
v, err := query.Values(request)
|
||||
if err != nil {
|
||||
|
||||
@@ -143,8 +143,8 @@ type TransferAccountFundsResponse struct {
|
||||
type AccountWithdrawRequest struct {
|
||||
Amount float64 `json:"amount"` // [required] withdrawal amount
|
||||
Currency string `json:"currency"` // [required] token
|
||||
Destination int64 `json:"destination"` // [required] withdrawal address(2:OKCoin International 3:OKEx 4:others)
|
||||
Fee float64 `json:"fee"` // [required] Network transaction fee≥0. Withdrawals to OKCoin or OKEx are fee-free, please set as 0. Withdrawal to external digital asset address requires network transaction fee.
|
||||
Destination int64 `json:"destination"` // [required] withdrawal address(2:OKCoin International 3:others)
|
||||
Fee float64 `json:"fee"` // [required] Network transaction fee≥0. Withdrawals to OKCoin are fee-free, please set as 0. Withdrawal to external digital asset address requires network transaction fee.
|
||||
ToAddress string `json:"to_address"` // [required] verified digital asset address, email or mobile number,some digital asset address format is address+tag , eg: "ARDOR-7JF3-8F2E-QUWZ-CAN7F:123456"
|
||||
TradePwd string `json:"trade_pwd"` // [required] fund password
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
)
|
||||
|
||||
// Note: GoCryptoTrader wrapper funcs currently only support SPOT trades.
|
||||
// Therefore this OKGroup_Wrapper can be shared between OKEX and OKCoin.
|
||||
// Therefore this OKGroup_Wrapper can be shared between OKCoin and OKCoin.
|
||||
// When circumstances change, wrapper funcs can be split appropriately
|
||||
|
||||
var errNoAccountDepositAddress = errors.New("no account deposit address")
|
||||
|
||||
Reference in New Issue
Block a user